Check for isTaskbarPresent in addition to isTransientTaskbar
when the method is called outside of taskbar.
This prevents the case where phone runs transient taskbar logic.
Bug: 260006210
Test: added local logs, tested in phone mode
Change-Id: I600c06d6c797bd68461ac033dcc2c6158f221024
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 9aedbf8..19ffd2a 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -316,6 +316,7 @@
private final float mQuickSwitchScaleScrollThreshold;
private final int mTaskbarAppWindowThreshold;
+ private final int mTaskbarHomeOverviewThreshold;
private final int mTaskbarCatchUpThreshold;
private boolean mTaskbarAlreadyOpen;
private final boolean mIsTransientTaskbar;
@@ -344,21 +345,29 @@
mContinuingLastGesture = continuingLastGesture;
Resources res = context.getResources();
- mTaskbarAppWindowThreshold = res
- .getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
- ? R.dimen.taskbar_app_window_threshold_v2
- : R.dimen.taskbar_app_window_threshold);
- mTaskbarCatchUpThreshold = res.getDimensionPixelSize(R.dimen.taskbar_catch_up_threshold);
- mIsTransientTaskbar = DisplayController.isTransientTaskbar(mActivity);
-
mQuickSwitchScaleScrollThreshold = res
.getDimension(R.dimen.quick_switch_scaling_scroll_threshold);
mSplashMainWindowShiftLength = -res
.getDimensionPixelSize(R.dimen.starting_surface_exit_animation_window_shift_length);
- initAfterSubclassConstructor();
+ initTransitionEndpoints(mRemoteTargetHandles[0].getTaskViewSimulator()
+ .getOrientationState().getLauncherDeviceProfile());
initStateCallbacks();
+
+ mIsTransientTaskbar = mDp.isTaskbarPresent
+ && DisplayController.isTransientTaskbar(mActivity);
+ TaskbarUIController controller = mActivityInterface.getTaskbarController();
+ mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed();
+ mTaskbarAppWindowThreshold = res
+ .getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
+ ? R.dimen.taskbar_app_window_threshold_v2
+ : R.dimen.taskbar_app_window_threshold);
+ mTaskbarHomeOverviewThreshold = res.getDimensionPixelSize(
+ ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
+ ? R.dimen.taskbar_home_overview_threshold_v2
+ : R.dimen.taskbar_home_overview_threshold);
+ mTaskbarCatchUpThreshold = res.getDimensionPixelSize(R.dimen.taskbar_catch_up_threshold);
}
@Nullable
@@ -737,18 +746,12 @@
}
/**
- * Sets whether or not we should clamp the scroll offset.
- * This is used to avoid x-axis movement when swiping up transient taskbar.
- * @param clampScrollOffset When true, we clamp the scroll to 0 before the clamp threshold is
- * met.
+ * Returns threshold that needs to be met in order for motion pause to be allowed.
*/
- public void setClampScrollOffset(boolean clampScrollOffset) {
- if (mRecentsView == null) {
- mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT,
- () -> mRecentsView.setClampScrollOffset(clampScrollOffset));
- return;
- }
- mRecentsView.setClampScrollOffset(clampScrollOffset);
+ public float getThresholdToAllowMotionPause() {
+ return mIsTransientTaskbar
+ ? mTaskbarHomeOverviewThreshold
+ : 0;
}
public void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask) {
@@ -947,11 +950,34 @@
}
notifyGestureStartedAsync();
setIsLikelyToStartNewTask(isLikelyToStartNewTask, false /* animate */);
+
+ if (mIsTransientTaskbar && !mTaskbarAlreadyOpen && !isLikelyToStartNewTask) {
+ setClampScrollOffset(true);
+ }
mStateCallback.setStateOnUiThread(STATE_GESTURE_STARTED);
mGestureStarted = true;
}
/**
+ * Sets whether or not we should clamp the scroll offset.
+ * This is used to avoid x-axis movement when swiping up transient taskbar.
+ * @param clampScrollOffset When true, we clamp the scroll to 0 before the clamp threshold is
+ * met.
+ */
+ private void setClampScrollOffset(boolean clampScrollOffset) {
+ if (!mIsTransientTaskbar) {
+ return;
+ }
+ if (mRecentsView == null) {
+ mStateCallback.runOnceAtState(STATE_LAUNCHER_PRESENT,
+ () -> mRecentsView.setClampScrollOffset(clampScrollOffset));
+ return;
+ }
+ mRecentsView.setClampScrollOffset(clampScrollOffset);
+ }
+
+
+ /**
* Notifies the launcher that the swipe gesture has started. This can be called multiple times.
*/
@UiThread
@@ -1177,6 +1203,8 @@
float currentShift = mCurrentShift.value;
final GestureEndTarget endTarget = calculateEndTarget(velocity, endVelocity,
isFling, isCancel);
+
+ setClampScrollOffset(false);
// Set the state, but don't notify until the animation completes
mGestureState.setEndTarget(endTarget, false /* isAtomic */);
mAnimationFactory.setEndTarget(endTarget);
@@ -1969,15 +1997,6 @@
|| app.windowConfiguration.getActivityType() == ACTIVITY_TYPE_HOME;
}
- /**
- * To be called at the end of constructor of subclasses. This calls various methods which can
- * depend on proper class initialization.
- */
- protected void initAfterSubclassConstructor() {
- initTransitionEndpoints(mRemoteTargetHandles[0].getTaskViewSimulator()
- .getOrientationState().getLauncherDeviceProfile());
- }
-
protected void performHapticFeedback() {
VibratorWrapper.INSTANCE.get(mContext).vibrate(OVERVIEW_HAPTIC);
}
@@ -2232,13 +2251,6 @@
}
/**
- * Updates the current status of taskbar during this swipe.
- */
- public void setTaskbarAlreadyOpen(boolean taskbarAlreadyOpen) {
- mTaskbarAlreadyOpen = taskbarAlreadyOpen;
- }
-
- /**
* Overrides the gesture displacement to keep the app window at the bottom of the screen while
* the transient taskbar is being swiped in.
*
diff --git a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
index bf666ea..db243da 100644
--- a/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
+++ b/quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java
@@ -27,7 +27,6 @@
import static com.android.launcher3.PagedView.DEBUG_FAILED_QUICKSWITCH;
import static com.android.launcher3.Utilities.EDGE_NAV_BAR;
import static com.android.launcher3.Utilities.squaredHypot;
-import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_REVISED_THRESHOLDS;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
import static com.android.launcher3.util.TraceHelper.FLAG_CHECK_FOR_RACE_CONDITIONS;
import static com.android.launcher3.util.VelocityUtils.PX_PER_MS;
@@ -48,11 +47,9 @@
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
-import com.android.launcher3.taskbar.TaskbarUIController;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.tracing.InputConsumerProto;
-import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.Preconditions;
import com.android.launcher3.util.TraceHelper;
import com.android.quickstep.AbsSwipeUpHandler;
@@ -134,10 +131,6 @@
// Might be displacement in X or Y, depending on the direction we are swiping from the nav bar.
private float mStartDisplacement;
- private final boolean mIsTransientTaskbar;
- private final boolean mTaskbarAlreadyOpen;
- private final int mTaskbarHomeOverviewThreshold;
-
public OtherActivityInputConsumer(Context base, RecentsAnimationDeviceState deviceState,
TaskAnimationManager taskAnimationManager, GestureState gestureState,
boolean isDeferredDownTarget, Consumer<OtherActivityInputConsumer> onCompleteCallback,
@@ -161,14 +154,6 @@
mInputMonitorCompat = inputMonitorCompat;
mInputEventReceiver = inputEventReceiver;
- TaskbarUIController controller = mActivityInterface.getTaskbarController();
- mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed();
- mIsTransientTaskbar = DisplayController.isTransientTaskbar(base);
- mTaskbarHomeOverviewThreshold = base.getResources()
- .getDimensionPixelSize(ENABLE_TASKBAR_REVISED_THRESHOLDS.get()
- ? R.dimen.taskbar_home_overview_threshold_v2
- : R.dimen.taskbar_home_overview_threshold);
-
boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning();
mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget;
@@ -340,10 +325,8 @@
}
if (mDeviceState.isFullyGesturalNavMode()) {
- boolean minSwipeMet = upDist >= mMotionPauseMinDisplacement;
- if (mIsTransientTaskbar) {
- minSwipeMet = upDist >= mTaskbarHomeOverviewThreshold;
- }
+ boolean minSwipeMet = upDist >= Math.max(mMotionPauseMinDisplacement,
+ mInteractionHandler.getThresholdToAllowMotionPause());
mInteractionHandler.setCanSlowSwipeGoHome(minSwipeMet);
mMotionPauseDetector.setDisallowPause(!minSwipeMet
|| isLikelyToStartNewTask);
@@ -379,11 +362,6 @@
// Notify the handler that the gesture has actually started
mInteractionHandler.onGestureStarted(isLikelyToStartNewTask);
-
- mInteractionHandler.setTaskbarAlreadyOpen(mTaskbarAlreadyOpen);
- if (mIsTransientTaskbar && !mTaskbarAlreadyOpen && !isLikelyToStartNewTask) {
- mInteractionHandler.setClampScrollOffset(true);
- }
}
private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
@@ -479,9 +457,6 @@
@UiThread
private void onInteractionGestureFinished() {
Preconditions.assertUIThread();
- if (mInteractionHandler != null) {
- mInteractionHandler.setClampScrollOffset(false);
- }
removeListener();
mInteractionHandler = null;
cleanupAfterGesture();
diff --git a/quickstep/src/com/android/quickstep/views/TaskView.java b/quickstep/src/com/android/quickstep/views/TaskView.java
index 4de69cd..bda30a5 100644
--- a/quickstep/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/src/com/android/quickstep/views/TaskView.java
@@ -1632,7 +1632,7 @@
*/
private static RectF getInsetsToDrawInFullscreen(PreviewPositionHelper pph,
DeviceProfile dp, boolean isTaskbarTransient) {
- if (isTaskbarTransient) {
+ if (dp.isTaskbarPresent && isTaskbarTransient) {
return pph.getClippedInsets();
}
return dp.isTaskbarPresent && !dp.isTaskbarPresentInApps