mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-20 16:57:34 +01:00
apktool-lib: fix recompiling framework apk's with dependencies by using static package-id
This commit is contained in:
parent
3578010262
commit
071ce71a61
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user