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
There are 2 copy codes for handling the obfuscating resources names
between serializing to pb format file and writing to apks. The
obfuscator also needs to dump resources names. It means there are
3 places to handle the obfuscating resources names.
So, using C++ lambda to apply the callback mechanism refactors the
codes.
Obfuscator
* Initial a Obfuscator according to Optimizer's options
* Add Obfuscator.IsEnabled() function.
return true either shorten_resource_paths_ is true or
collapse_key_stringpool_ is true.
Bug: 228192695
Test: atest aapt2_test idmap2_test
Change-Id: Idd2442beecf41e9392620ff801a36fd1285e06f9
ResourcePathShortener is a part of Obfuscator. Obfuscator will not
only shorten the path but also handle obfuscating resource names.
Format C++ code by clang-format.
Bug: 228192695
Test: atest aapt2_test idmap2_test
Change-Id: I27b4b1af44061e3cd8a6717ffd46b8a187cdc41d