Merge "Update the reference profile from .dm files only during installs"
am: 23bc5ea51b
Change-Id: Ia905bf18228eaf94d5b1d8ec8703b2cdd3473fd7
This commit is contained in:
@@ -17597,7 +17597,8 @@ public class PackageManagerService extends IPackageManager.Stub
|
|||||||
// Prepare the application profiles for the new code paths.
|
// Prepare the application profiles for the new code paths.
|
||||||
// This needs to be done before invoking dexopt so that any install-time profile
|
// This needs to be done before invoking dexopt so that any install-time profile
|
||||||
// can be used for optimizations.
|
// can be used for optimizations.
|
||||||
mArtManagerService.prepareAppProfiles(pkg, resolveUserIds(args.user.getIdentifier()));
|
mArtManagerService.prepareAppProfiles(pkg, resolveUserIds(args.user.getIdentifier()),
|
||||||
|
/* updateReferenceProfileContent= */ true);
|
||||||
|
|
||||||
// Check whether we need to dexopt the app.
|
// Check whether we need to dexopt the app.
|
||||||
//
|
//
|
||||||
@@ -22698,8 +22699,18 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
|
|||||||
//
|
//
|
||||||
// We also have to cover non system users because we do not call the usual install package
|
// We also have to cover non system users because we do not call the usual install package
|
||||||
// methods for them.
|
// methods for them.
|
||||||
|
//
|
||||||
|
// NOTE: in order to speed up first boot time we only create the current profile and do not
|
||||||
|
// update the content of the reference profile. A system image should already be configured
|
||||||
|
// with the right profile keys and the profiles for the speed-profile prebuilds should
|
||||||
|
// already be copied. That's done in #performDexOptUpgrade.
|
||||||
|
//
|
||||||
|
// TODO(calin, mathieuc): We should use .dm files for prebuilds profiles instead of
|
||||||
|
// manually copying them in #performDexOptUpgrade. When we do that we should have a more
|
||||||
|
// granular check here and only update the existing profiles.
|
||||||
if (mIsUpgrade || mFirstBoot || (userId != UserHandle.USER_SYSTEM)) {
|
if (mIsUpgrade || mFirstBoot || (userId != UserHandle.USER_SYSTEM)) {
|
||||||
mArtManagerService.prepareAppProfiles(pkg, userId);
|
mArtManagerService.prepareAppProfiles(pkg, userId,
|
||||||
|
/* updateReferenceProfileContent= */ false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((flags & StorageManager.FLAG_STORAGE_CE) != 0 && ceDataInode != -1) {
|
if ((flags & StorageManager.FLAG_STORAGE_CE) != 0 && ceDataInode != -1) {
|
||||||
|
|||||||
@@ -389,7 +389,8 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
* - create the current primary profile to save time at app startup time.
|
* - create the current primary profile to save time at app startup time.
|
||||||
* - copy the profiles from the associated dex metadata file to the reference profile.
|
* - copy the profiles from the associated dex metadata file to the reference profile.
|
||||||
*/
|
*/
|
||||||
public void prepareAppProfiles(PackageParser.Package pkg, @UserIdInt int user) {
|
public void prepareAppProfiles(PackageParser.Package pkg, @UserIdInt int user,
|
||||||
|
boolean updateReferenceProfileContent) {
|
||||||
final int appId = UserHandle.getAppId(pkg.applicationInfo.uid);
|
final int appId = UserHandle.getAppId(pkg.applicationInfo.uid);
|
||||||
if (user < 0) {
|
if (user < 0) {
|
||||||
Slog.wtf(TAG, "Invalid user id: " + user);
|
Slog.wtf(TAG, "Invalid user id: " + user);
|
||||||
@@ -404,8 +405,14 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
for (int i = codePathsProfileNames.size() - 1; i >= 0; i--) {
|
for (int i = codePathsProfileNames.size() - 1; i >= 0; i--) {
|
||||||
String codePath = codePathsProfileNames.keyAt(i);
|
String codePath = codePathsProfileNames.keyAt(i);
|
||||||
String profileName = codePathsProfileNames.valueAt(i);
|
String profileName = codePathsProfileNames.valueAt(i);
|
||||||
File dexMetadata = DexMetadataHelper.findDexMetadataForFile(new File(codePath));
|
String dexMetadataPath = null;
|
||||||
String dexMetadataPath = dexMetadata == null ? null : dexMetadata.getAbsolutePath();
|
// Passing the dex metadata file to the prepare method will update the reference
|
||||||
|
// profile content. As such, we look for the dex metadata file only if we need to
|
||||||
|
// perform an update.
|
||||||
|
if (updateReferenceProfileContent) {
|
||||||
|
File dexMetadata = DexMetadataHelper.findDexMetadataForFile(new File(codePath));
|
||||||
|
dexMetadataPath = dexMetadata == null ? null : dexMetadata.getAbsolutePath();
|
||||||
|
}
|
||||||
synchronized (mInstaller) {
|
synchronized (mInstaller) {
|
||||||
boolean result = mInstaller.prepareAppProfile(pkg.packageName, user, appId,
|
boolean result = mInstaller.prepareAppProfile(pkg.packageName, user, appId,
|
||||||
profileName, codePath, dexMetadataPath);
|
profileName, codePath, dexMetadataPath);
|
||||||
@@ -423,9 +430,10 @@ public class ArtManagerService extends android.content.pm.dex.IArtManager.Stub {
|
|||||||
/**
|
/**
|
||||||
* Prepares the app profiles for a set of users. {@see ArtManagerService#prepareAppProfiles}.
|
* Prepares the app profiles for a set of users. {@see ArtManagerService#prepareAppProfiles}.
|
||||||
*/
|
*/
|
||||||
public void prepareAppProfiles(PackageParser.Package pkg, int[] user) {
|
public void prepareAppProfiles(PackageParser.Package pkg, int[] user,
|
||||||
|
boolean updateReferenceProfileContent) {
|
||||||
for (int i = 0; i < user.length; i++) {
|
for (int i = 0; i < user.length; i++) {
|
||||||
prepareAppProfiles(pkg, user[i]);
|
prepareAppProfiles(pkg, user[i], updateReferenceProfileContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user