extract_utils: add CDEX support via compact_dex_converter

Source: https://github.com/anestisb/vdexExtractor#compact-dex-converter

Change-Id: I63664cae02e51a05e5a62c0c5c0595eead6c6513
This commit is contained in:
codeworkx
2018-09-23 12:36:57 +02:00
parent 8e388bcddc
commit 02233784a8

View File

@@ -787,6 +787,10 @@ function oat2dex() {
export VDEXEXTRACTOR="$LINEAGE_ROOT"/vendor/lineage/build/tools/"$HOST"/vdexExtractor
fi
if [ -z "$CDEXCONVERTER" ]; then
export CDEXCONVERTER="$LINEAGE_ROOT"/vendor/lineage/build/tools/"$HOST"/compact_dex_converter
fi
# Extract existing boot.oats to the temp folder
if [ -z "$ARCHES" ]; then
echo "Checking if system is odexed and locating boot.oats..."
@@ -821,7 +825,13 @@ function oat2dex() {
if get_file "$OAT" "$TMPDIR" "$SRC"; then
if get_file "$VDEX" "$TMPDIR" "$SRC"; then
"$VDEXEXTRACTOR" -o "$TMPDIR/" -i "$TMPDIR/$(basename "$VDEX")" > /dev/null
mv "$TMPDIR/$(basename "${OEM_TARGET%.*}").apk_classes.dex" "$TMPDIR/classes.dex"
# Check if we have to deal with CompactDex
if [ -f "$TMPDIR/$(basename "${OEM_TARGET%.*}")_classes.cdex" ]; then
"$CDEXCONVERTER" "$TMPDIR/$(basename "${OEM_TARGET%.*}")_classes.cdex" &> /dev/null
mv "$TMPDIR/$(basename "${OEM_TARGET%.*}")_classes.cdex.new" "$TMPDIR/classes.dex"
else
mv "$TMPDIR/$(basename "${OEM_TARGET%.*}").apk_classes.dex" "$TMPDIR/classes.dex"
fi
else
java -jar "$BAKSMALIJAR" deodex -o "$TMPDIR/dexout" -b "$BOOTOAT" -d "$TMPDIR" "$TMPDIR/$(basename "$OAT")"
java -jar "$SMALIJAR" assemble "$TMPDIR/dexout" -o "$TMPDIR/classes.dex"