Unregister AbsSwipeUpHandler's ContextInitListener on launcher destroy
- Unregister the init listener on launcher destroy to unblock the home button - This also exposes a crash in AbsSwipeUpHandler.onRecentsAnimation start since the home bounds aren't available. So, also adding handling to reload the launcher on night mode change Flag: EXEMPT bug fix Fixes: 384423890 Fixes: 416536400 Test: changed dark theme then swiped/pressed home and overview buttons. Change-Id: Ic26192e8d0e4e6b226fb9af6dba596aa78a09e96
This commit is contained in:
committed by
Schneider Victor-tulias
parent
f21e4b8023
commit
8f88cb272d
+29
-1
@@ -18,13 +18,16 @@ package com.android.quickstep;
|
||||
|
||||
import static android.view.Display.DEFAULT_DISPLAY;
|
||||
|
||||
import static com.android.launcher3.BaseActivity.EVENT_DESTROYED;
|
||||
import static com.android.launcher3.statehandlers.DesktopVisibilityController.INACTIVE_DESK_ID;
|
||||
import static com.android.quickstep.AbsSwipeUpHandler.STATE_HANDLER_INVALIDATED;
|
||||
import static com.android.wm.shell.shared.ShellSharedConstants.KEY_EXTRA_SHELL_CAN_HAND_OFF_ANIMATION;
|
||||
import static com.android.wm.shell.shared.split.SplitBounds.KEY_EXTRA_SPLIT_BOUNDS;
|
||||
import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_2_50_50;
|
||||
|
||||
import static junit.framework.Assert.assertNotNull;
|
||||
import static junit.framework.TestCase.assertFalse;
|
||||
import static junit.framework.TestCase.assertNull;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
@@ -199,7 +202,7 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
|
||||
@Before
|
||||
public void setUpRecentsContainer() {
|
||||
mTaskAnimationManager = new TaskAnimationManager(mContext, DEFAULT_DISPLAY);
|
||||
mTaskAnimationManager = spy(new TaskAnimationManager(mContext, DEFAULT_DISPLAY));
|
||||
RECENTS_CONTAINER recentsContainer = getRecentsContainer();
|
||||
RECENTS_VIEW recentsView = getRecentsView();
|
||||
|
||||
@@ -340,6 +343,31 @@ public abstract class AbsSwipeUpHandlerTestCase<
|
||||
verifyNoMoreInteractions(mMSDLPlayerWrapper);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOnContainerDestroy_cleansUpSwipeHandler() {
|
||||
SWIPE_HANDLER swipeHandler = createSwipeHandler();
|
||||
|
||||
swipeHandler.onActivityInit(true);
|
||||
|
||||
RECENTS_CONTAINER container = getRecentsContainer();
|
||||
ArgumentCaptor<Runnable> onContainerDestroyCallbackCaptor =
|
||||
ArgumentCaptor.forClass(Runnable.class);
|
||||
|
||||
verify(container)
|
||||
.addEventCallback(eq(EVENT_DESTROYED), onContainerDestroyCallbackCaptor.capture());
|
||||
|
||||
assertNotNull(swipeHandler.mRecentsView);
|
||||
assertNotNull(swipeHandler.mContainer);
|
||||
|
||||
onContainerDestroyCallbackCaptor.getValue().run();
|
||||
|
||||
assertNull(swipeHandler.mRecentsView);
|
||||
assertNull(swipeHandler.mContainer);
|
||||
verify(mTaskAnimationManager).onLauncherDestroyed();
|
||||
runOnMainSync(() -> verify(mContextInitListener)
|
||||
.unregister(eq("AbsSwipeUpHandler.mLauncherOnDestroyCallback")));
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies that RecentsAnimationController#finish() is called, and captures and runs any
|
||||
* callback that was passed to it. This ensures that STATE_CURRENT_TASK_FINISHED is correctly
|
||||
|
||||
Reference in New Issue
Block a user