added in version 24.1.0
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_ALLOWED

Result from noteOp(Context, String, int, String): the given caller is allowed to perform the given operation.

int MODE_DEFAULT

Result from noteOp(Context, String, int, String): the given caller should use its default security check.

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.

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).

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 noteOp(Context, String, int, String) but instead of throwing a SecurityException it returns MODE_ERRORED.

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 noteProxyOp(Context, String, String) but instead of throwing a SecurityException it returns MODE_ERRORED.

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

added in version 24.1.0
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

added in version 24.1.0
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)