Merge "Removing debug tracing for flakes that stopped reproing" into ub-launcher3-qt-qpr1-dev
diff --git a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
index 6a6916e..4246096 100644
--- a/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
+++ b/tests/src/com/android/launcher3/testcomponent/TestCommandReceiver.java
@@ -104,7 +104,8 @@
case GET_SYSTEM_HEALTH_MESSAGE: {
final Bundle response = new Bundle();
- response.putString("result", TestHelpers.getSystemHealthMessage(getContext()));
+ response.putString("result",
+ TestHelpers.getSystemHealthMessage(getContext(), Long.parseLong(arg)));
return response;
}
}
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index 840fdd2..1f4ba1a 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -105,8 +105,9 @@
}
if (TestHelpers.isInLauncherProcess()) {
Utilities.enableRunningInTestHarnessForTests();
- mLauncher.setSystemHealthSupplier(() -> TestCommandReceiver.callCommand(
- TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE).getString("result"));
+ mLauncher.setSystemHealthSupplier(startTime -> TestCommandReceiver.callCommand(
+ TestCommandReceiver.GET_SYSTEM_HEALTH_MESSAGE, startTime.toString()).
+ getString("result"));
mLauncher.setOnSettledStateAction(
containerType -> executeOnLauncher(
launcher ->
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 15615fc..65208ce 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -73,7 +73,7 @@
import java.util.List;
import java.util.concurrent.TimeoutException;
import java.util.function.Consumer;
-import java.util.function.Supplier;
+import java.util.function.Function;
/**
* The main tapl object. The only object that can be explicitly constructed by the using code. It
@@ -84,6 +84,7 @@
private static final String TAG = "Tapl";
private static final int ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME = 20;
private static final int GESTURE_STEP_MS = 16;
+ private static long START_TIME = System.currentTimeMillis();
// Types for launcher containers that the user is interacting with. "Background" is a
// pseudo-container corresponding to inactive launcher covered by another app.
@@ -134,7 +135,7 @@
private int mExpectedRotation = Surface.ROTATION_0;
private final Uri mTestProviderUri;
private final Deque<String> mDiagnosticContext = new LinkedList<>();
- private Supplier<String> mSystemHealthSupplier;
+ private Function<Long, String> mSystemHealthSupplier;
private Consumer<ContainerType> mOnSettledStateAction;
@@ -296,7 +297,7 @@
return "Background";
}
- public void setSystemHealthSupplier(Supplier<String> supplier) {
+ public void setSystemHealthSupplier(Function<Long, String> supplier) {
this.mSystemHealthSupplier = supplier;
}
@@ -316,8 +317,8 @@
}
return mSystemHealthSupplier != null
- ? mSystemHealthSupplier.get()
- : TestHelpers.getSystemHealthMessage(getContext());
+ ? mSystemHealthSupplier.apply(START_TIME)
+ : TestHelpers.getSystemHealthMessage(getContext(), START_TIME);
}
private void fail(String message) {
diff --git a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
index a089a52..05c987b 100644
--- a/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
+++ b/tests/tapl/com/android/launcher3/tapl/TestHelpers.java
@@ -101,11 +101,11 @@
return ret.toString();
}
- private static String checkCrash(Context context, String label) {
+ private static String checkCrash(Context context, String label, long startTime) {
DropBoxManager dropbox = (DropBoxManager) context.getSystemService(Context.DROPBOX_SERVICE);
Assert.assertNotNull("Unable access the DropBoxManager service", dropbox);
- long timestamp = System.currentTimeMillis() - 5 * 60000;
+ long timestamp = startTime;
DropBoxManager.Entry entry;
StringBuilder errorDetails = new StringBuilder();
while (null != (entry = dropbox.getNextEntry(label, timestamp))) {
@@ -123,7 +123,7 @@
return errorDetails.length() != 0 ? errorDetails.toString() : null;
}
- public static String getSystemHealthMessage(Context context) {
+ public static String getSystemHealthMessage(Context context, long startTime) {
try {
StringBuilder errors = new StringBuilder();
@@ -139,7 +139,7 @@
};
for (String label : labels) {
- final String crash = checkCrash(context, label);
+ final String crash = checkCrash(context, label, startTime);
if (crash != null) errors.append(crash);
}