mirror of
https://github.com/revanced/Apktool.git
synced 2025-01-05 17:45:52 +01:00
Storing resources.arsc uncompressed in framework apk files.
This commit is contained in:
parent
602fd95f8a
commit
4bd9ea4b60
@ -108,11 +108,13 @@ public class Androlib {
|
||||
|
||||
public void build(ExtFile appDir, boolean forceBuildAll)
|
||||
throws AndrolibException {
|
||||
boolean framework = mAndRes.detectWhetherAppIsFramework(appDir);
|
||||
|
||||
new File(appDir, APK_DIRNAME).mkdirs();
|
||||
buildSources(appDir, forceBuildAll);
|
||||
buildResources(appDir, forceBuildAll);
|
||||
buildResources(appDir, forceBuildAll, framework);
|
||||
buildLib(appDir, forceBuildAll);
|
||||
buildApk(appDir);
|
||||
buildApk(appDir, framework);
|
||||
}
|
||||
|
||||
public void buildSources(File appDir, boolean forceBuildAll)
|
||||
@ -160,10 +162,10 @@ public class Androlib {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void buildResources(ExtFile appDir, boolean forceBuildAll)
|
||||
throws AndrolibException {
|
||||
public void buildResources(ExtFile appDir, boolean forceBuildAll,
|
||||
boolean framework) throws AndrolibException {
|
||||
if (! buildResourcesRaw(appDir, forceBuildAll)
|
||||
&& ! buildResourcesFull(appDir, forceBuildAll)) {
|
||||
&& ! buildResourcesFull(appDir, forceBuildAll, framework)) {
|
||||
LOGGER.warning("Could not find resources");
|
||||
}
|
||||
}
|
||||
@ -191,8 +193,8 @@ public class Androlib {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean buildResourcesFull(File appDir, boolean forceBuildAll)
|
||||
throws AndrolibException {
|
||||
public boolean buildResourcesFull(File appDir, boolean forceBuildAll,
|
||||
boolean framework) throws AndrolibException {
|
||||
try {
|
||||
if (! forceBuildAll) {
|
||||
LOGGER.info("Checking whether resources has changed...");
|
||||
@ -213,8 +215,8 @@ public class Androlib {
|
||||
mAndRes.aaptPackage(
|
||||
apkFile,
|
||||
new File(appDir, "AndroidManifest.xml"),
|
||||
new File(appDir, "res"), ninePatch, null, false,
|
||||
mAndRes.detectWhetherAppIsFramework(appDir)
|
||||
new File(appDir, "res"),
|
||||
ninePatch, null, false, framework
|
||||
);
|
||||
|
||||
new ExtFile(apkFile).getDirectory()
|
||||
@ -246,7 +248,8 @@ public class Androlib {
|
||||
}
|
||||
}
|
||||
|
||||
public void buildApk(File appDir) throws AndrolibException {
|
||||
public void buildApk(File appDir, boolean framework)
|
||||
throws AndrolibException {
|
||||
LOGGER.info("Building apk file");
|
||||
File outApk = new File(appDir, OUT_APK_FILENAME);
|
||||
if (outApk.exists()) {
|
||||
@ -262,7 +265,7 @@ public class Androlib {
|
||||
assetDir = null;
|
||||
}
|
||||
mAndRes.aaptPackage(outApk, null, null,
|
||||
new File(appDir, APK_DIRNAME), assetDir, false, false);
|
||||
new File(appDir, APK_DIRNAME), assetDir, false, true);
|
||||
}
|
||||
|
||||
private boolean isModified(File working, File stored) {
|
||||
|
@ -87,7 +87,7 @@ final public class AndrolibResources {
|
||||
public void aaptPackage(File apkFile, File manifest, File resDir,
|
||||
File rawDir, File assetDir, boolean update, boolean framework)
|
||||
throws AndrolibException {
|
||||
String[] cmd = new String[13];
|
||||
String[] cmd = new String[14];
|
||||
int i = 0;
|
||||
cmd[i++] = "aapt";
|
||||
cmd[i++] = "p";
|
||||
@ -97,21 +97,24 @@ final public class AndrolibResources {
|
||||
cmd[i++] = "-F";
|
||||
cmd[i++] = apkFile.getAbsolutePath();
|
||||
|
||||
if (framework) {
|
||||
cmd[i++] = "-x";
|
||||
} else {
|
||||
cmd[i++] = "-I";
|
||||
cmd[i++] = getAndroidResourcesFile().getAbsolutePath();
|
||||
if (resDir != null) {
|
||||
if (framework) {
|
||||
cmd[i++] = "-x";
|
||||
} else {
|
||||
cmd[i++] = "-I";
|
||||
cmd[i++] = getAndroidResourcesFile().getAbsolutePath();
|
||||
}
|
||||
cmd[i++] = "-S";
|
||||
cmd[i++] = resDir.getAbsolutePath();
|
||||
} else if (framework) {
|
||||
cmd[i++] = "-0";
|
||||
cmd[i++] = "arsc";
|
||||
}
|
||||
|
||||
if (manifest != null) {
|
||||
cmd[i++] = "-M";
|
||||
cmd[i++] = manifest.getAbsolutePath();
|
||||
}
|
||||
if (resDir != null) {
|
||||
cmd[i++] = "-S";
|
||||
cmd[i++] = resDir.getAbsolutePath();
|
||||
}
|
||||
if (assetDir != null) {
|
||||
cmd[i++] = "-A";
|
||||
cmd[i++] = assetDir.getAbsolutePath();
|
||||
|
Loading…
Reference in New Issue
Block a user