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

Commit a144105c authored by Jagrut Desai's avatar Jagrut Desai Committed by Android (Google) Code Review
Browse files

Merge "Fix TaplTestsNexus#testSearchForApp" into main

parents 42d12bad 311d5192
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
 */
package com.android.quickstep.util;

import static com.android.launcher3.testing.shared.TestProtocol.PAUSE_DETECTED_MESSAGE;

import android.content.Context;
import android.content.res.Resources;
import android.util.Log;
@@ -201,7 +203,8 @@ public class MotionPauseDetector {
            ActiveGestureLog.INSTANCE.addLog(logString);
            boolean isFirstDetectedPause = !mHasEverBeenPaused && mIsPaused;
            if (mIsPaused) {
                AccessibilityManagerCompat.sendPauseDetectedEventToTest(mContext);
                AccessibilityManagerCompat.sendTestProtocolEventToTest(mContext,
                        PAUSE_DETECTED_MESSAGE);
                mHasEverBeenPaused = true;
            }
            if (mOnMotionPauseListener != null) {
+3 −1
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
import static com.android.launcher3.testing.shared.TestProtocol.DISMISS_ANIMATION_ENDS_MESSAGE;
import static com.android.launcher3.touch.PagedOrientationHandler.CANVAS_TRANSLATE;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
@@ -4035,7 +4036,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
    }

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

    public PendingAnimation createAllTasksDismissAnimation(long duration) {
+4 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.launcher3;

import static com.android.launcher3.testing.shared.TestProtocol.SCROLL_FINISHED_MESSAGE;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
@@ -170,7 +172,8 @@ public abstract class FastScrollRecyclerView extends RecyclerView {
        super.onScrollStateChanged(state);

        if (state == SCROLL_STATE_IDLE) {
            AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
            AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
                    SCROLL_FINISHED_MESSAGE);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.launcher3;
import static com.android.app.animation.Interpolators.SCROLL;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isAccessibilityEnabled;
import static com.android.launcher3.compat.AccessibilityManagerCompat.isObservedEventType;
import static com.android.launcher3.testing.shared.TestProtocol.SCROLL_FINISHED_MESSAGE;
import static com.android.launcher3.touch.OverScroll.OVERSCROLL_DAMP_FACTOR;
import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_BY;
import static com.android.launcher3.touch.PagedOrientationHandler.VIEW_SCROLL_TO;
@@ -492,7 +493,8 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
     */
    protected void onPageEndTransition() {
        mCurrentPageScrollDiff = 0;
        AccessibilityManagerCompat.sendScrollFinishedEventToTest(getContext());
        AccessibilityManagerCompat.sendTestProtocolEventToTest(getContext(),
                SCROLL_FINISHED_MESSAGE);
        AccessibilityManagerCompat.sendCustomAccessibilityEvent(getPageAt(mCurrentPage),
                AccessibilityEvent.TYPE_VIEW_FOCUSED, null);
        if (mOnPageTransitionEndCallback != null) {
+2 −28
Original line number Diff line number Diff line
@@ -74,38 +74,12 @@ public class AccessibilityManagerCompat {
        Log.d(TestProtocol.PERMANENT_DIAG_TAG, "sendStateEventToTest: " + stateOrdinal);
    }

    public static void sendScrollFinishedEventToTest(Context context) {
    public static void sendTestProtocolEventToTest(Context context, String testProtocolEvent) {
        final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
        if (accessibilityManager == null) return;

        sendEventToTest(accessibilityManager, context, TestProtocol.SCROLL_FINISHED_MESSAGE, null);
        sendEventToTest(accessibilityManager, context, testProtocolEvent, null);
    }

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

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

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

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

    /**
     * Notify running tests of a folder opened.
     */
    public static void sendFolderOpenedEventToTest(Context context) {
        final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
        if (accessibilityManager == null) return;

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

    private static void sendEventToTest(
            AccessibilityManager accessibilityManager,
            Context context, String eventTag, Bundle data) {
Loading