Skip to content
Commit 1033db8d authored by Ng Zhi An's avatar Ng Zhi An Committed by Zhi An Ng
Browse files

Do not load xml metadata for unchanged packages in RegisteredServicesCache

RegisteredServicesCache caches services in an xml, so the system doesn't
have to scan all the apks. Whenever a package is changed
(add/remove/replaced), the broadcast receiver in RegisteredServicesCache
will refresh this cache by quering all matching services and reading
their
xml metadata. There is extra work done here, because only the changed
package
will have services added/removed.

The edge case is after a cache is invalidated, we want to query package
manager for everything, regardless of what changedUids is (we could
have arrived here if invalidateCache is called, and then a package
change event fires, before a getAllServices is called to rescan
everything).

Add a new test to verify that the optimization takes care of the case
when the cache is invalidated.

Bug: 117755076
Bug: 122912184
Test: atest RegisteredServicesCache
Test: dumpsys content # check sync adapters
Change-Id: I5c1f57108c4b67d24b198000d57216c63d35290a
(cherry picked from commit dc66ef5e)
parent 8eacbb33
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