Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fce7ec97 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Log a string to logcat when ContentProvider access gets denied due to appop"

parents 12df9d61 b22f71ea
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.os.UserHandle;
import android.os.storage.StorageManager;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;

import com.android.internal.annotations.VisibleForTesting;

@@ -586,7 +587,13 @@ public abstract class ContentProvider implements ComponentCallbacks2 {
        private int noteProxyOp(String callingPkg, int op) {
            if (op != AppOpsManager.OP_NONE) {
                int mode = mAppOpsManager.noteProxyOp(op, callingPkg);
                return mode == MODE_DEFAULT ? interpretDefaultAppOpMode(op) : mode;
                int nonDefaultMode = mode == MODE_DEFAULT ? interpretDefaultAppOpMode(op) : mode;
                if (mode == MODE_DEFAULT && nonDefaultMode == MODE_IGNORED) {
                    Slog.w(TAG, "Denying access for " + callingPkg + " to " + getClass().getName()
                            + " (" + AppOpsManager.opToName(op)
                            + " = " + AppOpsManager.opToName(mode) + ")");
                }
                return mode == MODE_DEFAULT ? nonDefaultMode : mode;
            }

            return AppOpsManager.MODE_ALLOWED;