Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a5845e6 authored by Nicolas Geoffray's avatar Nicolas Geoffray
Browse files

Adjust forced dexopt in case of stripped APKs.

We cannot compile from scratch for strip APK. So
if getDexOptNeeded returns NotNeeded, pretend there was
a compiler filter change, in order to pick up the vdex file.

bug: 37558732
Test: "adb shell cmd package compile" of a stripped /system apk

(cherry picked from commit 96d12a93)

Change-Id: I3b699a18799ea035ff78c60578c08f8803a17e36
parent 3eafb6e2
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -613,9 +613,13 @@ public class PackageDexOptimizer {

        @Override
        protected int adjustDexoptNeeded(int dexoptNeeded) {
            // Ensure compilation, no matter the current state.
            // TODO: The return value is wrong when patchoat is needed.
            return DexFile.DEX2OAT_FROM_SCRATCH;
            if (dexoptNeeded == DexFile.NO_DEXOPT_NEEDED) {
                // Ensure compilation by pretending a compiler filter change on the
                // apk/odex location (the reason for the '-'. A positive value means
                // the 'oat' location).
                return -DexFile.DEX2OAT_FOR_FILTER;
            }
            return dexoptNeeded;
        }

        @Override