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

Commit 97cba26a authored by Alex Chau's avatar Alex Chau
Browse files

Wait for dismiss animation to finish before checking task count

- See http://b/193440212#comment5, TaskView takes time after swipe gesture to finish dismiss animation, so wait for the animation to finish before checking task count

Bug: 193440212
Test: TaplTestsQuickstep#testOverview
Change-Id: I21397e68f384e956a7c9f2ee8a8161ac784b4d2e
parent daf42897
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2599,6 +2599,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    }

    protected void onDismissAnimationEnds() {
        AccessibilityManagerCompat.sendDismissAnimationEndsEventToTest(getContext());
    }

    public PendingAnimation createAllTasksDismissAnimation(long duration) {
+8 −1
Original line number Diff line number Diff line
@@ -87,7 +87,14 @@ public class AccessibilityManagerCompat {
        if (accessibilityManager == null) return;

        sendEventToTest(accessibilityManager, context, TestProtocol.PAUSE_DETECTED_MESSAGE, null);
        Log.d(TestProtocol.HOME_TO_OVERVIEW_FLAKY, "sendPauseDetectedEventToTest");
    }

    public static void sendDismissAnimationEndsEventToTest(Context context) {
        final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
        if (accessibilityManager == null) return;

        sendEventToTest(accessibilityManager, context, TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE,
                null);
    }

    private static void sendEventToTest(
+1 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ public final class TestProtocol {
    public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
    public static final String SCROLL_FINISHED_MESSAGE = "TAPL_SCROLL_FINISHED";
    public static final String PAUSE_DETECTED_MESSAGE = "TAPL_PAUSE_DETECTED";
    public static final String DISMISS_ANIMATION_ENDS_MESSAGE = "TAPL_DISMISS_ANIMATION_ENDS";
    public static final int NORMAL_STATE_ORDINAL = 0;
    public static final int SPRING_LOADED_STATE_ORDINAL = 1;
    public static final int OVERVIEW_STATE_ORDINAL = 2;
@@ -111,5 +112,4 @@ public final class TestProtocol {
    public static final String PERMANENT_DIAG_TAG = "TaplTarget";
    public static final String WORK_PROFILE_REMOVED = "b/159671700";
    public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015";
    public static final String HOME_TO_OVERVIEW_FLAKY = "b/193440212";
}
+8 −3
Original line number Diff line number Diff line
@@ -59,9 +59,14 @@ public final class OverviewTask {
            final Rect taskBounds = mLauncher.getVisibleBounds(mTask);
            final int centerX = taskBounds.centerX();
            final int centerY = taskBounds.centerY();
            mLauncher.linearGesture(centerX, centerY, centerX, 0, 10, false,
                    LauncherInstrumentation.GestureScope.INSIDE);
            mLauncher.waitForIdle();
            mLauncher.executeAndWaitForLauncherEvent(
                    () -> mLauncher.linearGesture(centerX, centerY, centerX, 0, 10, false,
                            LauncherInstrumentation.GestureScope.INSIDE),
                    event -> TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE.equals(
                            event.getClassName()),
                    () -> "Didn't receive a dismiss animation ends message: " + centerX + ", "
                            + centerY,
                    "swiping to dismiss");
        }
    }