Loading quickstep/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,10 @@ <dimen name="transient_taskbar_margin">24dp</dimen> <dimen name="transient_taskbar_shadow_blur">40dp</dimen> <dimen name="transient_taskbar_key_shadow_distance">10dp</dimen> <!-- Taskbar swipe up thresholds --> <dimen name="taskbar_app_window_threshold">150dp</dimen> <dimen name="taskbar_home_overview_threshold">225dp</dimen> <dimen name="taskbar_catch_up_threshold">300dp</dimen> <!-- Taskbar 3 button spacing --> <dimen name="taskbar_button_space_inbetween">24dp</dimen> Loading quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +7 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ public class TaskbarUIController { } } /** * Returns true iff taskbar is stashed. */ public boolean isTaskbarStashed() { return mControllers.taskbarStashController.isStashed(); } @CallSuper protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(String.format( Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +54 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import android.app.ActivityManager; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -101,6 +102,7 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.tracing.InputConsumerProto; import com.android.launcher3.tracing.SwipeHandlerProto; import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; Loading Loading @@ -311,6 +313,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Interpolate RecentsView scale from start of quick switch scroll until this scroll threshold private final float mQuickSwitchScaleScrollThreshold; private final int mTaskbarAppWindowThreshold; private final int mTaskbarCatchUpThreshold; private boolean mTaskbarAlreadyOpen; public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs, boolean continuingLastGesture, Loading @@ -331,11 +337,17 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mTaskAnimationManager = taskAnimationManager; mTouchTimeMs = touchTimeMs; mContinuingLastGesture = continuingLastGesture; mQuickSwitchScaleScrollThreshold = context.getResources().getDimension( R.dimen.quick_switch_scaling_scroll_threshold); mSplashMainWindowShiftLength = -context.getResources().getDimensionPixelSize( R.dimen.starting_surface_exit_animation_window_shift_length); Resources res = context.getResources(); mTaskbarAppWindowThreshold = res .getDimensionPixelSize(R.dimen.taskbar_app_window_threshold); mTaskbarCatchUpThreshold = res.getDimensionPixelSize(R.dimen.taskbar_catch_up_threshold); mQuickSwitchScaleScrollThreshold = res .getDimension(R.dimen.quick_switch_scaling_scroll_threshold); mSplashMainWindowShiftLength = -res .getDimensionPixelSize(R.dimen.starting_surface_exit_animation_window_shift_length); initAfterSubclassConstructor(); initStateCallbacks(); Loading Loading @@ -824,7 +836,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return; } mLauncherTransitionController.setProgress( Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor); Math.max(getTaskbarProgress(), getScaleProgressDueToScroll()), mDragLengthFactor); } /** Loading Loading @@ -1170,7 +1182,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } private boolean hasReachedOverviewThreshold() { return mCurrentShift.value > MIN_PROGRESS_FOR_OVERVIEW; return getTaskbarProgress() > MIN_PROGRESS_FOR_OVERVIEW; } @UiThread Loading Loading @@ -2198,7 +2210,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, AnimatorControllerWithResistance playbackController = remoteHandle.getPlaybackController(); if (playbackController != null) { playbackController.setProgress(Math.max(mCurrentShift.value, playbackController.setProgress(Math.max(getTaskbarProgress(), getScaleProgressDueToScroll()), mDragLengthFactor); } Loading Loading @@ -2242,6 +2254,41 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return scaleProgress; } /** * Updates the current status of taskbar during this swipe. */ public void setTaskbarAlreadyOpen(boolean taskbarAlreadyOpen) { mTaskbarAlreadyOpen = taskbarAlreadyOpen; } /** * Overrides the current shift progress to keep the app window at the bottom of the screen * while the transient taskbar is being swiped in. * * There is also a catch up period so that the window can start moving 1:1 with the swipe. */ private float getTaskbarProgress() { if (!DisplayController.isTransientTaskbar(mContext)) { return mCurrentShift.value; } if (mTaskbarAlreadyOpen) { return mCurrentShift.value; } if (mCurrentDisplacement < mTaskbarAppWindowThreshold) { return 0; } // "Catch up" with `mCurrentShift.value`. if (mCurrentDisplacement < mTaskbarCatchUpThreshold) { return Utilities.mapToRange(mCurrentDisplacement, mTaskbarAppWindowThreshold, mTaskbarCatchUpThreshold, 0, mCurrentShift.value, ACCEL_DEACCEL); } return mCurrentShift.value; } private void setDividerShown(boolean shown, boolean immediate) { if (mDividerAnimator != null) { mDividerAnimator.cancel(); Loading quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +3 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public abstract class SwipeUpAnimationLogic implements // 1 => preview snapShot is completely aligned with the recents view and hotseat is completely // visible. protected final AnimatedFloat mCurrentShift = new AnimatedFloat(this::updateFinalShift); protected float mCurrentDisplacement; // The distance needed to drag to reach the task size in recents. protected int mTransitionDragLength; Loading Loading @@ -116,6 +117,8 @@ public abstract class SwipeUpAnimationLogic implements public void updateDisplacement(float displacement) { // We are moving in the negative x/y direction displacement = -displacement; mCurrentDisplacement = displacement; float shift; if (displacement > mTransitionDragLength * mDragLengthFactor && mTransitionDragLength > 0) { shift = mDragLengthFactor; Loading quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +28 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.annotation.TargetApi; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.Resources; import android.graphics.PointF; import android.os.Build; import android.util.Log; Loading @@ -48,13 +49,16 @@ import androidx.annotation.UiThread; 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; import com.android.quickstep.AbsSwipeUpHandler.Factory; import com.android.quickstep.BaseActivityInterface; import com.android.quickstep.GestureState; import com.android.quickstep.InputConsumer; import com.android.quickstep.RecentsAnimationCallbacks; Loading Loading @@ -97,6 +101,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC private final CachedEventDispatcher mRecentsViewDispatcher = new CachedEventDispatcher(); private final InputMonitorCompat mInputMonitorCompat; private final InputEventReceiver mInputEventReceiver; private final BaseActivityInterface mActivityInterface; private final AbsSwipeUpHandler.Factory mHandlerFactory; Loading Loading @@ -131,6 +136,10 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // 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, Loading @@ -142,6 +151,11 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mHandlerFactory = handlerFactory; mActivityInterface = mGestureState.getActivityInterface(); Resources res = base.getResources(); mTaskbarHomeOverviewThreshold = res .getDimensionPixelSize(R.dimen.taskbar_home_overview_threshold); mMotionPauseDetector = new MotionPauseDetector(base, false, mNavBarPosition.isLeftEdge() || mNavBarPosition.isRightEdge() Loading @@ -153,6 +167,10 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mInputMonitorCompat = inputMonitorCompat; mInputEventReceiver = inputEventReceiver; TaskbarUIController controller = mActivityInterface.getTaskbarController(); mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed(); mIsTransientTaskbar = DisplayController.isTransientTaskbar(base); boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning(); mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget; Loading Loading @@ -279,6 +297,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC float upDist = -displacement; boolean passedSlop = squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop; if (!mPassedSlopOnThisGesture && passedSlop) { mPassedSlopOnThisGesture = true; } Loading Loading @@ -323,7 +342,13 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } if (mDeviceState.isFullyGesturalNavMode()) { mMotionPauseDetector.setDisallowPause(upDist < mMotionPauseMinDisplacement float minDisplacement = mMotionPauseMinDisplacement; if (mIsTransientTaskbar && !mTaskbarAlreadyOpen) { minDisplacement += mTaskbarHomeOverviewThreshold; } mMotionPauseDetector.setDisallowPause(upDist < minDisplacement || isLikelyToStartNewTask); mMotionPauseDetector.addPosition(ev); mInteractionHandler.setIsLikelyToStartNewTask(isLikelyToStartNewTask); Loading Loading @@ -357,6 +382,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // Notify the handler that the gesture has actually started mInteractionHandler.onGestureStarted(isLikelyToStartNewTask); mInteractionHandler.setTaskbarAlreadyOpen(mTaskbarAlreadyOpen); } private void startTouchTrackingForWindowAnimation(long touchTimeMs) { Loading Loading
quickstep/res/values/dimens.xml +4 −0 Original line number Diff line number Diff line Loading @@ -288,6 +288,10 @@ <dimen name="transient_taskbar_margin">24dp</dimen> <dimen name="transient_taskbar_shadow_blur">40dp</dimen> <dimen name="transient_taskbar_key_shadow_distance">10dp</dimen> <!-- Taskbar swipe up thresholds --> <dimen name="taskbar_app_window_threshold">150dp</dimen> <dimen name="taskbar_home_overview_threshold">225dp</dimen> <dimen name="taskbar_catch_up_threshold">300dp</dimen> <!-- Taskbar 3 button spacing --> <dimen name="taskbar_button_space_inbetween">24dp</dimen> Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarUIController.java +7 −0 Original line number Diff line number Diff line Loading @@ -97,6 +97,13 @@ public class TaskbarUIController { } } /** * Returns true iff taskbar is stashed. */ public boolean isTaskbarStashed() { return mControllers.taskbarStashController.isStashed(); } @CallSuper protected void dumpLogs(String prefix, PrintWriter pw) { pw.println(String.format( Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +54 −7 Original line number Diff line number Diff line Loading @@ -64,6 +64,7 @@ import android.app.ActivityManager; import android.app.WindowConfiguration; import android.content.Context; import android.content.Intent; import android.content.res.Resources; import android.graphics.Matrix; import android.graphics.PointF; import android.graphics.Rect; Loading Loading @@ -101,6 +102,7 @@ import com.android.launcher3.statemanager.StatefulActivity; import com.android.launcher3.tracing.InputConsumerProto; import com.android.launcher3.tracing.SwipeHandlerProto; import com.android.launcher3.util.ActivityLifecycleCallbacksAdapter; import com.android.launcher3.util.DisplayController; import com.android.launcher3.util.TraceHelper; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; Loading Loading @@ -311,6 +313,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Interpolate RecentsView scale from start of quick switch scroll until this scroll threshold private final float mQuickSwitchScaleScrollThreshold; private final int mTaskbarAppWindowThreshold; private final int mTaskbarCatchUpThreshold; private boolean mTaskbarAlreadyOpen; public AbsSwipeUpHandler(Context context, RecentsAnimationDeviceState deviceState, TaskAnimationManager taskAnimationManager, GestureState gestureState, long touchTimeMs, boolean continuingLastGesture, Loading @@ -331,11 +337,17 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mTaskAnimationManager = taskAnimationManager; mTouchTimeMs = touchTimeMs; mContinuingLastGesture = continuingLastGesture; mQuickSwitchScaleScrollThreshold = context.getResources().getDimension( R.dimen.quick_switch_scaling_scroll_threshold); mSplashMainWindowShiftLength = -context.getResources().getDimensionPixelSize( R.dimen.starting_surface_exit_animation_window_shift_length); Resources res = context.getResources(); mTaskbarAppWindowThreshold = res .getDimensionPixelSize(R.dimen.taskbar_app_window_threshold); mTaskbarCatchUpThreshold = res.getDimensionPixelSize(R.dimen.taskbar_catch_up_threshold); mQuickSwitchScaleScrollThreshold = res .getDimension(R.dimen.quick_switch_scaling_scroll_threshold); mSplashMainWindowShiftLength = -res .getDimensionPixelSize(R.dimen.starting_surface_exit_animation_window_shift_length); initAfterSubclassConstructor(); initStateCallbacks(); Loading Loading @@ -824,7 +836,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return; } mLauncherTransitionController.setProgress( Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor); Math.max(getTaskbarProgress(), getScaleProgressDueToScroll()), mDragLengthFactor); } /** Loading Loading @@ -1170,7 +1182,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } private boolean hasReachedOverviewThreshold() { return mCurrentShift.value > MIN_PROGRESS_FOR_OVERVIEW; return getTaskbarProgress() > MIN_PROGRESS_FOR_OVERVIEW; } @UiThread Loading Loading @@ -2198,7 +2210,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, AnimatorControllerWithResistance playbackController = remoteHandle.getPlaybackController(); if (playbackController != null) { playbackController.setProgress(Math.max(mCurrentShift.value, playbackController.setProgress(Math.max(getTaskbarProgress(), getScaleProgressDueToScroll()), mDragLengthFactor); } Loading Loading @@ -2242,6 +2254,41 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return scaleProgress; } /** * Updates the current status of taskbar during this swipe. */ public void setTaskbarAlreadyOpen(boolean taskbarAlreadyOpen) { mTaskbarAlreadyOpen = taskbarAlreadyOpen; } /** * Overrides the current shift progress to keep the app window at the bottom of the screen * while the transient taskbar is being swiped in. * * There is also a catch up period so that the window can start moving 1:1 with the swipe. */ private float getTaskbarProgress() { if (!DisplayController.isTransientTaskbar(mContext)) { return mCurrentShift.value; } if (mTaskbarAlreadyOpen) { return mCurrentShift.value; } if (mCurrentDisplacement < mTaskbarAppWindowThreshold) { return 0; } // "Catch up" with `mCurrentShift.value`. if (mCurrentDisplacement < mTaskbarCatchUpThreshold) { return Utilities.mapToRange(mCurrentDisplacement, mTaskbarAppWindowThreshold, mTaskbarCatchUpThreshold, 0, mCurrentShift.value, ACCEL_DEACCEL); } return mCurrentShift.value; } private void setDividerShown(boolean shown, boolean immediate) { if (mDividerAnimator != null) { mDividerAnimator.cancel(); Loading
quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +3 −0 Original line number Diff line number Diff line Loading @@ -65,6 +65,7 @@ public abstract class SwipeUpAnimationLogic implements // 1 => preview snapShot is completely aligned with the recents view and hotseat is completely // visible. protected final AnimatedFloat mCurrentShift = new AnimatedFloat(this::updateFinalShift); protected float mCurrentDisplacement; // The distance needed to drag to reach the task size in recents. protected int mTransitionDragLength; Loading Loading @@ -116,6 +117,8 @@ public abstract class SwipeUpAnimationLogic implements public void updateDisplacement(float displacement) { // We are moving in the negative x/y direction displacement = -displacement; mCurrentDisplacement = displacement; float shift; if (displacement > mTransitionDragLength * mDragLengthFactor && mTransitionDragLength > 0) { shift = mDragLengthFactor; Loading
quickstep/src/com/android/quickstep/inputconsumers/OtherActivityInputConsumer.java +28 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import android.annotation.TargetApi; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.res.Resources; import android.graphics.PointF; import android.os.Build; import android.util.Log; Loading @@ -48,13 +49,16 @@ import androidx.annotation.UiThread; 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; import com.android.quickstep.AbsSwipeUpHandler.Factory; import com.android.quickstep.BaseActivityInterface; import com.android.quickstep.GestureState; import com.android.quickstep.InputConsumer; import com.android.quickstep.RecentsAnimationCallbacks; Loading Loading @@ -97,6 +101,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC private final CachedEventDispatcher mRecentsViewDispatcher = new CachedEventDispatcher(); private final InputMonitorCompat mInputMonitorCompat; private final InputEventReceiver mInputEventReceiver; private final BaseActivityInterface mActivityInterface; private final AbsSwipeUpHandler.Factory mHandlerFactory; Loading Loading @@ -131,6 +136,10 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // 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, Loading @@ -142,6 +151,11 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mTaskAnimationManager = taskAnimationManager; mGestureState = gestureState; mHandlerFactory = handlerFactory; mActivityInterface = mGestureState.getActivityInterface(); Resources res = base.getResources(); mTaskbarHomeOverviewThreshold = res .getDimensionPixelSize(R.dimen.taskbar_home_overview_threshold); mMotionPauseDetector = new MotionPauseDetector(base, false, mNavBarPosition.isLeftEdge() || mNavBarPosition.isRightEdge() Loading @@ -153,6 +167,10 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC mInputMonitorCompat = inputMonitorCompat; mInputEventReceiver = inputEventReceiver; TaskbarUIController controller = mActivityInterface.getTaskbarController(); mTaskbarAlreadyOpen = controller != null && !controller.isTaskbarStashed(); mIsTransientTaskbar = DisplayController.isTransientTaskbar(base); boolean continuingPreviousGesture = mTaskAnimationManager.isRecentsAnimationRunning(); mIsDeferredDownTarget = !continuingPreviousGesture && isDeferredDownTarget; Loading Loading @@ -279,6 +297,7 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC float upDist = -displacement; boolean passedSlop = squaredHypot(displacementX, displacementY) >= mSquaredTouchSlop; if (!mPassedSlopOnThisGesture && passedSlop) { mPassedSlopOnThisGesture = true; } Loading Loading @@ -323,7 +342,13 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC } if (mDeviceState.isFullyGesturalNavMode()) { mMotionPauseDetector.setDisallowPause(upDist < mMotionPauseMinDisplacement float minDisplacement = mMotionPauseMinDisplacement; if (mIsTransientTaskbar && !mTaskbarAlreadyOpen) { minDisplacement += mTaskbarHomeOverviewThreshold; } mMotionPauseDetector.setDisallowPause(upDist < minDisplacement || isLikelyToStartNewTask); mMotionPauseDetector.addPosition(ev); mInteractionHandler.setIsLikelyToStartNewTask(isLikelyToStartNewTask); Loading Loading @@ -357,6 +382,8 @@ public class OtherActivityInputConsumer extends ContextWrapper implements InputC // Notify the handler that the gesture has actually started mInteractionHandler.onGestureStarted(isLikelyToStartNewTask); mInteractionHandler.setTaskbarAlreadyOpen(mTaskbarAlreadyOpen); } private void startTouchTrackingForWindowAnimation(long touchTimeMs) { Loading