summaryrefslogtreecommitdiff
path: root/quickstep
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2022-02-16 18:20:06 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2022-02-16 18:20:06 +0000
commit64162f1e0582b4573e2f7ea53431e8ad5b6dd343 (patch)
tree9c5b6ac280498881b1b028bc444ddba82b430338 /quickstep
parentb63aad9de8c9a2012c97ceb1fb726ca05f9c99eb (diff)
parentd6279ae64103738f653034e885b1c3f47b2284e9 (diff)
downloadLauncher3-64162f1e0582b4573e2f7ea53431e8ad5b6dd343.tar.gz
Merge "Update TAPL object hierarchy in preparation for Taskbar TAPL tests"
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java6
-rw-r--r--quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java16
-rw-r--r--quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java8
-rw-r--r--quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java2
-rw-r--r--quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java43
-rw-r--r--quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java12
6 files changed, 34 insertions, 53 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
index 59ade49761..099915a281 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java
@@ -221,13 +221,9 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
* @return true if the event is over the hotseat
*/
static boolean isTouchOverHotseat(Launcher launcher, MotionEvent ev) {
- return (ev.getY() >= getHotseatTop(launcher));
- }
-
- public static int getHotseatTop(Launcher launcher) {
DeviceProfile dp = launcher.getDeviceProfile();
int hotseatHeight = dp.hotseatBarSizePx + dp.getInsets().bottom;
- return launcher.getDragLayer().getHeight() - hotseatHeight;
+ return (ev.getY() >= (launcher.getDragLayer().getHeight() - hotseatHeight));
}
@Override
diff --git a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
index 4c570f1d95..ef81449d8b 100644
--- a/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
+++ b/quickstep/src/com/android/quickstep/QuickstepTestInformationHandler.java
@@ -7,11 +7,9 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
-import com.android.launcher3.LauncherState;
import com.android.launcher3.testing.TestInformationHandler;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
-import com.android.launcher3.uioverrides.touchcontrollers.PortraitStatesTouchController;
import com.android.quickstep.util.LayoutUtils;
public class QuickstepTestInformationHandler extends TestInformationHandler {
@@ -26,15 +24,6 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
public Bundle call(String method, String arg, @Nullable Bundle extras) {
final Bundle response = new Bundle();
switch (method) {
- case TestProtocol.REQUEST_ALL_APPS_TO_OVERVIEW_SWIPE_HEIGHT: {
- return getLauncherUIProperty(Bundle::putInt, l -> {
- final float progress = LauncherState.OVERVIEW.getVerticalProgress(l)
- - LauncherState.ALL_APPS.getVerticalProgress(l);
- final float distance = l.getAllAppsController().getShiftRange() * progress;
- return (int) distance;
- });
- }
-
case TestProtocol.REQUEST_HOME_TO_OVERVIEW_SWIPE_HEIGHT: {
final float swipeHeight =
LayoutUtils.getDefaultSwipeHeight(mContext, mDeviceProfile);
@@ -50,11 +39,6 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
return response;
}
- case TestProtocol.REQUEST_HOTSEAT_TOP: {
- return getLauncherUIProperty(
- Bundle::putInt, PortraitStatesTouchController::getHotseatTop);
- }
-
case TestProtocol.REQUEST_GET_FOCUSED_TASK_HEIGHT_FOR_TABLET: {
if (!mDeviceProfile.isTablet) {
return null;
diff --git a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
index cba48334d8..4529217a21 100644
--- a/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
+++ b/quickstep/tests/src/com/android/quickstep/FallbackRecentsTest.java
@@ -165,7 +165,7 @@ public class FallbackRecentsTest {
assertTrue("Fallback Launcher not visible", mDevice.wait(Until.hasObject(By.pkg(
mOtherLauncherActivity.packageName)), WAIT_TIME_MS));
- mLauncher.getBackground().switchToOverview();
+ mLauncher.getLaunchedAppState().switchToOverview();
}
// b/143488140
@@ -174,7 +174,7 @@ public class FallbackRecentsTest {
public void goToOverviewFromApp() {
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
- mLauncher.getBackground().switchToOverview();
+ mLauncher.getLaunchedAppState().switchToOverview();
}
protected void executeOnRecents(Consumer<RecentsActivity> f) {
@@ -200,7 +200,7 @@ public class FallbackRecentsTest {
private BaseOverview pressHomeAndGoToOverview() {
mDevice.pressHome();
- return mLauncher.getBackground().switchToOverview();
+ return mLauncher.getLaunchedAppState().switchToOverview();
}
// b/143488140
@@ -213,7 +213,7 @@ public class FallbackRecentsTest {
Wait.atMost("Expected three apps in the task list",
() -> mLauncher.getRecentTasks().size() >= 3, DEFAULT_ACTIVITY_TIMEOUT, mLauncher);
- BaseOverview overview = mLauncher.getBackground().switchToOverview();
+ BaseOverview overview = mLauncher.getLaunchedAppState().switchToOverview();
executeOnRecents(recents -> {
assertTrue("Don't have at least 3 tasks", getTaskCount(recents) >= 3);
});
diff --git a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
index 75d057ef80..535196329c 100644
--- a/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
+++ b/quickstep/tests/src/com/android/quickstep/StartLauncherViaGestureTests.java
@@ -78,7 +78,7 @@ public class StartLauncherViaGestureTests extends AbstractQuickStepTest {
closeLauncherActivity();
// The test action.
- mLauncher.getBackground().switchToOverview();
+ mLauncher.getLaunchedAppState().switchToOverview();
}
closeLauncherActivity();
mLauncher.pressHome();
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index e3198a819a..396cb1b79c 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -32,8 +32,8 @@ import androidx.test.uiautomator.Until;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.tapl.AllApps;
-import com.android.launcher3.tapl.Background;
+import com.android.launcher3.tapl.HomeAllApps;
+import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.tapl.LauncherInstrumentation.NavigationModel;
import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.OverviewActions;
@@ -84,7 +84,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
executeOnLauncher(launcher -> assertTrue(
"Launcher activity is the top activity; expecting another activity to be the top "
+ "one",
- isInBackground(launcher)));
+ isInLaunchedApp(launcher)));
}
@Test
@@ -136,7 +136,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
executeOnLauncher(launcher -> assertTrue(
"Launcher activity is the top activity; expecting another activity to be the top "
+ "one",
- isInBackground(launcher)));
+ isInLaunchedApp(launcher)));
// Test dismissing a task.
overview = mLauncher.pressHome().switchToOverview();
@@ -210,21 +210,22 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
@PortraitLandscape
public void testBackground() throws Exception {
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
- final Background background = getAndAssertBackground();
+ final LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
- assertNotNull("Background.switchToOverview() returned null", background.switchToOverview());
+ assertNotNull("Background.switchToOverview() returned null",
+ launchedAppState.switchToOverview());
assertTrue("Launcher internal state didn't switch to Overview",
isInState(() -> LauncherState.OVERVIEW));
}
- private Background getAndAssertBackground() {
- final Background background = mLauncher.getBackground();
- assertNotNull("Launcher.getBackground() returned null", background);
+ private LaunchedAppState getAndAssertLaunchedApp() {
+ final LaunchedAppState launchedAppState = mLauncher.getLaunchedAppState();
+ assertNotNull("Launcher.getLaunchedApp() returned null", launchedAppState);
executeOnLauncher(launcher -> assertTrue(
"Launcher activity is the top activity; expecting another activity to be the top "
+ "one",
- isInBackground(launcher)));
- return background;
+ isInLaunchedApp(launcher)));
+ return launchedAppState;
}
@Test
@@ -253,13 +254,13 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
startTestActivity(3);
startTestActivity(4);
- Background background = getAndAssertBackground();
- background.quickSwitchToPreviousApp();
+ LaunchedAppState launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.quickSwitchToPreviousApp();
assertTrue("The first app we should have quick switched to is not running",
isTestActivityRunning(3));
- background = getAndAssertBackground();
- background.quickSwitchToPreviousApp();
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.quickSwitchToPreviousApp();
if (mLauncher.getNavigationModel() == NavigationModel.THREE_BUTTON) {
// 3-button mode toggles between 2 apps, rather than going back further.
assertTrue("Second quick switch should have returned to the first app.",
@@ -268,13 +269,13 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
assertTrue("The second app we should have quick switched to is not running",
isTestActivityRunning(2));
}
- background = getAndAssertBackground();
- background.quickSwitchToPreviousAppSwipeLeft();
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.quickSwitchToPreviousAppSwipeLeft();
assertTrue("The 2nd app we should have quick switched to is not running",
isTestActivityRunning(3));
- background = getAndAssertBackground();
- background.switchToOverview();
+ launchedAppState = getAndAssertLaunchedApp();
+ launchedAppState.switchToOverview();
}
private boolean isTestActivityRunning(int activityNumber) {
@@ -291,7 +292,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
mLauncher.pressHome().quickSwitchToPreviousApp();
assertTrue("The most recent task is not running after quick switching from home",
isTestActivityRunning(2));
- getAndAssertBackground();
+ getAndAssertLaunchedApp();
}
// TODO(b/204830798): test with all navigation modes(add @NavigationModeSwitch annotation)
@@ -306,7 +307,7 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
mLauncher.getWorkspace();
waitForState("Launcher internal state didn't switch to Home", () -> LauncherState.NORMAL);
- AllApps allApps = mLauncher.getWorkspace().switchToAllApps();
+ HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps();
allApps.freeze();
try {
allApps.getAppIcon(APP_NAME).dragToWorkspace(false, false);
diff --git a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
index 0f5a1c8589..661beda41c 100644
--- a/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
+++ b/quickstep/tests/src/com/android/quickstep/ViewInflationDuringSwipeUp.java
@@ -51,7 +51,7 @@ import androidx.test.uiautomator.Until;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.model.data.LauncherAppWidgetInfo;
-import com.android.launcher3.tapl.Background;
+import com.android.launcher3.tapl.LaunchedAppState;
import com.android.launcher3.testcomponent.ListViewService;
import com.android.launcher3.testcomponent.ListViewService.SimpleViewsFactory;
import com.android.launcher3.testcomponent.TestCommandReceiver;
@@ -119,13 +119,13 @@ public class ViewInflationDuringSwipeUp extends AbstractQuickStepTest {
try {
// Go to overview once so that all views are initialized and cached
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
- mLauncher.getBackground().switchToOverview().dismissAllTasks();
+ mLauncher.getLaunchedAppState().switchToOverview().dismissAllTasks();
// Track view creations
mInitTracker.startTracking();
startTestActivity(2);
- mLauncher.getBackground().switchToOverview();
+ mLauncher.getLaunchedAppState().switchToOverview();
assertEquals("Views inflated during swipe up", 0, mInitTracker.viewInitCount);
} finally {
@@ -205,18 +205,18 @@ public class ViewInflationDuringSwipeUp extends AbstractQuickStepTest {
// Go to overview once so that all views are initialized and cached
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
- mLauncher.getBackground().switchToOverview().dismissAllTasks();
+ mLauncher.getLaunchedAppState().switchToOverview().dismissAllTasks();
// Track view creations
mInitTracker.startTracking();
startTestActivity(2);
- Background background = mLauncher.getBackground();
+ LaunchedAppState launchedAppState = mLauncher.getLaunchedAppState();
// Update widget
updateBeforeSwipeUp.accept(widgetId);
- background.switchToOverview();
+ launchedAppState.switchToOverview();
assertEquals("Views inflated during swipe up", 0, mInitTracker.viewInitCount);
// Widget is updated when going home