compat/src/main/java/androidx/core/app/AppOpsManagerCompat.java
public static int noteOpNoThrow(@NonNull Context context, @NonNull String op, int uid,
            @NonNull String packageName) {
        if (SDK_INT >= 19) {
            AppOpsManager appOpsManager =
                    (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
            return appOpsManager.noteOpNoThrow(op, uid, packageName);
        } else {
            return MODE_IGNORED;
        }
    }
/**
     * Like {@link #noteOp} but instead of throwing a {@link SecurityException} it
     * returns {@link #MODE_ERRORED}.
     * <p>
     * <strong>Compatibility</strong>
     * <ul>
     * <li>On API 18 and lower, this method always returns {@link #MODE_IGNORED}
     * </ul>
     */
Like  #noteOp but instead of throwing a  SecurityException it
returns  #MODE_ERRORED.

Compatibility

On API 18 and lower, this method always returns  #MODE_IGNORED

Like #noteOp but instead of throwing a SecurityException it returns #MODE_ERRORED . Compatibility On API 18 and lower this method always returns #MODE_IGNORED
public static int noteOpNoThrow(@NonNull Context context, @NonNull String op, int uid,
            @NonNull String packageName) {
        if (SDK_INT >= 19) {
            AppOpsManager appOpsManager =
                    (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
            return appOpsManager.noteOpNoThrow(op, uid, packageName);
        } else {
            return MODE_IGNORED;
        }
    }
public static int noteOpNoThrow ( @ NonNull Context context , @ NonNull String op , int uid , @ NonNull String packageName ) { if ( SDK_INT >= 19 ) { AppOpsManager appOpsManager = ( AppOpsManager ) context . getSystemService ( Context . APP_OPS_SERVICE ) ; return appOpsManager . noteOpNoThrow ( op , uid , packageName ) ; } else { return MODE_IGNORED ; } }
Like {@link #noteOp} but instead of throwing a {@link SecurityException} it
 returns {@link #MODE_ERRORED}.
Like { @link #noteOp } but instead of throwing a { @link SecurityException } it returns { @link #MODE_ERRORED } .