Revert "Add support for taskbar background to wrap around hotseat"
This reverts commit 5dc07d786f.
Reason for revert: b/360116669
Bug: 345768019
Change-Id: Id70ceed141e2106f746d4a0e68a09675ba45dd28
Fixes: 360116669
Test: open taskbar, open all apps w/ ime, use ime back button
Flag: com.android.launcher3.enable_scaling_reveal_home_animation
This commit is contained in:
@@ -24,7 +24,6 @@ import static com.android.launcher3.taskbar.TaskbarLauncherStateController.FLAG_
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.graphics.Rect;
|
||||
import android.window.RemoteTransition;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -189,24 +188,6 @@ public class LauncherTaskbarUIController extends TaskbarUIController {
|
||||
placeholderDuration));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of launcher's hotseat.
|
||||
*/
|
||||
public void getHotseatBounds(Rect hotseatBoundsOut) {
|
||||
DeviceProfile launcherDP = mLauncher.getDeviceProfile();
|
||||
if (launcherDP.isQsbInline) {
|
||||
// Not currently supported.
|
||||
hotseatBoundsOut.setEmpty();
|
||||
return;
|
||||
}
|
||||
int left = (launcherDP.widthPx - launcherDP.getHotseatWidthPx()
|
||||
- mLauncher.getHotseat().getUnusedHorizontalSpace()) / 2;
|
||||
int right = left + launcherDP.getHotseatWidthPx();
|
||||
int bottom = launcherDP.getHotseatLayoutPadding(mLauncher).bottom;
|
||||
int top = bottom - launcherDP.hotseatCellHeightPx;
|
||||
hotseatBoundsOut.set(left, top, right, bottom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called from onResume() and onPause(), and animates the Taskbar accordingly.
|
||||
*/
|
||||
|
||||
@@ -208,11 +208,8 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
* Creates and returns a {@link RevealOutlineAnimation} Animator that updates the stashed handle
|
||||
* shape and size. When stashed, the shape is a thin rounded pill. When unstashed, the shape
|
||||
* morphs into the size of where the taskbar icons will be.
|
||||
*
|
||||
* @param taskbarToHotseatOffsets A Rect of offsets used to transform the bounds of the
|
||||
* stashed handle to wrap around the hotseat items.
|
||||
*/
|
||||
public Animator createRevealAnimToIsStashed(boolean isStashed, Rect taskbarToHotseatOffsets) {
|
||||
public Animator createRevealAnimToIsStashed(boolean isStashed) {
|
||||
Rect visualBounds = mControllers.taskbarViewController.getIconLayoutVisualBounds();
|
||||
float startRadius = mStashedHandleRadius;
|
||||
|
||||
@@ -223,13 +220,6 @@ public class StashedHandleViewController implements TaskbarControllers.LoggableT
|
||||
visualBounds.bottom += heightDiff;
|
||||
|
||||
startRadius = visualBounds.height() / 2f;
|
||||
|
||||
// We use these offsets to create a larger stashed handle to wrap around the items
|
||||
// of the hotseat. This is only used for certain animations.
|
||||
visualBounds.top += taskbarToHotseatOffsets.top;
|
||||
visualBounds.bottom += taskbarToHotseatOffsets.bottom;
|
||||
visualBounds.left += taskbarToHotseatOffsets.left;
|
||||
visualBounds.right += taskbarToHotseatOffsets.right;
|
||||
}
|
||||
|
||||
final RevealOutlineAnimation handleRevealProvider = new RoundedRectRevealOutlineProvider(
|
||||
|
||||
@@ -361,38 +361,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
dispatchDeviceProfileChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the offsets needed to transform the transient taskbar bounds to the hotseat bounds.
|
||||
* @return The offsets will be stored in a Rect
|
||||
*/
|
||||
public Rect calculateTaskbarToHotseatOffsets(Rect hotseatBounds) {
|
||||
Rect taskbar = getTransientTaskbarBounds();
|
||||
Rect offsets = new Rect();
|
||||
|
||||
offsets.left = hotseatBounds.left - taskbar.left;
|
||||
offsets.right = hotseatBounds.right - taskbar.right;
|
||||
|
||||
int heightDiff = hotseatBounds.height() - taskbar.height();
|
||||
offsets.top = (taskbar.height() - heightDiff) / 2;
|
||||
|
||||
int gleanedTaskbarPadding = (mDeviceProfile.taskbarHeight
|
||||
- getTransientTaskbarBounds().height()) / 2;
|
||||
offsets.left -= gleanedTaskbarPadding;
|
||||
offsets.top -= gleanedTaskbarPadding;
|
||||
offsets.right += gleanedTaskbarPadding;
|
||||
|
||||
// Bottom is relative to the bottom of layout, so we can calculate it with padding included.
|
||||
offsets.bottom = (hotseatBounds.height() - taskbar.height()) / 2;
|
||||
|
||||
// Update bounds in taskbar background
|
||||
if (hotseatBounds.isEmpty()) {
|
||||
mDragLayer.getTaskbarToHotseatOffsetRect().setEmpty();
|
||||
} else {
|
||||
mDragLayer.getTaskbarToHotseatOffsetRect().set(offsets);
|
||||
}
|
||||
return offsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy the original DeviceProfile, match the number of hotseat icons and qsb width and update
|
||||
* the icon size
|
||||
@@ -1716,18 +1684,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
|
||||
return AnimatorPlaybackController.wrap(fullAnimation, duration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the bounds of launcher's hotseat (if exists).
|
||||
*/
|
||||
public void getHotseatBounds(Rect hotseatBoundsOut) {
|
||||
TaskbarUIController uiController = mControllers.uiController;
|
||||
if (uiController instanceof LauncherTaskbarUIController launcherController) {
|
||||
launcherController.getHotseatBounds(hotseatBoundsOut);
|
||||
} else {
|
||||
hotseatBoundsOut.setEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when we determine the touchable region.
|
||||
*
|
||||
|
||||
@@ -21,7 +21,6 @@ import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.graphics.Paint
|
||||
import android.graphics.Path
|
||||
import android.graphics.Rect
|
||||
import android.graphics.RectF
|
||||
import com.android.app.animation.Interpolators
|
||||
import com.android.internal.policy.ScreenDecorationsUtils
|
||||
@@ -60,9 +59,6 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
var translationYForSwipe = 0f
|
||||
var translationYForStash = 0f
|
||||
|
||||
// When not empty, we can use this to transform transient taskbar background to hotseat bounds.
|
||||
val taskbarToHotseatOffsetRect = Rect()
|
||||
|
||||
private val transientBackgroundBounds = context.transientTaskbarBounds
|
||||
|
||||
private val shadowAlpha: Float
|
||||
@@ -230,12 +226,6 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
val radius = newBackgroundHeight / 2f
|
||||
val bottomMarginProgress = bottomMargin * ((1f - progress) / 2f)
|
||||
|
||||
// Used to transform the background so that it wraps around the items on the hotseat.
|
||||
val hotseatOffsetLeft = taskbarToHotseatOffsetRect.left * progress
|
||||
val hotseatOffsetTop = taskbarToHotseatOffsetRect.top * progress
|
||||
val hotseatOffsetRight = taskbarToHotseatOffsetRect.right * progress
|
||||
val hotseatOffsetBottom = taskbarToHotseatOffsetRect.bottom * progress
|
||||
|
||||
// Aligns the bottom with the bottom of the stashed handle.
|
||||
val bottom =
|
||||
canvas.height - bottomMargin +
|
||||
@@ -260,10 +250,10 @@ class TaskbarBackgroundRenderer(private val context: TaskbarActivityContext) {
|
||||
strokePaint.alpha = (paint.alpha * strokeAlpha) / 255
|
||||
|
||||
lastDrawnTransientRect.set(
|
||||
transientBackgroundBounds.left + halfWidthDelta + hotseatOffsetLeft,
|
||||
bottom - newBackgroundHeight + hotseatOffsetTop,
|
||||
transientBackgroundBounds.right - halfWidthDelta + hotseatOffsetRight,
|
||||
bottom + hotseatOffsetBottom,
|
||||
transientBackgroundBounds.left + halfWidthDelta,
|
||||
bottom - newBackgroundHeight,
|
||||
transientBackgroundBounds.right - halfWidthDelta,
|
||||
bottom
|
||||
)
|
||||
val horizontalInset = fullWidth * widthInsetPercentage
|
||||
lastDrawnTransientRect.inset(horizontalInset, 0f)
|
||||
|
||||
@@ -22,7 +22,6 @@ import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UN
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.media.permission.SafeCloseable;
|
||||
import android.util.AttributeSet;
|
||||
@@ -260,11 +259,6 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
|
||||
return mBackgroundRenderer.getLastDrawnTransientRect();
|
||||
}
|
||||
|
||||
/** Returns the rect used to transform transient taskbar to the hotseat */
|
||||
public Rect getTaskbarToHotseatOffsetRect() {
|
||||
return mBackgroundRenderer.getTaskbarToHotseatOffsetRect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean dispatchTouchEvent(MotionEvent ev) {
|
||||
TestLogging.recordMotionEvent(TestProtocol.SEQUENCE_MAIN, "Touch event", ev);
|
||||
|
||||
@@ -42,7 +42,6 @@ import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.AnimatorSet;
|
||||
import android.animation.ValueAnimator;
|
||||
import android.app.RemoteAction;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Icon;
|
||||
import android.os.SystemClock;
|
||||
import android.util.Log;
|
||||
@@ -209,7 +208,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
* by not scaling the height of the taskbar background.
|
||||
*/
|
||||
private static final int TRANSITION_UNSTASH_SUW_MANUAL = 3;
|
||||
private static final Rect EMPTY_RECT = new Rect();
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef(value = {
|
||||
@@ -771,7 +769,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
fullLengthAnimatorSet.play(mControllers.stashedHandleViewController
|
||||
.createRevealAnimToIsStashed(isStashed, EMPTY_RECT));
|
||||
.createRevealAnimToIsStashed(isStashed));
|
||||
// Return the stashed handle to its default scale in case it was changed as part of the
|
||||
// feedforward hint. Note that the reveal animation above also visually scales it.
|
||||
fullLengthAnimatorSet.play(mTaskbarStashedHandleHintScale.animateToValue(1f));
|
||||
@@ -821,19 +819,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Rect taskbarToHotseatOffsets = new Rect();
|
||||
if (enableScalingRevealHomeAnimation() && animationType == TRANSITION_HOME_TO_APP) {
|
||||
Rect hotseatRect = new Rect();
|
||||
mActivity.getHotseatBounds(hotseatRect);
|
||||
|
||||
// Calculate and store offsets so that we can sync with the taskbar stashed handle
|
||||
taskbarToHotseatOffsets.set(
|
||||
mActivity.calculateTaskbarToHotseatOffsets(hotseatRect));
|
||||
as.addListener(AnimatorListeners.forEndCallback(
|
||||
() -> mActivity.calculateTaskbarToHotseatOffsets(EMPTY_RECT)));
|
||||
}
|
||||
|
||||
play(as, mTaskbarStashedHandleAlpha.animateToValue(stashedHandleAlphaTarget),
|
||||
backgroundAndHandleAlphaStartDelay,
|
||||
backgroundAndHandleAlphaDuration, LINEAR);
|
||||
@@ -882,12 +867,10 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
|
||||
}
|
||||
|
||||
mControllers.taskbarViewController.addRevealAnimToIsStashed(skippable, isStashed, duration,
|
||||
EMPHASIZED, animationType == TRANSITION_UNSTASH_SUW_MANUAL,
|
||||
animationType == TRANSITION_HOME_TO_APP);
|
||||
EMPHASIZED, animationType == TRANSITION_UNSTASH_SUW_MANUAL);
|
||||
|
||||
play(skippable, mControllers.stashedHandleViewController
|
||||
.createRevealAnimToIsStashed(isStashed, taskbarToHotseatOffsets), 0, duration,
|
||||
EMPHASIZED);
|
||||
.createRevealAnimToIsStashed(isStashed), 0, duration, EMPHASIZED);
|
||||
|
||||
// Return the stashed handle to its default scale in case it was changed as part of the
|
||||
// feedforward hint. Note that the reveal animation above also visually scales it.
|
||||
|
||||
@@ -36,7 +36,6 @@ import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_NAV_BAR_AN
|
||||
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_ALIGNMENT_ANIM;
|
||||
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_PINNING_ANIM;
|
||||
import static com.android.launcher3.util.MultiTranslateDelegate.INDEX_TASKBAR_REVEAL_ANIM;
|
||||
import static com.android.launcher3.util.window.RefreshRateTracker.getSingleFrameMs;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorSet;
|
||||
@@ -671,8 +670,7 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
* @param interpolator The interpolator to use for all animations.
|
||||
*/
|
||||
public void addRevealAnimToIsStashed(AnimatorSet as, boolean isStashed, long duration,
|
||||
Interpolator interpolator, boolean dispatchOnAnimationStart,
|
||||
boolean isHomeToAppAnimation) {
|
||||
Interpolator interpolator, boolean dispatchOnAnimationStart) {
|
||||
AnimatorSet reveal = new AnimatorSet();
|
||||
|
||||
Rect stashedBounds = new Rect();
|
||||
@@ -721,21 +719,8 @@ public class TaskbarViewController implements TaskbarControllers.LoggableTaskbar
|
||||
reveal.play(ObjectAnimator.ofFloat(mtd.getTranslationX(INDEX_TASKBAR_REVEAL_ANIM),
|
||||
MULTI_PROPERTY_VALUE, transX)
|
||||
.setDuration(duration));
|
||||
|
||||
if (enableScalingRevealHomeAnimation()) {
|
||||
// Delay y-translation by 1 frame to keep icons within the bounds of the bg.
|
||||
int delay = isHomeToAppAnimation ? getSingleFrameMs(mActivity) : 0;
|
||||
ObjectAnimator yAnimator =
|
||||
ObjectAnimator.ofFloat(mtd.getTranslationY(INDEX_TASKBAR_REVEAL_ANIM),
|
||||
MULTI_PROPERTY_VALUE, transY)
|
||||
.setDuration(Math.max(0, duration - delay));
|
||||
yAnimator.setStartDelay(delay);
|
||||
reveal.play(yAnimator);
|
||||
} else {
|
||||
reveal.play(
|
||||
ObjectAnimator.ofFloat(mtd.getTranslationY(INDEX_TASKBAR_REVEAL_ANIM),
|
||||
MULTI_PROPERTY_VALUE, transY));
|
||||
}
|
||||
reveal.play(ObjectAnimator.ofFloat(mtd.getTranslationY(INDEX_TASKBAR_REVEAL_ANIM),
|
||||
MULTI_PROPERTY_VALUE, transY));
|
||||
as.addListener(forEndCallback(() ->
|
||||
mtd.setTranslation(INDEX_TASKBAR_REVEAL_ANIM, 0, 0)));
|
||||
} else {
|
||||
|
||||
@@ -1056,6 +1056,7 @@ public class DeviceProfile {
|
||||
return mHotseatColumnSpan;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
public int getHotseatWidthPx() {
|
||||
return mHotseatWidthPx;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user