Merge "Disabling failing test" into ub-launcher3-master
diff --git a/OWNERS b/OWNERS
index 7340e84..bf4cd0b 100644
--- a/OWNERS
+++ b/OWNERS
@@ -8,9 +8,26 @@
hyunyoungs@google.com
mrcasey@google.com
sunnygoyal@google.com
+awickham@google.com
twickham@google.com
winsonc@google.com
zakcohen@google.com
+santie@google.com
+vadimt@google.com
+mett@google.com
+jonmiranda@google.com
+pinyaoting@google.com
+sfufa@google.com
+gwasserman@google.com
+jamesoleary@google.com
+joshtrask@google.com
+mrenouf@google.com
+mkephart@google.com
+hwwang@google.com
+tracyzhou@google.com
+peanutbutter@google.com
+xuqiu@google.com
+sreyasr@google.com
per-file FeatureFlags.java = sunnygoyal@google.com, adamcohen@google.com
per-file BaseFlags.java = sunnygoyal@google.com, adamcohen@google.com
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
index 947a861..f79ad25 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java
@@ -105,6 +105,10 @@
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
+ if ((ev.getAction() == MotionEvent.ACTION_UP || ev.getAction() == MotionEvent.ACTION_CANCEL)
+ && mCurrentAnimation == null) {
+ clearState();
+ }
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = !canInterceptTouch();
if (mNoIntercept) {
@@ -125,6 +129,11 @@
TaskView view = mRecentsView.getTaskViewAt(i);
if (mRecentsView.isTaskViewVisible(view) && mActivity.getDragLayer()
.isEventOverView(view, ev)) {
+ // Disable swiping up and down if the task overlay is modal.
+ if (view.isTaskOverlayModal()) {
+ mTaskBeingDragged = null;
+ break;
+ }
mTaskBeingDragged = view;
if (!SysUINavigationMode.getMode(mActivity).hasGestures) {
// Don't allow swipe down to open if we don't support swipe up
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
index ec7cddf..eb3b190 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskOverlayFactory.java
@@ -87,5 +87,12 @@
* Called when the overlay is no longer used.
*/
public void reset() { }
+
+ /**
+ * Whether the overlay is modal, which means only tapping is enabled, but no swiping.
+ */
+ public boolean isOverlayModal() {
+ return false;
+ }
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
index 4750caa..05c206f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DelegateInputConsumer.java
@@ -36,7 +36,7 @@
protected void setActive(MotionEvent ev) {
mState = STATE_ACTIVE;
- TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "pilferPointers");
mInputMonitor.pilferPointers();
// Send cancel event
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
index 7b8d40c..ba1d38c 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/DeviceLockedInputConsumer.java
@@ -204,7 +204,7 @@
private void startRecentsTransition() {
mThresholdCrossed = true;
- TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "pilferPointers");
mInputMonitorCompat.pilferPointers();
Intent intent = new Intent(Intent.ACTION_MAIN)
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index 42f6ff5..8e7074d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -309,7 +309,7 @@
if (mInteractionHandler == null) {
return;
}
- TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "pilferPointers");
mInputMonitorCompat.pilferPointers();
mActivityInterface.closeOverlay();
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
index 6bfabcd..f161cc0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewInputConsumer.java
@@ -108,7 +108,7 @@
ActiveGestureLog.INSTANCE.addLog("startQuickstep");
}
if (mInputMonitor != null) {
- TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "pilferPointers");
mInputMonitor.pilferPointers();
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
index ac1c3a8..823b254 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/inputconsumers/OverviewWithoutFocusInputConsumer.java
@@ -65,7 +65,7 @@
private void onInterceptTouch() {
if (mInputMonitor != null) {
- TestLogging.recordEvent(TestProtocol.SEQUENCE_PILFER, "pilferPointers");
+ TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "pilferPointers");
mInputMonitor.pilferPointers();
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index e34e74c..e668ca0 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -565,6 +565,13 @@
return isHandlingTouch() || shouldStealTouchFromSiblingsBelow(ev);
}
+ @Override
+ protected void determineScrollingStart(MotionEvent ev, float touchSlopScale) {
+ // Enables swiping to the left or right only if the task overlay is not modal.
+ if (getCurrentPageTaskView() == null || !getCurrentPageTaskView().isTaskOverlayModal()) {
+ super.determineScrollingStart(ev, touchSlopScale);
+ }
+ }
protected boolean shouldStealTouchFromSiblingsBelow(MotionEvent ev) {
return true;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index dce92ff..79b9a9d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -251,6 +251,10 @@
}
}
+ public boolean isTaskOverlayModal() {
+ return mSnapshotView.getTaskOverlay().isOverlayModal();
+ }
+
public TaskMenuView getMenuView() {
return mMenuView;
}
diff --git a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
index 5904fcd..8e4762d 100644
--- a/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
+++ b/quickstep/tests/src/com/android/quickstep/AppPredictionsUITests.java
@@ -88,6 +88,7 @@
*/
@Test
public void testPredictionExistsInAllApps() {
+ mDevice.pressHome();
mLauncher.pressHome().switchToAllApps();
// Dispatch an update
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index 28ed588..03d7c3e 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -81,8 +81,7 @@
@Test
public void testAllAppsFromOverview() throws Exception {
- // When actions are enabled, all apps isn't present in overview
- if (mLauncher.overviewActionsEnabled()) {
+ if (!mLauncher.hasAllAppsInOverview()) {
return;
}
@@ -146,7 +145,7 @@
launcher -> assertEquals("Dismissing a task didn't remove 1 task from Overview",
numTasks - 1, getTaskCount(launcher)));
- if (!mLauncher.overviewActionsEnabled() && (!TestHelpers.isInLauncherProcess()
+ if (mLauncher.hasAllAppsInOverview() && (!TestHelpers.isInLauncherProcess()
|| getFromLauncher(launcher -> !launcher.getDeviceProfile().isLandscape))) {
// Test switching to all apps and back.
final AllAppsFromOverview allApps = overview.switchToAllApps();
@@ -190,8 +189,7 @@
@Test
public void testAppIconLaunchFromAllAppsFromOverview() throws Exception {
- // All apps doesn't exist in Overview when actions are enabled
- if (mLauncher.overviewActionsEnabled()) {
+ if (!mLauncher.hasAllAppsInOverview()) {
return;
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1743b14..33f5a95 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -941,7 +941,6 @@
// Workaround for b/78520668, explicitly trim memory once UI is hidden
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStop");
}
@Override
@@ -955,7 +954,6 @@
mAppWidgetHost.setListenIfResumed(true);
TraceHelper.INSTANCE.endSection(traceToken);
- TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "Activity.onStart");
}
private void handleDeferredResume() {
diff --git a/src/com/android/launcher3/SecondaryDropTarget.java b/src/com/android/launcher3/SecondaryDropTarget.java
index 114c491..1841134 100644
--- a/src/com/android/launcher3/SecondaryDropTarget.java
+++ b/src/com/android/launcher3/SecondaryDropTarget.java
@@ -67,7 +67,6 @@
super(context, attrs, defStyle);
mCacheExpireAlarm = new Alarm();
- mCacheExpireAlarm.setOnAlarmListener(this);
}
@Override
@@ -75,6 +74,7 @@
super.onAttachedToWindow();
if (mHadPendingAlarm) {
mCacheExpireAlarm.setAlarm(CACHE_EXPIRE_TIMEOUT);
+ mCacheExpireAlarm.setOnAlarmListener(this);
mHadPendingAlarm = false;
}
}
@@ -84,6 +84,7 @@
super.onDetachedFromWindow();
if (mCacheExpireAlarm.alarmPending()) {
mCacheExpireAlarm.cancelAlarm();
+ mCacheExpireAlarm.setOnAlarmListener(null);
mHadPendingAlarm = true;
}
}
@@ -168,6 +169,7 @@
}
// Cancel any pending alarm and set cache expiry after some time
mCacheExpireAlarm.setAlarm(CACHE_EXPIRE_TIMEOUT);
+ mCacheExpireAlarm.setOnAlarmListener(this);
if (uninstallDisabled) {
return false;
}
diff --git a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
index 0927b26..02e98e8 100644
--- a/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
+++ b/src/com/android/launcher3/graphics/LauncherPreviewRenderer.java
@@ -87,9 +87,11 @@
import com.android.launcher3.model.WidgetsModel;
import com.android.launcher3.pm.InstallSessionHelper;
import com.android.launcher3.pm.UserCache;
+import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.views.ActivityContext;
import com.android.launcher3.views.BaseDragLayer;
+import com.android.launcher3.widget.custom.CustomWidgetManager;
import java.util.ArrayList;
import java.util.Arrays;
@@ -128,7 +130,8 @@
private static final Set<MainThreadInitializedObject> WHITELIST = new HashSet<>(
Arrays.asList(UserCache.INSTANCE, InstallSessionHelper.INSTANCE,
- LauncherAppState.INSTANCE, InvariantDeviceProfile.INSTANCE));
+ LauncherAppState.INSTANCE, InvariantDeviceProfile.INSTANCE,
+ CustomWidgetManager.INSTANCE, PluginManagerWrapper.INSTANCE));
private final InvariantDeviceProfile mIdp;
private final Map<MainThreadInitializedObject, Object> mObjectMap = new HashMap<>();
@@ -145,6 +148,14 @@
return this;
}
+ public void onDestroy() {
+ CustomWidgetManager customWidgetManager = (CustomWidgetManager) mObjectMap.get(
+ CustomWidgetManager.INSTANCE);
+ if (customWidgetManager != null) {
+ customWidgetManager.onDestroy();
+ }
+ }
+
/**
* Find a cached object from mObjectMap if we have already created one. If not, generate
* an object using the provider.
@@ -349,6 +360,9 @@
private void inflateAndAddWidgets(LauncherAppWidgetInfo info, WidgetsModel widgetsModel) {
WidgetItem widgetItem = widgetsModel.getWidgetProviderInfoByProviderName(
info.providerName);
+ if (widgetItem == null) {
+ return;
+ }
AppWidgetHostView view = new AppWidgetHostView(mContext);
view.setAppWidget(-1, widgetItem.widgetInfo);
view.updateAppWidget(null);
@@ -385,9 +399,11 @@
}
WorkspaceFetcher fetcher;
+ PreviewContext previewContext = null;
if (needsToMigrate && success) {
+ previewContext = new PreviewContext(mContext, mIdp);
LauncherAppState appForPreview = new LauncherAppState(
- new PreviewContext(mContext, mIdp), null /* iconCacheFileName */);
+ previewContext, null /* iconCacheFileName */);
fetcher = new WorkspaceItemsInfoFromPreviewFetcher(appForPreview);
MODEL_EXECUTOR.execute(fetcher);
} else {
@@ -396,6 +412,9 @@
(LauncherModel.ModelUpdateTask) fetcher);
}
WorkspaceResult workspaceResult = fetcher.get();
+ if (previewContext != null) {
+ previewContext.onDestroy();
+ }
if (workspaceResult == null) {
return;
@@ -557,6 +576,7 @@
public WorkspaceResult call() throws Exception {
List<ShortcutInfo> allShortcuts = new ArrayList<>();
loadWorkspace(allShortcuts, LauncherSettings.Favorites.PREVIEW_CONTENT_URI);
+ mBgDataModel.widgetsModel.update(mApp, null);
return new WorkspaceResult(mBgDataModel.workspaceItems, mBgDataModel.appWidgets,
mBgDataModel.widgetsModel);
}
diff --git a/src/com/android/launcher3/model/LoaderTask.java b/src/com/android/launcher3/model/LoaderTask.java
index fbf01fc..62904ae 100644
--- a/src/com/android/launcher3/model/LoaderTask.java
+++ b/src/com/android/launcher3/model/LoaderTask.java
@@ -104,7 +104,7 @@
public class LoaderTask implements Runnable {
private static final String TAG = "LoaderTask";
- private final LauncherAppState mApp;
+ protected final LauncherAppState mApp;
private final AllAppsList mBgAllAppsList;
protected final BgDataModel mBgDataModel;
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 4e60d13..97ce65e 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -35,7 +35,6 @@
public static final String TAPL_EVENTS_TAG = "TaplEvents";
public static final String SEQUENCE_MAIN = "Main";
public static final String SEQUENCE_TIS = "TIS";
- public static final String SEQUENCE_PILFER = "Pilfer";
public static String stateOrdinalToString(int ordinal) {
switch (ordinal) {
diff --git a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java
index 2aed936..0ea7d85 100644
--- a/src/com/android/launcher3/widget/custom/CustomWidgetManager.java
+++ b/src/com/android/launcher3/widget/custom/CustomWidgetManager.java
@@ -51,6 +51,7 @@
public static final MainThreadInitializedObject<CustomWidgetManager> INSTANCE =
new MainThreadInitializedObject<>(CustomWidgetManager::new);
+ private final Context mContext;
/**
* auto provider Id is an ever-increasing number that serves as the providerId whenever a new
* custom widget has been connected.
@@ -62,6 +63,7 @@
private Consumer<PackageUserKey> mWidgetRefreshCallback;
private CustomWidgetManager(Context context) {
+ mContext = context;
mPlugins = new SparseArray<>();
mCustomWidgets = new ArrayList<>();
mWidgetsIdMap = new SparseArray<>();
@@ -69,6 +71,10 @@
.addPluginListener(this, CustomWidgetPlugin.class, true);
}
+ public void onDestroy() {
+ PluginManagerWrapper.INSTANCE.get(mContext).removePluginListener(this);
+ }
+
@Override
public void onPluginConnected(CustomWidgetPlugin plugin, Context context) {
mPlugins.put(mAutoProviderId, plugin);
diff --git a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
index ae32692..0b99e7a 100644
--- a/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
+++ b/src_shortcuts_overrides/com/android/launcher3/model/WidgetsModel.java
@@ -249,6 +249,10 @@
ComponentName providerName) {
ArrayList<WidgetItem> widgetsList = mWidgetsList.get(
new PackageItemInfo(providerName.getPackageName()));
+ if (widgetsList == null) {
+ return null;
+ }
+
for (WidgetItem item : widgetsList) {
if (item.componentName.equals(providerName)) {
return item;
diff --git a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
index de9757f..4b1a067 100644
--- a/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
+++ b/tests/src/com/android/launcher3/ui/widget/AddConfigWidgetTest.java
@@ -41,6 +41,7 @@
import com.android.launcher3.util.rule.ShellCommandRule;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -70,12 +71,14 @@
@Test
@PortraitLandscape
+ @Ignore // b/148867106
public void testWidgetConfig() throws Throwable {
runTest(true);
}
@Test
@PortraitLandscape
+ @Ignore // b/148867106
public void testConfigCancelled() throws Throwable {
runTest(false);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/Background.java b/tests/tapl/com/android/launcher3/tapl/Background.java
index 8972876..2acab97 100644
--- a/tests/tapl/com/android/launcher3/tapl/Background.java
+++ b/tests/tapl/com/android/launcher3/tapl/Background.java
@@ -72,7 +72,6 @@
}
protected void goToOverviewUnchecked() {
- final boolean launcherWasVisible = mLauncher.isLauncherVisible();
switch (mLauncher.getNavigationModel()) {
case ZERO_BUTTON: {
final int centerX = mLauncher.getDevice().getDisplayWidth() / 2;
@@ -138,10 +137,6 @@
OVERVIEW_STATE_ORDINAL);
break;
}
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
}
/**
@@ -162,7 +157,6 @@
}
protected void quickSwitchToPreviousApp(int expectedState) {
- final boolean launcherWasVisible = mLauncher.isLauncherVisible();
boolean transposeInLandscape = false;
switch (mLauncher.getNavigationModel()) {
case TWO_BUTTON:
@@ -186,17 +180,15 @@
endX = startX;
endY = 0;
}
+ final boolean launcherIsVisible =
+ mLauncher.hasLauncherObject(By.textStartsWith(""));
final boolean isZeroButton = mLauncher.getNavigationModel()
== LauncherInstrumentation.NavigationModel.ZERO_BUTTON;
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN,
- LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
mLauncher.swipeToState(startX, startY, endX, endY, 20, expectedState,
- launcherWasVisible && isZeroButton
+ launcherIsVisible && isZeroButton
? LauncherInstrumentation.GestureScope.INSIDE_TO_OUTSIDE
- : LauncherInstrumentation.GestureScope.OUTSIDE);
+ : LauncherInstrumentation.GestureScope.OUTSIDE
+ );
break;
}
@@ -204,11 +196,6 @@
// Double press the recents button.
UiObject2 recentsButton = mLauncher.waitForSystemUiObject("recent_apps");
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
- if (!launcherWasVisible) {
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN,
- LauncherInstrumentation.EVENT_START_ACTIVITY);
- }
mLauncher.runToState(() -> recentsButton.click(), OVERVIEW_STATE_ORDINAL);
mLauncher.getOverview();
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, SQUARE_BUTTON_EVENT);
@@ -216,8 +203,6 @@
break;
}
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
protected String getSwipeHeightRequestName() {
diff --git a/tests/tapl/com/android/launcher3/tapl/Launchable.java b/tests/tapl/com/android/launcher3/tapl/Launchable.java
index 0f65ba5..b20384e 100644
--- a/tests/tapl/com/android/launcher3/tapl/Launchable.java
+++ b/tests/tapl/com/android/launcher3/tapl/Launchable.java
@@ -25,8 +25,6 @@
import androidx.test.uiautomator.UiObject2;
import androidx.test.uiautomator.Until;
-import com.android.launcher3.testing.TestProtocol;
-
/**
* Ancestor for AppIcon and AppMenuItem.
*/
@@ -64,8 +62,6 @@
event -> event.getEventType() == TYPE_WINDOW_STATE_CHANGED,
() -> "Launching an app didn't open a new window: " + mObject.getText());
expectActivityStartEvents();
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
mLauncher.assertTrue(
"App didn't start: " + selector,
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index 47a60cf..17858a0 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -97,8 +97,6 @@
private static final Pattern EVENT_TOUCH_UP = getTouchEventPattern("ACTION_UP");
private static final Pattern EVENT_TOUCH_CANCEL = getTouchEventPattern("ACTION_CANCEL");
private static final Pattern EVENT_PILFER_POINTERS = Pattern.compile("pilferPointers");
- static final Pattern EVENT_START_ACTIVITY = Pattern.compile("Activity\\.onStart");
- static final Pattern EVENT_STOP_ACTIVITY = Pattern.compile("Activity\\.onStop");
static final Pattern EVENT_TOUCH_DOWN_TIS = getTouchEventPatternTIS("ACTION_DOWN");
static final Pattern EVENT_TOUCH_UP_TIS = getTouchEventPatternTIS("ACTION_UP");
@@ -333,21 +331,25 @@
}
private String getSystemAnomalyMessage() {
- UiObject2 object = mDevice.findObject(By.res("android", "alertTitle"));
- if (object != null) {
- return "System alert popup is visible: " + object.getText();
+ try {
+ UiObject2 object = mDevice.findObject(By.res("android", "alertTitle"));
+ if (object != null) {
+ return "System alert popup is visible: " + object.getText();
+ }
+
+ object = mDevice.findObject(By.res("android", "message"));
+ if (object != null) {
+ return "Message popup by " + object.getApplicationPackage() + " is visible: "
+ + object.getText();
+ }
+
+ if (hasSystemUiObject("keyguard_status_view")) return "Phone is locked";
+
+ if (!mDevice.hasObject(By.textStartsWith(""))) return "Screen is empty";
+ } catch (Throwable e) {
+ Log.w(TAG, "getSystemAnomalyMessage failed", e);
}
- object = mDevice.findObject(By.res("android", "message"));
- if (object != null) {
- return "Message popup by " + object.getApplicationPackage() + " is visible: "
- + object.getText();
- }
-
- if (hasSystemUiObject("keyguard_status_view")) return "Phone is locked";
-
- if (!mDevice.hasObject(By.textStartsWith(""))) return "Screen is empty";
-
return null;
}
@@ -567,7 +569,7 @@
return waitForLauncherObject(APPS_RES_ID);
}
case OVERVIEW: {
- if (mDevice.isNaturalOrientation() && !overviewActionsEnabled()) {
+ if (hasAllAppsInOverview()) {
waitForLauncherObject(APPS_RES_ID);
} else {
waitUntilGone(APPS_RES_ID);
@@ -635,7 +637,6 @@
// otherwise waitForIdle may return immediately in case when there was a big enough
// pause in accessibility events prior to pressing Home.
final String action;
- final boolean launcherWasVisible = isLauncherVisible();
if (getNavigationModel() == NavigationModel.ZERO_BUTTON) {
checkForAnomaly();
@@ -664,18 +665,12 @@
displaySize.x / 2, displaySize.y - 1,
displaySize.x / 2, 0,
ZERO_BUTTON_STEPS_FROM_BACKGROUND_TO_HOME, NORMAL_STATE_ORDINAL,
- launcherWasVisible
+ hasLauncherObject(By.textStartsWith(""))
? GestureScope.INSIDE_TO_OUTSIDE
: GestureScope.OUTSIDE);
}
- if (!launcherWasVisible) {
- expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
- }
}
} else {
- if (!launcherWasVisible) {
- expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_START_ACTIVITY);
- }
log("Hierarchy before clicking home:");
dumpViewHierarchy();
log(action = "clicking home button from " + getVisibleStateMessage());
@@ -686,7 +681,6 @@
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_DOWN_TIS);
expectEvent(TestProtocol.SEQUENCE_TIS, EVENT_TOUCH_UP_TIS);
}
-
runToState(
waitForSystemUiObject("home")::click,
NORMAL_STATE_ORDINAL,
@@ -703,10 +697,6 @@
}
}
- boolean isLauncherVisible() {
- return hasLauncherObject(By.textStartsWith(""));
- }
-
/**
* Gets the Workspace object if the current state is "active home", i.e. workspace. Fails if the
* launcher is not in that state.
@@ -1125,7 +1115,7 @@
break;
case MotionEvent.ACTION_UP:
if (gestureScope != GestureScope.INSIDE) {
- expectEvent(TestProtocol.SEQUENCE_PILFER, EVENT_PILFER_POINTERS);
+ expectEvent(TestProtocol.SEQUENCE_MAIN, EVENT_PILFER_POINTERS);
}
if (gestureScope != GestureScope.OUTSIDE) {
expectEvent(TestProtocol.SEQUENCE_MAIN, gestureScope == GestureScope.INSIDE
@@ -1227,7 +1217,24 @@
getTestInfo(TestProtocol.REQUEST_ENABLE_DEBUG_TRACING);
}
- public boolean overviewActionsEnabled() {
+ public boolean hasAllAppsInOverview() {
+ // Vertical bar layouts don't contain all apps
+ if (!mDevice.isNaturalOrientation()) {
+ return false;
+ }
+ // Portrait two button (quickstep) always has all apps.
+ if (getNavigationModel() == NavigationModel.TWO_BUTTON) {
+ return true;
+ }
+ // Overview actions hide all apps
+ if (overviewActionsEnabled()) {
+ return false;
+ }
+ // ...otherwise there should be all apps
+ return true;
+ }
+
+ private boolean overviewActionsEnabled() {
return getTestInfo(TestProtocol.REQUEST_OVERVIEW_ACTIONS_ENABLED).getBoolean(
TestProtocol.TEST_INFO_RESPONSE_FIELD);
}
diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
index 5c51782..f955cf2 100644
--- a/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
+++ b/tests/tapl/com/android/launcher3/tapl/OverviewTask.java
@@ -79,8 +79,6 @@
() -> "Launching task didn't open a new window: "
+ mTask.getParent().getContentDescription());
mLauncher.expectEvent(TestProtocol.SEQUENCE_MAIN, TASK_START_EVENT);
- mLauncher.expectEvent(
- TestProtocol.SEQUENCE_MAIN, LauncherInstrumentation.EVENT_STOP_ACTIVITY);
}
return new Background(mLauncher);
}