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

Commit 4ae95e5a authored by Fyodor Kupolov's avatar Fyodor Kupolov Committed by Android (Google) Code Review
Browse files

Merge "Explicitly pass userId to getWindowToken"

parents f9bf6da6 e2239c93
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ import android.os.ParcelFileDescriptor;
import android.os.Process;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.UserHandle;
import android.view.IWindowManager;
import android.view.InputEvent;
import android.view.SurfaceControl;
@@ -167,9 +168,10 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
            throwIfShutdownLocked();
            throwIfNotConnectedLocked();
        }
        int callingUserId = UserHandle.getCallingUserId();
        final long identity = Binder.clearCallingIdentity();
        try {
            IBinder token = mAccessibilityManager.getWindowToken(windowId);
            IBinder token = mAccessibilityManager.getWindowToken(windowId, callingUserId);
            if (token == null) {
                return false;
            }
@@ -186,9 +188,10 @@ public final class UiAutomationConnection extends IUiAutomationConnection.Stub {
            throwIfShutdownLocked();
            throwIfNotConnectedLocked();
        }
        int callingUserId = UserHandle.getCallingUserId();
        final long identity = Binder.clearCallingIdentity();
        try {
            IBinder token = mAccessibilityManager.getWindowToken(windowId);
            IBinder token = mAccessibilityManager.getWindowToken(windowId, callingUserId);
            if (token == null) {
                return null;
            }
+1 −1
Original line number Diff line number Diff line
@@ -58,5 +58,5 @@ interface IAccessibilityManager {
    void temporaryEnableAccessibilityStateUntilKeyguardRemoved(in ComponentName service,
            boolean touchExplorationEnabled);

    IBinder getWindowToken(int windowId);
    IBinder getWindowToken(int windowId, int userId);
}
+2 −3
Original line number Diff line number Diff line
@@ -715,7 +715,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
    }

    @Override
    public IBinder getWindowToken(int windowId) {
    public IBinder getWindowToken(int windowId, int userId) {
        mSecurityPolicy.enforceCallingPermission(
                Manifest.permission.RETRIEVE_WINDOW_TOKEN,
                GET_WINDOW_TOKEN);
@@ -724,8 +724,7 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub {
            // share the accessibility state of the parent. The call below
            // performs the current profile parent resolution.
            final int resolvedUserId = mSecurityPolicy
                    .resolveCallingUserIdEnforcingPermissionsLocked(
                            UserHandle.getCallingUserId());
                    .resolveCallingUserIdEnforcingPermissionsLocked(userId);
            if (resolvedUserId != mCurrentUserId) {
                return null;
            }