mirror of
https://github.com/revanced/Apktool.git
synced 2024-09-05 14:06:40 +02:00
fix spacing in installFramework()
This commit is contained in:
parent
d18ee186da
commit
db6ecadc00
@ -686,63 +686,63 @@ final public class AndrolibResources {
|
|||||||
throw new CantFindFrameworkResException(id);
|
throw new CantFindFrameworkResException(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void installFramework(File frameFile, String tag)
|
public void installFramework(File frameFile, String tag)
|
||||||
throws AndrolibException {
|
throws AndrolibException {
|
||||||
InputStream in = null;
|
InputStream in = null;
|
||||||
ZipArchiveOutputStream out = null;
|
ZipArchiveOutputStream out = null;
|
||||||
try {
|
try {
|
||||||
ZipExtFile zip = new ZipExtFile(frameFile);
|
ZipExtFile zip = new ZipExtFile(frameFile);
|
||||||
ZipArchiveEntry entry = zip.getEntry("resources.arsc");
|
ZipArchiveEntry entry = zip.getEntry("resources.arsc");
|
||||||
|
|
||||||
if (entry == null) {
|
if (entry == null) {
|
||||||
throw new AndrolibException("Can't find resources.arsc file");
|
throw new AndrolibException("Can't find resources.arsc file");
|
||||||
}
|
}
|
||||||
|
|
||||||
in = zip.getInputStream(entry);
|
in = zip.getInputStream(entry);
|
||||||
byte[] data = IOUtils.toByteArray(in);
|
byte[] data = IOUtils.toByteArray(in);
|
||||||
|
|
||||||
ARSCData arsc = ARSCDecoder.decode(new ByteArrayInputStream(data),
|
ARSCData arsc = ARSCDecoder.decode(new ByteArrayInputStream(data),
|
||||||
true, true);
|
true, true);
|
||||||
publicizeResources(data, arsc.getFlagsOffsets());
|
publicizeResources(data, arsc.getFlagsOffsets());
|
||||||
|
|
||||||
File outFile = new File(getFrameworkDir(), String.valueOf(arsc
|
File outFile = new File(getFrameworkDir(), String.valueOf(arsc
|
||||||
.getOnePackage().getId())
|
.getOnePackage().getId())
|
||||||
+ (tag == null ? "" : '-' + tag)
|
+ (tag == null ? "" : '-' + tag)
|
||||||
+ ".apk");
|
+ ".apk");
|
||||||
|
|
||||||
out = new ZipArchiveOutputStream(new FileOutputStream(outFile));
|
out = new ZipArchiveOutputStream(new FileOutputStream(outFile));
|
||||||
out.setMethod(ZipOutputStream.STORED);
|
out.setMethod(ZipOutputStream.STORED);
|
||||||
|
|
||||||
CRC32 crc = new CRC32();
|
CRC32 crc = new CRC32();
|
||||||
crc.update(data);
|
crc.update(data);
|
||||||
entry = new ZipArchiveEntry("resources.arsc");
|
entry = new ZipArchiveEntry("resources.arsc");
|
||||||
entry.setSize(data.length);
|
entry.setSize(data.length);
|
||||||
entry.setCrc(crc.getValue());
|
entry.setCrc(crc.getValue());
|
||||||
out.putArchiveEntry(entry);
|
out.putArchiveEntry(entry);
|
||||||
out.write(data);
|
out.write(data);
|
||||||
|
|
||||||
out.closeArchiveEntry();
|
out.closeArchiveEntry();
|
||||||
zip.close();
|
zip.close();
|
||||||
LOGGER.info("Framework installed to: " + outFile);
|
LOGGER.info("Framework installed to: " + outFile);
|
||||||
} catch (ZipException ex) {
|
} catch (ZipException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
throw new AndrolibException(ex);
|
throw new AndrolibException(ex);
|
||||||
} finally {
|
} finally {
|
||||||
if (in != null) {
|
if (in != null) {
|
||||||
try {
|
try {
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (out != null) {
|
if (out != null) {
|
||||||
try {
|
try {
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void publicizeResources(File arscFile) throws AndrolibException {
|
public void publicizeResources(File arscFile) throws AndrolibException {
|
||||||
byte[] data = new byte[(int) arscFile.length()];
|
byte[] data = new byte[(int) arscFile.length()];
|
||||||
|
Loading…
Reference in New Issue
Block a user