Refactor updatePermissions() into onPackageInstalled().
1. For the case where a dangling system PackageSetting is left without a (disabled) factory package, the previous logic was to remove its data directory before ag/920260, which deferred the removal into reconcileAppsDataLI(). However, there are more package related states that should be cleaned up apart from the data directory, hence ag/7278993 added a call to removePackageDataLIF() for the similar case when handling dangling updated system apps. Meanwhile, ag/11872632 was later submitted to remove the permission state for this case of factory packages, but still, it seems more consistent to also call removePackageDataLIF() for consistency and better cleanup. 2. For enableCompressedPackage() and installPackageFromSystemLIF(), they are simply changed from calling updatePermissions() to call onPackageInstalled() with no additional permission granting. 3. onPackageInstalled() is changed to call updatePermissions() as the first thing, and updatePermissions() is removed from the internal API. 4. The call to updatePermissions() is removed from updateSettingsInternalLI(), because the only call path into it goes back to processInstallRequestsAsync(), which will always call restoreAndPostInstall() which goes into handlePackagePostInstall() and call onPackageInstalled() there. Packages needs to go through handlePackagePostInstall() to get their permission allowlisted/granted anyway so not calling updatePermissions() again earlier shouldn't be a problem. Bug: 158736025 Test: presubmit Test: manual Test: adb remount and push an APK to /system/priv-app Test: adb reboot and verify package is system package Test: flash a build with this change so that system partition is reset and app is gone Test: onPackageInstalled() logged stacktrace for being called and package setting is removed. Change-Id: Id68428b3aca18c0badee58d1a57663510db438e9
Loading
Please register or sign in to comment