Skip to content

Commit 832f885

Browse files
Calin JuravlePMS22
authored andcommitted
Do not clean up ART profiles during OTAs
Test: manual, upgrade & test for profiles Bug: 135299330 (cherry picked from commit 86b6bbd4c593aedb3c5e27995727fb2cb55c604b) Merged-In: I39d3376fc845ec5f2b474ea6f39a3c534ed2ce69 Change-Id: I29833113f7d0806733be669cfbc6fe2b206a982f
1 parent a6d9d77 commit 832f885

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

services/core/java/com/android/server/pm/Installer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public class Installer extends SystemService {
8585
public static final int FLAG_USE_QUOTA = IInstalld.FLAG_USE_QUOTA;
8686
public static final int FLAG_FORCE = IInstalld.FLAG_FORCE;
8787

88+
public static final int FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES =
89+
IInstalld.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES;
90+
8891
private final boolean mIsolated;
8992

9093
private volatile IInstalld mInstalld;

services/core/java/com/android/server/pm/PackageManagerService.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,7 +3282,8 @@ public PackageManagerService(Context context, Installer installer,
32823282
// No apps are running this early, so no need to freeze
32833283
clearAppDataLIF(ps.pkg, UserHandle.USER_ALL,
32843284
FLAG_STORAGE_DE | FLAG_STORAGE_CE | FLAG_STORAGE_EXTERNAL
3285-
| Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
3285+
| Installer.FLAG_CLEAR_CODE_CACHE_ONLY
3286+
| Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
32863287
}
32873288
}
32883289
ver.fingerprint = Build.DATE;
@@ -10394,7 +10395,9 @@ private void clearAppDataLIF(PackageParser.Package pkg, int userId, int flags) {
1039410395
clearAppDataLeafLIF(pkg.childPackages.get(i), userId, flags);
1039510396
}
1039610397

10397-
clearAppProfilesLIF(pkg, UserHandle.USER_ALL);
10398+
if ((flags & Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES) == 0) {
10399+
clearAppProfilesLIF(pkg, UserHandle.USER_ALL);
10400+
}
1039810401
}
1039910402

1040010403
private void clearAppDataLeafLIF(PackageParser.Package pkg, int userId, int flags) {
@@ -22737,7 +22740,8 @@ private void loadPrivatePackagesInner(VolumeInfo vol) {
2273722740

2273822741
if (!Build.DATE.equals(ver.fingerprint)) {
2273922742
clearAppDataLIF(ps.pkg, UserHandle.USER_ALL, FLAG_STORAGE_DE | FLAG_STORAGE_CE
22740-
| FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY);
22743+
| FLAG_STORAGE_EXTERNAL | Installer.FLAG_CLEAR_CODE_CACHE_ONLY
22744+
| Installer.FLAG_CLEAR_APP_DATA_KEEP_ART_PROFILES);
2274122745
}
2274222746
}
2274322747
}

0 commit comments

Comments
 (0)