mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-05 17:45:52 +01:00
Added support for framework apks.
This commit is contained in:
parent
5a6e684f80
commit
9234017707
@ -214,7 +214,7 @@ public class Androlib {
|
||||
apkFile,
|
||||
new File(appDir, "AndroidManifest.xml"),
|
||||
new File(appDir, "res"), ninePatch, null, false,
|
||||
false
|
||||
mAndRes.detectWhetherAppIsFramework(appDir)
|
||||
);
|
||||
|
||||
new ExtFile(apkFile).getDirectory()
|
||||
|
@ -29,7 +29,9 @@ import brut.directory.*;
|
||||
import brut.util.*;
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.logging.Logger;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.xmlpull.v1.XmlSerializer;
|
||||
|
||||
/**
|
||||
@ -38,8 +40,10 @@ import org.xmlpull.v1.XmlSerializer;
|
||||
final public class AndrolibResources {
|
||||
public ResTable getResTable(ExtFile apkFile) throws AndrolibException {
|
||||
ResTable resTable = new ResTable();
|
||||
decodeArsc(resTable, new ExtFile(getAndroidResourcesFile()), false);
|
||||
decodeArsc(resTable, apkFile, true);
|
||||
if (! resTable.hasPackage(1)) {
|
||||
decodeArsc(resTable, new ExtFile(getAndroidResourcesFile()), false);
|
||||
}
|
||||
return resTable;
|
||||
}
|
||||
|
||||
@ -123,6 +127,21 @@ final public class AndrolibResources {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean detectWhetherAppIsFramework(File appDir)
|
||||
throws AndrolibException {
|
||||
Iterator<String> it;
|
||||
try {
|
||||
it = IOUtils.lineIterator(
|
||||
new FileReader(new File(appDir, "res/values/public.xml")));
|
||||
} catch (FileNotFoundException ex) {
|
||||
throw new AndrolibException(
|
||||
"Could not detect whether app is framework one", ex);
|
||||
}
|
||||
it.next();
|
||||
it.next();
|
||||
return it.next().contains("0x01");
|
||||
}
|
||||
|
||||
public void tagSmaliResIDs(ResTable resTable, File smaliDir)
|
||||
throws AndrolibException {
|
||||
new ResSmaliUpdater().tagResIDs(resTable, smaliDir);
|
||||
|
Loading…
Reference in New Issue
Block a user