Some 3P launcher transition fixes am: 91d26f0b5e am: 53ceb7df56
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/14430440 Change-Id: I24d4d36b6bb5aa5183217c0745a8620093b5c68e
This commit is contained in:
@@ -47,7 +47,6 @@ import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
|
|||||||
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
|
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
|
||||||
import static com.android.quickstep.util.SwipePipToHomeAnimator.FRACTION_END;
|
import static com.android.quickstep.util.SwipePipToHomeAnimator.FRACTION_END;
|
||||||
import static com.android.quickstep.util.SwipePipToHomeAnimator.FRACTION_START;
|
import static com.android.quickstep.util.SwipePipToHomeAnimator.FRACTION_START;
|
||||||
import static com.android.quickstep.views.RecentsView.RECENTS_GRID_PROGRESS;
|
|
||||||
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
|
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
|
||||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
|
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
|
||||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
|
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACTIVITY_TYPE_HOME;
|
||||||
@@ -55,7 +54,6 @@ import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.ACT
|
|||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
import android.animation.AnimatorSet;
|
import android.animation.AnimatorSet;
|
||||||
import android.animation.ObjectAnimator;
|
|
||||||
import android.animation.ValueAnimator;
|
import android.animation.ValueAnimator;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
@@ -464,8 +462,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
mDeviceState.getRotationTouchHelper()
|
mDeviceState.getRotationTouchHelper()
|
||||||
.onEndTargetCalculated(mGestureState.getEndTarget(),
|
.onEndTargetCalculated(mGestureState.getEndTarget(),
|
||||||
mActivityInterface);
|
mActivityInterface);
|
||||||
|
|
||||||
mRecentsView.onGestureEndTargetCalculated(mGestureState.getEndTarget());
|
|
||||||
});
|
});
|
||||||
|
|
||||||
notifyGestureStartedAsync();
|
notifyGestureStartedAsync();
|
||||||
@@ -1133,6 +1129,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
}
|
}
|
||||||
homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y);
|
homeAnimFactory.playAtomicAnimation(velocityPxPerMs.y);
|
||||||
mLauncherTransitionController = null;
|
mLauncherTransitionController = null;
|
||||||
|
|
||||||
|
if (mRecentsView != null) {
|
||||||
|
mRecentsView.onPrepareGestureEndAnimation(null, mGestureState.getEndTarget());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
AnimatorSet animatorSet = new AnimatorSet();
|
AnimatorSet animatorSet = new AnimatorSet();
|
||||||
ValueAnimator windowAnim = mCurrentShift.animateToValue(start, end);
|
ValueAnimator windowAnim = mCurrentShift.animateToValue(start, end);
|
||||||
@@ -1171,9 +1171,9 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
animatorSet.play(windowAnim);
|
animatorSet.play(windowAnim);
|
||||||
S state = mActivityInterface.stateFromGestureEndTarget(mGestureState.getEndTarget());
|
if (mRecentsView != null) {
|
||||||
if (mRecentsView != null && state.displayOverviewTasksAsGrid(mDp)) {
|
mRecentsView.onPrepareGestureEndAnimation(
|
||||||
animatorSet.play(ObjectAnimator.ofFloat(mRecentsView, RECENTS_GRID_PROGRESS, 1));
|
animatorSet, mGestureState.getEndTarget());
|
||||||
}
|
}
|
||||||
animatorSet.setDuration(duration).setInterpolator(interpolator);
|
animatorSet.setDuration(duration).setInterpolator(interpolator);
|
||||||
animatorSet.start();
|
animatorSet.start();
|
||||||
|
|||||||
@@ -22,11 +22,13 @@ import static com.android.launcher3.QuickstepTransitionManager.RECENTS_LAUNCH_DU
|
|||||||
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_DURATION;
|
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_DURATION;
|
||||||
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY;
|
import static com.android.launcher3.QuickstepTransitionManager.STATUS_BAR_TRANSITION_PRE_DELAY;
|
||||||
import static com.android.launcher3.Utilities.createHomeIntent;
|
import static com.android.launcher3.Utilities.createHomeIntent;
|
||||||
|
import static com.android.launcher3.graphics.SysUiScrim.SYSUI_PROGRESS;
|
||||||
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
|
import static com.android.launcher3.testing.TestProtocol.OVERVIEW_STATE_ORDINAL;
|
||||||
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
|
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
|
||||||
import static com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator;
|
import static com.android.quickstep.TaskViewUtils.createRecentsWindowAnimator;
|
||||||
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
|
import static com.android.quickstep.util.NavigationModeFeatureFlag.LIVE_TILE;
|
||||||
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
|
||||||
|
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
|
||||||
|
|
||||||
import android.animation.Animator;
|
import android.animation.Animator;
|
||||||
import android.animation.AnimatorListenerAdapter;
|
import android.animation.AnimatorListenerAdapter;
|
||||||
@@ -36,6 +38,7 @@ import android.content.res.Configuration;
|
|||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
|
import android.view.SurfaceControl.Transaction;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -48,6 +51,7 @@ import com.android.launcher3.LauncherAnimationRunner.AnimationResult;
|
|||||||
import com.android.launcher3.R;
|
import com.android.launcher3.R;
|
||||||
import com.android.launcher3.WrappedAnimationRunnerImpl;
|
import com.android.launcher3.WrappedAnimationRunnerImpl;
|
||||||
import com.android.launcher3.WrappedLauncherAnimationRunner;
|
import com.android.launcher3.WrappedLauncherAnimationRunner;
|
||||||
|
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||||
import com.android.launcher3.anim.Interpolators;
|
import com.android.launcher3.anim.Interpolators;
|
||||||
import com.android.launcher3.anim.PendingAnimation;
|
import com.android.launcher3.anim.PendingAnimation;
|
||||||
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
import com.android.launcher3.compat.AccessibilityManagerCompat;
|
||||||
@@ -92,6 +96,8 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||||||
|
|
||||||
private Handler mUiHandler = new Handler(Looper.getMainLooper());
|
private Handler mUiHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
|
private static final long HOME_APPEAR_DURATION = 250;
|
||||||
|
|
||||||
private RecentsDragLayer mDragLayer;
|
private RecentsDragLayer mDragLayer;
|
||||||
private ScrimView mScrimView;
|
private ScrimView mScrimView;
|
||||||
private FallbackRecentsView mFallbackRecentsView;
|
private FallbackRecentsView mFallbackRecentsView;
|
||||||
@@ -114,6 +120,7 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||||||
mScrimView = findViewById(R.id.scrim_view);
|
mScrimView = findViewById(R.id.scrim_view);
|
||||||
mFallbackRecentsView = findViewById(R.id.overview_panel);
|
mFallbackRecentsView = findViewById(R.id.overview_panel);
|
||||||
mActionsView = findViewById(R.id.overview_actions_view);
|
mActionsView = findViewById(R.id.overview_actions_view);
|
||||||
|
SYSUI_PROGRESS.set(getRootView().getSysUiScrim(), 0f);
|
||||||
|
|
||||||
SplitPlaceholderView splitPlaceholderView = findViewById(R.id.split_placeholder);
|
SplitPlaceholderView splitPlaceholderView = findViewById(R.id.split_placeholder);
|
||||||
splitPlaceholderView.init(
|
splitPlaceholderView.init(
|
||||||
@@ -351,7 +358,32 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void startHomeInternal() {
|
private void startHomeInternal() {
|
||||||
startActivity(createHomeIntent());
|
WrappedLauncherAnimationRunner runner = new WrappedLauncherAnimationRunner(
|
||||||
|
getMainThreadHandler(), this::onCreateAnimationToHome, true);
|
||||||
|
RemoteAnimationAdapterCompat adapterCompat =
|
||||||
|
new RemoteAnimationAdapterCompat(runner, HOME_APPEAR_DURATION, 0);
|
||||||
|
startActivity(createHomeIntent(),
|
||||||
|
ActivityOptionsCompat.makeRemoteAnimation(adapterCompat).toBundle());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onCreateAnimationToHome(
|
||||||
|
int transit, RemoteAnimationTargetCompat[] appTargets,
|
||||||
|
RemoteAnimationTargetCompat[] wallpaperTargets,
|
||||||
|
RemoteAnimationTargetCompat[] nonAppTargets, AnimationResult result) {
|
||||||
|
AnimatorPlaybackController controller = getStateManager()
|
||||||
|
.createAnimationToNewWorkspace(RecentsState.BG_LAUNCHER, HOME_APPEAR_DURATION);
|
||||||
|
controller.dispatchOnStart();
|
||||||
|
|
||||||
|
RemoteAnimationTargets targets = new RemoteAnimationTargets(
|
||||||
|
appTargets, wallpaperTargets, nonAppTargets, MODE_OPENING);
|
||||||
|
for (RemoteAnimationTargetCompat app : targets.apps) {
|
||||||
|
new Transaction().setAlpha(app.leash.getSurfaceControl(), 1).apply();
|
||||||
|
}
|
||||||
|
AnimatorSet anim = new AnimatorSet();
|
||||||
|
anim.play(controller.getAnimationPlayer());
|
||||||
|
anim.setDuration(HOME_APPEAR_DURATION);
|
||||||
|
result.setAnimation(anim, this,
|
||||||
|
() -> getStateManager().goToState(RecentsState.HOME, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import static com.android.quickstep.fallback.RecentsState.DEFAULT;
|
|||||||
import static com.android.quickstep.fallback.RecentsState.HOME;
|
import static com.android.quickstep.fallback.RecentsState.HOME;
|
||||||
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
import static com.android.quickstep.fallback.RecentsState.MODAL_TASK;
|
||||||
|
|
||||||
|
import android.animation.AnimatorSet;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.app.ActivityManager.RunningTaskInfo;
|
import android.app.ActivityManager.RunningTaskInfo;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -27,6 +28,9 @@ import android.os.Build;
|
|||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||||
import com.android.launcher3.anim.PendingAnimation;
|
import com.android.launcher3.anim.PendingAnimation;
|
||||||
import com.android.launcher3.statemanager.StateManager.StateListener;
|
import com.android.launcher3.statemanager.StateManager.StateListener;
|
||||||
import com.android.launcher3.testing.TestProtocol;
|
import com.android.launcher3.testing.TestProtocol;
|
||||||
@@ -67,7 +71,6 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
|||||||
@Override
|
@Override
|
||||||
public void startHome() {
|
public void startHome() {
|
||||||
mActivity.startHome();
|
mActivity.startHome();
|
||||||
mActivity.getStateManager().goToState(RecentsState.HOME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -86,14 +89,17 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity, RecentsSta
|
|||||||
* to the center.
|
* to the center.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onGestureEndTargetCalculated(GestureState.GestureEndTarget endTarget) {
|
public void onPrepareGestureEndAnimation(
|
||||||
super.onGestureEndTargetCalculated(endTarget);
|
@Nullable AnimatorSet animatorSet, GestureState.GestureEndTarget endTarget) {
|
||||||
if (mHomeTaskInfo != null && endTarget == RECENTS) {
|
super.onPrepareGestureEndAnimation(animatorSet, endTarget);
|
||||||
|
if (mHomeTaskInfo != null && endTarget == RECENTS && animatorSet != null) {
|
||||||
TaskView tv = getTaskView(mHomeTaskInfo.taskId);
|
TaskView tv = getTaskView(mHomeTaskInfo.taskId);
|
||||||
if (tv != null) {
|
if (tv != null) {
|
||||||
PendingAnimation pa = createTaskDismissAnimation(tv, true, false, 150);
|
PendingAnimation pa = createTaskDismissAnimation(tv, true, false, 150);
|
||||||
pa.addEndListener(e -> setCurrentTask(-1));
|
pa.addEndListener(e -> setCurrentTask(-1));
|
||||||
runDismissAnimation(pa);
|
AnimatorPlaybackController controller = pa.createPlaybackController();
|
||||||
|
controller.dispatchOnStart();
|
||||||
|
animatorSet.play(controller.getAnimationPlayer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ public class RecentsState implements BaseState<RecentsState> {
|
|||||||
public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2,
|
public static final RecentsState BACKGROUND_APP = new BackgroundAppState(2,
|
||||||
FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN);
|
FLAG_DISABLE_RESTORE | FLAG_NON_INTERACTIVE | FLAG_FULL_SCREEN);
|
||||||
public static final RecentsState HOME = new RecentsState(3, 0);
|
public static final RecentsState HOME = new RecentsState(3, 0);
|
||||||
|
public static final RecentsState BG_LAUNCHER = new LauncherState(4, 0);
|
||||||
|
|
||||||
public final int ordinal;
|
public final int ordinal;
|
||||||
private final int mFlags;
|
private final int mFlags;
|
||||||
@@ -161,4 +162,15 @@ public class RecentsState implements BaseState<RecentsState> {
|
|||||||
return getOverviewScaleAndOffsetForBackgroundState(activity);
|
return getOverviewScaleAndOffsetForBackgroundState(activity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static class LauncherState extends RecentsState {
|
||||||
|
LauncherState(int id, int flags) {
|
||||||
|
super(id, flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public float[] getOverviewScaleAndOffset(RecentsActivity activity) {
|
||||||
|
return new float[] { NO_SCALE, 1 };
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1631,7 +1631,16 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
/**
|
/**
|
||||||
* Called when a gesture from an app has finished, and an end target has been determined.
|
* Called when a gesture from an app has finished, and an end target has been determined.
|
||||||
*/
|
*/
|
||||||
public void onGestureEndTargetCalculated(GestureState.GestureEndTarget endTarget) {
|
public void onPrepareGestureEndAnimation(
|
||||||
|
@Nullable AnimatorSet animatorSet, GestureState.GestureEndTarget endTarget) {
|
||||||
|
if (mSizeStrategy.stateFromGestureEndTarget(endTarget)
|
||||||
|
.displayOverviewTasksAsGrid(mActivity.getDeviceProfile())) {
|
||||||
|
if (animatorSet == null) {
|
||||||
|
setGridProgress(1);
|
||||||
|
} else {
|
||||||
|
animatorSet.play(ObjectAnimator.ofFloat(this, RECENTS_GRID_PROGRESS, 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
mCurrentGestureEndTarget = endTarget;
|
mCurrentGestureEndTarget = endTarget;
|
||||||
if (endTarget == GestureState.GestureEndTarget.NEW_TASK
|
if (endTarget == GestureState.GestureEndTarget.NEW_TASK
|
||||||
|| endTarget == GestureState.GestureEndTarget.LAST_TASK) {
|
|| endTarget == GestureState.GestureEndTarget.LAST_TASK) {
|
||||||
@@ -2348,7 +2357,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void runDismissAnimation(PendingAnimation pendingAnim) {
|
private void runDismissAnimation(PendingAnimation pendingAnim) {
|
||||||
AnimatorPlaybackController controller = pendingAnim.createPlaybackController();
|
AnimatorPlaybackController controller = pendingAnim.createPlaybackController();
|
||||||
controller.dispatchOnStart();
|
controller.dispatchOnStart();
|
||||||
controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
|
controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
|
||||||
|
|||||||
Reference in New Issue
Block a user