PackageManagerCompat

Added in 1.7.0

public final class PackageManagerCompat


Helper for accessing features in PackageManager.

Summary

Constants

static final String
ACTION_PERMISSION_REVOCATION_SETTINGS = "android.intent.action.AUTO_REVOKE_PERMISSIONS"

Activity action: creates an intent to redirect the user to UI to turn on/off their permission revocation settings.

Public methods

static @NonNull ListenableFuture<Integer>

Returns the status of Unused App Restrictions for the current application.

Constants

ACTION_PERMISSION_REVOCATION_SETTINGS

Added in 1.7.0
public static final String ACTION_PERMISSION_REVOCATION_SETTINGS = "android.intent.action.AUTO_REVOKE_PERMISSIONS"

Activity action: creates an intent to redirect the user to UI to turn on/off their permission revocation settings.

Public methods

getUnusedAppRestrictionsStatus

Added in 1.7.0
public static @NonNull ListenableFuture<IntegergetUnusedAppRestrictionsStatus(@NonNull Context context)

Returns the status of Unused App Restrictions for the current application. In other words, whether the features are available and if so, enabled for the application. The returned value is a ListenableFuture with an Integer corresponding to a value in UnusedAppRestrictionsConstants. The possible values are as follows:

  • ERROR: an error occurred when fetching the availability and status of Unused App Restrictions. Check the logs for the reason (e.g. if the app's target SDK version <30 or the user is in locked device boot mode).
  • FEATURE_NOT_AVAILABLE: there are no available Unused App Restrictions for this app.
  • DISABLED: any available Unused App Restrictions on the device are disabled for this app.
  • API_30_BACKPORT: Unused App Restrictions introduced by Android API 30, and since made available on earlier (API 23-29) devices are enabled for this app: permission auto-reset.
  • API_30: Unused App Restrictions introduced by Android API 30 are enabled for this app: permission auto-reset.
  • API_31: Unused App Restrictions introduced by Android API 31 are enabled for this app: permission auto-reset and app hibernation.
Compatibility behavior: