Merge "Consolidate split divider show/hide behavior" into tm-qpr-dev am: 064d88d8b8 am: 8ab17926ac am: 1dcf99f961
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/22099682 Change-Id: I7865f45a9f3db1867780e0277ed83905dceb1309 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -278,8 +278,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private RunningWindowAnim[] mRunningWindowAnim;
|
private RunningWindowAnim[] mRunningWindowAnim;
|
||||||
// Possible second animation running at the same time as mRunningWindowAnim
|
// Possible second animation running at the same time as mRunningWindowAnim
|
||||||
private Animator mParallelRunningAnim;
|
private Animator mParallelRunningAnim;
|
||||||
// Current running divider animation
|
|
||||||
private ValueAnimator mDividerAnimator;
|
|
||||||
private boolean mIsMotionPaused;
|
private boolean mIsMotionPaused;
|
||||||
private boolean mHasMotionEverBeenPaused;
|
private boolean mHasMotionEverBeenPaused;
|
||||||
|
|
||||||
@@ -324,8 +322,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
private final boolean mIsTransientTaskbar;
|
private final boolean mIsTransientTaskbar;
|
||||||
// May be set to false when mIsTransientTaskbar is true.
|
// May be set to false when mIsTransientTaskbar is true.
|
||||||
private boolean mCanSlowSwipeGoHome = true;
|
private boolean mCanSlowSwipeGoHome = true;
|
||||||
private boolean mHasReachedOverviewThreshold = false;
|
// Indicates whether the divider is shown, only used when split screen is activated.
|
||||||
private boolean mDividerHiddenBeforeAnimation = false;
|
private boolean mIsDividerShown = true;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null;
|
private RemoteAnimationTargets.ReleaseCheck mSwipePipToHomeReleaseCheck = null;
|
||||||
@@ -766,10 +764,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|
|
||||||
private void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask, boolean animate) {
|
private void setIsLikelyToStartNewTask(boolean isLikelyToStartNewTask, boolean animate) {
|
||||||
if (mIsLikelyToStartNewTask != isLikelyToStartNewTask) {
|
if (mIsLikelyToStartNewTask != isLikelyToStartNewTask) {
|
||||||
if (isLikelyToStartNewTask && mIsTransientTaskbar) {
|
|
||||||
setDividerShown(false /* shown */, true /* immediate */);
|
|
||||||
}
|
|
||||||
|
|
||||||
mIsLikelyToStartNewTask = isLikelyToStartNewTask;
|
mIsLikelyToStartNewTask = isLikelyToStartNewTask;
|
||||||
maybeUpdateRecentsAttachedState(animate);
|
maybeUpdateRecentsAttachedState(animate);
|
||||||
}
|
}
|
||||||
@@ -1107,9 +1101,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
} else {
|
} else {
|
||||||
mStateCallback.setState(STATE_RESUME_LAST_TASK);
|
mStateCallback.setState(STATE_RESUME_LAST_TASK);
|
||||||
}
|
}
|
||||||
if (mRecentsAnimationTargets != null) {
|
// Restore the divider as it resumes the last top-tasks.
|
||||||
setDividerShown(true /* shown */, true /* immediate */);
|
setDividerShown(true);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ActiveGestureLog.INSTANCE.addLog(
|
ActiveGestureLog.INSTANCE.addLog(
|
||||||
@@ -1281,9 +1274,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
if (mRecentsAnimationController != null) {
|
if (mRecentsAnimationController != null) {
|
||||||
mRecentsAnimationController.detachNavigationBarFromApp(true);
|
mRecentsAnimationController.detachNavigationBarFromApp(true);
|
||||||
}
|
}
|
||||||
if (mIsTransientTaskbar) {
|
|
||||||
setDividerShown(false /* shown */, true /* immediate */);
|
|
||||||
}
|
|
||||||
} else if (endTarget == RECENTS) {
|
} else if (endTarget == RECENTS) {
|
||||||
if (mRecentsView != null) {
|
if (mRecentsView != null) {
|
||||||
int nearestPage = mRecentsView.getDestinationPage();
|
int nearestPage = mRecentsView.getDestinationPage();
|
||||||
@@ -1683,12 +1673,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mRecentsAnimationController.enableInputConsumer();
|
mRecentsAnimationController.enableInputConsumer();
|
||||||
|
|
||||||
// Start hiding the divider
|
|
||||||
if (!mIsTransientTaskbar || mTaskbarAlreadyOpen || mIsTaskbarAllAppsOpen
|
|
||||||
|| mDividerHiddenBeforeAnimation) {
|
|
||||||
setDividerShown(false /* shown */, true /* immediate */);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void computeRecentsScrollIfInvisible() {
|
private void computeRecentsScrollIfInvisible() {
|
||||||
@@ -2156,9 +2140,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
||||||
if (!controller.getFinishTargetIsLauncher()) {
|
|
||||||
setDividerShown(true /* shown */, false /* immediate */);
|
|
||||||
}
|
|
||||||
mRecentsAnimationController = null;
|
mRecentsAnimationController = null;
|
||||||
mRecentsAnimationTargets = null;
|
mRecentsAnimationTargets = null;
|
||||||
if (mRecentsView != null) {
|
if (mRecentsView != null) {
|
||||||
@@ -2258,18 +2239,23 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
boolean notSwipingToHome = mRecentsAnimationTargets != null
|
boolean notSwipingToHome = mRecentsAnimationTargets != null
|
||||||
&& mGestureState.getEndTarget() != HOME;
|
&& mGestureState.getEndTarget() != HOME;
|
||||||
boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null;
|
boolean setRecentsScroll = mRecentsViewScrollLinked && mRecentsView != null;
|
||||||
|
float progress = Math.max(mCurrentShift.value, getScaleProgressDueToScroll());
|
||||||
|
int scrollOffset = setRecentsScroll ? mRecentsView.getScrollOffset() : 0;
|
||||||
|
if (progress > 0 || scrollOffset != 0) {
|
||||||
|
// Hide the divider as the tasks start moving.
|
||||||
|
setDividerShown(false);
|
||||||
|
}
|
||||||
for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) {
|
for (RemoteTargetHandle remoteHandle : mRemoteTargetHandles) {
|
||||||
AnimatorControllerWithResistance playbackController =
|
AnimatorControllerWithResistance playbackController =
|
||||||
remoteHandle.getPlaybackController();
|
remoteHandle.getPlaybackController();
|
||||||
if (playbackController != null) {
|
if (playbackController != null) {
|
||||||
playbackController.setProgress(Math.max(mCurrentShift.value,
|
playbackController.setProgress(progress, mDragLengthFactor);
|
||||||
getScaleProgressDueToScroll()), mDragLengthFactor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (notSwipingToHome) {
|
if (notSwipingToHome) {
|
||||||
TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator();
|
TaskViewSimulator taskViewSimulator = remoteHandle.getTaskViewSimulator();
|
||||||
if (setRecentsScroll) {
|
if (setRecentsScroll) {
|
||||||
taskViewSimulator.setScroll(mRecentsView.getScrollOffset());
|
taskViewSimulator.setScroll(scrollOffset);
|
||||||
}
|
}
|
||||||
taskViewSimulator.apply(remoteHandle.getTransformParams());
|
taskViewSimulator.apply(remoteHandle.getTransformParams());
|
||||||
}
|
}
|
||||||
@@ -2328,10 +2314,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
|
|
||||||
// "Catch up" with the displacement at mTaskbarCatchUpThreshold.
|
// "Catch up" with the displacement at mTaskbarCatchUpThreshold.
|
||||||
if (displacement < mTaskbarCatchUpThreshold) {
|
if (displacement < mTaskbarCatchUpThreshold) {
|
||||||
if (!mHasReachedOverviewThreshold) {
|
|
||||||
setDividerShown(false /* shown */, true /* immediate */);
|
|
||||||
mHasReachedOverviewThreshold = true;
|
|
||||||
}
|
|
||||||
return Utilities.mapToRange(displacement, mTaskbarAppWindowThreshold,
|
return Utilities.mapToRange(displacement, mTaskbarAppWindowThreshold,
|
||||||
mTaskbarCatchUpThreshold, 0, mTaskbarCatchUpThreshold, ACCEL_DEACCEL);
|
mTaskbarCatchUpThreshold, 0, mTaskbarCatchUpThreshold, ACCEL_DEACCEL);
|
||||||
}
|
}
|
||||||
@@ -2339,23 +2321,13 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<S>,
|
|||||||
return displacement;
|
return displacement;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDividerShown(boolean shown, boolean immediate) {
|
private void setDividerShown(boolean shown) {
|
||||||
if (mRecentsAnimationTargets == null) {
|
if (mRecentsAnimationTargets == null || mIsDividerShown == shown) {
|
||||||
if (!shown) {
|
|
||||||
mDividerHiddenBeforeAnimation = true;
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mDividerAnimator != null) {
|
mIsDividerShown = shown;
|
||||||
mDividerAnimator.cancel();
|
TaskViewUtils.createSplitAuxiliarySurfacesAnimator(
|
||||||
}
|
mRecentsAnimationTargets.nonApps, shown, null /* animatorHandler */);
|
||||||
mDividerAnimator = TaskViewUtils.createSplitAuxiliarySurfacesAnimator(
|
|
||||||
mRecentsAnimationTargets.nonApps, shown, (dividerAnimator) -> {
|
|
||||||
dividerAnimator.start();
|
|
||||||
if (immediate) {
|
|
||||||
dividerAnimator.end();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -186,12 +186,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (nonAppTargets.length > 0) {
|
} else if (nonAppTargets.length > 0) {
|
||||||
TaskViewUtils.createSplitAuxiliarySurfacesAnimator(
|
TaskViewUtils.createSplitAuxiliarySurfacesAnimator(nonAppTargets /* nonApps */,
|
||||||
nonAppTargets /* nonApps */,
|
true /*shown*/, null /* animatorHandler */);
|
||||||
true /*shown*/, dividerAnimator -> {
|
|
||||||
dividerAnimator.start();
|
|
||||||
dividerAnimator.end();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
if (mController != null) {
|
if (mController != null) {
|
||||||
if (mLastAppearedTaskTarget == null
|
if (mLastAppearedTaskTarget == null
|
||||||
|
|||||||
@@ -679,28 +679,36 @@ public final class TaskViewUtils {
|
|||||||
/**
|
/**
|
||||||
* Creates an animation to show/hide the auxiliary surfaces (aka. divider bar), only calling
|
* Creates an animation to show/hide the auxiliary surfaces (aka. divider bar), only calling
|
||||||
* {@param animatorHandler} if there are valid surfaces to animate.
|
* {@param animatorHandler} if there are valid surfaces to animate.
|
||||||
|
* Passing null handler to apply the visibility immediately.
|
||||||
*
|
*
|
||||||
* @return the animator animating the surfaces
|
* @return the animator animating the surfaces
|
||||||
*/
|
*/
|
||||||
public static ValueAnimator createSplitAuxiliarySurfacesAnimator(
|
public static ValueAnimator createSplitAuxiliarySurfacesAnimator(
|
||||||
RemoteAnimationTarget[] nonApps, boolean shown,
|
@Nullable RemoteAnimationTarget[] nonApps, boolean shown,
|
||||||
Consumer<ValueAnimator> animatorHandler) {
|
@Nullable Consumer<ValueAnimator> animatorHandler) {
|
||||||
if (nonApps == null || nonApps.length == 0) {
|
if (nonApps == null || nonApps.length == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
List<SurfaceControl> auxiliarySurfaces = new ArrayList<>();
|
||||||
List<SurfaceControl> auxiliarySurfaces = new ArrayList<>(nonApps.length);
|
for (RemoteAnimationTarget target : nonApps) {
|
||||||
boolean hasSurfaceToAnimate = false;
|
final SurfaceControl leash = target.leash;
|
||||||
for (int i = 0; i < nonApps.length; ++i) {
|
if (target.windowType == TYPE_DOCK_DIVIDER && leash != null && leash.isValid()) {
|
||||||
final RemoteAnimationTarget targ = nonApps[i];
|
|
||||||
final SurfaceControl leash = targ.leash;
|
|
||||||
if (targ.windowType == TYPE_DOCK_DIVIDER && leash != null && leash.isValid()) {
|
|
||||||
auxiliarySurfaces.add(leash);
|
auxiliarySurfaces.add(leash);
|
||||||
hasSurfaceToAnimate = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasSurfaceToAnimate) {
|
if (auxiliarySurfaces.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
SurfaceControl.Transaction t = new SurfaceControl.Transaction();
|
||||||
|
if (animatorHandler == null) {
|
||||||
|
// Apply the visibility directly without fade animation.
|
||||||
|
for (SurfaceControl leash : auxiliarySurfaces) {
|
||||||
|
t.setVisibility(leash, shown);
|
||||||
|
}
|
||||||
|
t.apply();
|
||||||
|
t.close();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user