Loading services/core/java/com/android/server/pm/PackageManagerService.java +29 −12 Original line number Diff line number Diff line Loading @@ -444,13 +444,14 @@ public class PackageManagerService extends IPackageManager.Stub { } // Compilation reasons. public static final int REASON_BOOT = 0; public static final int REASON_INSTALL = 1; public static final int REASON_BACKGROUND_DEXOPT = 2; public static final int REASON_AB_OTA = 3; public static final int REASON_NON_SYSTEM_LIBRARY = 4; public static final int REASON_SHARED_APK = 5; public static final int REASON_FORCED_DEXOPT = 6; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_BOOT = 1; 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_NON_SYSTEM_LIBRARY = 5; public static final int REASON_SHARED_APK = 6; public static final int REASON_FORCED_DEXOPT = 7; public static final int REASON_LAST = REASON_FORCED_DEXOPT; Loading @@ -473,6 +474,7 @@ public class PackageManagerService extends IPackageManager.Stub { final int mDefParseFlags; final String[] mSeparateProcesses; final boolean mIsUpgrade; final boolean mIsPreNUpgrade; /** The location for ASEC container files on internal storage. */ final String mAsecInternalPath; Loading Loading @@ -2206,6 +2208,7 @@ public class PackageManagerService extends IPackageManager.Stub { final VersionInfo ver = mSettings.getInternalVersion(); mIsUpgrade = !Build.FINGERPRINT.equals(ver.fingerprint); // when upgrading from pre-M, promote system app permissions from install to runtime mPromoteSystemApps = mIsUpgrade && ver.sdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1; Loading @@ -2222,6 +2225,10 @@ public class PackageManagerService extends IPackageManager.Stub { } } // When upgrading form pre-N, we need to handle package extraction like first boot, // as there is no profiling data available. mIsPreNUpgrade = ver.sdkVersion <= Build.VERSION_CODES.M; // Collect vendor overlay packages. // (Do this before scanning any apps.) // For security and version matching reason, only consider Loading Loading @@ -6910,10 +6917,18 @@ public class PackageManagerService extends IPackageManager.Stub { public void extractPackagesIfNeeded() { enforceSystemOrRoot("Only the system can request package extraction"); // Extract pacakges only if profile-guided compilation is enabled because // otherwise BackgroundDexOptService will not dexopt them later. boolean prunedCache = VMRuntime.didPruneDalvikCache(); if (!isUpgrade() && !prunedCache) { // We need to re-extract after an OTA. boolean causeUpgrade = isUpgrade(); // First boot or factory reset. // Note: we also handle devices that are upgrading to N right now as if it is their // first boot, as they do not have profile data. boolean causeFirstBoot = isFirstBoot() || mIsPreNUpgrade; // We need to re-extract after a pruned cache, as AoT-ed files will be out of date. boolean causePrunedCache = VMRuntime.didPruneDalvikCache(); if (!causeUpgrade && !causeFirstBoot && !causePrunedCache) { return; } Loading Loading @@ -6945,7 +6960,9 @@ public class PackageManagerService extends IPackageManager.Stub { // and would have to be patched (would be SELF_PATCHOAT, which is deprecated). // Instead, force the extraction in this case. performDexOpt(pkg.packageName, null /* instructionSet */, false /* checkProfiles */, REASON_BOOT, prunedCache); false /* checkProfiles */, causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT, causePrunedCache); } } } Loading services/core/java/com/android/server/pm/PackageManagerServiceCompilerMapping.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ import dalvik.system.DexFile; class PackageManagerServiceCompilerMapping { // Names for compilation reasons. static final String REASON_STRINGS[] = { "boot", "install", "bg-dexopt", "ab-ota", "nsys-library", "shared-apk", "forced-dexopt" "first-boot", "boot", "install", "bg-dexopt", "ab-ota", "nsys-library", "shared-apk", "forced-dexopt" }; // Static block to ensure the strings array is of the right length. Loading Loading
services/core/java/com/android/server/pm/PackageManagerService.java +29 −12 Original line number Diff line number Diff line Loading @@ -444,13 +444,14 @@ public class PackageManagerService extends IPackageManager.Stub { } // Compilation reasons. public static final int REASON_BOOT = 0; public static final int REASON_INSTALL = 1; public static final int REASON_BACKGROUND_DEXOPT = 2; public static final int REASON_AB_OTA = 3; public static final int REASON_NON_SYSTEM_LIBRARY = 4; public static final int REASON_SHARED_APK = 5; public static final int REASON_FORCED_DEXOPT = 6; public static final int REASON_FIRST_BOOT = 0; public static final int REASON_BOOT = 1; 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_NON_SYSTEM_LIBRARY = 5; public static final int REASON_SHARED_APK = 6; public static final int REASON_FORCED_DEXOPT = 7; public static final int REASON_LAST = REASON_FORCED_DEXOPT; Loading @@ -473,6 +474,7 @@ public class PackageManagerService extends IPackageManager.Stub { final int mDefParseFlags; final String[] mSeparateProcesses; final boolean mIsUpgrade; final boolean mIsPreNUpgrade; /** The location for ASEC container files on internal storage. */ final String mAsecInternalPath; Loading Loading @@ -2206,6 +2208,7 @@ public class PackageManagerService extends IPackageManager.Stub { final VersionInfo ver = mSettings.getInternalVersion(); mIsUpgrade = !Build.FINGERPRINT.equals(ver.fingerprint); // when upgrading from pre-M, promote system app permissions from install to runtime mPromoteSystemApps = mIsUpgrade && ver.sdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1; Loading @@ -2222,6 +2225,10 @@ public class PackageManagerService extends IPackageManager.Stub { } } // When upgrading form pre-N, we need to handle package extraction like first boot, // as there is no profiling data available. mIsPreNUpgrade = ver.sdkVersion <= Build.VERSION_CODES.M; // Collect vendor overlay packages. // (Do this before scanning any apps.) // For security and version matching reason, only consider Loading Loading @@ -6910,10 +6917,18 @@ public class PackageManagerService extends IPackageManager.Stub { public void extractPackagesIfNeeded() { enforceSystemOrRoot("Only the system can request package extraction"); // Extract pacakges only if profile-guided compilation is enabled because // otherwise BackgroundDexOptService will not dexopt them later. boolean prunedCache = VMRuntime.didPruneDalvikCache(); if (!isUpgrade() && !prunedCache) { // We need to re-extract after an OTA. boolean causeUpgrade = isUpgrade(); // First boot or factory reset. // Note: we also handle devices that are upgrading to N right now as if it is their // first boot, as they do not have profile data. boolean causeFirstBoot = isFirstBoot() || mIsPreNUpgrade; // We need to re-extract after a pruned cache, as AoT-ed files will be out of date. boolean causePrunedCache = VMRuntime.didPruneDalvikCache(); if (!causeUpgrade && !causeFirstBoot && !causePrunedCache) { return; } Loading Loading @@ -6945,7 +6960,9 @@ public class PackageManagerService extends IPackageManager.Stub { // and would have to be patched (would be SELF_PATCHOAT, which is deprecated). // Instead, force the extraction in this case. performDexOpt(pkg.packageName, null /* instructionSet */, false /* checkProfiles */, REASON_BOOT, prunedCache); false /* checkProfiles */, causeFirstBoot ? REASON_FIRST_BOOT : REASON_BOOT, causePrunedCache); } } } Loading
services/core/java/com/android/server/pm/PackageManagerServiceCompilerMapping.java +2 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,8 @@ import dalvik.system.DexFile; class PackageManagerServiceCompilerMapping { // Names for compilation reasons. static final String REASON_STRINGS[] = { "boot", "install", "bg-dexopt", "ab-ota", "nsys-library", "shared-apk", "forced-dexopt" "first-boot", "boot", "install", "bg-dexopt", "ab-ota", "nsys-library", "shared-apk", "forced-dexopt" }; // Static block to ensure the strings array is of the right length. Loading