From 64785d2b06d4c4ee38cb29a68d558636538dc684 Mon Sep 17 00:00:00 2001 From: Siarhei Vishniakou Date: Tue, 15 Dec 2020 07:18:49 +0000 Subject: [PATCH] Clean up gesture monitor pid collection We no longer need to store the pids of gesture monitors, because the dispatcher will tell us explicitly about the pids that are unresponsive or responsive. Bug: 175593831 Test: atest inputflinger_tests Change-Id: Ie191d79ed4f82c3f3d328c3be560d1fed11cbeef --- .../server/input/InputManagerService.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/services/core/java/com/android/server/input/InputManagerService.java b/services/core/java/com/android/server/input/InputManagerService.java index 23e6f736e4001..0535352c12baa 100644 --- a/services/core/java/com/android/server/input/InputManagerService.java +++ b/services/core/java/com/android/server/input/InputManagerService.java @@ -217,10 +217,6 @@ public class InputManagerService extends IInputManager.Stub IInputFilter mInputFilter; // guarded by mInputFilterLock InputFilterHost mInputFilterHost; // guarded by mInputFilterLock - private final Object mGestureMonitorPidsLock = new Object(); - @GuardedBy("mGestureMonitorPidsLock") - private final ArrayMap mGestureMonitorPidsByToken = new ArrayMap<>(); - // The associations of input devices to displays by port. Maps from input device port (String) // to display id (int). Currently only accessed by InputReader. private final Map mStaticAssociations; @@ -616,9 +612,6 @@ public class InputManagerService extends IInputManager.Stub InputChannel inputChannel = nativeCreateInputMonitor( mPtr, displayId, true /*isGestureMonitor*/, inputChannelName, pid); InputMonitorHost host = new InputMonitorHost(inputChannel.getToken()); - synchronized (mGestureMonitorPidsLock) { - mGestureMonitorPidsByToken.put(inputChannel.getToken(), pid); - } return new InputMonitor(inputChannel, host); } finally { Binder.restoreCallingIdentity(ident); @@ -642,9 +635,6 @@ public class InputManagerService extends IInputManager.Stub if (connectionToken == null) { throw new IllegalArgumentException("connectionToken must not be null."); } - synchronized (mGestureMonitorPidsLock) { - mGestureMonitorPidsByToken.remove(connectionToken); - } nativeRemoveInputChannel(mPtr, connectionToken); } @@ -2052,7 +2042,6 @@ public class InputManagerService extends IInputManager.Stub if (dumpStr != null) { pw.println(dumpStr); dumpAssociations(pw); - dumpGestureMonitorPidsByToken(pw); } } @@ -2076,19 +2065,6 @@ public class InputManagerService extends IInputManager.Stub } } - private void dumpGestureMonitorPidsByToken(PrintWriter pw) { - synchronized (mGestureMonitorPidsLock) { - if (!mGestureMonitorPidsByToken.isEmpty()) { - pw.println("Gesture monitor pids by token:"); - for (int i = 0; i < mGestureMonitorPidsByToken.size(); i++) { - pw.print(" " + i + ": "); - pw.print(" token: " + mGestureMonitorPidsByToken.keyAt(i)); - pw.println(" pid: " + mGestureMonitorPidsByToken.valueAt(i)); - } - } - } - } - private boolean checkCallingPermission(String permission, String func) { // Quick check: if the calling permission is me, it's all okay. if (Binder.getCallingPid() == Process.myPid()) { @@ -2111,7 +2087,6 @@ public class InputManagerService extends IInputManager.Stub public void monitor() { synchronized (mInputFilterLock) { } synchronized (mAssociationsLock) { /* Test if blocked by associations lock. */} - synchronized (mGestureMonitorPidsLock) { /* Test if blocked by gesture monitor pids lock */} synchronized (mLidSwitchLock) { /* Test if blocked by lid switch lock. */ } nativeMonitor(mPtr); } @@ -2181,9 +2156,6 @@ public class InputManagerService extends IInputManager.Stub // Native callback. private void notifyInputChannelBroken(IBinder token) { - synchronized (mGestureMonitorPidsLock) { - mGestureMonitorPidsByToken.remove(token); - } mWindowManagerCallbacks.notifyInputChannelBroken(token); }