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

Commit a1f0a106 authored by vadimt's avatar vadimt
Browse files

Removing tracking activity start/stop events

They were not especially useful in investigations; besides, these events
can be sent by the system asynchronously for actions that happened
before entering TAPL, causing flakes.

Change-Id: I72b5aad5521c6c0969f5b657b3db3e4d855f1d64
parent 0d9a9b93
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -921,8 +921,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
                }
            });
        }

        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStop");
    }

    @Override
@@ -936,7 +934,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,

        mAppWidgetHost.setListenIfResumed(true);
        TraceHelper.INSTANCE.endSection(traceToken);
        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStart");
    }

    private void handleDeferredResume() {
+0 −18
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
    }

    protected void goToOverviewUnchecked() {
        final boolean launcherWasVisible = mLauncher.isLauncherVisible();
        switch (mLauncher.getNavigationModel()) {
            case ZERO_BUTTON: {
                final int centerX = mLauncher.getDevice().getDisplayWidth() / 2;
@@ -138,11 +137,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                break;
        }
        expectSwitchToOverviewEvents();

        if (!launcherWasVisible) {
            mLauncher.expectEvent(
                    TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START_ACTIVITY);
        }
    }

    private void expectSwitchToOverviewEvents() {
@@ -192,11 +186,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                }
                final boolean isZeroButton = mLauncher.getNavigationModel()
                        == LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
                if (!launcherWasVisible) {
                    mLauncher.expectEvent(
                            TestProtocol.SEQUENCE_MAIN,
                            LauncherInstrumentation.EVENT_START_ACTIVITY);
                }
                mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState,
                        launcherWasVisible && isZeroButton
                                ? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
@@ -208,11 +197,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                // Double press the recents button.
                UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps");
                mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
                if (!launcherWasVisible) {
                    mLauncher.expectEvent(
                            TestProtocol.SEQUENCE_MAIN,
                            LauncherInstrumentation.EVENT_START_ACTIVITY);
                }
                mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL);
                mLauncher.getOverview();
                mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
@@ -220,8 +204,6 @@ public class Background extends LauncherInstrumentation.VisibleContainer {
                break;
        }
        mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
        mLauncher.expectEvent(
                TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
    }

    protected String getSwipeHeightRequestName() {
+2 −5
Original line number Diff line number Diff line
@@ -25,8 +25,6 @@ import androidx.test.uiautomator.BySelector;
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;

import com.android.launcher3.testing.TestProtocol;

/**
 * Ancestor for AppIcon and AppMenuItem.
 */
@@ -64,8 +62,6 @@ abstract class Launchable {
                event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
                () -> "Launching an app didn't open a new window: " + mObject.getText());
        expectActivityStartEvents();
        mLauncher.expectEvent(
                TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);

        mLauncher.assertTrue(
                "App didn't start: " + selector,
@@ -76,6 +72,7 @@ abstract class Launchable {

    /**
     * Drags an object to the center of homescreen.
     *
     * @param startsActivity   whether it's expected to start an activity.
     * @param isWidgetShortcut whether we drag a widget shortcut
     */
+0 −8
Original line number Diff line number Diff line
@@ -97,8 +97,6 @@ public final class LauncherInstrumentation {
    private static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP");
    private static final Pattern EVENT_TOUCH_CANCEL = getTouchEventPattern("ACTION_CANCEL");
    private static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers");
    static final Pattern EVENT_START_ACTIVITY = Pattern.compile("Activity\\.onStart");
    static final Pattern EVENT_STOP_ACTIVITY = Pattern.compile("Activity\\.onStop");
    static final Pattern EVENT_START = Pattern.compile("start:");

    static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
@@ -680,14 +678,8 @@ public final class LauncherInstrumentation {
                                        ? GestureScope.INSIDE_TO_OUTSIDE
                                        : GestureScope.OUTSIDE);
                    }
                    if (!launcherWasVisible) {
                        expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
                    }
                }
            } else {
                if (!launcherWasVisible) {
                    expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
                }
                log("Hierarchy before clicking home:");
                dumpViewHierarchy();
                log(action = "clicking home button from " + getVisibleStateMessage());
+0 −8
Original line number Diff line number Diff line
@@ -15,8 +15,6 @@
 */
package com.android.launcher3.tapl;

import android.os.Build;

import androidx.annotation.NonNull;
import androidx.test.uiautomator.By;
import androidx.test.uiautomator.UiObject2;
@@ -44,12 +42,6 @@ public class OptionsPopupMenuItem {
                    + mObject.getVisibleCenter() + " in " + mLauncher.getVisibleBounds(mObject));
            mLauncher.clickLauncherObject(mObject);
            mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
            if (!Build.MODEL.contains("Cuttlefish") ||
                    Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q &&
                            !"R".equals(Build.VERSION.CODENAME)) {
                mLauncher.expectEvent(
                        TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
            }
            mLauncher.assertTrue(
                    "App didn't start: " + By.pkg(expectedPackageName),
                    mLauncher.getDevice().wait(Until.hasObject(By.pkg(expectedPackageName)),
Loading