OSDN Git Service

Use the new refined DexOptNeeded codes.
authorNicolas Geoffray <ngeoffray@google.com>
Fri, 25 Nov 2016 09:50:29 +0000 (09:50 +0000)
committerNicolas Geoffray <ngeoffray@google.com>
Mon, 28 Nov 2016 08:51:36 +0000 (08:51 +0000)
bug: 30937355
Test: device boots, messages are printed correctly
Change-Id: Ia5274e3659471c2a52244d5838d207d407e79023

services/core/java/com/android/server/pm/PackageDexOptimizer.java

index 1ef4a9f..acdcc72 100644 (file)
@@ -219,19 +219,20 @@ class PackageDexOptimizer {
 
                 final String dexoptType;
                 String oatDir = null;
-                switch (dexoptNeeded) {
+                boolean isOdexLocation = (dexoptNeeded < 0);
+                switch (Math.abs(dexoptNeeded)) {
                     case DexFile.NO_DEXOPT_NEEDED:
                         continue;
-                    case DexFile.DEX2OAT_NEEDED:
+                    case DexFile.DEX2OAT_FROM_SCRATCH:
+                    case DexFile.DEX2OAT_FOR_BOOT_IMAGE:
+                    case DexFile.DEX2OAT_FOR_FILTER:
+                    case DexFile.DEX2OAT_FOR_RELOCATION:
                         dexoptType = "dex2oat";
                         oatDir = createOatDirIfSupported(pkg, dexCodeInstructionSet);
                         break;
-                    case DexFile.PATCHOAT_NEEDED:
+                    case DexFile.PATCHOAT_FOR_RELOCATION:
                         dexoptType = "patchoat";
                         break;
-                    case DexFile.SELF_PATCHOAT_NEEDED:
-                        dexoptType = "self patchoat";
-                        break;
                     default:
                         throw new IllegalStateException("Invalid dexopt:" + dexoptNeeded);
                 }
@@ -383,7 +384,7 @@ class PackageDexOptimizer {
         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_NEEDED;
+            return DexFile.DEX2OAT_FROM_SCRATCH;
         }
     }
 }