compat/src/main/java/androidx/core/app/AppOpsManagerCompat.java
public static int noteProxyOp(@NonNull Context context, @NonNull String op,
            @NonNull String proxiedPackageName) {
        if (SDK_INT >= 23) {
            AppOpsManager appOpsManager = context.getSystemService(AppOpsManager.class);
            return appOpsManager.noteProxyOp(op, proxiedPackageName);
        } else {
            return MODE_IGNORED;
        }
    }
/**
     * 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 {@link #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.
     * <p>
     * <strong>Compatibility</strong>
     * <ul>
     * <li>On API 22 and lower, this method always returns {@link #MODE_IGNORED}
     * </ul>
     * @param context Your context.
     * @param op The operation to note.  One of the OPSTR_* constants.
     * @param proxiedPackageName The name of the application calling into the proxy application.
     * @return Returns {@link #MODE_ALLOWED} if the operation is allowed, or
     * {@link #MODE_IGNORED} if 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.
     */
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

@param context Your context.
@param op The operation to note.  One of the OPSTR_* constants.
@param proxiedPackageName The name of the application calling into the proxy application.
@return Returns  #MODE_ALLOWED if the operation is allowed, or
#MODE_IGNORED if 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.
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 @param context Your context . @param op The operation to note . One of the OPSTR_ * constants . @param proxiedPackageName The name of the application calling into the proxy application . @return Returns #MODE_ALLOWED if the operation is allowed or #MODE_IGNORED if 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 .
public static int noteProxyOp(@NonNull Context context, @NonNull String op,
            @NonNull String proxiedPackageName) {
        if (SDK_INT >= 23) {
            AppOpsManager appOpsManager = context.getSystemService(AppOpsManager.class);
            return appOpsManager.noteProxyOp(op, proxiedPackageName);
        } else {
            return MODE_IGNORED;
        }
    }
public static int noteProxyOp ( @ NonNull Context context , @ NonNull String op , @ NonNull String proxiedPackageName ) { if ( SDK_INT >= 23 ) { AppOpsManager appOpsManager = context . getSystemService ( AppOpsManager . class ) ; return appOpsManager . noteProxyOp ( op , proxiedPackageName ) ; } else { return MODE_IGNORED ; } }
Make note of an application performing an operation on behalf of another
 application when handling an IPC.
Make note of an application performing an operation on behalf of another application when handling an IPC .