From 9016e17988509705f9c3569fc668774e92640fa1 Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Mon, 2 Aug 2021 09:39:11 +0100 Subject: [PATCH 1/2] Add ScreenRecord for testDragCustomShortcut - For investigation of a failing test Bug: 195263971 Test: manual Change-Id: If68e678a847f70c5b891c9dbcece77333fedf846 --- tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java index dad4f2b045..2e8048a846 100644 --- a/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java +++ b/tests/src/com/android/launcher3/ui/widget/AddWidgetTest.java @@ -27,6 +27,7 @@ import com.android.launcher3.model.data.LauncherAppWidgetInfo; import com.android.launcher3.tapl.Widget; import com.android.launcher3.ui.AbstractLauncherUiTest; import com.android.launcher3.ui.TestViewHelpers; +import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord; import com.android.launcher3.util.rule.ShellCommandRule; import com.android.launcher3.widget.LauncherAppWidgetProviderInfo; @@ -80,6 +81,7 @@ public class AddWidgetTest extends AbstractLauncherUiTest { */ @Test @PortraitLandscape + @ScreenRecord //b/195263971 public void testDragCustomShortcut() throws Throwable { clearHomescreen(); mDevice.pressHome(); From 42a7d1af83b317076afc16f5ff8e142c828bf613 Mon Sep 17 00:00:00 2001 From: vadimt Date: Mon, 2 Aug 2021 10:38:12 -0700 Subject: [PATCH 2/2] Band-aid for getHomeActivities returning null It can return null immediately after android.intent.action.ACTION_PREFERRED_ACTIVITY_CHANGED notification. Test: local Bug: 187080582 Change-Id: I8625fdfc0add57fed832bdca4713747a005bf08c --- .../quickstep/OverviewComponentObserver.java | 13 +++++++++++++ .../com/android/quickstep/FallbackRecentsTest.java | 1 + src/com/android/launcher3/testing/TestProtocol.java | 1 + 3 files changed, 15 insertions(+) diff --git a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java index 0efe6666a8..780032e11b 100644 --- a/quickstep/src/com/android/quickstep/OverviewComponentObserver.java +++ b/quickstep/src/com/android/quickstep/OverviewComponentObserver.java @@ -33,8 +33,11 @@ import android.content.IntentFilter; import android.content.pm.ActivityInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; +import android.os.SystemClock; +import android.util.Log; import android.util.SparseIntArray; +import com.android.launcher3.testing.TestProtocol; import com.android.launcher3.tracing.OverviewComponentObserverProto; import com.android.launcher3.tracing.TouchInteractionServiceProto; import com.android.launcher3.util.SimpleBroadcastReceiver; @@ -129,6 +132,16 @@ public final class OverviewComponentObserver { private void updateOverviewTargets() { ComponentName defaultHome = PackageManagerWrapper.getInstance() .getHomeActivities(new ArrayList<>()); + if (TestProtocol.sDebugTracing && defaultHome == null) { + Log.d(TestProtocol.THIRD_PARTY_LAUNCHER_NOT_SET, "getHomeActivities returned null"); + while ((defaultHome = + PackageManagerWrapper.getInstance().getHomeActivities(new ArrayList<>())) + == null) { + SystemClock.sleep(10); + } + Log.d(TestProtocol.THIRD_PARTY_LAUNCHER_NOT_SET, + "getHomeActivities returned non-null: " + defaultHome); + } mIsHomeDisabled = mDeviceState.isHomeDisabled(); mIsDefaultHome = Objects.equals(mMyHomeIntent.getComponent(), defaultHome); diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java index a683d01f6c..45e7e695a4 100644 --- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java +++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java @@ -98,6 +98,7 @@ public class FallbackRecentsTest { mDevice = UiDevice.getInstance(instrumentation); mDevice.setOrientationNatural(); mLauncher = new LauncherInstrumentation(); + mLauncher.enableDebugTracing(); // b/143488140 //mLauncher.enableCheckEventsForSuccessfulGestures(); diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java index 2f1f82d9f7..71046be44d 100644 --- a/src/com/android/launcher3/testing/TestProtocol.java +++ b/src/com/android/launcher3/testing/TestProtocol.java @@ -110,4 +110,5 @@ public final class TestProtocol { public static final String PERMANENT_DIAG_TAG = "TaplTarget"; public static final String WORK_PROFILE_REMOVED = "b/159671700"; public static final String FALLBACK_ACTIVITY_NO_SET = "b/181019015"; + public static final String THIRD_PARTY_LAUNCHER_NOT_SET = "b/187080582"; }