belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
AppOpsManagerCompat
  public
  
  final
  
  class
  AppOpsManagerCompat
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.support.v4.app.AppOpsManagerCompat | 
Helper for accessing features in AppOpsManager.
Summary
| Constants | |
|---|---|
| int | MODE_ALLOWEDResult from  | 
| int | MODE_DEFAULTResult from  | 
| int | MODE_ERROREDResult from  | 
| int | MODE_IGNOREDResult from  | 
| Public methods | |
|---|---|
| 
        
        
        static
        
        
        int | 
      noteOp(Context context, String op, int uid, String packageName)
      Make note of an application performing an operation. | 
| 
        
        
        static
        
        
        int | 
      noteOpNoThrow(Context context, String op, int uid, String packageName)
      Like  | 
| 
        
        
        static
        
        
        int | 
      noteProxyOp(Context context, String op, String proxiedPackageName)
      Make note of an application performing an operation on behalf of another application when handling an IPC. | 
| 
        
        
        static
        
        
        int | 
      noteProxyOpNoThrow(Context context, String op, String proxiedPackageName)
      Like  | 
| 
        
        
        static
        
        
        String | 
      permissionToOp(String permission)
      Gets the app op name associated with a given permission. | 
| Inherited methods | |
|---|---|
|  From
class 
  
    java.lang.Object
  
 | |
Constants
MODE_ALLOWED
int MODE_ALLOWED
Result from noteOp(Context, String, int, String): the given caller is allowed to
 perform the given operation.
Constant Value: 0 (0x00000000)
MODE_DEFAULT
int MODE_DEFAULT
Result from noteOp(Context, String, int, String): the given caller should use its default
 security check.  This mode is not normally used; it should only be used
 with appop permissions, and callers must explicitly check for it and
 deal with it.
Constant Value: 3 (0x00000003)
MODE_ERRORED
int MODE_ERRORED
Result from noteOpNoThrow(Context, String, int, String): the
 given caller is not allowed to perform the given operation, and this attempt should
 cause it to have a fatal error, typically a SecurityException.
Constant Value: 2 (0x00000002)
MODE_IGNORED
int MODE_IGNORED
Result from noteOp(Context, String, int, String): the given caller is not allowed to perform
 the given operation, and this attempt should silently fail (it
 should not cause the app to crash).
Constant Value: 1 (0x00000001)
Public methods
noteOp
int noteOp (Context context, String op, int uid, String packageName)
Make note of an application performing an operation.  Note that you must pass
 in both the uid and name of the application to be checked; this function will verify
 that these two match, and if not, return MODE_IGNORED.  If this call
 succeeds, the last execution time of the operation for this app will be updated to
 the current time.
 
Compatibility
- On API 18 and lower, this method always returns MODE_IGNORED
| Parameters | |
|---|---|
| context | Context: Your context. | 
| op | String: The operation to note.  One of the OPSTR_* constants. | 
| uid | int: The user id of the application attempting to perform the operation. | 
| packageName | String: The name of the application attempting to perform the operation. | 
| Returns | |
|---|---|
| int | Returns MODE_ALLOWEDif the operation is allowed, orMODE_IGNOREDif it is not allowed and should be silently ignored (without
 causing the app to crash). | 
| Throws | |
|---|---|
| SecurityException | If the app has been configured to crash on this op. | 
noteOpNoThrow
int noteOpNoThrow (Context context, String op, int uid, String packageName)
Like noteOp(Context, String, int, String) but instead of throwing a SecurityException it
 returns MODE_ERRORED.
 
Compatibility
- On API 18 and lower, this method always returns MODE_IGNORED
| Parameters | |
|---|---|
| context | Context | 
| op | String | 
| uid | int | 
| packageName | String | 
| Returns | |
|---|---|
| int | |
noteProxyOp
int noteProxyOp (Context context, String op, String proxiedPackageName)
Make note of an application performing an operation on behalf of another
 application when handling an IPC. Note that you must pass the package name
 of the application that is being proxied while its UID will be inferred from
 the IPC state; this function will verify that the calling uid and proxied
 package name match, and if not, return MODE_IGNORED. If this call
 succeeds, the last execution time of the operation for the proxied app and
 your app will be updated to the current time.
 
Compatibility
- On API 22 and lower, this method always returns MODE_IGNORED
| Parameters | |
|---|---|
| context | Context: Your context. | 
| op | String: The operation to note.  One of the OPSTR_* constants. | 
| proxiedPackageName | String: The name of the application calling into the proxy application. | 
| Returns | |
|---|---|
| int | Returns MODE_ALLOWEDif the operation is allowed, orMODE_IGNOREDif it is not allowed and should be silently ignored (without
 causing the app to crash). | 
| Throws | |
|---|---|
| SecurityException | If the app has been configured to crash on this op. | 
noteProxyOpNoThrow
int noteProxyOpNoThrow (Context context, String op, String proxiedPackageName)
Like noteProxyOp(Context, String, String) but instead
 of throwing a SecurityException it returns MODE_ERRORED.
 
Compatibility
- On API 22 and lower, this method always returns MODE_IGNORED
| Parameters | |
|---|---|
| context | Context | 
| op | String | 
| proxiedPackageName | String | 
| Returns | |
|---|---|
| int | |
permissionToOp
String permissionToOp (String permission)
Gets the app op name associated with a given permission.
Compatibility
- On API 22 and lower, this method always returns null
| Parameters | |
|---|---|
| permission | String: The permission. | 
| Returns | |
|---|---|
| String | The app op associated with the permission or null. | 
- Annotations
- Interfaces- ActionBarDrawerToggle.Delegate
- ActionBarDrawerToggle.DelegateProvider
- ActivityCompat.OnRequestPermissionsResultCallback
- ActivityCompat.PermissionCompatDelegate
- FragmentManager.BackStackEntry
- FragmentManager.OnBackStackChangedListener
- LoaderManager.LoaderCallbacks
- NotificationCompat.Action.Extender
- NotificationCompat.Extender
- SharedElementCallback.OnSharedElementsReadyListener
- TaskStackBuilder.SupportParentable
 
- Classes- ActionBarDrawerToggle
- ActivityCompat
- ActivityManagerCompat
- ActivityOptionsCompat
- AlarmManagerCompat
- AppLaunchChecker
- AppOpsManagerCompat
- BundleCompat
- DialogFragment
- Fragment
- Fragment.SavedState
- FragmentActivity
- FragmentContainer
- FragmentController
- FragmentHostCallback
- FragmentManager
- FragmentManager.FragmentLifecycleCallbacks
- FragmentManagerNonConfig
- FragmentPagerAdapter
- FragmentStatePagerAdapter
- FragmentTabHost
- FragmentTransaction
- FrameMetricsAggregator
- JobIntentService
- ListFragment
- LoaderManager
- NavUtils
- NotificationCompat
- NotificationCompat.Action
- NotificationCompat.Action.Builder
- NotificationCompat.Action.WearableExtender
- NotificationCompat.BigPictureStyle
- NotificationCompat.BigTextStyle
- NotificationCompat.Builder
- NotificationCompat.CarExtender
- NotificationCompat.CarExtender.UnreadConversation
- NotificationCompat.CarExtender.UnreadConversation.Builder
- NotificationCompat.DecoratedCustomViewStyle
- NotificationCompat.InboxStyle
- NotificationCompat.MessagingStyle
- NotificationCompat.MessagingStyle.Message
- NotificationCompat.Style
- NotificationCompat.WearableExtender
- NotificationCompatExtras
- NotificationCompatSideChannelService
- NotificationManagerCompat
- RemoteInput
- RemoteInput.Builder
- ServiceCompat
- ShareCompat
- ShareCompat.IntentBuilder
- ShareCompat.IntentReader
- SharedElementCallback
- TaskStackBuilder
 
- Exceptions
