Merge "Clean up bubbles home gesture flag" into tm-qpr-dev
This commit is contained in:
@@ -83,7 +83,6 @@ import com.android.wm.shell.bubbles.animation.AnimatableScaleMatrix;
|
||||
import com.android.wm.shell.bubbles.animation.ExpandedAnimationController;
|
||||
import com.android.wm.shell.bubbles.animation.ExpandedViewAnimationController;
|
||||
import com.android.wm.shell.bubbles.animation.ExpandedViewAnimationControllerImpl;
|
||||
import com.android.wm.shell.bubbles.animation.ExpandedViewAnimationControllerStub;
|
||||
import com.android.wm.shell.bubbles.animation.PhysicsAnimationLayout;
|
||||
import com.android.wm.shell.bubbles.animation.StackAnimationController;
|
||||
import com.android.wm.shell.common.FloatingContentCoordinator;
|
||||
@@ -105,11 +104,6 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
public class BubbleStackView extends FrameLayout
|
||||
implements ViewTreeObserver.OnComputeInternalInsetsListener {
|
||||
/**
|
||||
* Set to {@code true} to enable home gesture handling in bubbles
|
||||
*/
|
||||
public static final boolean HOME_GESTURE_ENABLED =
|
||||
SystemProperties.getBoolean("persist.wm.debug.bubbles_home_gesture", true);
|
||||
|
||||
public static final boolean ENABLE_FLING_TO_DISMISS_BUBBLE =
|
||||
SystemProperties.getBoolean("persist.wm.debug.fling_to_dismiss_bubble", true);
|
||||
@@ -898,12 +892,8 @@ public class BubbleStackView extends FrameLayout
|
||||
mExpandedAnimationController = new ExpandedAnimationController(mPositioner,
|
||||
onBubbleAnimatedOut, this);
|
||||
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
mExpandedViewAnimationController =
|
||||
new ExpandedViewAnimationControllerImpl(context, mPositioner);
|
||||
} else {
|
||||
mExpandedViewAnimationController = new ExpandedViewAnimationControllerStub();
|
||||
}
|
||||
mExpandedViewAnimationController =
|
||||
new ExpandedViewAnimationControllerImpl(context, mPositioner);
|
||||
|
||||
mSurfaceSynchronizer = synchronizer != null ? synchronizer : DEFAULT_SURFACE_SYNCHRONIZER;
|
||||
|
||||
@@ -1965,11 +1955,7 @@ public class BubbleStackView extends FrameLayout
|
||||
|
||||
if (wasExpanded) {
|
||||
stopMonitoringSwipeUpGesture();
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
animateCollapse();
|
||||
} else {
|
||||
animateCollapseWithScale();
|
||||
}
|
||||
animateCollapse();
|
||||
logBubbleEvent(mExpandedBubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__COLLAPSED);
|
||||
} else {
|
||||
animateExpansion();
|
||||
@@ -1977,13 +1963,11 @@ public class BubbleStackView extends FrameLayout
|
||||
logBubbleEvent(mExpandedBubble, FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__EXPANDED);
|
||||
logBubbleEvent(mExpandedBubble,
|
||||
FrameworkStatsLog.BUBBLE_UICHANGED__ACTION__STACK_EXPANDED);
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
mBubbleController.isNotificationPanelExpanded(notifPanelExpanded -> {
|
||||
if (!notifPanelExpanded && mIsExpanded) {
|
||||
startMonitoringSwipeUpGesture();
|
||||
}
|
||||
});
|
||||
}
|
||||
mBubbleController.isNotificationPanelExpanded(notifPanelExpanded -> {
|
||||
if (!notifPanelExpanded && mIsExpanded) {
|
||||
startMonitoringSwipeUpGesture();
|
||||
}
|
||||
});
|
||||
}
|
||||
notifyExpansionChanged(mExpandedBubble, mIsExpanded);
|
||||
}
|
||||
@@ -2299,106 +2283,6 @@ public class BubbleStackView extends FrameLayout
|
||||
mMainExecutor.executeDelayed(mDelayedAnimation, startDelay);
|
||||
}
|
||||
|
||||
private void animateCollapseWithScale() {
|
||||
cancelDelayedExpandCollapseSwitchAnimations();
|
||||
|
||||
if (mManageEduView != null && mManageEduView.getVisibility() == VISIBLE) {
|
||||
mManageEduView.hide();
|
||||
}
|
||||
// Hide the menu if it's visible.
|
||||
showManageMenu(false);
|
||||
|
||||
mIsExpanded = false;
|
||||
mIsExpansionAnimating = true;
|
||||
|
||||
showScrim(false);
|
||||
|
||||
mBubbleContainer.cancelAllAnimations();
|
||||
|
||||
// If we were in the middle of swapping, the animating-out surface would have been scaling
|
||||
// to zero - finish it off.
|
||||
PhysicsAnimator.getInstance(mAnimatingOutSurfaceContainer).cancel();
|
||||
mAnimatingOutSurfaceContainer.setScaleX(0f);
|
||||
mAnimatingOutSurfaceContainer.setScaleY(0f);
|
||||
|
||||
// Let the expanded animation controller know that it shouldn't animate child adds/reorders
|
||||
// since we're about to animate collapsed.
|
||||
mExpandedAnimationController.notifyPreparingToCollapse();
|
||||
|
||||
mExpandedAnimationController.collapseBackToStack(
|
||||
mStackAnimationController.getStackPositionAlongNearestHorizontalEdge()
|
||||
/* collapseTo */,
|
||||
() -> mBubbleContainer.setActiveController(mStackAnimationController));
|
||||
|
||||
int index;
|
||||
if (mExpandedBubble != null && BubbleOverflow.KEY.equals(mExpandedBubble.getKey())) {
|
||||
index = mBubbleData.getBubbles().size();
|
||||
} else {
|
||||
index = mBubbleData.getBubbles().indexOf(mExpandedBubble);
|
||||
}
|
||||
// Value the bubble is animating from (back into the stack).
|
||||
final PointF p = mPositioner.getExpandedBubbleXY(index, getState());
|
||||
if (mPositioner.showBubblesVertically()) {
|
||||
float pivotX;
|
||||
float pivotY = p.y + mBubbleSize / 2f;
|
||||
if (mStackOnLeftOrWillBe) {
|
||||
pivotX = mPositioner.getAvailableRect().left + mBubbleSize + mExpandedViewPadding;
|
||||
} else {
|
||||
pivotX = mPositioner.getAvailableRect().right - mBubbleSize - mExpandedViewPadding;
|
||||
}
|
||||
mExpandedViewContainerMatrix.setScale(
|
||||
1f, 1f,
|
||||
pivotX, pivotY);
|
||||
} else {
|
||||
mExpandedViewContainerMatrix.setScale(
|
||||
1f, 1f,
|
||||
p.x + mBubbleSize / 2f,
|
||||
p.y + mBubbleSize + mExpandedViewPadding);
|
||||
}
|
||||
|
||||
mExpandedViewAlphaAnimator.reverse();
|
||||
|
||||
// When the animation completes, we should no longer be showing the content.
|
||||
if (mExpandedBubble.getExpandedView() != null) {
|
||||
mExpandedBubble.getExpandedView().setContentVisibility(false);
|
||||
}
|
||||
|
||||
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix).cancel();
|
||||
PhysicsAnimator.getInstance(mExpandedViewContainerMatrix)
|
||||
.spring(AnimatableScaleMatrix.SCALE_X,
|
||||
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(
|
||||
1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT),
|
||||
mScaleOutSpringConfig)
|
||||
.spring(AnimatableScaleMatrix.SCALE_Y,
|
||||
AnimatableScaleMatrix.getAnimatableValueForScaleFactor(
|
||||
1f - EXPANDED_VIEW_ANIMATE_SCALE_AMOUNT),
|
||||
mScaleOutSpringConfig)
|
||||
.addUpdateListener((target, values) -> {
|
||||
mExpandedViewContainer.setAnimationMatrix(mExpandedViewContainerMatrix);
|
||||
})
|
||||
.withEndActions(() -> {
|
||||
final BubbleViewProvider previouslySelected = mExpandedBubble;
|
||||
beforeExpandedViewAnimation();
|
||||
if (mManageEduView != null) {
|
||||
mManageEduView.hide();
|
||||
}
|
||||
|
||||
if (DEBUG_BUBBLE_STACK_VIEW) {
|
||||
Log.d(TAG, "animateCollapse");
|
||||
Log.d(TAG, BubbleDebugConfig.formatBubblesString(getBubblesOnScreen(),
|
||||
mExpandedBubble));
|
||||
}
|
||||
updateOverflowVisibility();
|
||||
updateZOrder();
|
||||
updateBadges(true /* setBadgeForCollapsedStack */);
|
||||
afterExpandedViewAnimation();
|
||||
if (previouslySelected != null) {
|
||||
previouslySelected.setTaskViewVisibility(false);
|
||||
}
|
||||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
private void animateCollapse() {
|
||||
cancelDelayedExpandCollapseSwitchAnimations();
|
||||
|
||||
@@ -2580,65 +2464,6 @@ public class BubbleStackView extends FrameLayout
|
||||
* and clip the expanded view.
|
||||
*/
|
||||
public void setImeVisible(boolean visible) {
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
setImeVisibleInternal(visible);
|
||||
} else {
|
||||
setImeVisibleWithoutClipping(visible);
|
||||
}
|
||||
}
|
||||
|
||||
private void setImeVisibleWithoutClipping(boolean visible) {
|
||||
if ((mIsExpansionAnimating || mIsBubbleSwitchAnimating) && mIsExpanded) {
|
||||
// This will update the animation so the bubbles move to position for the IME
|
||||
mExpandedAnimationController.expandFromStack(() -> {
|
||||
updatePointerPosition(false /* forIme */);
|
||||
afterExpandedViewAnimation();
|
||||
} /* after */);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mIsExpanded && getBubbleCount() > 0) {
|
||||
final float stackDestinationY =
|
||||
mStackAnimationController.animateForImeVisibility(visible);
|
||||
|
||||
// How far the stack is animating due to IME, we'll just animate the flyout by that
|
||||
// much too.
|
||||
final float stackDy =
|
||||
stackDestinationY - mStackAnimationController.getStackPosition().y;
|
||||
|
||||
// If the flyout is visible, translate it along with the bubble stack.
|
||||
if (mFlyout.getVisibility() == VISIBLE) {
|
||||
PhysicsAnimator.getInstance(mFlyout)
|
||||
.spring(DynamicAnimation.TRANSLATION_Y,
|
||||
mFlyout.getTranslationY() + stackDy,
|
||||
FLYOUT_IME_ANIMATION_SPRING_CONFIG)
|
||||
.start();
|
||||
}
|
||||
} else if (mPositioner.showBubblesVertically() && mIsExpanded
|
||||
&& mExpandedBubble != null && mExpandedBubble.getExpandedView() != null) {
|
||||
float selectedY = mPositioner.getExpandedBubbleXY(getState().selectedIndex,
|
||||
getState()).y;
|
||||
float newExpandedViewTop = mPositioner.getExpandedViewY(mExpandedBubble, selectedY);
|
||||
mExpandedBubble.getExpandedView().setImeVisible(visible);
|
||||
if (!mExpandedBubble.getExpandedView().isUsingMaxHeight()) {
|
||||
mExpandedViewContainer.animate().translationY(newExpandedViewTop);
|
||||
}
|
||||
|
||||
List<Animator> animList = new ArrayList();
|
||||
for (int i = 0; i < mBubbleContainer.getChildCount(); i++) {
|
||||
View child = mBubbleContainer.getChildAt(i);
|
||||
float transY = mPositioner.getExpandedBubbleXY(i, getState()).y;
|
||||
ObjectAnimator anim = ObjectAnimator.ofFloat(child, TRANSLATION_Y, transY);
|
||||
animList.add(anim);
|
||||
}
|
||||
updatePointerPosition(true /* forIme */);
|
||||
AnimatorSet set = new AnimatorSet();
|
||||
set.playTogether(animList);
|
||||
set.start();
|
||||
}
|
||||
}
|
||||
|
||||
private void setImeVisibleInternal(boolean visible) {
|
||||
if ((mIsExpansionAnimating || mIsBubbleSwitchAnimating) && mIsExpanded) {
|
||||
// This will update the animation so the bubbles move to position for the IME
|
||||
mExpandedAnimationController.expandFromStack(() -> {
|
||||
|
||||
@@ -20,7 +20,6 @@ import static android.view.View.LAYOUT_DIRECTION_RTL;
|
||||
|
||||
import static com.android.wm.shell.bubbles.BubblePositioner.NUM_VISIBLE_WHEN_RESTING;
|
||||
import static com.android.wm.shell.bubbles.BubbleStackView.ENABLE_FLING_TO_DISMISS_BUBBLE;
|
||||
import static com.android.wm.shell.bubbles.BubbleStackView.HOME_GESTURE_ENABLED;
|
||||
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Path;
|
||||
@@ -81,11 +80,6 @@ public class ExpandedAnimationController
|
||||
new PhysicsAnimator.SpringConfig(
|
||||
EXPAND_COLLAPSE_ANIM_STIFFNESS, SpringForce.DAMPING_RATIO_NO_BOUNCY);
|
||||
|
||||
private final PhysicsAnimator.SpringConfig mAnimateOutSpringConfigWithoutHomeGesture =
|
||||
new PhysicsAnimator.SpringConfig(
|
||||
EXPAND_COLLAPSE_ANIM_STIFFNESS_WITHOUT_HOME_GESTURE,
|
||||
SpringForce.DAMPING_RATIO_NO_BOUNCY);
|
||||
|
||||
/** Horizontal offset between bubbles, which we need to know to re-stack them. */
|
||||
private float mStackOffsetPx;
|
||||
/** Size of each bubble. */
|
||||
@@ -307,14 +301,8 @@ public class ExpandedAnimationController
|
||||
(firstBubbleLeads && index == 0)
|
||||
|| (!firstBubbleLeads && index == mLayout.getChildCount() - 1);
|
||||
|
||||
Interpolator interpolator;
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
// When home gesture is enabled, we use a different animation timing for collapse
|
||||
interpolator = expanding
|
||||
? Interpolators.EMPHASIZED_ACCELERATE : Interpolators.EMPHASIZED_DECELERATE;
|
||||
} else {
|
||||
interpolator = Interpolators.LINEAR;
|
||||
}
|
||||
Interpolator interpolator = expanding
|
||||
? Interpolators.EMPHASIZED_ACCELERATE : Interpolators.EMPHASIZED_DECELERATE;
|
||||
|
||||
animation
|
||||
.followAnimatedTargetAlongPath(
|
||||
@@ -564,16 +552,10 @@ public class ExpandedAnimationController
|
||||
finishRemoval.run();
|
||||
mOnBubbleAnimatedOutAction.run();
|
||||
} else {
|
||||
PhysicsAnimator.SpringConfig springConfig;
|
||||
if (HOME_GESTURE_ENABLED) {
|
||||
springConfig = mAnimateOutSpringConfig;
|
||||
} else {
|
||||
springConfig = mAnimateOutSpringConfigWithoutHomeGesture;
|
||||
}
|
||||
PhysicsAnimator.getInstance(child)
|
||||
.spring(DynamicAnimation.ALPHA, 0f)
|
||||
.spring(DynamicAnimation.SCALE_X, 0f, springConfig)
|
||||
.spring(DynamicAnimation.SCALE_Y, 0f, springConfig)
|
||||
.spring(DynamicAnimation.SCALE_X, 0f, mAnimateOutSpringConfig)
|
||||
.spring(DynamicAnimation.SCALE_Y, 0f, mAnimateOutSpringConfig)
|
||||
.withEndActions(finishRemoval, mOnBubbleAnimatedOutAction)
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2022 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.wm.shell.bubbles.animation;
|
||||
|
||||
import com.android.wm.shell.bubbles.BubbleExpandedView;
|
||||
|
||||
/**
|
||||
* Stub implementation {@link ExpandedViewAnimationController} that does not animate the
|
||||
* {@link BubbleExpandedView}
|
||||
*/
|
||||
public class ExpandedViewAnimationControllerStub implements ExpandedViewAnimationController {
|
||||
@Override
|
||||
public void setExpandedView(BubbleExpandedView expandedView) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDrag(float distance) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwipeVelocity(float velocity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldCollapse() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateCollapse(Runnable startStackCollapse, Runnable after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateBackToExpanded() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animateForImeVisibilityChange(boolean visible) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() {
|
||||
}
|
||||
}
|
||||
@@ -249,12 +249,6 @@ object Flags {
|
||||
val WM_ENABLE_SHELL_TRANSITIONS =
|
||||
SysPropBooleanFlag(1100, "persist.wm.debug.shell_transit", false)
|
||||
|
||||
/** b/170163464: animate bubbles expanded view collapse with home gesture */
|
||||
@JvmField
|
||||
@Keep
|
||||
val BUBBLES_HOME_GESTURE =
|
||||
SysPropBooleanFlag(1101, "persist.wm.debug.bubbles_home_gesture", true)
|
||||
|
||||
// TODO(b/254513207): Tracking Bug
|
||||
@JvmField
|
||||
@Keep
|
||||
|
||||
Reference in New Issue
Block a user