Loading
Cache resolved details about remote callers.
The logic in MediaProvider is technically correct, but it's sometimes inefficient in calling into the OS multiple times with the same questions, such as validating getCallingPackage(). To mitigate this overhead, and start paving the way for more dynamic delegation of permission checks, collect these details into a LocalCallingIdentity object. We carefully perform all permissions checking against this new object, and avoid using any other thread-local values from ContentProvider or Binder. Local tests show this CL improves performance of a test app that takes 100 rapid shots by 37%. This change is a no-op refactoring. Bug: 130758409, 115619667 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: If250a7675f2246cd10881acf615619d6d6061f3d