Skip to content
Commit 0f3bd201 authored by Hai Zhang's avatar Hai Zhang
Browse files

Second batch of permission in-process API refactoring.

- Refactored isPermissionReviewRequired(),
  grantRequestedRuntimePermissions(),
  setAllowlistedRestrictedPermissions(), and setAutoRevokeExempted(),

- Added javadoc for the methods, and refactor the parameter types to
  conform with API guidelines.

- The methods are taking an int array of user IDs because they
  are (mostly) used in handlePackagePostInstall, where the install can
  happen for multiple users at once, and allowing the API
  implementation to handle multiple users at once allows optimization,
  namely calling restorePermissionState() only once for all users.

- Fixed the bug that auto revoke exemption could only be set for the
  primary users post install, but not non-primary users.

- Renamed the methods to be inclusive, replacing the term with
  allowlist. However setAutoRevokeAllowlisted() is a bit confusing so
  I'm renaming it to setAutoRevokeExempted().

- Removed the callingUid parameter from the methods. Since the methods
  were called from handlePackagePostInstall(), which is called by a
  handler thread upon receiving the corresponding message, it is
  basically useless and for two methods we were already passing
  Process.myUid().

- Renamed/Created the API implementation methods, so that *Internal()
  methods perform no checks, whereas non-internal ones perform checks.

Bug: 158736025
Test: presubmit
Change-Id: I6965e2c715bc65ddb8e2aa51c03ccb1031c3a161
parent 65d46e9b
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