Merge "Improving diagnostics for objects disappearing from screen" into sc-dev am: 5dae3f3162
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14989389 Change-Id: Ic9a0efdc6f233906aae05cbe089be96f75f7036a
This commit is contained in:
@@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.test.uiautomator.By;
|
import androidx.test.uiautomator.By;
|
||||||
import androidx.test.uiautomator.BySelector;
|
import androidx.test.uiautomator.BySelector;
|
||||||
import androidx.test.uiautomator.Direction;
|
import androidx.test.uiautomator.Direction;
|
||||||
|
import androidx.test.uiautomator.StaleObjectException;
|
||||||
import androidx.test.uiautomator.UiObject2;
|
import androidx.test.uiautomator.UiObject2;
|
||||||
|
|
||||||
import com.android.launcher3.testing.TestProtocol;
|
import com.android.launcher3.testing.TestProtocol;
|
||||||
@@ -61,7 +62,13 @@ public class AllApps extends LauncherInstrumentation.VisibleContainer {
|
|||||||
|
|
||||||
private boolean hasClickableIcon(UiObject2 allAppsContainer, UiObject2 appListRecycler,
|
private boolean hasClickableIcon(UiObject2 allAppsContainer, UiObject2 appListRecycler,
|
||||||
BySelector appIconSelector, int displayBottom) {
|
BySelector appIconSelector, int displayBottom) {
|
||||||
final UiObject2 icon = appListRecycler.findObject(appIconSelector);
|
final UiObject2 icon;
|
||||||
|
try {
|
||||||
|
icon = appListRecycler.findObject(appIconSelector);
|
||||||
|
} catch (StaleObjectException e) {
|
||||||
|
mLauncher.fail("All apps recycler disappeared from screen");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (icon == null) {
|
if (icon == null) {
|
||||||
LauncherInstrumentation.log("hasClickableIcon: icon not visible");
|
LauncherInstrumentation.log("hasClickableIcon: icon not visible");
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -496,7 +496,7 @@ public final class LauncherInstrumentation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fail(String message) {
|
void fail(String message) {
|
||||||
checkForAnomaly();
|
checkForAnomaly();
|
||||||
Assert.fail(formatSystemHealthMessage(formatErrorWithEvents(
|
Assert.fail(formatSystemHealthMessage(formatErrorWithEvents(
|
||||||
"http://go/tapl test failure:\nSummary: " + getContextDescription()
|
"http://go/tapl test failure:\nSummary: " + getContextDescription()
|
||||||
@@ -1449,6 +1449,9 @@ public final class LauncherInstrumentation {
|
|||||||
Rect getVisibleBounds(UiObject2 object) {
|
Rect getVisibleBounds(UiObject2 object) {
|
||||||
try {
|
try {
|
||||||
return object.getVisibleBounds();
|
return object.getVisibleBounds();
|
||||||
|
} catch (StaleObjectException e) {
|
||||||
|
fail("Object " + object + " disappeared from screen");
|
||||||
|
return null;
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
fail(t.toString());
|
fail(t.toString());
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
Reference in New Issue
Block a user