Commit Graph

5 Commits

Author SHA1 Message Date
felkachang
78a8d373ca 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
2022-12-01 13:53:31 +00:00
TreeHugger Robot
6757d436d9 Merge "Use lambda to refactor the obfuscating resource name." 2022-12-01 12:33:42 +00:00
felkachang
8ceb39c94f Use lambda to refactor the obfuscating resource name.
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
2022-11-30 17:46:25 +00:00
Yurii Zubrytskyi
a577514789 Make StringPiece to be std::string_view alias
Bug: 237583012
Test: build + boot + UTs

Change-Id: I849831f4466d3b9c7ec842b75256e7fcba77a0c0
2022-11-29 21:46:02 -08:00
felkachang
4bdd3ac44c Rename ResourcePathShortener to Obfuscator
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
2022-09-26 12:29:08 +08:00