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

Commit e963b4c5 authored by Winson Chung's avatar Winson Chung
Browse files

Remove the input consumer surfaces when the consumer is disposed

- When disposing the input consumer we were just hiding it, while a new
  one was created everytime the IC is requested, resulting a leak of
  input surfaces for these consumers

Bug: 153081070
Test: Enter pip several times, ensure there is only one pip input
          surface
Change-Id: I0161a36f3c4eb675dab9a72a896801c837d75852
parent 6f9b5cc3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -153,10 +153,11 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
        t.reparent(mInputSurface, wc.getSurfaceControl());
    }

    void disposeChannelsLw() {
    void disposeChannelsLw(SurfaceControl.Transaction t) {
        mService.mInputManager.unregisterInputChannel(mServerChannel);
        mClientChannel.dispose();
        mServerChannel.dispose();
        t.remove(mInputSurface);
        unlinkFromDeathRecipient();
    }

+3 −3
Original line number Diff line number Diff line
@@ -112,8 +112,9 @@ final class InputMonitor {
        @Override
        public void dispose() {
            synchronized (mService.mGlobalLock) {
                disposeChannelsLw();
                disposeChannelsLw(mInputMonitor.mInputTransaction);
                mInputEventReceiver.dispose();
                mInputMonitor.updateInputWindowsLw(true /* force */);
            }
        }
    }
@@ -195,8 +196,7 @@ final class InputMonitor {

    private boolean disposeInputConsumer(InputConsumerImpl consumer) {
        if (consumer != null) {
            consumer.disposeChannelsLw();
            consumer.hide(mInputTransaction);
            consumer.disposeChannelsLw(mInputTransaction);
            return true;
        }
        return false;