Merge "Drop REASON_SHARED_APK." into oc-dev

This commit is contained in:
Nicolas Geoffray
2017-03-30 21:11:05 +00:00
committed by Android (Google) Code Review
2 changed files with 2 additions and 57 deletions

View File

@@ -537,8 +537,7 @@ public class PackageManagerService extends IPackageManager.Stub {
public static final int REASON_INSTALL = 2;
public static final int REASON_BACKGROUND_DEXOPT = 3;
public static final int REASON_AB_OTA = 4;
public static final int REASON_SHARED_APK = 5;
public static final int REASON_FORCED_DEXOPT = 6;
public static final int REASON_FORCED_DEXOPT = 5;
public static final int REASON_LAST = REASON_FORCED_DEXOPT;
@@ -2381,59 +2380,6 @@ public class PackageManagerService extends IPackageManager.Stub {
Slog.w(TAG, "No SYSTEMSERVERCLASSPATH found!");
}
final List<String> allInstructionSets = InstructionSets.getAllInstructionSets();
final String[] dexCodeInstructionSets =
getDexCodeInstructionSets(
allInstructionSets.toArray(new String[allInstructionSets.size()]));
/**
* Ensure all external libraries have had dexopt run on them.
*/
if (mSharedLibraries.size() > 0) {
Trace.traceBegin(TRACE_TAG_PACKAGE_MANAGER, "dexopt");
// NOTE: For now, we're compiling these system "shared libraries"
// (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 dexCodeInstructionSet : dexCodeInstructionSets) {
final int libCount = mSharedLibraries.size();
for (int i = 0; i < libCount; i++) {
SparseArray<SharedLibraryEntry> versionedLib = mSharedLibraries.valueAt(i);
final int versionCount = versionedLib.size();
for (int j = 0; j < versionCount; j++) {
SharedLibraryEntry libEntry = versionedLib.valueAt(j);
final String libPath = libEntry.path != null
? libEntry.path : libEntry.apk;
if (libPath == null) {
continue;
}
try {
// Shared libraries do not have profiles so we perform a full
// AOT compilation (if needed).
int dexoptNeeded = DexFile.getDexOptNeeded(
libPath, dexCodeInstructionSet,
getCompilerFilterForReason(REASON_SHARED_APK),
false /* newProfile */);
if (dexoptNeeded != DexFile.NO_DEXOPT_NEEDED) {
mInstaller.dexopt(libPath, Process.SYSTEM_UID, "*",
dexCodeInstructionSet, dexoptNeeded, null,
DEXOPT_PUBLIC,
getCompilerFilterForReason(REASON_SHARED_APK),
StorageManager.UUID_PRIVATE_INTERNAL,
PackageDexOptimizer.SKIP_SHARED_LIBRARY_CHECK);
}
} catch (FileNotFoundException e) {
Slog.w(TAG, "Library not found: " + libPath);
} catch (IOException | InstallerException e) {
Slog.w(TAG, "Cannot dexopt " + libPath + "; is it an APK or JAR? "
+ e.getMessage());
}
}
}
}
Trace.traceEnd(TRACE_TAG_PACKAGE_MANAGER);
}
File frameworkDir = new File(Environment.getRootDirectory(), "framework");
final VersionInfo ver = mSettings.getInternalVersion();

View File

@@ -26,7 +26,7 @@ import dalvik.system.DexFile;
public class PackageManagerServiceCompilerMapping {
// Names for compilation reasons.
static final String REASON_STRINGS[] = {
"first-boot", "boot", "install", "bg-dexopt", "ab-ota", "shared-apk", "forced-dexopt"
"first-boot", "boot", "install", "bg-dexopt", "ab-ota", "forced-dexopt"
};
// Static block to ensure the strings array is of the right length.
@@ -56,7 +56,6 @@ public class PackageManagerServiceCompilerMapping {
// Ensure that some reasons are not mapped to profile-guided filters.
switch (reason) {
case PackageManagerService.REASON_SHARED_APK:
case PackageManagerService.REASON_FORCED_DEXOPT:
if (DexFile.isProfileGuidedCompilerFilter(sysPropValue)) {
throw new IllegalStateException("\"" + sysPropValue + "\" is profile-guided, "