summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author William Loh <wloh@google.com> 2024-07-25 13:53:58 -0700
committer William Loh <wloh@google.com> 2024-07-29 15:01:54 -0700
commit0f41e48273eb54e9bdde58906bca426548cfe70f (patch)
tree1d36a27f5cda995cda93180731cc1546270df72a
parentcd3621fb1374ec3717dfa157d363a114bc328972 (diff)
Fix missing ASL after reboot
Only clear the appMetadataFilePath in commitPackageSettings if the lastUpdateTime has changed. Previously we only checked that the old package setting was null which was not reliable because in many cases the old package setting is set to be the existing package setting. Bug: 354882606 Test: Manually add a entry in preinstalled-packages--asl-files.xml for a system app Test: adb shell setprop persist.pm.mock-upgrade true && adb reboot Test: check that the ASL for the system app persists after reboots Flag: EXEMPT bugfix Change-Id: Ibbf1be2e3e160eb143393d3eb7bf5fac0e4229a5
-rw-r--r--services/core/java/com/android/server/pm/InstallPackageHelper.java6
1 files changed, 3 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/pm/InstallPackageHelper.java b/services/core/java/com/android/server/pm/InstallPackageHelper.java
index 8d3f07edb687..8cdeaf3f8b09 100644
--- a/services/core/java/com/android/server/pm/InstallPackageHelper.java
+++ b/services/core/java/com/android/server/pm/InstallPackageHelper.java
@@ -501,9 +501,9 @@ final class InstallPackageHelper {
mPm.setUpCustomResolverActivity(pkg, pkgSetting);
}
- // When upgrading a package, pkgSetting is copied from oldPkgSetting. Clear the app
- // metadata file path for the new package.
- if (oldPkgSetting != null) {
+ // When upgrading a package, clear the app metadata file path for the new package.
+ if (oldPkgSetting != null
+ && oldPkgSetting.getLastUpdateTime() < pkgSetting.getLastUpdateTime()) {
pkgSetting.setAppMetadataFilePath(null);
pkgSetting.setAppMetadataSource(APP_METADATA_SOURCE_UNKNOWN);
}