Loading quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +13 −9 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.AnimatorControllerWithResistance; Loading Loading @@ -434,7 +435,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // RecentsView never updates the display rotation until swipe-up, force update // RecentsView never updates the display rotation until swipe-up, force update // RecentsOrientedState before passing to TaskViewSimulator. // RecentsOrientedState before passing to TaskViewSimulator. mRecentsView.updateRecentsRotation(); mRecentsView.updateRecentsRotation(); runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTaskViewSimulator runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() .setOrientationState(mRecentsView.getPagedViewOrientedState())); .setOrientationState(mRecentsView.getPagedViewOrientedState())); // If we've already ended the gesture and are going home, don't prepare recents UI, // If we've already ended the gesture and are going home, don't prepare recents UI, Loading Loading @@ -753,6 +754,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, public void onRecentsAnimationStart(RecentsAnimationController controller, public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) { RecentsAnimationTargets targets) { super.onRecentsAnimationStart(controller, targets); super.onRecentsAnimationStart(controller, targets); ActiveGestureLog.INSTANCE.addLog("startRecentsAnimationCallback", targets.apps.length); mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(targets); mRecentsAnimationController = controller; mRecentsAnimationController = controller; mRecentsAnimationTargets = targets; mRecentsAnimationTargets = targets; Loading @@ -763,7 +766,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // orientation state is independent of which remote target handle we use since both // orientation state is independent of which remote target handle we use since both // should be pointing to the same one. Just choose index 0 for now since that works for // should be pointing to the same one. Just choose index 0 for now since that works for // both split and non-split // both split and non-split RecentsOrientedState orientationState = mRemoteTargetHandles[0].mTaskViewSimulator RecentsOrientedState orientationState = mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState(); .getOrientationState(); DeviceProfile dp = orientationState.getLauncherDeviceProfile(); DeviceProfile dp = orientationState.getLauncherDeviceProfile(); if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) { if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) { Loading Loading @@ -1350,7 +1353,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { // Directly animate the app to PiP (picture-in-picture) mode // Directly animate the app to PiP (picture-in-picture) mode final ActivityManager.RunningTaskInfo taskInfo = mGestureState.getRunningTask(); final ActivityManager.RunningTaskInfo taskInfo = mGestureState.getRunningTask(); final RecentsOrientedState orientationState = mRemoteTargetHandles[0].mTaskViewSimulator final RecentsOrientedState orientationState = mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState(); .getOrientationState(); final int windowRotation = calculateWindowRotation(runningTaskTarget, orientationState); final int windowRotation = calculateWindowRotation(runningTaskTarget, orientationState); final int homeRotation = orientationState.getRecentsActivityRotation(); final int homeRotation = orientationState.getRecentsActivityRotation(); Loading Loading @@ -1386,7 +1389,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // is not ROTATION_0 (which implies the rotation is turned on in launcher settings). // is not ROTATION_0 (which implies the rotation is turned on in launcher settings). if (homeRotation == ROTATION_0 if (homeRotation == ROTATION_0 && (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) { && (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) { builder.setFromRotation(mRemoteTargetHandles[0].mTaskViewSimulator, windowRotation, builder.setFromRotation(mRemoteTargetHandles[0].getTaskViewSimulator(), windowRotation, taskInfo.displayCutoutInsets); taskInfo.displayCutoutInsets); } } final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build(); final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build(); Loading Loading @@ -1756,7 +1759,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, * depend on proper class initialization. * depend on proper class initialization. */ */ protected void initAfterSubclassConstructor() { protected void initAfterSubclassConstructor() { initTransitionEndpoints(mRemoteTargetHandles[0].mTaskViewSimulator initTransitionEndpoints(mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState().getLauncherDeviceProfile()); .getOrientationState().getLauncherDeviceProfile()); } } Loading @@ -1774,7 +1777,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, protected void linkRecentsViewScroll() { protected void linkRecentsViewScroll() { SurfaceTransactionApplier.create(mRecentsView, applier -> { SurfaceTransactionApplier.create(mRecentsView, applier -> { runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTransformParams() .setSyncTransactionApplier(applier)); .setSyncTransactionApplier(applier)); runOnRecentsAnimationStart(() -> runOnRecentsAnimationStart(() -> mRecentsAnimationTargets.addReleaseCheck(applier)); mRecentsAnimationTargets.addReleaseCheck(applier)); Loading Loading @@ -1910,18 +1913,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, boolean notSwipingPipToHome = mRecentsAnimationTargets != null && !mIsSwipingPipToHome; boolean notSwipingPipToHome = mRecentsAnimationTargets != null && !mIsSwipingPipToHome; boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { AnimatorControllerWithResistance playbackController = remoteHandle.mPlaybackController; AnimatorControllerWithResistance playbackController = remoteHandle.getPlaybackController(); if (playbackController != null) { if (playbackController != null) { playbackController.setProgress(Math.max(mCurrentShift.value, playbackController.setProgress(Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor); getScaleProgressDueToScroll()), mDragLengthFactor); } } if (notSwipingPipToHome) { if (notSwipingPipToHome) { TaskViewSimulator taskViewSimulator = remoteHandle.mTaskViewSimulator; TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator(); if (setRecentsScroll) { if (setRecentsScroll) { taskViewSimulator.setScroll(mRecentsView.getScrollOffset()); taskViewSimulator.setScroll(mRecentsView.getScrollOffset()); } } taskViewSimulator.apply(remoteHandle.mTransformParams); taskViewSimulator.apply(remoteHandle.getTransformParams()); } } } } ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); Loading quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class FallbackSwipeHandler extends mRunningOverHome = ActivityManagerWrapper.isHomeTask(mGestureState.getRunningTask()); mRunningOverHome = ActivityManagerWrapper.isHomeTask(mGestureState.getRunningTask()); if (mRunningOverHome) { if (mRunningOverHome) { runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackSwipeHandler.this::updateHomeActivityTransformDuringSwipeUp)); FallbackSwipeHandler.this::updateHomeActivityTransformDuringSwipeUp)); } } } } Loading @@ -115,7 +115,8 @@ public class FallbackSwipeHandler extends super.initTransitionEndpoints(dp); super.initTransitionEndpoints(dp); if (mRunningOverHome) { if (mRunningOverHome) { // Full screen scale should be independent of remote target handle // Full screen scale should be independent of remote target handle mMaxLauncherScale = 1 / mRemoteTargetHandles[0].mTaskViewSimulator.getFullScreenScale(); mMaxLauncherScale = 1 / mRemoteTargetHandles[0].getTaskViewSimulator() .getFullScreenScale(); } } } } Loading Loading @@ -214,21 +215,21 @@ public class FallbackSwipeHandler extends mHomeAlpha.value = Utilities.boundToRange(1 - mCurrentShift.value, 0, 1); mHomeAlpha.value = Utilities.boundToRange(1 - mCurrentShift.value, 0, 1); mVerticalShiftForScale.value = mCurrentShift.value; mVerticalShiftForScale.value = mCurrentShift.value; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateHomeActivityTransformDuringHomeAnim)); ::updateHomeActivityTransformDuringHomeAnim)); } else { } else { mHomeAlpha = new AnimatedFloat(this::updateHomeAlpha); mHomeAlpha = new AnimatedFloat(this::updateHomeAlpha); mHomeAlpha.value = 0; mHomeAlpha.value = 0; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateHomeActivityTransformDuringHomeAnim)); ::updateHomeActivityTransformDuringHomeAnim)); } } mRecentsAlpha.value = 1; mRecentsAlpha.value = 1; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateRecentsActivityTransformDuringHomeAnim)); ::updateRecentsActivityTransformDuringHomeAnim)); } } Loading quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -183,13 +183,13 @@ public class LauncherSwipeHandlerV2 extends Rect crop = new Rect(); Rect crop = new Rect(); // We can assume there is only one remote target here because staged split never animates // We can assume there is only one remote target here because staged split never animates // into the app icon, only into the homescreen // into the app icon, only into the homescreen mRemoteTargetHandles[0].mTaskViewSimulator.getCurrentCropRect().roundOut(crop); mRemoteTargetHandles[0].getTaskViewSimulator().getCurrentCropRect().roundOut(crop); Size windowSize = new Size(crop.width(), crop.height()); Size windowSize = new Size(crop.width(), crop.height()); int fallbackBackgroundColor = int fallbackBackgroundColor = FloatingWidgetView.getDefaultBackgroundColor(mContext, runningTaskTarget); FloatingWidgetView.getDefaultBackgroundColor(mContext, runningTaskTarget); FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, hostView, backgroundLocation, windowSize, hostView, backgroundLocation, windowSize, mRemoteTargetHandles[0].mTaskViewSimulator.getCurrentCornerRadius(), mRemoteTargetHandles[0].getTaskViewSimulator().getCurrentCornerRadius(), isTargetTranslucent, fallbackBackgroundColor); isTargetTranslucent, fallbackBackgroundColor); return new FloatingViewHomeAnimationFactory(floatingWidgetView) { return new FloatingViewHomeAnimationFactory(floatingWidgetView) { Loading quickstep/src/com/android/quickstep/RemoteTargetGluer.java 0 → 100644 +177 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import android.content.Context; import androidx.annotation.Nullable; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.LauncherSplitScreenListener; import com.android.quickstep.util.TaskViewSimulator; import com.android.quickstep.util.TransformParams; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * Glues together the necessary components to animate a remote target using a * {@link TaskViewSimulator} */ public class RemoteTargetGluer { private final RemoteTargetHandle[] mRemoteTargetHandles; private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds; /** * Use this constructor if remote targets are split-screen independent */ public RemoteTargetGluer(Context context, BaseActivityInterface sizingStrategy, RemoteAnimationTargets targets) { mRemoteTargetHandles = createHandles(context, sizingStrategy, targets.apps.length); } /** * Use this constructor if you want the number of handles created to match the number of active * running tasks */ public RemoteTargetGluer(Context context, BaseActivityInterface sizingStrategy) { int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate() .getRunningSplitTaskIds(); mRemoteTargetHandles = createHandles(context, sizingStrategy, splitIds.length == 2 ? 2 : 1); } private RemoteTargetHandle[] createHandles(Context context, BaseActivityInterface sizingStrategy, int numHandles) { RemoteTargetHandle[] handles = new RemoteTargetHandle[numHandles]; for (int i = 0; i < numHandles; i++) { TaskViewSimulator tvs = new TaskViewSimulator(context, sizingStrategy); TransformParams transformParams = new TransformParams(); handles[i] = new RemoteTargetHandle(tvs, transformParams); } return handles; } /** * Pairs together {@link TaskViewSimulator}s and {@link TransformParams} into a * {@link RemoteTargetHandle} * Assigns only the apps associated with {@param targets} into their own TaskViewSimulators. * Length of targets.apps should match that of {@link #mRemoteTargetHandles}. * * If split screen may be active when this is called, you might want to use * {@link #assignTargetsForSplitScreen(RemoteAnimationTargets)} */ public RemoteTargetHandle[] assignTargets(RemoteAnimationTargets targets) { for (int i = 0; i < mRemoteTargetHandles.length; i++) { RemoteAnimationTargetCompat primaryTaskTarget = targets.apps[i]; mRemoteTargetHandles[i].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets)); mRemoteTargetHandles[i].mTaskViewSimulator.setPreview(primaryTaskTarget, null); } return mRemoteTargetHandles; } /** * Similar to {@link #assignTargets(RemoteAnimationTargets)}, except this matches the * apps in targets.apps to that of the split screened tasks. If split screen is active, then * {@link #mRemoteTargetHandles} index 0 will be the left/top task, index one right/bottom */ public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) { int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate() .getRunningSplitTaskIds(); RemoteAnimationTargetCompat primaryTaskTarget; RemoteAnimationTargetCompat secondaryTaskTarget; if (mRemoteTargetHandles.length == 1) { // If we're not in split screen, the splitIds count doesn't really matter since we // should always hit this case. Right now there's no use case for multiple app targets // without being in split screen primaryTaskTarget = targets.apps[0]; mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets); mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, null); } else { // split screen primaryTaskTarget = targets.findTask(splitIds[0]); secondaryTaskTarget = targets.findTask(splitIds[1]); RemoteAnimationTargetCompat dividerTarget = targets.getNonAppTargetOfType( TYPE_DOCK_DIVIDER); mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds( primaryTaskTarget.screenSpaceBounds, secondaryTaskTarget.screenSpaceBounds, dividerTarget.screenSpaceBounds); mRemoteTargetHandles[0].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets)); mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, mStagedSplitBounds); mRemoteTargetHandles[1].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(secondaryTaskTarget, targets)); mRemoteTargetHandles[1].mTaskViewSimulator.setPreview(secondaryTaskTarget, mStagedSplitBounds); } return mRemoteTargetHandles; } private RemoteAnimationTargets createRemoteAnimationTargetsForTarget( RemoteAnimationTargetCompat target, RemoteAnimationTargets targets) { return new RemoteAnimationTargets(new RemoteAnimationTargetCompat[]{target}, targets.wallpapers, targets.nonApps, targets.targetMode); } public RemoteTargetHandle[] getRemoteTargetHandles() { return mRemoteTargetHandles; } public SplitConfigurationOptions.StagedSplitBounds getStagedSplitBounds() { return mStagedSplitBounds; } /** * Container to keep together all the associated objects whose properties need to be updated to * animate a single remote app target */ public static class RemoteTargetHandle { private final TaskViewSimulator mTaskViewSimulator; private final TransformParams mTransformParams; @Nullable private AnimatorControllerWithResistance mPlaybackController; public RemoteTargetHandle(TaskViewSimulator taskViewSimulator, TransformParams transformParams) { mTransformParams = transformParams; mTaskViewSimulator = taskViewSimulator; } public TaskViewSimulator getTaskViewSimulator() { return mTaskViewSimulator; } public TransformParams getTransformParams() { return mTransformParams; } @Nullable public AnimatorControllerWithResistance getPlaybackController() { return mPlaybackController; } public void setPlaybackController( @Nullable AnimatorControllerWithResistance playbackController) { mPlaybackController = playbackController; } } } quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +15 −86 File changed.Preview size limit exceeded, changes collapsed. Show changes Loading
quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java +13 −9 Original line number Original line Diff line number Diff line Loading @@ -96,6 +96,7 @@ import com.android.launcher3.util.VibratorWrapper; import com.android.launcher3.util.WindowBounds; import com.android.launcher3.util.WindowBounds; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.BaseActivityInterface.AnimationFactory; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.GestureState.GestureEndTarget; import com.android.quickstep.RemoteTargetGluer.RemoteTargetHandle; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActiveGestureLog; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.ActivityInitListener; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.AnimatorControllerWithResistance; Loading Loading @@ -434,7 +435,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // RecentsView never updates the display rotation until swipe-up, force update // RecentsView never updates the display rotation until swipe-up, force update // RecentsOrientedState before passing to TaskViewSimulator. // RecentsOrientedState before passing to TaskViewSimulator. mRecentsView.updateRecentsRotation(); mRecentsView.updateRecentsRotation(); runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTaskViewSimulator runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTaskViewSimulator() .setOrientationState(mRecentsView.getPagedViewOrientedState())); .setOrientationState(mRecentsView.getPagedViewOrientedState())); // If we've already ended the gesture and are going home, don't prepare recents UI, // If we've already ended the gesture and are going home, don't prepare recents UI, Loading Loading @@ -753,6 +754,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, public void onRecentsAnimationStart(RecentsAnimationController controller, public void onRecentsAnimationStart(RecentsAnimationController controller, RecentsAnimationTargets targets) { RecentsAnimationTargets targets) { super.onRecentsAnimationStart(controller, targets); super.onRecentsAnimationStart(controller, targets); ActiveGestureLog.INSTANCE.addLog("startRecentsAnimationCallback", targets.apps.length); mRemoteTargetHandles = mTargetGluer.assignTargetsForSplitScreen(targets); mRecentsAnimationController = controller; mRecentsAnimationController = controller; mRecentsAnimationTargets = targets; mRecentsAnimationTargets = targets; Loading @@ -763,7 +766,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // orientation state is independent of which remote target handle we use since both // orientation state is independent of which remote target handle we use since both // should be pointing to the same one. Just choose index 0 for now since that works for // should be pointing to the same one. Just choose index 0 for now since that works for // both split and non-split // both split and non-split RecentsOrientedState orientationState = mRemoteTargetHandles[0].mTaskViewSimulator RecentsOrientedState orientationState = mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState(); .getOrientationState(); DeviceProfile dp = orientationState.getLauncherDeviceProfile(); DeviceProfile dp = orientationState.getLauncherDeviceProfile(); if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) { if (targets.minimizedHomeBounds != null && primaryTaskTarget != null) { Loading Loading @@ -1350,7 +1353,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { RemoteAnimationTargetCompat runningTaskTarget, float startProgress) { // Directly animate the app to PiP (picture-in-picture) mode // Directly animate the app to PiP (picture-in-picture) mode final ActivityManager.RunningTaskInfo taskInfo = mGestureState.getRunningTask(); final ActivityManager.RunningTaskInfo taskInfo = mGestureState.getRunningTask(); final RecentsOrientedState orientationState = mRemoteTargetHandles[0].mTaskViewSimulator final RecentsOrientedState orientationState = mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState(); .getOrientationState(); final int windowRotation = calculateWindowRotation(runningTaskTarget, orientationState); final int windowRotation = calculateWindowRotation(runningTaskTarget, orientationState); final int homeRotation = orientationState.getRecentsActivityRotation(); final int homeRotation = orientationState.getRecentsActivityRotation(); Loading Loading @@ -1386,7 +1389,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, // is not ROTATION_0 (which implies the rotation is turned on in launcher settings). // is not ROTATION_0 (which implies the rotation is turned on in launcher settings). if (homeRotation == ROTATION_0 if (homeRotation == ROTATION_0 && (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) { && (windowRotation == ROTATION_90 || windowRotation == ROTATION_270)) { builder.setFromRotation(mRemoteTargetHandles[0].mTaskViewSimulator, windowRotation, builder.setFromRotation(mRemoteTargetHandles[0].getTaskViewSimulator(), windowRotation, taskInfo.displayCutoutInsets); taskInfo.displayCutoutInsets); } } final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build(); final SwipePipToHomeAnimator swipePipToHomeAnimator = builder.build(); Loading Loading @@ -1756,7 +1759,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, * depend on proper class initialization. * depend on proper class initialization. */ */ protected void initAfterSubclassConstructor() { protected void initAfterSubclassConstructor() { initTransitionEndpoints(mRemoteTargetHandles[0].mTaskViewSimulator initTransitionEndpoints(mRemoteTargetHandles[0].getTaskViewSimulator() .getOrientationState().getLauncherDeviceProfile()); .getOrientationState().getLauncherDeviceProfile()); } } Loading @@ -1774,7 +1777,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, protected void linkRecentsViewScroll() { protected void linkRecentsViewScroll() { SurfaceTransactionApplier.create(mRecentsView, applier -> { SurfaceTransactionApplier.create(mRecentsView, applier -> { runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.getTransformParams() .setSyncTransactionApplier(applier)); .setSyncTransactionApplier(applier)); runOnRecentsAnimationStart(() -> runOnRecentsAnimationStart(() -> mRecentsAnimationTargets.addReleaseCheck(applier)); mRecentsAnimationTargets.addReleaseCheck(applier)); Loading Loading @@ -1910,18 +1913,19 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>, boolean notSwipingPipToHome = mRecentsAnimationTargets != null && !mIsSwipingPipToHome; boolean notSwipingPipToHome = mRecentsAnimationTargets != null && !mIsSwipingPipToHome; boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null; for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) { AnimatorControllerWithResistance playbackController = remoteHandle.mPlaybackController; AnimatorControllerWithResistance playbackController = remoteHandle.getPlaybackController(); if (playbackController != null) { if (playbackController != null) { playbackController.setProgress(Math.max(mCurrentShift.value, playbackController.setProgress(Math.max(mCurrentShift.value, getScaleProgressDueToScroll()), mDragLengthFactor); getScaleProgressDueToScroll()), mDragLengthFactor); } } if (notSwipingPipToHome) { if (notSwipingPipToHome) { TaskViewSimulator taskViewSimulator = remoteHandle.mTaskViewSimulator; TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator(); if (setRecentsScroll) { if (setRecentsScroll) { taskViewSimulator.setScroll(mRecentsView.getScrollOffset()); taskViewSimulator.setScroll(mRecentsView.getScrollOffset()); } } taskViewSimulator.apply(remoteHandle.mTransformParams); taskViewSimulator.apply(remoteHandle.getTransformParams()); } } } } ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); ProtoTracer.INSTANCE.get(mContext).scheduleFrameUpdate(); Loading
quickstep/src/com/android/quickstep/FallbackSwipeHandler.java +6 −5 Original line number Original line Diff line number Diff line Loading @@ -105,7 +105,7 @@ public class FallbackSwipeHandler extends mRunningOverHome = ActivityManagerWrapper.isHomeTask(mGestureState.getRunningTask()); mRunningOverHome = ActivityManagerWrapper.isHomeTask(mGestureState.getRunningTask()); if (mRunningOverHome) { if (mRunningOverHome) { runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackSwipeHandler.this::updateHomeActivityTransformDuringSwipeUp)); FallbackSwipeHandler.this::updateHomeActivityTransformDuringSwipeUp)); } } } } Loading @@ -115,7 +115,8 @@ public class FallbackSwipeHandler extends super.initTransitionEndpoints(dp); super.initTransitionEndpoints(dp); if (mRunningOverHome) { if (mRunningOverHome) { // Full screen scale should be independent of remote target handle // Full screen scale should be independent of remote target handle mMaxLauncherScale = 1 / mRemoteTargetHandles[0].mTaskViewSimulator.getFullScreenScale(); mMaxLauncherScale = 1 / mRemoteTargetHandles[0].getTaskViewSimulator() .getFullScreenScale(); } } } } Loading Loading @@ -214,21 +215,21 @@ public class FallbackSwipeHandler extends mHomeAlpha.value = Utilities.boundToRange(1 - mCurrentShift.value, 0, 1); mHomeAlpha.value = Utilities.boundToRange(1 - mCurrentShift.value, 0, 1); mVerticalShiftForScale.value = mCurrentShift.value; mVerticalShiftForScale.value = mCurrentShift.value; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateHomeActivityTransformDuringHomeAnim)); ::updateHomeActivityTransformDuringHomeAnim)); } else { } else { mHomeAlpha = new AnimatedFloat(this::updateHomeAlpha); mHomeAlpha = new AnimatedFloat(this::updateHomeAlpha); mHomeAlpha.value = 0; mHomeAlpha.value = 0; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateHomeActivityTransformDuringHomeAnim)); ::updateHomeActivityTransformDuringHomeAnim)); } } mRecentsAlpha.value = 1; mRecentsAlpha.value = 1; runActionOnRemoteHandles(remoteTargetHandle -> runActionOnRemoteHandles(remoteTargetHandle -> remoteTargetHandle.mTransformParams.setHomeBuilderProxy( remoteTargetHandle.getTransformParams().setHomeBuilderProxy( FallbackHomeAnimationFactory.this FallbackHomeAnimationFactory.this ::updateRecentsActivityTransformDuringHomeAnim)); ::updateRecentsActivityTransformDuringHomeAnim)); } } Loading
quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +2 −2 Original line number Original line Diff line number Diff line Loading @@ -183,13 +183,13 @@ public class LauncherSwipeHandlerV2 extends Rect crop = new Rect(); Rect crop = new Rect(); // We can assume there is only one remote target here because staged split never animates // We can assume there is only one remote target here because staged split never animates // into the app icon, only into the homescreen // into the app icon, only into the homescreen mRemoteTargetHandles[0].mTaskViewSimulator.getCurrentCropRect().roundOut(crop); mRemoteTargetHandles[0].getTaskViewSimulator().getCurrentCropRect().roundOut(crop); Size windowSize = new Size(crop.width(), crop.height()); Size windowSize = new Size(crop.width(), crop.height()); int fallbackBackgroundColor = int fallbackBackgroundColor = FloatingWidgetView.getDefaultBackgroundColor(mContext, runningTaskTarget); FloatingWidgetView.getDefaultBackgroundColor(mContext, runningTaskTarget); FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, FloatingWidgetView floatingWidgetView = FloatingWidgetView.getFloatingWidgetView(mActivity, hostView, backgroundLocation, windowSize, hostView, backgroundLocation, windowSize, mRemoteTargetHandles[0].mTaskViewSimulator.getCurrentCornerRadius(), mRemoteTargetHandles[0].getTaskViewSimulator().getCurrentCornerRadius(), isTargetTranslucent, fallbackBackgroundColor); isTargetTranslucent, fallbackBackgroundColor); return new FloatingViewHomeAnimationFactory(floatingWidgetView) { return new FloatingViewHomeAnimationFactory(floatingWidgetView) { Loading
quickstep/src/com/android/quickstep/RemoteTargetGluer.java 0 → 100644 +177 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.quickstep; import static android.view.WindowManager.LayoutParams.TYPE_DOCK_DIVIDER; import android.content.Context; import androidx.annotation.Nullable; import com.android.launcher3.util.SplitConfigurationOptions; import com.android.quickstep.util.AnimatorControllerWithResistance; import com.android.quickstep.util.LauncherSplitScreenListener; import com.android.quickstep.util.TaskViewSimulator; import com.android.quickstep.util.TransformParams; import com.android.systemui.shared.system.RemoteAnimationTargetCompat; /** * Glues together the necessary components to animate a remote target using a * {@link TaskViewSimulator} */ public class RemoteTargetGluer { private final RemoteTargetHandle[] mRemoteTargetHandles; private SplitConfigurationOptions.StagedSplitBounds mStagedSplitBounds; /** * Use this constructor if remote targets are split-screen independent */ public RemoteTargetGluer(Context context, BaseActivityInterface sizingStrategy, RemoteAnimationTargets targets) { mRemoteTargetHandles = createHandles(context, sizingStrategy, targets.apps.length); } /** * Use this constructor if you want the number of handles created to match the number of active * running tasks */ public RemoteTargetGluer(Context context, BaseActivityInterface sizingStrategy) { int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate() .getRunningSplitTaskIds(); mRemoteTargetHandles = createHandles(context, sizingStrategy, splitIds.length == 2 ? 2 : 1); } private RemoteTargetHandle[] createHandles(Context context, BaseActivityInterface sizingStrategy, int numHandles) { RemoteTargetHandle[] handles = new RemoteTargetHandle[numHandles]; for (int i = 0; i < numHandles; i++) { TaskViewSimulator tvs = new TaskViewSimulator(context, sizingStrategy); TransformParams transformParams = new TransformParams(); handles[i] = new RemoteTargetHandle(tvs, transformParams); } return handles; } /** * Pairs together {@link TaskViewSimulator}s and {@link TransformParams} into a * {@link RemoteTargetHandle} * Assigns only the apps associated with {@param targets} into their own TaskViewSimulators. * Length of targets.apps should match that of {@link #mRemoteTargetHandles}. * * If split screen may be active when this is called, you might want to use * {@link #assignTargetsForSplitScreen(RemoteAnimationTargets)} */ public RemoteTargetHandle[] assignTargets(RemoteAnimationTargets targets) { for (int i = 0; i < mRemoteTargetHandles.length; i++) { RemoteAnimationTargetCompat primaryTaskTarget = targets.apps[i]; mRemoteTargetHandles[i].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets)); mRemoteTargetHandles[i].mTaskViewSimulator.setPreview(primaryTaskTarget, null); } return mRemoteTargetHandles; } /** * Similar to {@link #assignTargets(RemoteAnimationTargets)}, except this matches the * apps in targets.apps to that of the split screened tasks. If split screen is active, then * {@link #mRemoteTargetHandles} index 0 will be the left/top task, index one right/bottom */ public RemoteTargetHandle[] assignTargetsForSplitScreen(RemoteAnimationTargets targets) { int[] splitIds = LauncherSplitScreenListener.INSTANCE.getNoCreate() .getRunningSplitTaskIds(); RemoteAnimationTargetCompat primaryTaskTarget; RemoteAnimationTargetCompat secondaryTaskTarget; if (mRemoteTargetHandles.length == 1) { // If we're not in split screen, the splitIds count doesn't really matter since we // should always hit this case. Right now there's no use case for multiple app targets // without being in split screen primaryTaskTarget = targets.apps[0]; mRemoteTargetHandles[0].mTransformParams.setTargetSet(targets); mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, null); } else { // split screen primaryTaskTarget = targets.findTask(splitIds[0]); secondaryTaskTarget = targets.findTask(splitIds[1]); RemoteAnimationTargetCompat dividerTarget = targets.getNonAppTargetOfType( TYPE_DOCK_DIVIDER); mStagedSplitBounds = new SplitConfigurationOptions.StagedSplitBounds( primaryTaskTarget.screenSpaceBounds, secondaryTaskTarget.screenSpaceBounds, dividerTarget.screenSpaceBounds); mRemoteTargetHandles[0].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(primaryTaskTarget, targets)); mRemoteTargetHandles[0].mTaskViewSimulator.setPreview(primaryTaskTarget, mStagedSplitBounds); mRemoteTargetHandles[1].mTransformParams.setTargetSet( createRemoteAnimationTargetsForTarget(secondaryTaskTarget, targets)); mRemoteTargetHandles[1].mTaskViewSimulator.setPreview(secondaryTaskTarget, mStagedSplitBounds); } return mRemoteTargetHandles; } private RemoteAnimationTargets createRemoteAnimationTargetsForTarget( RemoteAnimationTargetCompat target, RemoteAnimationTargets targets) { return new RemoteAnimationTargets(new RemoteAnimationTargetCompat[]{target}, targets.wallpapers, targets.nonApps, targets.targetMode); } public RemoteTargetHandle[] getRemoteTargetHandles() { return mRemoteTargetHandles; } public SplitConfigurationOptions.StagedSplitBounds getStagedSplitBounds() { return mStagedSplitBounds; } /** * Container to keep together all the associated objects whose properties need to be updated to * animate a single remote app target */ public static class RemoteTargetHandle { private final TaskViewSimulator mTaskViewSimulator; private final TransformParams mTransformParams; @Nullable private AnimatorControllerWithResistance mPlaybackController; public RemoteTargetHandle(TaskViewSimulator taskViewSimulator, TransformParams transformParams) { mTransformParams = transformParams; mTaskViewSimulator = taskViewSimulator; } public TaskViewSimulator getTaskViewSimulator() { return mTaskViewSimulator; } public TransformParams getTransformParams() { return mTransformParams; } @Nullable public AnimatorControllerWithResistance getPlaybackController() { return mPlaybackController; } public void setPlaybackController( @Nullable AnimatorControllerWithResistance playbackController) { mPlaybackController = playbackController; } } }
quickstep/src/com/android/quickstep/SwipeUpAnimationLogic.java +15 −86 File changed.Preview size limit exceeded, changes collapsed. Show changes