summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Optimize.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/aapt2/cmd/Optimize.h')
-rw-r--r--tools/aapt2/cmd/Optimize.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/tools/aapt2/cmd/Optimize.h b/tools/aapt2/cmd/Optimize.h
index d07305bc3e04..7f4a3ed85364 100644
--- a/tools/aapt2/cmd/Optimize.h
+++ b/tools/aapt2/cmd/Optimize.h
@@ -55,6 +55,12 @@ struct OptimizeOptions {
// Set of artifacts to keep when generating multi-APK splits. If the list is empty, all artifacts
// are kept and will be written as output.
std::unordered_set<std::string> kept_artifacts;
+
+ // Whether or not to shorten resource paths in the APK.
+ bool shorten_resource_paths;
+
+ // Path to the output map of original resource paths to shortened paths.
+ Maybe<std::string> shortened_paths_map_path;
};
class OptimizeCommand : public Command {
@@ -101,6 +107,12 @@ class OptimizeCommand : public Command {
AddOptionalSwitch("--enable-resource-obfuscation",
"Enables obfuscation of key string pool to single value",
&options_.table_flattener_options.collapse_key_stringpool);
+ AddOptionalSwitch("--enable-resource-path-shortening",
+ "Enables shortening of the path of the resources inside the APK.",
+ &options_.shorten_resource_paths);
+ AddOptionalFlag("--resource-path-shortening-map",
+ "Path to output the map of old resource paths to shortened paths.",
+ &options_.shortened_paths_map_path);
AddOptionalSwitch("-v", "Enables verbose logging", &verbose_);
}
@@ -109,6 +121,9 @@ class OptimizeCommand : public Command {
private:
OptimizeOptions options_;
+ bool WriteObfuscatedPathsMap(const std::map<std::string, std::string> &path_map,
+ const std::string &file_path);
+
Maybe<std::string> config_path_;
Maybe<std::string> whitelist_path_;
Maybe<std::string> resources_config_path_;
@@ -122,4 +137,4 @@ class OptimizeCommand : public Command {
}// namespace aapt
-#endif //AAPT2_OPTIMIZE_H \ No newline at end of file
+#endif //AAPT2_OPTIMIZE_H