extract_utils: Add VDEX deodex capabilities for oreo

Oreo introduces new optimized dex files (or vdex). While smali/baksmali
have supported vdex since 2.2.1, you actually have to have the .vdex in
the same location as the .oat or else the smali will fail due to not
finding the .vdex. Copy it (if it exists) and echo a warning since vdex
deodexing is still experimental.

Change-Id: Ic612751be45a8b6e54b8794b426a4d5adbbf13d2
This commit is contained in:
Rashed Abdel-Tawab 2017-08-23 15:13:17 -04:00
parent ac4a1be47b
commit 54b5d5e1e5
No known key found for this signature in database
GPG key ID: 832155B084F30453

View file

@ -718,11 +718,16 @@ function oat2dex() {
BOOTOAT="$TMPDIR/system/framework/$ARCH/boot.oat"
local OAT="$(dirname "$OEM_TARGET")/oat/$ARCH/$(basename "$OEM_TARGET" ."${OEM_TARGET##*.}").odex"
local VDEX="$(dirname "$OEM_TARGET")/oat/$ARCH/$(basename "$OEM_TARGET" ."${OEM_TARGET##*.}").vdex"
if get_file "$OAT" "$TMPDIR" "$SRC"; then
if get_file "$VDEX" "$TMPDIR" "$SRC"; then
echo "WARNING: Deodexing with VDEX. Still experimental"
fi
java -jar "$BAKSMALIJAR" deodex -o "$TMPDIR/dexout" -b "$BOOTOAT" -d "$TMPDIR" "$TMPDIR/$(basename "$OAT")"
elif [[ "$LINEAGE_TARGET" =~ .jar$ ]]; then
# try to extract classes.dex from boot.oats for framework jars
# TODO: check if extraction from boot.vdex is needed
JAROAT="$TMPDIR/system/framework/$ARCH/boot-$(basename ${OEM_TARGET%.*}).oat"
if [ ! -f "$JAROAT" ]; then
JAROAT=$BOOTOAT;