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
7 files changed