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

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

Merge "Revert "Log an App Op when an accessibility action is performed.""

parents 418875d9 e8fb83fd
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -260,10 +260,8 @@ public class AppOpsManager {
    public static final int OP_REQUEST_DELETE_PACKAGES = 72;
    /** @hide Bind an accessibility service. */
    public static final int OP_BIND_ACCESSIBILITY_SERVICE = 73;
    /** @hide Interact with the system UI via an Accessibility Service */
    public static final int OP_PERFORM_ACCESSIBILITY_ACTION = 74;
    /** @hide */
    public static final int _NUM_OP = 75;
    public static final int _NUM_OP = 74;

    /** Access to coarse location information. */
    public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
@@ -508,7 +506,6 @@ public class AppOpsManager {
            OP_CHANGE_WIFI_STATE,
            OP_REQUEST_DELETE_PACKAGES,
            OP_BIND_ACCESSIBILITY_SERVICE,
            OP_PERFORM_ACCESSIBILITY_ACTION,
    };

    /**
@@ -590,7 +587,6 @@ public class AppOpsManager {
            null, // OP_CHANGE_WIFI_STATE
            null, // OP_REQUEST_DELETE_PACKAGES
            null, // OP_BIND_ACCESSIBILITY_SERVICE
            null, // OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
@@ -672,7 +668,6 @@ public class AppOpsManager {
            "CHANGE_WIFI_STATE",
            "REQUEST_DELETE_PACKAGES",
            "BIND_ACCESSIBILITY_SERVICE",
            "OP_PERFORM_ACCESSIBILITY_ACTION",
    };

    /**
@@ -754,7 +749,6 @@ public class AppOpsManager {
            Manifest.permission.CHANGE_WIFI_STATE,
            Manifest.permission.REQUEST_DELETE_PACKAGES,
            Manifest.permission.BIND_ACCESSIBILITY_SERVICE,
            null, // no permission for OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
@@ -837,7 +831,6 @@ public class AppOpsManager {
            null, // OP_CHANGE_WIFI_STATE
            null, // REQUEST_DELETE_PACKAGES
            null, // OP_BIND_ACCESSIBILITY_SERVICE
            null, // OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
@@ -919,7 +912,6 @@ public class AppOpsManager {
            false, // OP_CHANGE_WIFI_STATE
            false, // OP_REQUEST_DELETE_PACKAGES
            false, // OP_BIND_ACCESSIBILITY_SERVICE
            false, // OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
@@ -1000,7 +992,6 @@ public class AppOpsManager {
            AppOpsManager.MODE_ALLOWED,  // OP_CHANGE_WIFI_STATE
            AppOpsManager.MODE_ALLOWED,  // REQUEST_DELETE_PACKAGES
            AppOpsManager.MODE_ALLOWED,  // OP_BIND_ACCESSIBILITY_SERVICE
            AppOpsManager.MODE_ALLOWED,  // OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
@@ -1085,7 +1076,6 @@ public class AppOpsManager {
            false, // OP_CHANGE_WIFI_STATE
            false, // OP_REQUEST_DELETE_PACKAGES
            false, // OP_BIND_ACCESSIBILITY_SERVICE
            false, // OP_PERFORM_ACCESSIBILITY_ACTION
    };

    /**
+0 −24
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@ import android.accessibilityservice.IAccessibilityServiceClient;
import android.accessibilityservice.IAccessibilityServiceConnection;
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.AppOpsManager;
import android.app.PendingIntent;
import android.content.ComponentName;
import android.content.Context;
@@ -40,9 +39,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.Looper;
import android.os.Message;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
import android.util.Slog;
import android.util.SparseArray;
import android.view.KeyEvent;
@@ -96,7 +93,6 @@ abstract class AccessibilityClientConnection extends IAccessibilityServiceConnec
    protected final Object mLock;

    protected final SecurityPolicy mSecurityPolicy;
    private final AppOpsManager mAppOpsManager;

    // The service that's bound to this instance. Whenever this value is non-null, this
    // object is registered as a death recipient
@@ -254,7 +250,6 @@ abstract class AccessibilityClientConnection extends IAccessibilityServiceConnec
        mAccessibilityServiceInfo = accessibilityServiceInfo;
        mLock = lock;
        mSecurityPolicy = securityPolicy;
        mAppOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
        mGlobalActionPerformer = globalActionPerfomer;
        mSystemSupport = systemSupport;
        mInvocationHandler = new InvocationHandler(mainHandler.getLooper());
@@ -711,16 +706,6 @@ abstract class AccessibilityClientConnection extends IAccessibilityServiceConnec
            long accessibilityNodeId, int action, Bundle arguments, int interactionId,
            IAccessibilityInteractionConnectionCallback callback, long interrogatingTid)
            throws RemoteException {

        // Skip this if the caller is the Accessibility InteractionBridge.
        if (UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID) {
            if (mAppOpsManager.noteOp(AppOpsManager.OP_PERFORM_ACCESSIBILITY_ACTION,
                    Binder.getCallingUid(), mComponentName.getPackageName())
                    != AppOpsManager.MODE_ALLOWED) {
                return false;
            }
        }

        final int resolvedWindowId;
        IAccessibilityInteractionConnection connection = null;
        synchronized (mLock) {
@@ -740,15 +725,6 @@ abstract class AccessibilityClientConnection extends IAccessibilityServiceConnec

    @Override
    public boolean performGlobalAction(int action) {
        // Skip this if the caller is the Accessibility InteractionBridge.
        if (UserHandle.getAppId(Binder.getCallingUid()) != Process.SYSTEM_UID) {
            if (mAppOpsManager.noteOp(AppOpsManager.OP_PERFORM_ACCESSIBILITY_ACTION,
                    Binder.getCallingUid(), mComponentName.getPackageName())
                    != AppOpsManager.MODE_ALLOWED) {
                return false;
            }
        }

        synchronized (mLock) {
            if (!isCalledForCurrentUserLocked()) {
                return false;