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

Commit 36647777 authored by Priyanka Advani (xWF)'s avatar Priyanka Advani (xWF) Committed by Android (Google) Code Review
Browse files

Revert "Ensure dispose is always called on looper thread"

This reverts commit 09a82bae.

Reason for revert: Droidmonitor created revert due to b/410560459. Will be verifying through ABTD before submission.

Bug: 376713684
Change-Id: Ic024754a05d4520d412d316896f2e5250c0f8dfc
parent 09a82bae
Loading
Loading
Loading
Loading
+4 −7
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ public abstract class InputEventReceiver {
    // We keep references to the input channel and message queue objects here so that
    // they are not GC'd while the native peer of the receiver is using them.
    private InputChannel mInputChannel;
    private Looper mLooper;
    private MessageQueue mMessageQueue;

    // Map from InputEvent sequence numbers to dispatcher sequence numbers.
    private final SparseIntArray mSeqMap = new SparseIntArray();
@@ -76,9 +76,9 @@ public abstract class InputEventReceiver {
        }

        mInputChannel = inputChannel;
        mLooper = looper;
        mMessageQueue = looper.getQueue();
        mReceiverPtr = nativeInit(new WeakReference<InputEventReceiver>(this),
                mInputChannel, mLooper.getQueue());
                mInputChannel, mMessageQueue);

        mCloseGuard.open("InputEventReceiver.dispose");
    }
@@ -108,9 +108,6 @@ public abstract class InputEventReceiver {
     * Must be called on the same Looper thread to which the receiver is attached.
     */
    public void dispose() {
        if (Thread.currentThread() != mLooper.getThread()) {
            throw new IllegalStateException("Must call dispose() on the Looper thread");
        }
        dispose(false);
    }

@@ -131,7 +128,7 @@ public abstract class InputEventReceiver {
            mInputChannel.dispose();
            mInputChannel = null;
        }
        mLooper = null;
        mMessageQueue = null;
        Reference.reachabilityFence(this);
    }

+1 −0
Original line number Diff line number Diff line
@@ -155,6 +155,7 @@ class InputEventSenderAndReceiverTest {
        sender.assertReceivedFinishedSignal(seq, handled = true)

        // Clean up
        crashingReceiver.dispose()
        sender.dispose()
        receiverThread.quitSafely()
    }