Merge "Fix TaplTestsLauncher.testWorkspace's page expectation for 2 panel" into sc-v2-dev
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 6423352..c04d15f 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -233,6 +233,7 @@
// Used to control launcher components throughout the swipe gesture.
private AnimatorControllerWithResistance mLauncherTransitionController;
+ private boolean mHasEndedLauncherTransition;
private AnimationFactory mAnimationFactory = (t) -> { };
@@ -617,11 +618,11 @@
/**
* We don't want to change mLauncherTransitionController if mGestureState.getEndTarget() == HOME
- * (it has its own animation).
+ * (it has its own animation) or if we explicitly ended the controller already.
* @return Whether we can create the launcher controller or update its progress.
*/
private boolean canCreateNewOrUpdateExistingLauncherTransitionController() {
- return mGestureState.getEndTarget() != HOME;
+ return mGestureState.getEndTarget() != HOME && !mHasEndedLauncherTransition;
}
@Override
@@ -1456,6 +1457,8 @@
}
private void endLauncherTransitionController() {
+ mHasEndedLauncherTransition = true;
+
if (mLauncherTransitionController != null) {
// End the animation, but stay at the same visual progress.
mLauncherTransitionController.getNormalController().dispatchSetInterpolator(
diff --git a/quickstep/src/com/android/quickstep/views/RecentsView.java b/quickstep/src/com/android/quickstep/views/RecentsView.java
index 538f626..0103acf 100644
--- a/quickstep/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/src/com/android/quickstep/views/RecentsView.java
@@ -870,10 +870,12 @@
}
public void launchSideTaskInLiveTileModeForRestartedApp(int taskId) {
- if (mRunningTaskId != -1 && mRunningTaskId == taskId &&
- getLiveTileParams().getTargetSet().findTask(taskId) != null) {
+ if (mRunningTaskId != -1 && mRunningTaskId == taskId) {
RemoteAnimationTargets targets = getLiveTileParams().getTargetSet();
- launchSideTaskInLiveTileMode(taskId, targets.apps, targets.wallpapers, targets.nonApps);
+ if (targets != null && targets.findTask(taskId) != null) {
+ launchSideTaskInLiveTileMode(taskId, targets.apps, targets.wallpapers,
+ targets.nonApps);
+ }
}
}
@@ -1298,8 +1300,14 @@
}
private void updateOrientationHandler() {
+ updateOrientationHandler(true);
+ }
+
+ private void updateOrientationHandler(boolean forceRecreateDragLayerControllers) {
// Handle orientation changes.
+ PagedOrientationHandler oldOrientationHandler = mOrientationHandler;
mOrientationHandler = mOrientationState.getOrientationHandler();
+
mIsRtl = mOrientationHandler.getRecentsRtlSetting(getResources());
setLayoutDirection(mIsRtl
? View.LAYOUT_DIRECTION_RTL
@@ -1308,7 +1316,13 @@
? View.LAYOUT_DIRECTION_LTR
: View.LAYOUT_DIRECTION_RTL);
mClearAllButton.setRotation(mOrientationHandler.getDegreesRotated());
- mActivity.getDragLayer().recreateControllers();
+
+ if (forceRecreateDragLayerControllers
+ || !mOrientationHandler.equals(oldOrientationHandler)) {
+ // Changed orientations, update controllers so they intercept accordingly.
+ mActivity.getDragLayer().recreateControllers();
+ }
+
boolean isInLandscape = mOrientationState.getTouchRotation() != ROTATION_0
|| mOrientationState.getRecentsActivityRotation() != ROTATION_0;
mActionsView.updateHiddenFlags(HIDDEN_NON_ZERO_ROTATION,
@@ -1636,7 +1650,7 @@
setCurrentPage(0);
LayoutUtils.setViewEnabled(mActionsView, true);
if (mOrientationState.setGestureActive(false)) {
- updateOrientationHandler();
+ updateOrientationHandler(/* forceRecreateDragLayerControllers = */ false);
}
});
}
diff --git a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
index a5038a1..9a6eda4 100644
--- a/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
+++ b/quickstep/tests/src/com/android/quickstep/TaplTestsQuickstep.java
@@ -23,7 +23,6 @@
import static org.junit.Assert.assertTrue;
import android.content.Intent;
-import android.util.Log;
import androidx.test.filters.LargeTest;
import androidx.test.runner.AndroidJUnit4;
@@ -37,8 +36,8 @@
import com.android.launcher3.tapl.Overview;
import com.android.launcher3.tapl.OverviewActions;
import com.android.launcher3.tapl.OverviewTask;
-import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.ui.TaplTestsLauncher3;
+import com.android.launcher3.util.rule.ScreenRecordRule.ScreenRecord;
import com.android.quickstep.NavigationModeSwitchRule.NavigationModeSwitch;
import com.android.quickstep.views.RecentsView;
@@ -94,6 +93,7 @@
@Test
@PortraitLandscape
+ @ScreenRecord //b/191344757
public void testOverview() throws Exception {
startTestAppsWithCheck();
// mLauncher.pressHome() also tests an important case of pressing home while in background.
@@ -163,6 +163,7 @@
@Test
@NavigationModeSwitch
@PortraitLandscape
+ @ScreenRecord //b/191344757
public void testOverviewActions() throws Exception {
// Experimenting for b/165029151:
final Overview overview = mLauncher.pressHome().switchToOverview();
@@ -188,6 +189,7 @@
@Test
@NavigationModeSwitch
@PortraitLandscape
+ @ScreenRecord //b/191344757
public void testSwitchToOverview() throws Exception {
assertNotNull("Workspace.switchToOverview() returned null",
mLauncher.pressHome().switchToOverview());
@@ -198,6 +200,7 @@
@Test
@NavigationModeSwitch
@PortraitLandscape
+ @ScreenRecord //b/191344757
public void testBackground() throws Exception {
startAppFast(resolveSystemApp(Intent.CATEGORY_APP_CALCULATOR));
final Background background = getAndAssertBackground();
@@ -219,6 +222,7 @@
@Test
@PortraitLandscape
+ @ScreenRecord //b/191344757
public void testAllAppsFromHome() throws Exception {
// Test opening all apps
assertNotNull("switchToAllApps() returned null",
diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java
index d1e643f..516af59 100644
--- a/src/com/android/launcher3/allapps/AllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java
@@ -51,7 +51,6 @@
import androidx.annotation.StringRes;
import androidx.annotation.VisibleForTesting;
import androidx.core.graphics.ColorUtils;
-import androidx.core.os.BuildCompat;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
@@ -188,11 +187,11 @@
Bundle state = (Bundle) sparseArray.get(R.id.work_tab_state_id, null);
if (state != null) {
int currentPage = state.getInt(BUNDLE_KEY_CURRENT_PAGE, 0);
- if (currentPage != 0) {
+ if (currentPage != 0 && mViewPager != null) {
mViewPager.setCurrentPage(currentPage);
rebindAdapters(true);
} else {
- mSearchUiManager.resetSearch();
+ reset(true);
}
}
@@ -260,21 +259,6 @@
mWorkAdapterProvider.updateCurrentState(isEnabled);
}
- private void hideInput() {
- if (!BuildCompat.isAtLeastR() || !FeatureFlags.ENABLE_DEVICE_SEARCH.get()) return;
-
- WindowInsets insets = getRootWindowInsets();
- if (insets == null) return;
-
- if (insets.isVisible(WindowInsets.Type.ime())) {
- hideIme();
- }
- }
-
- protected void hideIme() {
- getWindowInsetsController().hide(WindowInsets.Type.ime());
- }
-
/**
* Returns whether the view itself will handle the touch event or not.
*/
@@ -290,7 +274,6 @@
}
if (rv.getScrollbar().getThumbOffsetY() >= 0 &&
mLauncher.getDragLayer().isEventOverView(rv.getScrollbar(), ev)) {
- hideInput();
return false;
}
return rv.shouldContainerScroll(ev, mLauncher.getDragLayer());
diff --git a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
index 1eb726c..f64b7cb 100644
--- a/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
+++ b/src/com/android/launcher3/allapps/LauncherAllAppsContainerView.java
@@ -15,8 +15,6 @@
*/
package com.android.launcher3.allapps;
-import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_ALLAPPS_KEYBOARD_CLOSED;
-
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
@@ -88,10 +86,4 @@
public void onActivePageChanged(int currentActivePage) {
super.onActivePageChanged(currentActivePage);
}
-
- @Override
- protected void hideIme() {
- super.hideIme();
- mLauncher.getStatsLogManager().logger().log(LAUNCHER_ALLAPPS_KEYBOARD_CLOSED);
- }
}