Refactoring: Helper method for calling with clean binder identity
Introduce a helper method for executing a runnable that returns a value
with the binder caller's identity cleared.
Replace multiple call sites which employed the pattern of saving the
caller identity, clearing it and restoring it in the 'finally' block.
This would make the code safer as there'd be no chance of forgetting to
restore the caller's identity or restoring the wrong caller's identity.
This refactoring introduces no functional changes.
Bug: 146552069
Test: atest CtsDevicePolicyManagerTestCases:com.android.cts.devicepolicy.MixedDeviceOwnerTest
Test: atest FrameworksServicesTests:DevicePolicyManagerTest
Change-Id: I7eb84b00009778580560fa5f0bdd0a584f1d454b
1 file changed