Loading quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt +17 −9 Original line number Diff line number Diff line Loading @@ -44,11 +44,13 @@ class DesktopRecentsTransitionController( /** Launch desktop tasks from recents view */ fun launchDesktopFromRecents( desktopTaskView: DesktopTaskView, animated: Boolean, callback: Consumer<Boolean>? = null ) { val animRunner = RemoteDesktopLaunchTransitionRunner( desktopTaskView, animated, stateManager, depthController, callback Loading @@ -64,6 +66,7 @@ class DesktopRecentsTransitionController( private class RemoteDesktopLaunchTransitionRunner( private val desktopTaskView: DesktopTaskView, private val animated: Boolean, private val stateManager: StateManager<*, *>, private val depthController: DepthController?, private val successCallback: Consumer<Boolean>? Loading @@ -84,6 +87,7 @@ class DesktopRecentsTransitionController( } MAIN_EXECUTOR.execute { val animator = TaskViewUtils.composeRecentsDesktopLaunchAnimator( desktopTaskView, stateManager, Loading @@ -94,6 +98,10 @@ class DesktopRecentsTransitionController( errorHandlingFinishCallback.run() successCallback?.accept(true) } if (!animated) { animator.setDuration(0) } animator.start() } } } Loading quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +4 −6 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_BOTH import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.graphics.Rect; import android.os.VibrationEffect; import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; import com.android.app.animation.Interpolators; Loading Loading @@ -67,7 +67,7 @@ public abstract class TaskViewTouchController<CONTAINER extends Context & Recent protected final CONTAINER mContainer; private final SingleAxisSwipeDetector mDetector; private final RecentsView mRecentsView; private final int[] mTempCords = new int[2]; private final Rect mTempRect = new Rect(); private final boolean mIsRtl; private AnimatorPlaybackController mCurrentAnimation; Loading Loading @@ -252,10 +252,8 @@ public abstract class TaskViewTouchController<CONTAINER extends Context & Recent mTaskBeingDragged, maxDuration, currentInterpolator); // Since the thumbnail is what is filling the screen, based the end displacement on it. View thumbnailView = mTaskBeingDragged.getFirstSnapshotView(); mTempCords[1] = orientationHandler.getSecondaryDimension(thumbnailView); dl.getDescendantCoordRelativeToSelf(thumbnailView, mTempCords); mEndDisplacement = secondaryLayerDimension - mTempCords[1]; mTaskBeingDragged.getThumbnailBounds(mTempRect, /*relativeToDragLayer=*/true); mEndDisplacement = secondaryLayerDimension - mTempRect.bottom; } mEndDisplacement *= verticalFactor; mCurrentAnimation = pa.createPlaybackController(); Loading quickstep/src/com/android/quickstep/TaskViewUtils.java +9 −5 Original line number Diff line number Diff line Loading @@ -232,9 +232,13 @@ public final class TaskViewUtils { TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary, taskRectTranslationSecondary); if (v instanceof DesktopTaskView) { targetHandle.getTransformParams().setTargetAlpha(1f); } else { // Fade in the task during the initial 20% of the animation out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1, clampToProgress(LINEAR, 0, 0.2f)); out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1, clampToProgress(LINEAR, 0, 0.2f)); } } } Loading Loading @@ -558,7 +562,7 @@ public final class TaskViewUtils { /** * Start recents to desktop animation */ public static void composeRecentsDesktopLaunchAnimator( public static AnimatorSet composeRecentsDesktopLaunchAnimator( @NonNull DesktopTaskView launchingTaskView, @NonNull StateManager stateManager, @Nullable DepthController depthController, @NonNull TransitionInfo transitionInfo, Loading Loading @@ -588,7 +592,7 @@ public final class TaskViewUtils { true /* launcherClosing */, stateManager, launchingTaskView.getRecentsView(), depthController); animatorSet.start(); return animatorSet; } public static void composeRecentsLaunchAnimator(@NonNull AnimatorSet anim, @NonNull View v, Loading quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +16 −6 Original line number Diff line number Diff line Loading @@ -171,7 +171,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mTaskRect.set(mFullTaskSize); mOrientationState.getOrientationHandler() .setSplitTaskSwipeRect(mDp, mTaskRect, mSplitBounds, mStagePosition); mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } else if (mIsDesktopTask) { // For desktop, tasks can take up only part of the screen size. // Full task size represents the whole screen size, but scaled down to fit in recents. Loading @@ -185,10 +184,19 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mTaskRect.scale(scale); // Ensure the task rect is inside the full task rect mTaskRect.offset(mFullTaskSize.left, mFullTaskSize.top); Rect taskDimension = new Rect(0, 0, (int) fullscreenTaskDimension.x, (int) fullscreenTaskDimension.y); mTmpCropRect.set(mThumbnailPosition); if (mTmpCropRect.setIntersect(taskDimension, mThumbnailPosition)) { mTmpCropRect.offset(-mThumbnailPosition.left, -mThumbnailPosition.top); } else { mTmpCropRect.setEmpty(); } } else { mTaskRect.set(mFullTaskSize); mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } /** Loading Loading @@ -486,10 +494,12 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { recentsViewPrimaryTranslation.value); applyWindowToHomeRotation(mMatrix); if (!mIsDesktopTask) { // Crop rect is the inverse of thumbnail matrix mTempRectF.set(0, 0, taskWidth, taskHeight); mInversePositionMatrix.mapRect(mTempRectF); mTempRectF.roundOut(mTmpCropRect); } params.setProgress(1f - fullScreenProgress); params.applySurfaceParams(surfaceTransaction == null Loading quickstep/src/com/android/quickstep/views/DesktopTaskView.kt +12 −7 Original line number Diff line number Diff line Loading @@ -242,7 +242,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu } } override fun launchTaskAnimated(): RunnableList? { private fun launchTaskWithDesktopController(animated: Boolean): RunnableList? { val recentsView = recentsView ?: return null TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, Loading @@ -252,17 +252,23 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu val endCallback = RunnableList() val desktopController = recentsView.desktopRecentsController checkNotNull(desktopController) { "recentsController is null" } desktopController.launchDesktopFromRecents(this) { endCallback.executeAllAndDestroy() } Log.d(TAG, "launchTaskAnimated - launchDesktopFromRecents: ${taskIds.contentToString()}") desktopController.launchDesktopFromRecents(this, animated) { endCallback.executeAllAndDestroy() } Log.d( TAG, "launchTaskAnimated - launchTaskWithDesktopController: ${taskIds.contentToString()}, withRemoteTransition: $animated" ) // Callbacks get run from recentsView for case when recents animation already running recentsView.addSideTaskLaunchCallback(endCallback) return endCallback } override fun launchTaskAnimated() = launchTaskWithDesktopController(animated = true) override fun launchTask(callback: (launched: Boolean) -> Unit, isQuickSwitch: Boolean) { launchTasks() callback(true) launchTaskWithDesktopController(animated = false)?.add { callback(true) } ?: callback(false) } // Desktop tile can't be in split screen Loading @@ -272,8 +278,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu override fun setOverlayEnabled(overlayEnabled: Boolean) {} override fun onFullscreenProgressChanged(fullscreenProgress: Float) { // Don't show background while we are transitioning to/from fullscreen backgroundView.visibility = if (fullscreenProgress > 0) INVISIBLE else VISIBLE backgroundView.alpha = 1 - fullscreenProgress } override fun updateCurrentFullscreenParams() { Loading Loading
quickstep/src/com/android/launcher3/desktop/DesktopRecentsTransitionController.kt +17 −9 Original line number Diff line number Diff line Loading @@ -44,11 +44,13 @@ class DesktopRecentsTransitionController( /** Launch desktop tasks from recents view */ fun launchDesktopFromRecents( desktopTaskView: DesktopTaskView, animated: Boolean, callback: Consumer<Boolean>? = null ) { val animRunner = RemoteDesktopLaunchTransitionRunner( desktopTaskView, animated, stateManager, depthController, callback Loading @@ -64,6 +66,7 @@ class DesktopRecentsTransitionController( private class RemoteDesktopLaunchTransitionRunner( private val desktopTaskView: DesktopTaskView, private val animated: Boolean, private val stateManager: StateManager<*, *>, private val depthController: DepthController?, private val successCallback: Consumer<Boolean>? Loading @@ -84,6 +87,7 @@ class DesktopRecentsTransitionController( } MAIN_EXECUTOR.execute { val animator = TaskViewUtils.composeRecentsDesktopLaunchAnimator( desktopTaskView, stateManager, Loading @@ -94,6 +98,10 @@ class DesktopRecentsTransitionController( errorHandlingFinishCallback.run() successCallback?.accept(true) } if (!animated) { animator.setDuration(0) } animator.start() } } } Loading
quickstep/src/com/android/launcher3/uioverrides/touchcontrollers/TaskViewTouchController.java +4 −6 Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ import static com.android.launcher3.touch.SingleAxisSwipeDetector.DIRECTION_BOTH import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.graphics.Rect; import android.os.VibrationEffect; import android.view.MotionEvent; import android.view.View; import android.view.animation.Interpolator; import com.android.app.animation.Interpolators; Loading Loading @@ -67,7 +67,7 @@ public abstract class TaskViewTouchController<CONTAINER extends Context & Recent protected final CONTAINER mContainer; private final SingleAxisSwipeDetector mDetector; private final RecentsView mRecentsView; private final int[] mTempCords = new int[2]; private final Rect mTempRect = new Rect(); private final boolean mIsRtl; private AnimatorPlaybackController mCurrentAnimation; Loading Loading @@ -252,10 +252,8 @@ public abstract class TaskViewTouchController<CONTAINER extends Context & Recent mTaskBeingDragged, maxDuration, currentInterpolator); // Since the thumbnail is what is filling the screen, based the end displacement on it. View thumbnailView = mTaskBeingDragged.getFirstSnapshotView(); mTempCords[1] = orientationHandler.getSecondaryDimension(thumbnailView); dl.getDescendantCoordRelativeToSelf(thumbnailView, mTempCords); mEndDisplacement = secondaryLayerDimension - mTempCords[1]; mTaskBeingDragged.getThumbnailBounds(mTempRect, /*relativeToDragLayer=*/true); mEndDisplacement = secondaryLayerDimension - mTempRect.bottom; } mEndDisplacement *= verticalFactor; mCurrentAnimation = pa.createPlaybackController(); Loading
quickstep/src/com/android/quickstep/TaskViewUtils.java +9 −5 Original line number Diff line number Diff line Loading @@ -232,9 +232,13 @@ public final class TaskViewUtils { TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary, taskRectTranslationSecondary); if (v instanceof DesktopTaskView) { targetHandle.getTransformParams().setTargetAlpha(1f); } else { // Fade in the task during the initial 20% of the animation out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1, clampToProgress(LINEAR, 0, 0.2f)); out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1, clampToProgress(LINEAR, 0, 0.2f)); } } } Loading Loading @@ -558,7 +562,7 @@ public final class TaskViewUtils { /** * Start recents to desktop animation */ public static void composeRecentsDesktopLaunchAnimator( public static AnimatorSet composeRecentsDesktopLaunchAnimator( @NonNull DesktopTaskView launchingTaskView, @NonNull StateManager stateManager, @Nullable DepthController depthController, @NonNull TransitionInfo transitionInfo, Loading Loading @@ -588,7 +592,7 @@ public final class TaskViewUtils { true /* launcherClosing */, stateManager, launchingTaskView.getRecentsView(), depthController); animatorSet.start(); return animatorSet; } public static void composeRecentsLaunchAnimator(@NonNull AnimatorSet anim, @NonNull View v, Loading
quickstep/src/com/android/quickstep/util/TaskViewSimulator.java +16 −6 Original line number Diff line number Diff line Loading @@ -171,7 +171,6 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mTaskRect.set(mFullTaskSize); mOrientationState.getOrientationHandler() .setSplitTaskSwipeRect(mDp, mTaskRect, mSplitBounds, mStagePosition); mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } else if (mIsDesktopTask) { // For desktop, tasks can take up only part of the screen size. // Full task size represents the whole screen size, but scaled down to fit in recents. Loading @@ -185,10 +184,19 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { mTaskRect.scale(scale); // Ensure the task rect is inside the full task rect mTaskRect.offset(mFullTaskSize.left, mFullTaskSize.top); Rect taskDimension = new Rect(0, 0, (int) fullscreenTaskDimension.x, (int) fullscreenTaskDimension.y); mTmpCropRect.set(mThumbnailPosition); if (mTmpCropRect.setIntersect(taskDimension, mThumbnailPosition)) { mTmpCropRect.offset(-mThumbnailPosition.left, -mThumbnailPosition.top); } else { mTmpCropRect.setEmpty(); } } else { mTaskRect.set(mFullTaskSize); mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY); } /** Loading Loading @@ -486,10 +494,12 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy { recentsViewPrimaryTranslation.value); applyWindowToHomeRotation(mMatrix); if (!mIsDesktopTask) { // Crop rect is the inverse of thumbnail matrix mTempRectF.set(0, 0, taskWidth, taskHeight); mInversePositionMatrix.mapRect(mTempRectF); mTempRectF.roundOut(mTmpCropRect); } params.setProgress(1f - fullScreenProgress); params.applySurfaceParams(surfaceTransaction == null Loading
quickstep/src/com/android/quickstep/views/DesktopTaskView.kt +12 −7 Original line number Diff line number Diff line Loading @@ -242,7 +242,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu } } override fun launchTaskAnimated(): RunnableList? { private fun launchTaskWithDesktopController(animated: Boolean): RunnableList? { val recentsView = recentsView ?: return null TestLogging.recordEvent( TestProtocol.SEQUENCE_MAIN, Loading @@ -252,17 +252,23 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu val endCallback = RunnableList() val desktopController = recentsView.desktopRecentsController checkNotNull(desktopController) { "recentsController is null" } desktopController.launchDesktopFromRecents(this) { endCallback.executeAllAndDestroy() } Log.d(TAG, "launchTaskAnimated - launchDesktopFromRecents: ${taskIds.contentToString()}") desktopController.launchDesktopFromRecents(this, animated) { endCallback.executeAllAndDestroy() } Log.d( TAG, "launchTaskAnimated - launchTaskWithDesktopController: ${taskIds.contentToString()}, withRemoteTransition: $animated" ) // Callbacks get run from recentsView for case when recents animation already running recentsView.addSideTaskLaunchCallback(endCallback) return endCallback } override fun launchTaskAnimated() = launchTaskWithDesktopController(animated = true) override fun launchTask(callback: (launched: Boolean) -> Unit, isQuickSwitch: Boolean) { launchTasks() callback(true) launchTaskWithDesktopController(animated = false)?.add { callback(true) } ?: callback(false) } // Desktop tile can't be in split screen Loading @@ -272,8 +278,7 @@ class DesktopTaskView @JvmOverloads constructor(context: Context, attrs: Attribu override fun setOverlayEnabled(overlayEnabled: Boolean) {} override fun onFullscreenProgressChanged(fullscreenProgress: Float) { // Don't show background while we are transitioning to/from fullscreen backgroundView.visibility = if (fullscreenProgress > 0) INVISIBLE else VISIBLE backgroundView.alpha = 1 - fullscreenProgress } override fun updateCurrentFullscreenParams() { Loading