apktool-lib: fix recompiling framework apk's with dependencies by using static package-id

This commit is contained in:
M1cha 2013-03-17 15:37:46 +01:00 committed by Connor Tumbleson
parent 3578010262
commit 071ce71a61
4 changed files with 13 additions and 1 deletions

View File

@ -208,6 +208,7 @@ public class Androlib {
flags.put("compression", meta.get("compressionType") == null ? false
: (Boolean) meta.get("compressionType"));
mAndRes.setSdkInfo((Map<String, String>) meta.get("sdkInfo"));
mAndRes.setPackageId((String)meta.get("packageId"));
if (outFile == null) {
String outFileName = (String) meta.get("apkFileName");

View File

@ -246,6 +246,7 @@ public class ApkDecoder {
putSdkInfo(meta);
putPackageInfo(meta);
putCompressionInfo(meta);
meta.put("packageId", getResTable().getPackageInfo().get("cur_package_id"));
}
mAndrolib.writeMetaFile(mOutDir, meta);

View File

@ -313,6 +313,10 @@ final public class AndrolibResources {
}
}
public void setPackageId(String id) {
mPackageId = id;
}
public void aaptPackage(File apkFile, File manifest, File resDir,
File rawDir, File assetDir, File[] include,
HashMap<String, Boolean> flags, String aaptPath)
@ -350,6 +354,10 @@ final public class AndrolibResources {
if (flags.get("debug")) { // inject debuggable="true" into manifest
cmd.add("--debug-mode");
}
if (mPackageId != null) {
cmd.add("--forced-package-id");
cmd.add(mPackageId);
}
if (mMinSdkVersion != null) {
cmd.add("--min-sdk-version");
cmd.add(mMinSdkVersion);
@ -742,6 +750,7 @@ final public class AndrolibResources {
private final static Logger LOGGER = Logger
.getLogger(AndrolibResources.class.getName());
private String mPackageId = null;
private String mMinSdkVersion = null;
private String mMaxSdkVersion = null;
private String mTargetSdkVersion = null;

View File

@ -84,6 +84,7 @@ public class ARSCDecoder {
// store package
if (this.mResTable.isPackageInfoValueSet("cur_package") != true) {
this.mResTable.addPackageInfo("cur_package", packages[0].getName());
this.mResTable.addPackageInfo("cur_package_id", String.valueOf(packages[0].getId()));
}
return packages;
}
@ -440,4 +441,4 @@ public class ARSCDecoder {
private final FlagsOffset[] mFlagsOffsets;
private final ResTable mResTable;
}
}
}