mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
Merge "Revert "Make sure TAPL waits for Launcher activity to stop each time it stops"" into main
This commit is contained in:
@@ -178,9 +178,6 @@ public final class TestProtocol {
|
||||
public static final String REQUEST_UNSTASH_BUBBLE_BAR_IF_STASHED =
|
||||
"unstash-bubble-bar-if-stashed";
|
||||
|
||||
public static final String REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT =
|
||||
"get-and-reset-activity-stops";
|
||||
|
||||
/** Logs {@link Log#d(String, String)} if {@link #sDebugTracing} is true. */
|
||||
public static void testLogD(String tag, String message) {
|
||||
if (!sDebugTracing) {
|
||||
|
||||
@@ -599,9 +599,6 @@ public abstract class AbstractLauncherUiTest {
|
||||
Wait.atMost("Launcher activity didn't stop",
|
||||
() -> !launcherInstrumentation.isLauncherActivityStarted(),
|
||||
DEFAULT_ACTIVITY_TIMEOUT, launcherInstrumentation);
|
||||
|
||||
// Reset activity stop count.
|
||||
launcherInstrumentation.getAndResetActivityStopCount();
|
||||
}
|
||||
|
||||
public static ActivityInfo resolveSystemAppInfo(String category) {
|
||||
|
||||
@@ -44,15 +44,11 @@ public class TestIsolationRule implements TestRule {
|
||||
return new Statement() {
|
||||
@Override
|
||||
public void evaluate() throws Throwable {
|
||||
// Reset activity stop count.
|
||||
mLauncher.getAndResetActivityStopCount();
|
||||
|
||||
base.evaluate();
|
||||
|
||||
// Make sure that Launcher workspace looks correct.
|
||||
|
||||
UiDevice.getInstance(InstrumentationRegistry.getInstrumentation()).pressHome();
|
||||
AbstractLauncherUiTest.checkDetectedLeaks(mLauncher, mRequireOneActiveActivity);
|
||||
mLauncher.assertNoUnexpectedStops();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -207,7 +207,6 @@ public final class LauncherInstrumentation {
|
||||
|
||||
private TrackpadGestureType mTrackpadGestureType = TrackpadGestureType.NONE;
|
||||
private int mPointerCount = 0;
|
||||
private final boolean mIsLauncherTest;
|
||||
|
||||
private static Pattern getKeyEventPattern(String action, String keyCode) {
|
||||
return Pattern.compile("Key event: KeyEvent.*action=" + action + ".*keyCode=" + keyCode);
|
||||
@@ -244,7 +243,6 @@ public final class LauncherInstrumentation {
|
||||
*/
|
||||
@Deprecated
|
||||
public LauncherInstrumentation(Instrumentation instrumentation, boolean isLauncherTest) {
|
||||
mIsLauncherTest = isLauncherTest;
|
||||
mInstrumentation = instrumentation;
|
||||
mDevice = UiDevice.getInstance(instrumentation);
|
||||
|
||||
@@ -417,11 +415,6 @@ public final class LauncherInstrumentation {
|
||||
TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
public int getAndResetActivityStopCount() {
|
||||
return getTestInfo(TestProtocol.REQUEST_GET_AND_RESET_ACTIVITY_STOP_COUNT).getInt(
|
||||
TestProtocol.TEST_INFO_RESPONSE_FIELD);
|
||||
}
|
||||
|
||||
Rect getGridTaskRectForTablet() {
|
||||
return ((Rect) getTestInfo(TestProtocol.REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET)
|
||||
.getParcelable(TestProtocol.TEST_INFO_RESPONSE_FIELD));
|
||||
@@ -635,19 +628,10 @@ public final class LauncherInstrumentation {
|
||||
|
||||
public void onTestStart() {
|
||||
mTestStartTime = System.currentTimeMillis();
|
||||
assertNoUnexpectedStops();
|
||||
}
|
||||
|
||||
public void onTestFinish() {
|
||||
mTestStartTime = -1;
|
||||
assertNoUnexpectedStops();
|
||||
}
|
||||
|
||||
/** Verify that the activity stop count is zero. */
|
||||
public void assertNoUnexpectedStops() {
|
||||
if (mIsLauncherTest) {
|
||||
assertEquals("Unexpected activity stops", 0, getAndResetActivityStopCount());
|
||||
}
|
||||
}
|
||||
|
||||
private String formatSystemHealthMessage(String message) {
|
||||
@@ -1021,9 +1005,6 @@ public final class LauncherInstrumentation {
|
||||
event -> TestProtocol.LAUNCHER_ACTIVITY_STOPPED_MESSAGE
|
||||
.equals(event.getClassName().toString()),
|
||||
() -> "Launcher activity didn't stop", actionName);
|
||||
|
||||
// Reset activity stop count.
|
||||
getAndResetActivityStopCount();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2276,7 +2257,6 @@ public final class LauncherInstrumentation {
|
||||
}
|
||||
|
||||
public Closable eventsCheck() {
|
||||
assertNoUnexpectedStops();
|
||||
Assert.assertTrue("Nested event checking", mEventChecker == null);
|
||||
disableSensorRotation();
|
||||
final Integer initialPid = getPid();
|
||||
@@ -2284,7 +2264,6 @@ public final class LauncherInstrumentation {
|
||||
if (eventChecker.start()) mEventChecker = eventChecker;
|
||||
|
||||
return () -> {
|
||||
assertNoUnexpectedStops();
|
||||
if (initialPid != null && initialPid.intValue() != getPid()) {
|
||||
if (mOnLauncherCrashed != null) mOnLauncherCrashed.run();
|
||||
checkForAnomaly();
|
||||
|
||||
Reference in New Issue
Block a user