Dump the deobfuscate data using Protocol buffers
Using Google Protocol buffers to dump the obfuscating mapping
information of being used to deobfuscate items.
* shortened file path -> original file path
* resource id -> original resource name
This patch add a new option --save-obfuscating-map to deprecate
--resource-path-shortening-map. The option
--resource-path-shortening-map is kept until no one to use it.
Bug: 246489170
Bug: 228192695
b/228192695#comment2
Test: make WITH_TIDY=1 aapt2
Test: atest aapt2_test
Change-Id: I29733c4dbae9f6dd2f0e9b2c87b0d2046662fc59
diff --git a/tools/aapt2/optimize/Obfuscator.h b/tools/aapt2/optimize/Obfuscator.h
index 786bf8c..5ccf5438 100644
--- a/tools/aapt2/optimize/Obfuscator.h
+++ b/tools/aapt2/optimize/Obfuscator.h
@@ -20,6 +20,7 @@
#include <set>
#include <string>
+#include "ResourceMetadata.pb.h"
#include "ResourceTable.h"
#include "android-base/function_ref.h"
#include "android-base/macros.h"
@@ -38,6 +39,8 @@
bool Consume(IAaptContext* context, ResourceTable* table) override;
+ bool WriteObfuscationMap(const std::string& file_path) const;
+
bool IsEnabled() const;
enum class Result { Obfuscated, Keep_ExemptionList, Keep_Overlayable };