Skip to content
Commit 659dcc86 authored by Lee Shombert's avatar Lee Shombert
Browse files

Modify PropertyInvalidatedCache

Bug: 186778818

This makes two changes to PropertyInvalidatedCache.

1. disableLocal() now disables all current and future caches that use
   the same name (not the necessarily the same property) , in the
   local process.  Previously, disableLocal() only disabled a single
   cache instance, but the intent was always to disable all instances
   of the same cache in the process.

   disableInstance() is available with the old behavior.

2. A bypass() method has been added.  If bypass() returns true,
   query() will skip the cache and go straight to the binder call as
   though the cache had been disabled.  The default implementation
   always returns false.  Caches can override the implementation to
   avoid caching selected queries.

These changes specifically address the problem of caches that are
created dynamically and which should be disabled in the local
process.

A unit-test is added for PropertyInvalidatedCache.  This is not a
complete test because test processes are not allowed to set system
properties.  The unit-test will be improved in the future by modifying
PropertyInvalidatedCache to use an invalidation mechanism other than
system properties.

Manual test: boot a phone with a baseline build and with the build
under test and verified that the list of disabled caches is the same.
Use 'dumpsys cacheinfo' to get the cache status.

Test: atest
 * FrameworksServicesTests:UserManagerServiceCreateProfileTest

Change-Id: I9f604b872911290e4e3d8a58b3e28e328b2000a9
parent 3c0f63ab
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment