public static int noteOp(@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 Api19Impl.noteOp(appOpsManager, op, uid, packageName);
        } else {
            return MODE_IGNORED;
        }
    }
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 {@link #MODE_IGNORED}.  If this call
succeeds, the last execution time of the operation for this app will be updated to
the current time.
<p>
<strong>Compatibility</strong>
<ul>
<li>On API 18 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 uid         The user id of the application attempting to perform the operation.
@param packageName The name of the application attempting to perform the operation.
@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.
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/compat/AppOpsManagerCompat.java