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

Commit 857ae4dd authored by Prabir Pradhan's avatar Prabir Pradhan Committed by Automerger Merge Worker
Browse files

Merge "InputManagerService: Do not remove input channel when disposing...

Merge "InputManagerService: Do not remove input channel when disposing monitor" into sc-dev am: 2f13cca5 am: f80d266a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15405649

Change-Id: I4730a64fd93a8245d8db6f1f28bfd6da6f428355
parents 71c185e7 f80d266a
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -3228,7 +3228,7 @@ public class InputManagerService extends IInputManager.Stub
     * Interface for the system to handle request from InputMonitors.
     */
    private final class InputMonitorHost extends IInputMonitorHost.Stub {
        private final IBinder mToken;
        private IBinder mToken;

        InputMonitorHost(IBinder token) {
            mToken = token;
@@ -3236,12 +3236,23 @@ public class InputManagerService extends IInputManager.Stub

        @Override
        public void pilferPointers() {
            if (mToken == null) {
                throw new IllegalStateException(
                        "Illegal call to pilferPointers after InputMonitorHost is disposed.");
            }
            nativePilferPointers(mPtr, mToken);
        }

        @Override
        public void dispose() {
            nativeRemoveInputChannel(mPtr, mToken);
            // We do not remove the input monitor here by calling nativeRemoveInputChannel because
            // it causes a race in InputDispatcher between the removal of the InputChannel through
            // that call and the InputChannel#dispose call (which causes an FD hangup) from the
            // client (b/189135695).
            //
            // NOTE: This means the client is responsible for properly closing the InputMonitor by
            // disposing the InputChannel and all its duplicates.
            mToken = null;
        }
    }