Add package cache handling to PermissionService.

Since it's also in PermissionManagerServiceImpl.

The other corkPackageInfoCache() call in
PermissionManagerServiceImpl.updateAllPermissions() is skipped because
we are already properly batching the change notifications and there will
only be one invalidation call.

Bug: 263504888
Test: presubmit
Change-Id: I03246bb359f72321dfa930a83c582572d4c6a00a
This commit is contained in:
Hai Zhang
2023-03-20 21:06:48 +00:00
parent dcdcf65097
commit db8767f1b9

View File

@@ -142,6 +142,12 @@ class PermissionService(
userManagerInternal = LocalServices.getService(UserManagerInternal::class.java)
userManagerService = UserManagerService.getInstance()
// The package info cache is the cache for package and permission information.
// Disable the package info and package permission caches locally but leave the
// checkPermission cache active.
PackageManager.invalidatePackageInfoCache();
PermissionManager.disablePackageNamePermissionCache();
handlerThread = ServiceThread(LOG_TAG, Process.THREAD_PRIORITY_BACKGROUND, true)
.apply { start() }
handler = Handler(handlerThread.looper)