Merge "Add popup menu and click handling to taskbar." into sc-v2-dev
diff --git a/src/com/android/launcher3/statemanager/StateManager.java b/src/com/android/launcher3/statemanager/StateManager.java
index b34af97..1767939 100644
--- a/src/com/android/launcher3/statemanager/StateManager.java
+++ b/src/com/android/launcher3/statemanager/StateManager.java
@@ -84,7 +84,7 @@
+ ", mCurrentStableState:" + mCurrentStableState
+ ", mState:" + mState
+ ", mRestState:" + mRestState
- + ", isInTransition:" + (mConfig.currentAnimation != null) + ")";
+ + ", isInTransition:" + isInTransition() + ")";
}
public void dump(String prefix, PrintWriter writer) {
@@ -93,7 +93,7 @@
writer.println(prefix + "\tmCurrentStableState:" + mCurrentStableState);
writer.println(prefix + "\tmState:" + mState);
writer.println(prefix + "\tmRestState:" + mRestState);
- writer.println(prefix + "\tisInTransition:" + (mConfig.currentAnimation != null));
+ writer.println(prefix + "\tisInTransition:" + isInTransition());
}
public StateHandler[] getStateHandlers() {
@@ -130,6 +130,13 @@
}
/**
+ * @return {@code true} If there is an active transition.
+ */
+ public boolean isInTransition() {
+ return mConfig.currentAnimation != null;
+ }
+
+ /**
* @see #goToState(STATE_TYPE, boolean, AnimatorListener)
*/
public void goToState(STATE_TYPE state) {
diff --git a/src/com/android/launcher3/testing/TestInformationHandler.java b/src/com/android/launcher3/testing/TestInformationHandler.java
index 17d925c..8ebfd62 100644
--- a/src/com/android/launcher3/testing/TestInformationHandler.java
+++ b/src/com/android/launcher3/testing/TestInformationHandler.java
@@ -157,6 +157,12 @@
return response;
}
+ case TestProtocol.REQUEST_ENABLE_ROTATION:
+ MAIN_EXECUTOR.submit(() ->
+ Launcher.ACTIVITY_TRACKER.getCreatedActivity().getRotationHelper()
+ .forceAllowRotationForTesting(Boolean.parseBoolean(arg)));
+ return null;
+
default:
return null;
}
diff --git a/src/com/android/launcher3/testing/TestProtocol.java b/src/com/android/launcher3/testing/TestProtocol.java
index 91c7221..9a74fb1 100644
--- a/src/com/android/launcher3/testing/TestProtocol.java
+++ b/src/com/android/launcher3/testing/TestProtocol.java
@@ -108,6 +108,7 @@
"get-focused-task-height-for-tablet";
public static final String REQUEST_GET_GRID_TASK_SIZE_RECT_FOR_TABLET =
"get-grid-task-size-rect-for-tablet";
+ public static final String REQUEST_ENABLE_ROTATION = "enable_rotation";
public static Long sForcePauseTimeout;
public static final String REQUEST_SET_FORCE_PAUSE_TIMEOUT = "set-force-pause-timeout";
diff --git a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
index b3457cd..44f2719 100644
--- a/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
+++ b/tests/src/com/android/launcher3/ui/AbstractLauncherUiTest.java
@@ -354,9 +354,10 @@
// Cannot be used in TaplTests between a Tapl call injecting a gesture and a tapl call
// expecting the results of that gesture because the wait can hide flakeness.
- protected void waitForStableState(String message, Supplier<LauncherState> state) {
+ protected void waitForStateTransitionToEnd(String message, Supplier<LauncherState> state) {
waitForLauncherCondition(message,
- launcher -> launcher.getStateManager().isInStableState(state.get()));
+ launcher -> launcher.getStateManager().isInStableState(state.get())
+ && !launcher.getStateManager().isInTransition());
}
protected void waitForResumed(String message) {
diff --git a/tests/src/com/android/launcher3/ui/WorkProfileTest.java b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
index 2087bfe..aca5951 100644
--- a/tests/src/com/android/launcher3/ui/WorkProfileTest.java
+++ b/tests/src/com/android/launcher3/ui/WorkProfileTest.java
@@ -91,9 +91,11 @@
public void workTabExists() {
mDevice.pressHome();
waitForLauncherCondition("Launcher didn't start", Objects::nonNull);
- waitForStableState("Launcher internal state didn't switch to Normal", () -> NORMAL);
+ waitForStateTransitionToEnd("Launcher internal state didn't switch to Normal",
+ () -> NORMAL);
executeOnLauncher(launcher -> launcher.getStateManager().goToState(ALL_APPS));
- waitForStableState("Launcher internal state didn't switch to All Apps", () -> ALL_APPS);
+ waitForStateTransitionToEnd("Launcher internal state didn't switch to All Apps",
+ () -> ALL_APPS);
waitForLauncherCondition("Personal tab is missing",
launcher -> launcher.getAppsView().isPersonalTabVisible(),
LauncherInstrumentation.WAIT_TIME_MS);
diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
index e2d0238..5a807ca 100644
--- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
+++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java
@@ -350,6 +350,10 @@
getTestInfo(TestProtocol.REQUEST_SET_FORCE_PAUSE_TIMEOUT, Long.toString(timeout));
}
+ public void setEnableRotation(boolean on) {
+ getTestInfo(TestProtocol.REQUEST_ENABLE_ROTATION, Boolean.toString(on));
+ }
+
public boolean hadNontestEvents() {
return getTestInfo(TestProtocol.REQUEST_GET_HAD_NONTEST_EVENTS)
.getBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD);