From 54b5d5e1e52998d974c147144eae6022a20f6145 Mon Sep 17 00:00:00 2001 From: Rashed Abdel-Tawab Date: Wed, 23 Aug 2017 15:13:17 -0400 Subject: [PATCH] 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 --- build/tools/extract_utils.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/tools/extract_utils.sh b/build/tools/extract_utils.sh index d5cb79db..3eed1588 100644 --- a/build/tools/extract_utils.sh +++ b/build/tools/extract_utils.sh @@ -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;