Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e6751e09 authored by Lee Shombert's avatar Lee Shombert
Browse files

PM caches now cache nulls

PackageManager caches for getPackagesForUid(), getApplicationInfo(),
and getPackageInfo() now cache null results.  That is, if PM returns
null for a query, that null result is cached against the query.

AppsFilterImpl invalidates the caches to cover the situation in which
an application gains visibility and is now able to query package info.
The corresponding AppsFilterImplTest is updated to disable the caches
for the duration of the tests.

This change also makes invalidateGetPackagesForUidCache() faster by
going directly to the static cache.  This avoids the search for the
nonce handler that corresponds to the property string.

The cache declarations are refactored slightly to use the new Args()
constructor.

The name of the cache for getPackagesForUid() has been shortened to
"get_packages_for_uid" instead of the full property name.

Manually verified via dumpsys cacheinfo that the cache keys have not
changed and that the respective invalidations did not change
unexpectedly.

Flag: EXEMPT bug-fix
Bug: 382719639
Test: atest
 * com.android.server.pm.PackageManagerTests
 * android.content.pm.cts.PackageManagerTest
 * CtsAppEnumerationTestCases
Change-Id: I444379873a17ac9e8cdf4ce5a6ea5b4e59274a65
parent 24b592ab
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment