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

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

Ensure app is still touchable until the recents gesture has started

- When the recents animation starts, we start consuming touches from the
  app using the registered input consumer. As a result, we should only mark
  the window as able to receive touches until this is the case, otherwise
  a single tap in the gesture area (which starts the recents animation)
  would immediately mark the window as not-touchable.
- Fix regression where RecentsAnimationController.isAnimatingApp() returned
  early instead of going through all the tasks

Test: atest WindowInsetsBehaviorTests
Test: atest WindowStateTests
Test: Verify that b/138622418 is still fixed, swipe up and immediately
      swipe from edges (expect no back feedback)

Change-Id: Id82f2786451c9b44859b80dc0beff6eb5a55b331
parent 665896e3
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -754,8 +754,7 @@ public class RecentsAnimationController implements DeathRecipient {
        // Only apply the input consumer if it is enabled, it is not the target (home/recents)
        // being revealed with the transition, and we are actively animating the app as a part of
        // the animation
        return mInputConsumerEnabled && mTargetActivityRecord != activity
                && isAnimatingApp(activity);
        return mInputConsumerEnabled && !isTargetApp(activity) && isAnimatingApp(activity);
    }

    boolean updateInputConsumerForApp(InputWindowHandle inputWindowHandle,
@@ -810,7 +809,9 @@ public class RecentsAnimationController implements DeathRecipient {
                    PooledLambda.__(ActivityRecord.class));
            boolean isAnimatingApp = task.forAllActivities(f);
            f.recycle();
            return isAnimatingApp;
            if (isAnimatingApp) {
                return true;
            }
        }
        return false;
    }
+5 −5
Original line number Diff line number Diff line
@@ -2691,18 +2691,18 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP

        return mActivityRecord.getTask().getTaskStack().shouldIgnoreInput()
                || !mActivityRecord.mVisibleRequested
                || isAnimatingToRecents();
                || isRecentsAnimationConsumingAppInput();
    }

    /**
     * Returns {@code true} if the window is animating to home as part of the recents animation.
     * Returns {@code true} if the window is animating to home as part of the recents animation and
     * it is consuming input from the app.
     */
    private boolean isAnimatingToRecents() {
    private boolean isRecentsAnimationConsumingAppInput() {
        final RecentsAnimationController recentsAnimationController =
                mWmService.getRecentsAnimationController();
        return recentsAnimationController != null
                && recentsAnimationController.isAnimatingTask(getTask())
                && !recentsAnimationController.isTargetApp(mActivityRecord);
                && recentsAnimationController.shouldApplyInputConsumer(mActivityRecord);
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -596,7 +596,7 @@ public class WindowStateTests extends WindowTestsBase {

        // Mock active recents animation
        RecentsAnimationController recentsController = mock(RecentsAnimationController.class);
        when(recentsController.isAnimatingTask(win0.mActivityRecord.getTask())).thenReturn(true);
        when(recentsController.shouldApplyInputConsumer(win0.mActivityRecord)).thenReturn(true);
        mWm.setRecentsAnimationController(recentsController);
        assertTrue(win0.cantReceiveTouchInput());
    }