Loading quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +13 −3 Original line number Diff line number Diff line Loading @@ -16,10 +16,11 @@ package com.android.launcher3.taskbar import android.graphics.Insets import android.graphics.Region import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES import android.view.WindowManager import com.android.launcher3.AbstractFloatingView import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.quickstep.KtR Loading @@ -36,6 +37,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask /** The bottom insets taskbar provides to the IME when IME is visible. */ val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize( KtR.dimen.taskbar_ime_size) private val contentRegion: Region = Region() // Initialized in init. private lateinit var controllers: TaskbarControllers Loading @@ -50,7 +52,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask windowLayoutParams, intArrayOf( ITYPE_EXTRA_NAVIGATION_BAR, ITYPE_BOTTOM_TAPPABLE_ELEMENT ITYPE_BOTTOM_TAPPABLE_ELEMENT, ITYPE_BOTTOM_MANDATORY_GESTURES ) ) Loading @@ -67,14 +70,20 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask fun onTaskbarWindowHeightOrInsetsChanged() { var reducingSize = getReducingInsetsForTaskbarInsetsHeight( controllers.taskbarStashController.contentHeightToReportToApps) contentRegion.set(0, reducingSize.top, context.dragLayer.width, windowLayoutParams.height) windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize reducingSize = getReducingInsetsForTaskbarInsetsHeight( controllers.taskbarStashController.tappableHeightToReportToApps) windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize reducingSize = getReducingInsetsForTaskbarInsetsHeight(taskbarHeightForIme) windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize } /** Loading Loading @@ -121,7 +130,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask if (context.isTaskbarWindowFullscreen) { InsetsInfo.TOUCHABLE_INSETS_FRAME } else { InsetsInfo.TOUCHABLE_INSETS_CONTENT insetsInfo.touchableRegion.set(contentRegion) InsetsInfo.TOUCHABLE_INSETS_REGION } ) insetsIsTouchableRegion = false Loading quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +4 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import com.android.launcher3.util.Themes; */ public class AllAppsState extends LauncherState { private static final float WORKSPACE_SCALE_FACTOR = 0.97f; private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS | FLAG_HOTSEAT_INACCESSIBLE; Loading Loading @@ -58,7 +60,7 @@ public class AllAppsState extends LauncherState { @Override public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { return new ScaleAndTranslation(0.97f, NO_OFFSET, NO_OFFSET); return new ScaleAndTranslation(WORKSPACE_SCALE_FACTOR, NO_OFFSET, NO_OFFSET); } @Override Loading @@ -69,7 +71,7 @@ public class AllAppsState extends LauncherState { ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW .getWorkspaceScaleAndTranslation(launcher); return new ScaleAndTranslation( NO_SCALE, WORKSPACE_SCALE_FACTOR, overviewScaleAndTranslation.translationX, overviewScaleAndTranslation.translationY); } Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +70 −18 Original line number Diff line number Diff line Loading @@ -25,9 +25,17 @@ import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import android.view.MotionEvent; import android.view.animation.Interpolator; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; Loading Loading @@ -70,6 +78,28 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr */ public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f; // Custom timing for NORMAL -> ALL_APPS on phones only. private static final float ALL_APPS_STATE_TRANSITION = 0.4f; // Custom interpolators for NORMAL -> ALL_APPS on phones only. private static final Interpolator LINEAR_EARLY = Interpolators.clampToProgress(LINEAR, 0f, ALL_APPS_STATE_TRANSITION); private static final Interpolator STEP_TRANSITION = Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION); public static final Interpolator BLUR = LINEAR_EARLY; public static final Interpolator WORKSPACE_FADE = STEP_TRANSITION; public static final Interpolator WORKSPACE_SCALE = LINEAR_EARLY; public static final Interpolator HOTSEAT_FADE = STEP_TRANSITION; public static final Interpolator HOTSEAT_SCALE = LINEAR_EARLY; public static final Interpolator HOTSEAT_TRANSLATE = STEP_TRANSITION; public static final Interpolator SCRIM_FADE = LINEAR_EARLY; public static final Interpolator ALL_APPS_FADE = Interpolators.clampToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1f); public static final Interpolator ALL_APPS_VERTICAL_PROGRESS = Interpolators.clampToProgress( Interpolators.mapToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1.0f), ALL_APPS_STATE_TRANSITION, 1.0f); private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper; public PortraitStatesTouchController(Launcher l) { Loading Loading @@ -127,29 +157,51 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr private StateAnimationConfig getNormalToAllAppsAnimation() { StateAnimationConfig builder = new StateAnimationConfig(); boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? INSTANT : Interpolators.clampToProgress(LINEAR, ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, if (mLauncher.getDeviceProfile().isTablet) { builder.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD)); } else { // TODO(b/231682175): centralize this setup in AllAppsSwipeController. builder.setInterpolator(ANIM_DEPTH, BLUR); builder.setInterpolator(ANIM_WORKSPACE_FADE, WORKSPACE_FADE); builder.setInterpolator(ANIM_WORKSPACE_SCALE, WORKSPACE_SCALE); builder.setInterpolator(ANIM_HOTSEAT_FADE, HOTSEAT_FADE); builder.setInterpolator(ANIM_HOTSEAT_SCALE, HOTSEAT_SCALE); builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE, HOTSEAT_TRANSLATE); builder.setInterpolator(ANIM_SCRIM_FADE, SCRIM_FADE); builder.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_FADE); builder.setInterpolator(ANIM_VERTICAL_PROGRESS, ALL_APPS_VERTICAL_PROGRESS); } return builder; } private StateAnimationConfig getAllAppsToNormalAnimation() { StateAnimationConfig builder = new StateAnimationConfig(); boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? FINAL_FRAME : Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, if (mLauncher.getDeviceProfile().isTablet) { builder.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); } else { // These interpolators are the reverse of the ones used above, so swiping out of All // Apps feels the same as swiping into it. // TODO(b/231682175): centralize this setup in AllAppsSwipeController. builder.setInterpolator(ANIM_DEPTH, Interpolators.reverse(BLUR)); builder.setInterpolator(ANIM_WORKSPACE_FADE, Interpolators.reverse(WORKSPACE_FADE)); builder.setInterpolator(ANIM_WORKSPACE_SCALE, Interpolators.reverse(WORKSPACE_SCALE)); builder.setInterpolator(ANIM_HOTSEAT_FADE, Interpolators.reverse(HOTSEAT_FADE)); builder.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(HOTSEAT_SCALE)); builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE, Interpolators.reverse(HOTSEAT_TRANSLATE)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(SCRIM_FADE)); builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.reverse(ALL_APPS_FADE)); builder.setInterpolator(ANIM_VERTICAL_PROGRESS, Interpolators.reverse(ALL_APPS_VERTICAL_PROGRESS)); } return builder; } Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +25 −16 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Null if the recents animation hasn't started yet or has been canceled or finished. protected @Nullable RecentsAnimationController mRecentsAnimationController; protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; protected T mActivity; protected Q mRecentsView; Loading Loading @@ -435,6 +436,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsView.switchToScreenshot(snapshots, () -> { if (mRecentsAnimationController != null) { mRecentsAnimationController.cleanupScreenshot(); } else if (mDeferredCleanupRecentsAnimationController != null) { mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); mDeferredCleanupRecentsAnimationController = null; } }); mRecentsView.onRecentsAnimationComplete(); Loading Loading @@ -839,6 +843,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) { ActiveGestureLog.INSTANCE.addLog("cancelRecentsAnimation"); mActivityInitListener.unregister(); // Cache the recents animation controller so we can defer its cleanup to after having // properly cleaned up the screenshot without accidentally using it. mDeferredCleanupRecentsAnimationController = mRecentsAnimationController; mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED); if (mRecentsAnimationTargets != null) { Loading Loading @@ -1025,19 +1032,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return RECENTS; } final GestureEndTarget endTarget; final boolean canGoToNewTask; final boolean goingToNewTask; if (mRecentsView != null) { if (!hasTargets()) { // If there are no running tasks, then we can assume that this is a continuation of // the last gesture, but after the recents animation has finished canGoToNewTask = true; goingToNewTask = true; } else { final int runningTaskIndex = mRecentsView.getRunningTaskIndex(); final int taskToLaunch = mRecentsView.getNextPage(); canGoToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; goingToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; } } else { canGoToNewTask = false; goingToNewTask = false; } final boolean reachedOverviewThreshold = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW; final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() Loading @@ -1046,13 +1053,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { if (canGoToNewTask && isFlingX) { if (goingToNewTask && isFlingX) { // Flinging towards new task takes precedence over mIsMotionPaused (which only // checks y-velocity). endTarget = NEW_TASK; } else if (mIsMotionPaused) { endTarget = RECENTS; } else if (canGoToNewTask) { } else if (goingToNewTask) { endTarget = NEW_TASK; } else { endTarget = !reachedOverviewThreshold ? LAST_TASK : HOME; Loading @@ -1060,22 +1067,26 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } else { endTarget = reachedOverviewThreshold && mGestureStarted ? RECENTS : canGoToNewTask : goingToNewTask ? NEW_TASK : LAST_TASK; } } else { // If swiping at a diagonal, base end target on the faster velocity. boolean isSwipeUp = endVelocity < 0; boolean willGoToNewTask = canGoToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); boolean willGoToNewTaskOnSwipeUp = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { endTarget = willGoToNewTask ? NEW_TASK : HOME; if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) { endTarget = HOME; } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { // If swiping at a diagonal, base end target on the faster velocity. endTarget = NEW_TASK; } else if (isSwipeUp) { endTarget = (!reachedOverviewThreshold && willGoToNewTask) ? NEW_TASK : RECENTS; endTarget = !reachedOverviewThreshold && willGoToNewTaskOnSwipeUp ? NEW_TASK : RECENTS; } else { endTarget = willGoToNewTask ? NEW_TASK : LAST_TASK; // Swipe is downward. endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } } Loading Loading @@ -1160,8 +1171,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } } } else if (endTarget == LAST_TASK && mRecentsView != null) { mRecentsView.snapToPage(mRecentsView.getCurrentPage(), Math.toIntExact(duration)); } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask() Loading quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public class SurfaceTransactionApplier extends ReleaseCheck { mTargetViewRootImpl = targetView.getViewRootImpl(); mBarrierSurfaceControl = mTargetViewRootImpl.getSurfaceControl(); mApplyHandler = new Handler(this::onApplyMessage); setCanRelease(true); } protected boolean onApplyMessage(Message msg) { Loading Loading
quickstep/src/com/android/launcher3/taskbar/TaskbarInsetsController.kt +13 −3 Original line number Diff line number Diff line Loading @@ -16,10 +16,11 @@ package com.android.launcher3.taskbar import android.graphics.Insets import android.graphics.Region import android.view.InsetsState.ITYPE_BOTTOM_MANDATORY_GESTURES import android.view.WindowManager import com.android.launcher3.AbstractFloatingView import com.android.launcher3.AbstractFloatingView.TYPE_TASKBAR_ALL_APPS import com.android.launcher3.R import com.android.launcher3.anim.AlphaUpdateListener import com.android.launcher3.taskbar.TaskbarControllers.LoggableTaskbarController import com.android.quickstep.KtR Loading @@ -36,6 +37,7 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask /** The bottom insets taskbar provides to the IME when IME is visible. */ val taskbarHeightForIme: Int = context.resources.getDimensionPixelSize( KtR.dimen.taskbar_ime_size) private val contentRegion: Region = Region() // Initialized in init. private lateinit var controllers: TaskbarControllers Loading @@ -50,7 +52,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask windowLayoutParams, intArrayOf( ITYPE_EXTRA_NAVIGATION_BAR, ITYPE_BOTTOM_TAPPABLE_ELEMENT ITYPE_BOTTOM_TAPPABLE_ELEMENT, ITYPE_BOTTOM_MANDATORY_GESTURES ) ) Loading @@ -67,14 +70,20 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask fun onTaskbarWindowHeightOrInsetsChanged() { var reducingSize = getReducingInsetsForTaskbarInsetsHeight( controllers.taskbarStashController.contentHeightToReportToApps) contentRegion.set(0, reducingSize.top, context.dragLayer.width, windowLayoutParams.height) windowLayoutParams.providedInternalInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize reducingSize = getReducingInsetsForTaskbarInsetsHeight( controllers.taskbarStashController.tappableHeightToReportToApps) windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize windowLayoutParams.providedInternalInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize reducingSize = getReducingInsetsForTaskbarInsetsHeight(taskbarHeightForIme) windowLayoutParams.providedInternalImeInsets[ITYPE_EXTRA_NAVIGATION_BAR] = reducingSize windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_TAPPABLE_ELEMENT] = reducingSize windowLayoutParams.providedInternalImeInsets[ITYPE_BOTTOM_MANDATORY_GESTURES] = reducingSize } /** Loading Loading @@ -121,7 +130,8 @@ class TaskbarInsetsController(val context: TaskbarActivityContext): LoggableTask if (context.isTaskbarWindowFullscreen) { InsetsInfo.TOUCHABLE_INSETS_FRAME } else { InsetsInfo.TOUCHABLE_INSETS_CONTENT insetsInfo.touchableRegion.set(contentRegion) InsetsInfo.TOUCHABLE_INSETS_REGION } ) insetsIsTouchableRegion = false Loading
quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java +4 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,8 @@ import com.android.launcher3.util.Themes; */ public class AllAppsState extends LauncherState { private static final float WORKSPACE_SCALE_FACTOR = 0.97f; private static final int STATE_FLAGS = FLAG_WORKSPACE_INACCESSIBLE | FLAG_CLOSE_POPUPS | FLAG_HOTSEAT_INACCESSIBLE; Loading Loading @@ -58,7 +60,7 @@ public class AllAppsState extends LauncherState { @Override public ScaleAndTranslation getWorkspaceScaleAndTranslation(Launcher launcher) { return new ScaleAndTranslation(0.97f, NO_OFFSET, NO_OFFSET); return new ScaleAndTranslation(WORKSPACE_SCALE_FACTOR, NO_OFFSET, NO_OFFSET); } @Override Loading @@ -69,7 +71,7 @@ public class AllAppsState extends LauncherState { ScaleAndTranslation overviewScaleAndTranslation = LauncherState.OVERVIEW .getWorkspaceScaleAndTranslation(launcher); return new ScaleAndTranslation( NO_SCALE, WORKSPACE_SCALE_FACTOR, overviewScaleAndTranslation.translationX, overviewScaleAndTranslation.translationY); } Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/PortraitStatesTouchController.java +70 −18 Original line number Diff line number Diff line Loading @@ -25,9 +25,17 @@ import static com.android.launcher3.anim.Interpolators.FINAL_FRAME; import static com.android.launcher3.anim.Interpolators.INSTANT; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_SCALE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_HOTSEAT_TRANSLATE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_SCRIM_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_VERTICAL_PROGRESS; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_FADE; import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_SCALE; import android.view.MotionEvent; import android.view.animation.Interpolator; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; Loading Loading @@ -70,6 +78,28 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr */ public static final float ALL_APPS_SCRIM_OPAQUE_THRESHOLD = .5f; // Custom timing for NORMAL -> ALL_APPS on phones only. private static final float ALL_APPS_STATE_TRANSITION = 0.4f; // Custom interpolators for NORMAL -> ALL_APPS on phones only. private static final Interpolator LINEAR_EARLY = Interpolators.clampToProgress(LINEAR, 0f, ALL_APPS_STATE_TRANSITION); private static final Interpolator STEP_TRANSITION = Interpolators.clampToProgress(FINAL_FRAME, 0f, ALL_APPS_STATE_TRANSITION); public static final Interpolator BLUR = LINEAR_EARLY; public static final Interpolator WORKSPACE_FADE = STEP_TRANSITION; public static final Interpolator WORKSPACE_SCALE = LINEAR_EARLY; public static final Interpolator HOTSEAT_FADE = STEP_TRANSITION; public static final Interpolator HOTSEAT_SCALE = LINEAR_EARLY; public static final Interpolator HOTSEAT_TRANSLATE = STEP_TRANSITION; public static final Interpolator SCRIM_FADE = LINEAR_EARLY; public static final Interpolator ALL_APPS_FADE = Interpolators.clampToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1f); public static final Interpolator ALL_APPS_VERTICAL_PROGRESS = Interpolators.clampToProgress( Interpolators.mapToProgress(LINEAR, ALL_APPS_STATE_TRANSITION, 1.0f), ALL_APPS_STATE_TRANSITION, 1.0f); private final PortraitOverviewStateTouchHelper mOverviewPortraitStateTouchHelper; public PortraitStatesTouchController(Launcher l) { Loading Loading @@ -127,29 +157,51 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr private StateAnimationConfig getNormalToAllAppsAnimation() { StateAnimationConfig builder = new StateAnimationConfig(); boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? INSTANT : Interpolators.clampToProgress(LINEAR, ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD, ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, if (mLauncher.getDeviceProfile().isTablet) { builder.setInterpolator(ANIM_ALL_APPS_FADE, INSTANT); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, ALL_APPS_SCRIM_VISIBLE_THRESHOLD, ALL_APPS_SCRIM_OPAQUE_THRESHOLD)); } else { // TODO(b/231682175): centralize this setup in AllAppsSwipeController. builder.setInterpolator(ANIM_DEPTH, BLUR); builder.setInterpolator(ANIM_WORKSPACE_FADE, WORKSPACE_FADE); builder.setInterpolator(ANIM_WORKSPACE_SCALE, WORKSPACE_SCALE); builder.setInterpolator(ANIM_HOTSEAT_FADE, HOTSEAT_FADE); builder.setInterpolator(ANIM_HOTSEAT_SCALE, HOTSEAT_SCALE); builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE, HOTSEAT_TRANSLATE); builder.setInterpolator(ANIM_SCRIM_FADE, SCRIM_FADE); builder.setInterpolator(ANIM_ALL_APPS_FADE, ALL_APPS_FADE); builder.setInterpolator(ANIM_VERTICAL_PROGRESS, ALL_APPS_VERTICAL_PROGRESS); } return builder; } private StateAnimationConfig getAllAppsToNormalAnimation() { StateAnimationConfig builder = new StateAnimationConfig(); boolean isTablet = mLauncher.getDeviceProfile().isTablet; builder.setInterpolator(ANIM_ALL_APPS_FADE, isTablet ? FINAL_FRAME : Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_CONTENT_FADE_MAX_CLAMPING_THRESHOLD, 1 - ALL_APPS_CONTENT_FADE_MIN_CLAMPING_THRESHOLD)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, if (mLauncher.getDeviceProfile().isTablet) { builder.setInterpolator(ANIM_ALL_APPS_FADE, FINAL_FRAME); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.clampToProgress(LINEAR, 1 - ALL_APPS_SCRIM_OPAQUE_THRESHOLD, 1 - ALL_APPS_SCRIM_VISIBLE_THRESHOLD)); } else { // These interpolators are the reverse of the ones used above, so swiping out of All // Apps feels the same as swiping into it. // TODO(b/231682175): centralize this setup in AllAppsSwipeController. builder.setInterpolator(ANIM_DEPTH, Interpolators.reverse(BLUR)); builder.setInterpolator(ANIM_WORKSPACE_FADE, Interpolators.reverse(WORKSPACE_FADE)); builder.setInterpolator(ANIM_WORKSPACE_SCALE, Interpolators.reverse(WORKSPACE_SCALE)); builder.setInterpolator(ANIM_HOTSEAT_FADE, Interpolators.reverse(HOTSEAT_FADE)); builder.setInterpolator(ANIM_HOTSEAT_SCALE, Interpolators.reverse(HOTSEAT_SCALE)); builder.setInterpolator(ANIM_HOTSEAT_TRANSLATE, Interpolators.reverse(HOTSEAT_TRANSLATE)); builder.setInterpolator(ANIM_SCRIM_FADE, Interpolators.reverse(SCRIM_FADE)); builder.setInterpolator(ANIM_ALL_APPS_FADE, Interpolators.reverse(ALL_APPS_FADE)); builder.setInterpolator(ANIM_VERTICAL_PROGRESS, Interpolators.reverse(ALL_APPS_VERTICAL_PROGRESS)); } return builder; } Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +25 −16 Original line number Diff line number Diff line Loading @@ -151,6 +151,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // Null if the recents animation hasn't started yet or has been canceled or finished. protected @Nullable RecentsAnimationController mRecentsAnimationController; protected @Nullable RecentsAnimationController mDeferredCleanupRecentsAnimationController; protected RecentsAnimationTargets mRecentsAnimationTargets; protected T mActivity; protected Q mRecentsView; Loading Loading @@ -435,6 +436,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, mRecentsView.switchToScreenshot(snapshots, () -> { if (mRecentsAnimationController != null) { mRecentsAnimationController.cleanupScreenshot(); } else if (mDeferredCleanupRecentsAnimationController != null) { mDeferredCleanupRecentsAnimationController.cleanupScreenshot(); mDeferredCleanupRecentsAnimationController = null; } }); mRecentsView.onRecentsAnimationComplete(); Loading Loading @@ -839,6 +843,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) { ActiveGestureLog.INSTANCE.addLog("cancelRecentsAnimation"); mActivityInitListener.unregister(); // Cache the recents animation controller so we can defer its cleanup to after having // properly cleaned up the screenshot without accidentally using it. mDeferredCleanupRecentsAnimationController = mRecentsAnimationController; mStateCallback.setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED); if (mRecentsAnimationTargets != null) { Loading Loading @@ -1025,19 +1032,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, return RECENTS; } final GestureEndTarget endTarget; final boolean canGoToNewTask; final boolean goingToNewTask; if (mRecentsView != null) { if (!hasTargets()) { // If there are no running tasks, then we can assume that this is a continuation of // the last gesture, but after the recents animation has finished canGoToNewTask = true; goingToNewTask = true; } else { final int runningTaskIndex = mRecentsView.getRunningTaskIndex(); final int taskToLaunch = mRecentsView.getNextPage(); canGoToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; goingToNewTask = runningTaskIndex >= 0 && taskToLaunch != runningTaskIndex; } } else { canGoToNewTask = false; goingToNewTask = false; } final boolean reachedOverviewThreshold = mCurrentShift.value >= MIN_PROGRESS_FOR_OVERVIEW; final boolean isFlingX = Math.abs(velocity.x) > mContext.getResources() Loading @@ -1046,13 +1053,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, if (isCancel) { endTarget = LAST_TASK; } else if (mDeviceState.isFullyGesturalNavMode()) { if (canGoToNewTask && isFlingX) { if (goingToNewTask && isFlingX) { // Flinging towards new task takes precedence over mIsMotionPaused (which only // checks y-velocity). endTarget = NEW_TASK; } else if (mIsMotionPaused) { endTarget = RECENTS; } else if (canGoToNewTask) { } else if (goingToNewTask) { endTarget = NEW_TASK; } else { endTarget = !reachedOverviewThreshold ? LAST_TASK : HOME; Loading @@ -1060,22 +1067,26 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, } else { endTarget = reachedOverviewThreshold && mGestureStarted ? RECENTS : canGoToNewTask : goingToNewTask ? NEW_TASK : LAST_TASK; } } else { // If swiping at a diagonal, base end target on the faster velocity. boolean isSwipeUp = endVelocity < 0; boolean willGoToNewTask = canGoToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); boolean willGoToNewTaskOnSwipeUp = goingToNewTask && Math.abs(velocity.x) > Math.abs(endVelocity); if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { endTarget = willGoToNewTask ? NEW_TASK : HOME; if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp && !willGoToNewTaskOnSwipeUp) { endTarget = HOME; } else if (mDeviceState.isFullyGesturalNavMode() && isSwipeUp) { // If swiping at a diagonal, base end target on the faster velocity. endTarget = NEW_TASK; } else if (isSwipeUp) { endTarget = (!reachedOverviewThreshold && willGoToNewTask) ? NEW_TASK : RECENTS; endTarget = !reachedOverviewThreshold && willGoToNewTaskOnSwipeUp ? NEW_TASK : RECENTS; } else { endTarget = willGoToNewTask ? NEW_TASK : LAST_TASK; // Swipe is downward. endTarget = goingToNewTask ? NEW_TASK : LAST_TASK; } } Loading Loading @@ -1160,8 +1171,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, duration = Math.max(duration, mRecentsView.getScroller().getDuration()); } } } else if (endTarget == LAST_TASK && mRecentsView != null) { mRecentsView.snapToPage(mRecentsView.getCurrentPage(), Math.toIntExact(duration)); } // Let RecentsView handle the scrolling to the task, which we launch in startNewTask() Loading
quickstep/src/com/android/quickstep/util/SurfaceTransactionApplier.java +1 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,7 @@ public class SurfaceTransactionApplier extends ReleaseCheck { mTargetViewRootImpl = targetView.getViewRootImpl(); mBarrierSurfaceControl = mTargetViewRootImpl.getSurfaceControl(); mApplyHandler = new Handler(this::onApplyMessage); setCanRelease(true); } protected boolean onApplyMessage(Message msg) { Loading