Fix bug where the output vdex could get compact dex data even when
--compact-dex-level is none.

If an input vdex containing cdex was given (which is typically the
already existing vdex), then it was used as dex files source even when
the resulting vdex shouldn't contain cdex.

Correct the file magic check to detect that, and ignore the input vdex
in that case.

Test: m AppUsedByOtherApp
      adb install-multiple out/target/product/vsoc_x86_64/testcases/AppUsedByOtherApp/x86_64/AppUsedByOtherApp.apk AppUsedByOtherApp.dm
      # where AppUsedByOtherApp.dm is created from a non-empty profile
      adb shell pm bg-dexopt-job
      adb root && adb wait-for-device
      adb pull `adb shell ls /data/app/\*/android.compilation.cts.appusedbyotherapp-\*/oat/x86_64/base.vdex`
      grep cdex001 base.vdex
      # -> check that a match is found
      adb shell setprop persist.device_config.runtime_native_boot.disable_compact_dex true
      adb reboot && adb wait-for-device
      adb shell pm bg-dexopt-job
      adb root && adb wait-for-device
      adb pull `adb shell ls /data/app/\*/android.compilation.cts.appusedbyotherapp-\*/oat/x86_64/base.vdex`
      grep cdex001 base.vdex
      # -> check that no match is found
Bug: 256664509
Change-Id: I222c48c2e29d545e799f0b2faa7f6a7d952e21f6
4 files changed