From 710b5ba16236662fc9448cb326f6f29007cc673c Mon Sep 17 00:00:00 2001 From: Vinit Nayak Date: Fri, 23 Jun 2023 15:42:53 -0700 Subject: [PATCH] Add logs to determine if grid positions incorrect * Either positions are incorrect, or maybe we need to clean-up existing shortcuts if they are in incorrect position in the grid Bug: 282963545 Change-Id: I5d32d130d0e05bde69eda9d73468eda49a4f2802 --- .../com/android/launcher3/testing/shared/TestProtocol.java | 1 + .../com/android/launcher3/ui/AbstractLauncherUiTest.java | 3 +++ tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java index 8cc01ff32b..36e4e76439 100644 --- a/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java +++ b/tests/shared/com/android/launcher3/testing/shared/TestProtocol.java @@ -156,6 +156,7 @@ public final class TestProtocol { public static final String WORK_TAB_MISSING = "b/243688989"; public static final String TWO_TASKBAR_LONG_CLICKS = "b/262282528"; public static final String FLAKY_ACTIVITY_COUNT = "b/260260325"; + public static final String ICON_MISSING = "b/282963545"; public static final String REQUEST_EMULATE_DISPLAY = "emulate-display"; public static final String REQUEST_STOP_EMULATE_DISPLAY = "stop-emulate-display"; diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java index 1262a26338..7f796e7bb6 100644 --- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java +++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java @@ -17,6 +17,7 @@ package com.android.launcher3.ui; import static androidx.test.InstrumentationRegistry.getInstrumentation; +import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING; import static com.android.launcher3.ui.TaplTestsLauncher3.getAppPackageName; import static com.android.launcher3.util.Executors.MAIN_EXECUTOR; @@ -603,6 +604,8 @@ public abstract class AbstractLauncherUiTest { protected HomeAppIcon createShortcutIfNotExist(String name, int cellX, int cellY) { HomeAppIcon homeAppIcon = mLauncher.getWorkspace().tryGetWorkspaceAppIcon(name); + Log.d(ICON_MISSING, "homeAppIcon: " + homeAppIcon + " name: " + name + + " cell: " + cellX + ", " + cellY); if (homeAppIcon == null) { HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps(); allApps.freeze(); diff --git a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java index 095b1351a5..2c8acc4ddc 100644 --- a/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java +++ b/tests/src/com/android/launcher3/ui/TaplTestsLauncher3.java @@ -18,6 +18,8 @@ package com.android.launcher3.ui; import static androidx.test.InstrumentationRegistry.getInstrumentation; +import static com.android.launcher3.testing.shared.TestProtocol.ICON_MISSING; + import static com.google.common.truth.Truth.assertThat; import static org.junit.Assert.assertEquals; @@ -579,6 +581,11 @@ public class TaplTestsLauncher3 extends AbstractLauncherUiTest { @PlatinumTest(focusArea = "launcher") public void getIconsPosition_afterIconRemoved_notContained() throws IOException { Point[] gridPositions = getCornersAndCenterPositions(); + StringBuilder sb = new StringBuilder(); + for (Point p : gridPositions) { + sb.append(p).append(", "); + } + Log.d(ICON_MISSING, "allGridPositions: " + sb); createShortcutIfNotExist(STORE_APP_NAME, gridPositions[0]); createShortcutIfNotExist(MAPS_APP_NAME, gridPositions[1]); installDummyAppAndWaitForUIUpdate();