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

Commit 42a88b96 authored by vadimt's avatar vadimt
Browse files

Sending state ordinals from Launcher to TAPL

This improves diagnostics.

Test: TAPL tests
Change-Id: I0ebb533513405372ea7c58a36910160cfb6d8368
parent acc3b702
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -210,8 +210,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
            // Optimization, hide the all apps view to prevent layout while initializing
            activity.getAppsView().getContentView().setVisibility(View.GONE);

            AccessibilityManagerCompat.sendEventToTest(
                    activity, TestProtocol.SWITCHED_TO_STATE_MESSAGE);
            AccessibilityManagerCompat.sendStateEventToTest(activity, fromState.ordinal);
        } else {
            fromState = startState;
        }
+1 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ package com.android.launcher3;
public final class TestProtocol {
    public static final String GET_SCROLL_MESSAGE = "TAPL_GET_SCROLL";
    public static final String SCROLL_Y_FIELD = "scrollY";
    public static final String STATE_FIELD = "state";
    public static final String SWITCHED_TO_STATE_MESSAGE = "TAPL_SWITCHED_TO_STATE";
    public static final String RESPONSE_MESSAGE_POSTFIX = "_RESPONSE";
}
+5 −2
Original line number Diff line number Diff line
@@ -52,11 +52,14 @@ public class AccessibilityManagerCompat {
        return (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE);
    }

    public static void sendEventToTest(Context context, String eventTag) {
    public static void sendStateEventToTest(Context context, int stateOrdinal) {
        final AccessibilityManager accessibilityManager = getAccessibilityManagerForTest(context);
        if (accessibilityManager == null) return;

        sendEventToTest(accessibilityManager, eventTag, null);
        final Bundle parcel = new Bundle();
        parcel.putInt(TestProtocol.STATE_FIELD, stateOrdinal);

        sendEventToTest(accessibilityManager, TestProtocol.SWITCHED_TO_STATE_MESSAGE, parcel);
    }

    private static void sendEventToTest(
+1 −2
Original line number Diff line number Diff line
@@ -522,8 +522,7 @@ public abstract class AbstractStateChangeTouchController
            }
            mLauncher.getStateManager().goToState(targetState, false /* animated */);

            AccessibilityManagerCompat.sendEventToTest(
                    mLauncher, TestProtocol.SWITCHED_TO_STATE_MESSAGE);
            AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal);
        }
    }

+2 −1
Original line number Diff line number Diff line
@@ -45,7 +45,8 @@ public final class AllAppsFromOverview extends AllApps {
        final Point start = qsb.getVisibleCenter();
        final int endY = (int) (mLauncher.getDevice().getDisplayHeight() * 0.6);
        LauncherInstrumentation.log("AllAppsFromOverview.switchBackToOverview before swipe");
        mLauncher.swipe(start.x, start.y, start.x, endY);
        mLauncher.swipe(
                start.x, start.y, start.x, endY, LauncherInstrumentation.OVERVIEW_STATE_ORDINAL);

        return new Overview(mLauncher);
    }
Loading