Prevent animating app from setting exclusion rects
Back gesture still shows if user attempts to swipe back while we're animating an app away to home screen. Full screen exclusion rects for launcher are only granted after the animation has completed, but the user was able to interact w/ ongoing animations to see the back arrow. fixes: 138622418 Test: Open app, swipe home and quickly swipe from the edge of the screen. Should go to -1 screen and not see back arrow. Change-Id: I18603159fbb6b76e0fdb7911cbe7a6e2386c9f87
This commit is contained in:
@@ -2622,8 +2622,24 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
|
||||
/** @return false if this window desires touch events. */
|
||||
boolean cantReceiveTouchInput() {
|
||||
return mAppToken != null && mAppToken.getTask() != null
|
||||
&& (mAppToken.getTask().mStack.shouldIgnoreInput() || mAppToken.hiddenRequested);
|
||||
if (mAppToken == null || mAppToken.getTask() == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return mAppToken.getTask().mStack.shouldIgnoreInput()
|
||||
|| mAppToken.hiddenRequested
|
||||
|| isAnimatingToRecents();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns {@code true} if the window is animating to home as part of the recents animation.
|
||||
*/
|
||||
private boolean isAnimatingToRecents() {
|
||||
final RecentsAnimationController recentsAnimationController =
|
||||
mWmService.getRecentsAnimationController();
|
||||
return recentsAnimationController != null
|
||||
&& recentsAnimationController.isAnimatingTask(getTask())
|
||||
&& !recentsAnimationController.isTargetApp(mAppToken);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -57,6 +57,7 @@ import static org.mockito.ArgumentMatchers.anyInt;
|
||||
import static org.mockito.ArgumentMatchers.anyLong;
|
||||
import static org.mockito.ArgumentMatchers.anyString;
|
||||
import static org.mockito.ArgumentMatchers.eq;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import android.graphics.Insets;
|
||||
import android.graphics.Matrix;
|
||||
@@ -547,4 +548,29 @@ public class WindowStateTests extends WindowTestsBase {
|
||||
assertEquals(OFFSET_SUM, values[Matrix.MTRANS_X], 0f);
|
||||
assertEquals(0f, values[Matrix.MTRANS_Y], 0f);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantReceiveTouchDuringRecentsAnimation() {
|
||||
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");
|
||||
|
||||
// Mock active recents animation
|
||||
RecentsAnimationController recentsController = mock(RecentsAnimationController.class);
|
||||
when(recentsController.isAnimatingTask(win0.mAppToken.getTask())).thenReturn(true);
|
||||
mWm.setRecentsAnimationController(recentsController);
|
||||
assertTrue(win0.cantReceiveTouchInput());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantReceiveTouchWhenAppTokenHiddenRequested() {
|
||||
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");
|
||||
win0.mAppToken.hiddenRequested = true;
|
||||
assertTrue(win0.cantReceiveTouchInput());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCantReceiveTouchWhenShouldIgnoreInput() {
|
||||
final WindowState win0 = createWindow(null, TYPE_APPLICATION, "win0");
|
||||
win0.mAppToken.getStack().setAdjustedForMinimizedDock(1 /* Any non 0 value works */);
|
||||
assertTrue(win0.cantReceiveTouchInput());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user