Merge "Removing tracking activity start/stop events" into ub-launcher3-rvc-dev

This commit is contained in:
TreeHugger Robot
2020-04-30 18:06:00 +00:00
committed by Android (Google) Code Review
7 changed files with 2 additions and 48 deletions
-3
View File
@@ -923,8 +923,6 @@ public class Launcher extends BaseDraggingActivity implements LauncherExterns,
}
});
}
TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStop");
}
@Override
@@ -938,7 +936,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() {
@@ -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() {
@@ -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,7 +72,8 @@ abstract class Launchable {
/**
* Drags an object to the center of homescreen.
* @param startsActivity whether it's expected to start an activity.
*
* @param startsActivity whether it's expected to start an activity.
* @param isWidgetShortcut whether we drag a widget shortcut
*/
public void dragToWorkspace(boolean startsActivity, boolean isWidgetShortcut) {
@@ -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());
@@ -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)),
@@ -79,8 +79,6 @@ public final class OverviewTask {
() -> "Launching task didn't open a new window: "
+ mTask.getParent().getContentDescription());
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
mLauncher.expectEvent(
TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
return new Background(mLauncher);
}
@@ -229,10 +229,6 @@ public final class Workspace extends Home {
if (startsActivity || isWidgetShortcut) {
launcher.expectEvent(TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START);
}
if (startsActivity) {
launcher.expectEvent(
TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
LauncherInstrumentation.log("dragIconToWorkspace: end");
launcher.waitUntilGone("drop_target_bar");
}