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

Commit f61f7755 authored by Riddle Hsu's avatar Riddle Hsu Committed by Automerger Merge Worker
Browse files

Merge "Fix death recipient leakage of WindowTokenClient" into tm-dev am: 6cc80430 am: 816d5773

parents fcc84bca 816d5773
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -116,6 +116,9 @@ class WindowContextListenerController {
            return;
            return;
        }
        }
        listener.unregister();
        listener.unregister();
        if (listener.mDeathRecipient != null) {
            listener.mDeathRecipient.unlinkToDeath();
        }
    }
    }


    void dispatchPendingConfigurationIfNeeded(int displayId) {
    void dispatchPendingConfigurationIfNeeded(int displayId) {
+6 −1
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.view.WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG;
import static android.window.WindowProvider.KEY_IS_WINDOW_PROVIDER_SERVICE;
import static android.window.WindowProvider.KEY_IS_WINDOW_PROVIDER_SERVICE;


import static com.android.dx.mockito.inline.extended.ExtendedMockito.mock;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;
import static com.android.dx.mockito.inline.extended.ExtendedMockito.spyOn;


import static com.google.common.truth.Truth.assertThat;
import static com.google.common.truth.Truth.assertThat;
@@ -86,7 +87,7 @@ public class WindowContextListenerControllerTests extends WindowTestsBase {


        assertEquals(1, mController.mListeners.size());
        assertEquals(1, mController.mListeners.size());


        final IBinder clientToken = new Binder();
        final IBinder clientToken = mock(IBinder.class);
        mController.registerWindowContainerListener(clientToken, mContainer, -1,
        mController.registerWindowContainerListener(clientToken, mContainer, -1,
                TYPE_APPLICATION_OVERLAY, null /* options */);
                TYPE_APPLICATION_OVERLAY, null /* options */);


@@ -103,6 +104,10 @@ public class WindowContextListenerControllerTests extends WindowTestsBase {
        WindowContextListenerController.WindowContextListenerImpl listener =
        WindowContextListenerController.WindowContextListenerImpl listener =
                mController.mListeners.get(mClientToken);
                mController.mListeners.get(mClientToken);
        assertEquals(container, listener.getWindowContainer());
        assertEquals(container, listener.getWindowContainer());

        mController.unregisterWindowContainerListener(clientToken);
        assertFalse(mController.mListeners.containsKey(clientToken));
        verify(clientToken).unlinkToDeath(any(), anyInt());
    }
    }


    @UseTestDisplay
    @UseTestDisplay