diff options
author | Philip P. Moltmann <moltmann@google.com> | 2020-05-01 00:11:09 -0700 |
---|---|---|
committer | Philip P. Moltmann <moltmann@google.com> | 2020-05-01 19:46:03 +0000 |
commit | be11ab634c18aca4829c93ba310e8589f4021833 (patch) | |
tree | 85ef1472f15f57561be439af7c2b62bc718ef6b8 /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | 10f48bb6ab367f6e87caed78816838f47318ea9e (diff) |
Cache PM data in DPGP
DefaultPermissionGrantPolicy is run on user startup but also in other
cases. On user creation it loads a lot of data from the PackageManager
and applies a lot of permission state.
This change adds an abstraction layer to the
DefaultPermissionGrantPolicy that caches and delays the PackageManager
calls on user creation. As a side-effect it also duplicates the state by
UID as all runtime permission state is by UID.
If this is not for user creation NO_PM_CACHE is used which just forwards
the calls directly to PackageManager.
This carries around the PackageManagerWrapper to all methods which
causes a lot of trivial churn. Other options considered:
- Make it a field in DefaultPermissionGrantPolicy but this would require
outside code to create multiple DefaultPermissionGrantPolicy for
different use cases
- Make it a Thread-Local. This is brittle and causes overhead
Also: All app-op setting was removed as this is automatically handled by
PermissonPolicyService
Test: Created user: Before 800 to 1200 ms after ~450 ms spent in
DefaultPermissionGrantPolicy on sargo-userdebug
Fixes: 150405484
Change-Id: If77214a193a39fec2f311a3aea324ef07c2dfb42
Merged-In: If77214a193a39fec2f311a3aea324ef07c2dfb42
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions