Storing isFrameworkApk bool in apktool.yml instead of guessing it at build time.

This commit is contained in:
Ryszard Wiśniewski 2010-06-02 09:37:19 +02:00
parent 1826c7f65f
commit ebfb9e3038
2 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,7 @@ package brut.androlib;
import brut.androlib.java.AndrolibJava;
import brut.androlib.res.AndrolibResources;
import brut.androlib.res.data.ResPackage;
import brut.androlib.res.data.ResTable;
import brut.androlib.res.decoder.ARSCDecoder;
import brut.androlib.res.decoder.ARSCDecoder.FlagsOffset;
@ -152,8 +153,8 @@ public class Androlib {
public void build(ExtFile appDir, boolean forceBuildAll, boolean debug)
throws AndrolibException {
boolean framework = mAndRes.detectWhetherAppIsFramework(appDir);
Map<String, Object> meta = readMetaFile(appDir);
boolean framework = (Boolean) meta.get("isFrameworkApk");
new File(appDir, APK_DIRNAME).mkdirs();
buildSources(appDir, forceBuildAll, debug);
@ -361,6 +362,15 @@ public class Androlib {
}
}
public boolean isFrameworkApk(ResTable resTable) {
for (ResPackage pkg : resTable.listMainPackages()) {
if (pkg.getId() < 64) {
return true;
}
}
return false;
}
public static String getVersion() {
return VERSION;
}

View File

@ -163,6 +163,8 @@ public class ApkDecoder {
private void writeMetaFile() throws AndrolibException {
Map<String, Object> meta = new LinkedHashMap<String, Object>();
meta.put("version", Androlib.getVersion());
meta.put("isFrameworkApk",
Boolean.valueOf(mAndrolib.isFrameworkApk(getResTable())));
mAndrolib.writeMetaFile(mOutDir, meta);
}