oatdump: Convert cdex before exporting dex files

Use DexLayout to convert the compact dex files inside a vdex container
back to a standard dex file before exporting. There is limited benefit
when exporting a cdex file since it is an art internal format that is
not supported from most dex parsers/tools. Backwards compatibility is
still maintained, although not really useful since the oat loader will
reject files of different versions.

Also since commit 734806, the VdexFile::UnquickenDexFile() is no longer
implementing apis unhiding. Therefore, the oatdump should manually
unhide them before exporting. Otherwise the verifier will complain
when reading the exported standard dex files.

This feature is mostly useful when inspecting oat files that have the
original bytecode being stripped from the matching archive (apk, jar).

Test: oatdump --oat-file=services.odex --export-dex-to=/tmp \
      --header-only && dexdump2 /tmp/services.jar_export.dex (manual)
Test: test-art-host-gtest

Change-Id: Ide79c5b778f1d6d6b4e58a95811e66cccb20735e
Signed-off-by: Anestis Bechtsoudis <anestis@census-labs.com>
4 files changed