mirror of
https://github.com/revanced/Apktool.git
synced 2024-12-11 21:37:47 +01:00
Updating Framework Support
This commit is contained in:
parent
466319ad51
commit
daa1e1d753
@ -48,7 +48,7 @@ public class Main {
|
||||
|
||||
// cli parser
|
||||
CommandLineParser parser = new PosixParser();
|
||||
CommandLine commandLine = null;
|
||||
CommandLine commandLine;
|
||||
|
||||
// load options
|
||||
_Options();
|
||||
@ -57,7 +57,7 @@ public class Main {
|
||||
commandLine = parser.parse(allOptions, args, false);
|
||||
} catch (ParseException ex) {
|
||||
System.err.println(ex.getMessage());
|
||||
usage(commandLine);
|
||||
usage();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -86,6 +86,9 @@ public class Main {
|
||||
} else if (opt.equalsIgnoreCase("if") || opt.equalsIgnoreCase("install-framework")) {
|
||||
cmdInstallFramework(commandLine);
|
||||
cmdFound = true;
|
||||
} else if (opt.equalsIgnoreCase("u") || opt.equalsIgnoreCase("update-framework")) {
|
||||
cmdUpdateFramework(commandLine);
|
||||
cmdFound = true;
|
||||
} else if (opt.equalsIgnoreCase("publicize-resources")) {
|
||||
cmdPublicizeResources(commandLine);
|
||||
cmdFound = true;
|
||||
@ -97,7 +100,7 @@ public class Main {
|
||||
if (commandLine.hasOption("version")) {
|
||||
_version();
|
||||
} else {
|
||||
usage(commandLine);
|
||||
usage();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -107,7 +110,7 @@ public class Main {
|
||||
|
||||
int paraCount = cli.getArgList().size();
|
||||
String apkName = (String) cli.getArgList().get(paraCount - 1);
|
||||
File outDir = null;
|
||||
File outDir;
|
||||
|
||||
// check for options
|
||||
if (cli.hasOption("s") || cli.hasOption("no-src")) {
|
||||
@ -224,8 +227,7 @@ public class Main {
|
||||
new Androlib(apkOptions).build(new File(appDirName), outFile);
|
||||
}
|
||||
|
||||
private static void cmdInstallFramework(CommandLine cli)
|
||||
throws AndrolibException {
|
||||
private static void cmdInstallFramework(CommandLine cli) throws AndrolibException {
|
||||
int paraCount = cli.getArgList().size();
|
||||
String apkName = (String) cli.getArgList().get(paraCount - 1);
|
||||
|
||||
@ -239,14 +241,26 @@ public class Main {
|
||||
new Androlib(apkOptions).installFramework(new File(apkName));
|
||||
}
|
||||
|
||||
private static void cmdPublicizeResources(CommandLine cli)
|
||||
throws AndrolibException {
|
||||
private static void cmdPublicizeResources(CommandLine cli) throws AndrolibException {
|
||||
int paraCount = cli.getArgList().size();
|
||||
String apkName = (String) cli.getArgList().get(paraCount - 1);
|
||||
|
||||
new Androlib().publicizeResources(new File(apkName));
|
||||
}
|
||||
|
||||
private static void cmdUpdateFramework(CommandLine cli) throws AndrolibException {
|
||||
ApkOptions apkOptions = new ApkOptions();
|
||||
|
||||
if (cli.hasOption("f") || cli.hasOption("force")) {
|
||||
apkOptions.forceDeleteFramework = true;
|
||||
}
|
||||
if (cli.hasOption("p") || cli.hasOption("frame-path")) {
|
||||
apkOptions.frameworkFolderLocation = cli.getOptionValue("p");
|
||||
}
|
||||
|
||||
new Androlib(apkOptions).updateFramework();
|
||||
}
|
||||
|
||||
private static void _version() {
|
||||
System.out.println(Androlib.getVersion());
|
||||
}
|
||||
@ -426,7 +440,7 @@ public class Main {
|
||||
}
|
||||
}
|
||||
|
||||
private static void usage(CommandLine commandLine) {
|
||||
private static void usage() {
|
||||
|
||||
// load basicOptions
|
||||
_Options();
|
||||
|
@ -684,6 +684,10 @@ public class Androlib {
|
||||
mAndRes.installFramework(frameFile);
|
||||
}
|
||||
|
||||
public void updateFramework() throws AndrolibException {
|
||||
mAndRes.updateFramework();
|
||||
}
|
||||
|
||||
public boolean isFrameworkApk(ResTable resTable) {
|
||||
for (ResPackage pkg : resTable.listMainPackages()) {
|
||||
if (pkg.getId() < 64) {
|
||||
|
@ -19,6 +19,7 @@ import java.util.Collection;
|
||||
|
||||
public class ApkOptions {
|
||||
public boolean forceBuildAll = false;
|
||||
public boolean forceDeleteFramework = false;
|
||||
public boolean debugMode = false;
|
||||
public boolean verbose = false;
|
||||
public boolean copyOriginalFiles = false;
|
||||
|
@ -591,6 +591,19 @@ final public class AndrolibResources {
|
||||
throw new CantFindFrameworkResException(id);
|
||||
}
|
||||
|
||||
public void updateFramework() throws AndrolibException {
|
||||
File dir = getFrameworkDir();
|
||||
File apk;
|
||||
|
||||
apk = new File(dir, "1.apk");
|
||||
|
||||
if (! apk.exists()) {
|
||||
LOGGER.warning("Can't update framework, no file found at: " + apk.getAbsolutePath());
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void installFramework(File frameFile) throws AndrolibException {
|
||||
installFramework(frameFile, apkOptions.frameworkTag);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user