diff options
| author | 2022-11-04 18:58:24 +0000 | |
|---|---|---|
| committer | 2022-11-04 18:58:24 +0000 | |
| commit | 01cd6f81a88f46627eba593361feea721e7f93f6 (patch) | |
| tree | 4166966b950216ea1e75cd35f8b633539b9c6f14 | |
| parent | 39d2a64be47bdecaedc52e4b7a86f2e445863275 (diff) | |
| parent | 3160d38675aac541c2c0a89e110a5b75bd7878ae (diff) | |
Merge "Clean up bubbles home gesture flag" into tm-qpr-dev am: 28ba402dea am: 3160d38675
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20377745
Change-Id: I9e8ef157e7de4ce44e4c7eaa5e62a15ced03f80f
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
4 files changed, 12 insertions, 268 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java index f31a27dbac86..f621351907d2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleStackView.java @@ -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; @@ -1964,11 +1954,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(); @@ -1976,13 +1962,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); } @@ -2298,106 +2282,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(); @@ -2579,65 +2463,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(() -> { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java index b91062f891e8..33629f9f4622 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedAnimationController.java @@ -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(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedViewAnimationControllerStub.java b/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedViewAnimationControllerStub.java deleted file mode 100644 index bb8a3aaaf551..000000000000 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/animation/ExpandedViewAnimationControllerStub.java +++ /dev/null @@ -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() { - } -} diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index 10bf23badd18..6b32fd5894c0 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -256,12 +256,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 |