Merge "Use the new refined DexOptNeeded codes." am: d7e597a2e7 am: 99ae18486c

am: 51b40ee3eb

Change-Id: Iad8ab08d0e41a9ef6e373a9b2052f32b552c0ea7
This commit is contained in:
Nicolas Geoffray
2016-11-28 13:40:14 +00:00
committed by android-build-merger

View File

@@ -219,19 +219,20 @@ class PackageDexOptimizer {
final String dexoptType; final String dexoptType;
String oatDir = null; String oatDir = null;
switch (dexoptNeeded) { boolean isOdexLocation = (dexoptNeeded < 0);
switch (Math.abs(dexoptNeeded)) {
case DexFile.NO_DEXOPT_NEEDED: case DexFile.NO_DEXOPT_NEEDED:
continue; 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"; dexoptType = "dex2oat";
oatDir = createOatDirIfSupported(pkg, dexCodeInstructionSet); oatDir = createOatDirIfSupported(pkg, dexCodeInstructionSet);
break; break;
case DexFile.PATCHOAT_NEEDED: case DexFile.PATCHOAT_FOR_RELOCATION:
dexoptType = "patchoat"; dexoptType = "patchoat";
break; break;
case DexFile.SELF_PATCHOAT_NEEDED:
dexoptType = "self patchoat";
break;
default: default:
throw new IllegalStateException("Invalid dexopt:" + dexoptNeeded); throw new IllegalStateException("Invalid dexopt:" + dexoptNeeded);
} }
@@ -383,7 +384,7 @@ class PackageDexOptimizer {
protected int adjustDexoptNeeded(int dexoptNeeded) { protected int adjustDexoptNeeded(int dexoptNeeded) {
// Ensure compilation, no matter the current state. // Ensure compilation, no matter the current state.
// TODO: The return value is wrong when patchoat is needed. // TODO: The return value is wrong when patchoat is needed.
return DexFile.DEX2OAT_NEEDED; return DexFile.DEX2OAT_FROM_SCRATCH;
} }
} }
} }