diff --git a/services/java/com/android/server/pm/PackageManagerService.java b/services/java/com/android/server/pm/PackageManagerService.java index f076fa0199b8b..f98d90f37175f 100755 --- a/services/java/com/android/server/pm/PackageManagerService.java +++ b/services/java/com/android/server/pm/PackageManagerService.java @@ -1350,7 +1350,7 @@ public class PackageManagerService extends IPackageManager.Stub { boolean didDexOptLibraryOrTool = false; - final List instructionSets = getAllInstructionSets(); + final List dexCodeInstructionSets = getAllDexCodeInstructionSets(); /** * Ensure all external libraries have had dexopt run on them. @@ -1360,7 +1360,7 @@ public class PackageManagerService extends IPackageManager.Stub { // (and framework jars) into all available architectures. It's possible // to compile them only when we come across an app that uses them (there's // already logic for that in scanPackageLI) but that adds some complexity. - for (String instructionSet : instructionSets) { + for (String dexCodeInstructionSet : dexCodeInstructionSets) { for (SharedLibraryEntry libEntry : mSharedLibraries.values()) { final String lib = libEntry.path; if (lib == null) { @@ -1369,16 +1369,16 @@ public class PackageManagerService extends IPackageManager.Stub { try { byte dexoptRequired = DexFile.isDexOptNeededInternal(lib, null, - instructionSet, + dexCodeInstructionSet, false); if (dexoptRequired != DexFile.UP_TO_DATE) { alreadyDexOpted.add(lib); // The list of "shared libraries" we have at this point is if (dexoptRequired == DexFile.DEXOPT_NEEDED) { - mInstaller.dexopt(lib, Process.SYSTEM_UID, true, instructionSet); + mInstaller.dexopt(lib, Process.SYSTEM_UID, true, dexCodeInstructionSet); } else { - mInstaller.patchoat(lib, Process.SYSTEM_UID, true, instructionSet); + mInstaller.patchoat(lib, Process.SYSTEM_UID, true, dexCodeInstructionSet); } didDexOptLibraryOrTool = true; } @@ -1413,7 +1413,7 @@ public class PackageManagerService extends IPackageManager.Stub { // TODO: We could compile these only for the most preferred ABI. We should // first double check that the dex files for these commands are not referenced // by other system apps. - for (String instructionSet : instructionSets) { + for (String dexCodeInstructionSet : dexCodeInstructionSets) { for (int i=0; i done) { final String instructionSet = instructionSetOverride != null ? instructionSetOverride : getAppInstructionSet(pkg.applicationInfo); - + final String dexCodeInstructionSet = getDexCodeInstructionSet(instructionSet); if (done != null) { done.add(pkg.packageName); if (pkg.usesLibraries != null) { - performDexOptLibsLI(pkg.usesLibraries, instructionSet, forceDex, defer, done); + performDexOptLibsLI(pkg.usesLibraries, dexCodeInstructionSet, forceDex, defer, done); } if (pkg.usesOptionalLibraries != null) { - performDexOptLibsLI(pkg.usesOptionalLibraries, instructionSet, forceDex, defer, done); + performDexOptLibsLI(pkg.usesOptionalLibraries, dexCodeInstructionSet, forceDex, defer, done); } } @@ -4301,7 +4301,7 @@ public class PackageManagerService extends IPackageManager.Stub { // odex file and it matches the checksum of the image but not its base address, // meaning we need to move it. byte isDexOptNeededInternal = DexFile.isDexOptNeededInternal(path, pkg.packageName, - instructionSet, defer); + dexCodeInstructionSet, defer); // There are three basic cases here: // 1.) we need to dexopt, either because we are forced or it is needed // 2.) we are defering a needed dexopt @@ -4310,7 +4310,7 @@ public class PackageManagerService extends IPackageManager.Stub { Log.i(TAG, "Running dexopt on: " + pkg.applicationInfo.packageName); final int sharedGid = UserHandle.getSharedAppGid(pkg.applicationInfo.uid); int ret = mInstaller.dexopt(path, sharedGid, !isForwardLocked(pkg), - pkg.packageName, instructionSet); + pkg.packageName, dexCodeInstructionSet); // Note that we ran dexopt, since rerunning will // probably just result in an error again. pkg.mDexOptNeeded = false; @@ -4399,6 +4399,20 @@ public class PackageManagerService extends IPackageManager.Stub { return allInstructionSets; } + public static String getDexCodeInstructionSet(String sharedLibraryIsa) { + String dexCodeIsa = SystemProperties.get("ro.dalvik.vm.isa." + sharedLibraryIsa); + return (dexCodeIsa.isEmpty() ? sharedLibraryIsa : dexCodeIsa); + } + + private static List getAllDexCodeInstructionSets() { + List instructionSets = getAllInstructionSets(); + List dexCodeInstructionSets = new ArrayList(instructionSets.size()); + for (String instructionSet : instructionSets) { + dexCodeInstructionSets.add(getDexCodeInstructionSet(instructionSet)); + } + return dexCodeInstructionSets; + } + private int performDexOptLI(PackageParser.Package pkg, boolean forceDex, boolean defer, boolean inclDependencies) { HashSet done;