Java Code Examples for android.app.AppOpsManager#OP_NONE

The following examples show how to use android.app.AppOpsManager#OP_NONE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private int enforceReadPermission(String callingPkg, Uri uri, IBinder callerToken)
        throws SecurityException {
    final int mode = enforceReadPermissionInner(uri, callingPkg, callerToken);
    if (mode != MODE_ALLOWED) {
        return mode;
    }

    if (mReadOp != AppOpsManager.OP_NONE) {
        return mAppOpsManager.noteProxyOp(mReadOp, callingPkg);
    }

    return AppOpsManager.MODE_ALLOWED;
}
 
Example 2
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
private int enforceWritePermission(String callingPkg, Uri uri, IBinder callerToken)
        throws SecurityException {
    final int mode = enforceWritePermissionInner(uri, callingPkg, callerToken);
    if (mode != MODE_ALLOWED) {
        return mode;
    }

    if (mWriteOp != AppOpsManager.OP_NONE) {
        return mAppOpsManager.noteProxyOp(mWriteOp, callingPkg);
    }

    return AppOpsManager.MODE_ALLOWED;
}
 
Example 3
Source File: ContentProvider.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
/**
 * Verify that calling app holds both the given permission and any app-op
 * associated with that permission.
 */
private int checkPermissionAndAppOp(String permission, String callingPkg,
        IBinder callerToken) {
    if (getContext().checkPermission(permission, Binder.getCallingPid(), Binder.getCallingUid(),
            callerToken) != PERMISSION_GRANTED) {
        return MODE_ERRORED;
    }

    final int permOp = AppOpsManager.permissionToOpCode(permission);
    if (permOp != AppOpsManager.OP_NONE) {
        return mTransport.mAppOpsManager.noteProxyOp(permOp, callingPkg);
    }

    return MODE_ALLOWED;
}
 
Example 4
Source File: AppOpsService.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
@Override
public int permissionToOpCode(String permission) {
    if (permission == null) {
        return AppOpsManager.OP_NONE;
    }
    return AppOpsManager.permissionToOpCode(permission);
}
 
Example 5
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private int enforceReadPermission(String callingPkg, Uri uri, IBinder callerToken)
        throws SecurityException {
    final int mode = enforceReadPermissionInner(uri, callingPkg, callerToken);
    if (mode != MODE_ALLOWED) {
        return mode;
    }

    if (mReadOp != AppOpsManager.OP_NONE) {
        return mAppOpsManager.noteProxyOp(mReadOp, callingPkg);
    }

    return AppOpsManager.MODE_ALLOWED;
}
 
Example 6
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private int enforceWritePermission(String callingPkg, Uri uri, IBinder callerToken)
        throws SecurityException {
    final int mode = enforceWritePermissionInner(uri, callingPkg, callerToken);
    if (mode != MODE_ALLOWED) {
        return mode;
    }

    if (mWriteOp != AppOpsManager.OP_NONE) {
        return mAppOpsManager.noteProxyOp(mWriteOp, callingPkg);
    }

    return AppOpsManager.MODE_ALLOWED;
}
 
Example 7
Source File: ContentProvider.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
/**
 * Verify that calling app holds both the given permission and any app-op
 * associated with that permission.
 */
private int checkPermissionAndAppOp(String permission, String callingPkg,
        IBinder callerToken) {
    if (getContext().checkPermission(permission, Binder.getCallingPid(), Binder.getCallingUid(),
            callerToken) != PERMISSION_GRANTED) {
        return MODE_ERRORED;
    }

    final int permOp = AppOpsManager.permissionToOpCode(permission);
    if (permOp != AppOpsManager.OP_NONE) {
        return mTransport.mAppOpsManager.noteProxyOp(permOp, callingPkg);
    }

    return MODE_ALLOWED;
}