diff options
3 files changed, 53 insertions, 196 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java index 0e931679ec74..789ca5158dbf 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/shade/NotificationPanelViewControllerBaseTest.java @@ -531,9 +531,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mNotificationPanelViewController = new NotificationPanelViewController( mView, - mMainHandler, - mLayoutInflater, - mFeatureFlags, coordinator, expansionHandler, mDynamicPrivacyController, mKeyguardBypassController, mFalsingManager, new FalsingCollectorFake(), mKeyguardStateController, @@ -553,7 +550,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardStatusBarViewComponentFactory, mLockscreenShadeTransitionController, mScrimController, - mUserManager, mMediaDataManager, mNotificationShadeDepthController, mAmbientState, @@ -564,7 +560,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mQsController, mFragmentService, mStatusBarService, - mContentResolver, mShadeHeaderController, mScreenOffAnimationController, mLockscreenGestureLogger, @@ -575,7 +570,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { mKeyguardUnlockAnimationController, mKeyguardIndicationController, mNotificationListContainer, - mNotificationStackSizeCalculator, mUnlockedScreenOffAnimationController, systemClock, mKeyguardClockInteractor, @@ -594,7 +588,6 @@ public class NotificationPanelViewControllerBaseTest extends SysuiTestCase { new ResourcesSplitShadeStateController(), mPowerInteractor, mKeyguardClockPositionAlgorithm, - mNaturalScrollingSettingObserver, mMSDLPlayer, mBrightnessMirrorShowingInteractor); mNotificationPanelViewController.initDependencies( diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java index c9eb4962ab00..5ce323f6d04c 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationPanelViewController.java @@ -49,7 +49,6 @@ import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.NonNull; import android.annotation.Nullable; -import android.content.ContentResolver; import android.content.res.Resources; import android.graphics.Color; import android.graphics.Insets; @@ -58,28 +57,23 @@ import android.graphics.Region; import android.graphics.RenderEffect; import android.graphics.Shader; import android.os.Bundle; -import android.os.Handler; import android.os.Trace; -import android.os.UserManager; import android.util.IndentingPrintWriter; import android.util.Log; import android.util.MathUtils; import android.view.HapticFeedbackConstants; import android.view.InputDevice; -import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.View.AccessibilityDelegate; import android.view.ViewConfiguration; import android.view.ViewPropertyAnimator; -import android.view.ViewStub; import android.view.ViewTreeObserver; import android.view.WindowInsets; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; -import android.view.animation.Interpolator; import com.android.app.animation.Interpolators; import com.android.internal.annotations.VisibleForTesting; @@ -105,14 +99,11 @@ import com.android.systemui.deviceentry.domain.interactor.DeviceEntryFaceAuthInt import com.android.systemui.doze.DozeLog; import com.android.systemui.dump.DumpManager; import com.android.systemui.dump.DumpsysTableLogger; -import com.android.systemui.flags.FeatureFlags; -import com.android.systemui.flags.Flags; import com.android.systemui.fragments.FragmentService; import com.android.systemui.keyguard.KeyguardUnlockAnimationController; import com.android.systemui.keyguard.domain.interactor.KeyguardClockInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardInteractor; import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInteractor; -import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingObserver; import com.android.systemui.keyguard.shared.model.ClockSize; import com.android.systemui.keyguard.shared.model.Edge; import com.android.systemui.keyguard.shared.model.TransitionState; @@ -173,10 +164,8 @@ import com.android.systemui.statusbar.notification.stack.AnimationProperties; import com.android.systemui.statusbar.notification.stack.NotificationListContainer; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayoutController; -import com.android.systemui.statusbar.notification.stack.NotificationStackSizeCalculator; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; import com.android.systemui.statusbar.notification.stack.domain.interactor.SharedNotificationContainerInteractor; -import com.android.systemui.statusbar.phone.BounceInterpolator; import com.android.systemui.statusbar.phone.CentralSurfaces; import com.android.systemui.statusbar.phone.DozeParameters; import com.android.systemui.statusbar.phone.HeadsUpAppearanceController; @@ -253,7 +242,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump * Whether the Shade should animate to reflect Back gesture progress. * To minimize latency at runtime, we cache this, else we'd be reading it every time * updateQsExpansion() is called... and it's called very often. - * + * <p> * Whenever we change this flag, SysUI is restarted, so it's never going to be "stale". */ @@ -284,8 +273,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final ConfigurationController mConfigurationController; private final Provider<FlingAnimationUtils.Builder> mFlingAnimationUtilsBuilder; private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController; - private final LayoutInflater mLayoutInflater; - private final FeatureFlags mFeatureFlags; private final AccessibilityManager mAccessibilityManager; private final NotificationWakeUpCoordinator mWakeUpCoordinator; private final PulseExpansionHandler mPulseExpansionHandler; @@ -310,7 +297,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final DozeLog mDozeLog; /** Whether or not the NotificationPanelView can be expanded or collapsed with a drag. */ private final boolean mNotificationsDragEnabled; - private final Interpolator mBounceInterpolator; private final NotificationShadeWindowController mNotificationShadeWindowController; private final ShadeExpansionStateManager mShadeExpansionStateManager; private final ShadeRepository mShadeRepository; @@ -320,7 +306,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final NotificationGutsManager mGutsManager; private final AlternateBouncerInteractor mAlternateBouncerInteractor; private final QuickSettingsControllerImpl mQsController; - private final NaturalScrollingSettingObserver mNaturalScrollingSettingObserver; private final TouchHandler mTouchHandler = new TouchHandler(); private long mDownTime; @@ -435,7 +420,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mPanelAlphaAnimator.getProperty(), Interpolators.ALPHA_IN); private final CommandQueue mCommandQueue; - private final UserManager mUserManager; private final MediaDataManager mMediaDataManager; @PanelState private int mCurrentPanelState = STATE_CLOSED; @@ -461,7 +445,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private boolean mIsGestureNavigation; private int mOldLayoutDirection; - private final ContentResolver mContentResolver; private float mMinFraction; private final KeyguardMediaController mKeyguardMediaController; @@ -474,7 +457,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private int mSplitShadeScrimTransitionDistance; private final NotificationListContainer mNotificationListContainer; - private final NotificationStackSizeCalculator mNotificationStackSizeCalculator; private final NPVCDownEventState.Buffer mLastDownEvents; private final KeyguardClockInteractor mKeyguardClockInteractor; private float mMinExpandHeight; @@ -529,8 +511,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private final KeyguardInteractor mKeyguardInteractor; private final PowerInteractor mPowerInteractor; private final CoroutineDispatcher mMainDispatcher; - private boolean mIsAnyMultiShadeExpanded; - private boolean mForceFlingAnimationForTest = false; private final SplitShadeStateController mSplitShadeStateController; private final Runnable mFlingCollapseRunnable = () -> fling(0, false /* expand */, mNextCollapseSpeedUpFactor, false /* expandBecauseOfFalsing */); @@ -549,9 +529,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Inject public NotificationPanelViewController(NotificationPanelView view, - @Main Handler handler, - @ShadeDisplayAware LayoutInflater layoutInflater, - FeatureFlags featureFlags, NotificationWakeUpCoordinator coordinator, PulseExpansionHandler pulseExpansionHandler, DynamicPrivacyController dynamicPrivacyController, @@ -583,7 +560,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump KeyguardStatusBarViewComponent.Factory keyguardStatusBarViewComponentFactory, LockscreenShadeTransitionController lockscreenShadeTransitionController, ScrimController scrimController, - UserManager userManager, MediaDataManager mediaDataManager, NotificationShadeDepthController notificationShadeDepthController, AmbientState ambientState, @@ -594,7 +570,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump QuickSettingsControllerImpl quickSettingsController, FragmentService fragmentService, IStatusBarService statusBarService, - ContentResolver contentResolver, ShadeHeaderController shadeHeaderController, ScreenOffAnimationController screenOffAnimationController, LockscreenGestureLogger lockscreenGestureLogger, @@ -605,7 +580,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump KeyguardUnlockAnimationController keyguardUnlockAnimationController, KeyguardIndicationController keyguardIndicationController, NotificationListContainer notificationListContainer, - NotificationStackSizeCalculator notificationStackSizeCalculator, UnlockedScreenOffAnimationController unlockedScreenOffAnimationController, SystemClock systemClock, KeyguardClockInteractor keyguardClockInteractor, @@ -624,7 +598,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump SplitShadeStateController splitShadeStateController, PowerInteractor powerInteractor, KeyguardClockPositionAlgorithm keyguardClockPositionAlgorithm, - NaturalScrollingSettingObserver naturalScrollingSettingObserver, MSDLPlayer msdlPlayer, BrightnessMirrorShowingInteractor brightnessMirrorShowingInteractor) { SceneContainerFlag.assertInLegacyMode(); @@ -650,7 +623,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mKeyguardInteractor = keyguardInteractor; mPowerInteractor = powerInteractor; mClockPositionAlgorithm = keyguardClockPositionAlgorithm; - mNaturalScrollingSettingObserver = naturalScrollingSettingObserver; mView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() { @Override public void onViewAttachedToWindow(View v) { @@ -690,7 +662,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump .setY2(0.84f) .build(); mLatencyTracker = latencyTracker; - mBounceInterpolator = new BounceInterpolator(); mFalsingManager = falsingManager; mDozeLog = dozeLog; mNotificationsDragEnabled = mResources.getBoolean( @@ -707,13 +678,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mMediaHierarchyManager = mediaHierarchyManager; mNotificationsQSContainerController = notificationsQSContainerController; mNotificationListContainer = notificationListContainer; - mNotificationStackSizeCalculator = notificationStackSizeCalculator; mNavigationBarController = navigationBarController; mNotificationsQSContainerController.init(); mNotificationStackScrollLayoutController = notificationStackScrollLayoutController; mKeyguardStatusBarViewComponentFactory = keyguardStatusBarViewComponentFactory; mDepthController = notificationShadeDepthController; - mContentResolver = contentResolver; mFragmentService = fragmentService; mStatusBarService = statusBarService; mSplitShadeStateController = splitShadeStateController; @@ -721,8 +690,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mSplitShadeStateController.shouldUseSplitNotificationShade(mResources); mView.setWillNotDraw(!DEBUG_DRAWABLE); mShadeHeaderController = shadeHeaderController; - mLayoutInflater = layoutInflater; - mFeatureFlags = featureFlags; mAnimateBack = predictiveBackAnimateShade(); mFalsingCollector = falsingCollector; mWakeUpCoordinator = coordinator; @@ -735,7 +702,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mPulseExpansionHandler = pulseExpansionHandler; mDozeParameters = dozeParameters; mScrimController = scrimController; - mUserManager = userManager; mMediaDataManager = mediaDataManager; mTapAgainViewController = tapAgainViewController; mSysUiState = sysUiState; @@ -888,7 +854,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump // Dreaming->Lockscreen collectFlow(mView, mDreamingToLockscreenTransitionViewModel.getLockscreenAlpha(), - setDreamLockscreenTransitionAlpha(mNotificationStackScrollLayoutController), + setDreamLockscreenTransitionAlpha(), mMainDispatcher); collectFlow(mView, mKeyguardTransitionInteractor.transition( @@ -962,28 +928,31 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @Override public void updateResources() { - Trace.beginSection("NSSLC#updateResources"); - final boolean newSplitShadeEnabled = - mSplitShadeStateController.shouldUseSplitNotificationShade(mResources); - final boolean splitShadeChanged = mSplitShadeEnabled != newSplitShadeEnabled; - mSplitShadeEnabled = newSplitShadeEnabled; - mQsController.updateResources(); - mNotificationsQSContainerController.updateResources(); - updateKeyguardStatusViewAlignment(/* animate= */false); - mKeyguardMediaController.refreshMediaPosition( - "NotificationPanelViewController.updateResources"); - - if (splitShadeChanged) { - if (isPanelVisibleBecauseOfHeadsUp()) { - // workaround for b/324642496, because HUNs set state to OPENING - onPanelStateChanged(STATE_CLOSED); + try { + Trace.beginSection("NSSLC#updateResources"); + final boolean newSplitShadeEnabled = + mSplitShadeStateController.shouldUseSplitNotificationShade(mResources); + final boolean splitShadeChanged = mSplitShadeEnabled != newSplitShadeEnabled; + mSplitShadeEnabled = newSplitShadeEnabled; + mQsController.updateResources(); + mNotificationsQSContainerController.updateResources(); + updateKeyguardStatusViewAlignment(); + mKeyguardMediaController.refreshMediaPosition( + "NotificationPanelViewController.updateResources"); + + if (splitShadeChanged) { + if (isPanelVisibleBecauseOfHeadsUp()) { + // workaround for b/324642496, because HUNs set state to OPENING + onPanelStateChanged(STATE_CLOSED); + } + onSplitShadeEnabledChanged(); } - onSplitShadeEnabledChanged(); - } - mSplitShadeFullTransitionDistance = - mResources.getDimensionPixelSize(R.dimen.split_shade_full_transition_distance); - Trace.endSection(); + mSplitShadeFullTransitionDistance = + mResources.getDimensionPixelSize(R.dimen.split_shade_full_transition_distance); + } finally { + Trace.endSection(); + } } private void onSplitShadeEnabledChanged() { @@ -1010,29 +979,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mQsController.updateQsState(); } - private View reInflateStub(int viewId, int stubId, int layoutId, boolean enabled) { - View view = mView.findViewById(viewId); - if (view != null) { - int index = mView.indexOfChild(view); - mView.removeView(view); - if (enabled) { - view = mLayoutInflater.inflate(layoutId, mView, false); - mView.addView(view, index); - } else { - // Add the stub back so we can re-inflate it again if necessary - ViewStub stub = new ViewStub(mView.getContext(), layoutId); - stub.setId(stubId); - mView.addView(stub, index); - view = null; - } - } else if (enabled) { - // It's possible the stub was never inflated if the configuration changed - ViewStub stub = mView.findViewById(stubId); - view = stub.inflate(); - } - return view; - } - @VisibleForTesting void reInflateViews() { debugLog("reInflateViews"); @@ -1041,11 +987,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mStatusBarStateController.getInterpolatedDozeAmount()); } - @VisibleForTesting - boolean isFlinging() { - return mIsFlinging; - } - /** Sets a listener to be notified when the shade starts opening or finishes closing. */ public void setOpenCloseListener(OpenCloseListener openCloseListener) { SceneContainerFlag.assertInLegacyMode(); @@ -1095,8 +1036,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump * @param forceClockUpdate Should the clock be updated even when not on keyguard */ private void positionClockAndNotifications(boolean forceClockUpdate) { - boolean animate = !SceneContainerFlag.isEnabled() - && mNotificationStackScrollLayoutController.isAddOrRemoveAnimationPending(); int stackScrollerPadding; boolean onKeyguard = isKeyguardShowing(); @@ -1119,14 +1058,14 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mNotificationStackScrollLayoutController.setIntrinsicPadding(stackScrollerPadding); mStackScrollerMeasuringPass++; - requestScrollerTopPaddingUpdate(animate); + requestScrollerTopPaddingUpdate(); mStackScrollerMeasuringPass = 0; mAnimateNextPositionUpdate = false; } private void updateClockAppearance() { mKeyguardClockInteractor.setClockSize(computeDesiredClockSize()); - updateKeyguardStatusViewAlignment(/* animate= */true); + updateKeyguardStatusViewAlignment(); float darkAmount = mScreenOffAnimationController.shouldExpandNotifications() @@ -1145,10 +1084,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } private ClockSize computeDesiredClockSize() { - if (shouldForceSmallClock()) { - return ClockSize.SMALL; - } - if (mSplitShadeEnabled) { return computeDesiredClockSizeForSplitShade(); } @@ -1173,14 +1108,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return ClockSize.LARGE; } - private boolean shouldForceSmallClock() { - return mFeatureFlags.isEnabled(Flags.LOCKSCREEN_ENABLE_LANDSCAPE) - && !isOnAod() - // True on small landscape screens - && mResources.getBoolean(R.bool.force_small_clock_on_lockscreen); - } - - private void updateKeyguardStatusViewAlignment(boolean animate) { + private void updateKeyguardStatusViewAlignment() { boolean shouldBeCentered = shouldKeyguardStatusViewBeCentered(); mKeyguardUnfoldTransition.ifPresent(t -> t.setStatusViewCentered(shouldBeCentered)); mKeyguardInteractor.setClockShouldBeCentered(shouldBeCentered); @@ -1457,7 +1385,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } } }); - if (!mScrimController.isScreenOn() && !mForceFlingAnimationForTest) { + if (!mScrimController.isScreenOn()) { animator.setDuration(1); } setAnimator(animator); @@ -1465,16 +1393,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } @VisibleForTesting - void setForceFlingAnimationForTest(boolean force) { - mForceFlingAnimationForTest = force; - } - - @VisibleForTesting void onFlingEnd(boolean cancelled) { mIsFlinging = false; mExpectingSynthesizedDown = false; // No overshoot when the animation ends - setOverExpansionInternal(0, false /* isFromGesture */); + setOverExpansionInternal(0); setAnimator(null); mKeyguardStateController.notifyPanelFlingEnd(); if (!cancelled) { @@ -1565,7 +1488,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } /** Return whether a touch is near the gesture handle at the bottom of screen */ - boolean isInGestureNavHomeHandleArea(float x, float y) { + boolean isInGestureNavHomeHandleArea(float y) { return mIsGestureNavigation && y > mView.getHeight() - mNavigationBarBottomHeight; } @@ -1598,7 +1521,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump * There are two scenarios behind this function call. First, input focus transfer has * successfully happened and this view already received synthetic DOWN event. * (mExpectingSynthesizedDown == false). Do nothing. - * + * <p> * Second, before input focus transfer finished, user may have lifted finger in previous window * and this window never received synthetic DOWN event. (mExpectingSynthesizedDown == true). In * this case, we use the velocity to trigger fling event. @@ -1759,7 +1682,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return mBarState == KEYGUARD; } - void requestScrollerTopPaddingUpdate(boolean animate) { + void requestScrollerTopPaddingUpdate() { if (!SceneContainerFlag.isEnabled()) { float padding = mQsController.calculateNotificationsTopPadding(mIsExpandingOrCollapsing, getKeyguardNotificationStaticPadding(), mExpandedFraction); @@ -2034,11 +1957,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } @VisibleForTesting - void setTouchSlopExceeded(boolean isTouchSlopExceeded) { - mTouchSlopExceeded = isTouchSlopExceeded; - } - - @VisibleForTesting void setOverExpansion(float overExpansion) { if (overExpansion == mOverExpansion) { return; @@ -2387,7 +2305,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump final float dozeAmount = dozing ? 1 : 0; mStatusBarStateController.setAndInstrumentDozeAmount(mView, dozeAmount, animate); - updateKeyguardStatusViewAlignment(animate); + updateKeyguardStatusViewAlignment(); } @Override @@ -2406,7 +2324,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } mNotificationStackScrollLayoutController.setPulsing(pulsing, animatePulse); - updateKeyguardStatusViewAlignment(/* animate= */ true); + updateKeyguardStatusViewAlignment(); } public void performHapticFeedback(int constant) { @@ -2972,8 +2890,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mIsSpringBackAnimation = true; ValueAnimator animator = ValueAnimator.ofFloat(mOverExpansion, 0); animator.addUpdateListener( - animation -> setOverExpansionInternal((float) animation.getAnimatedValue(), - false /* isFromGesture */)); + animation -> setOverExpansionInternal((float) animation.getAnimatedValue())); animator.setDuration(SHADE_OPEN_SPRING_BACK_DURATION); animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN); animator.addListener(new AnimatorListenerAdapter() { @@ -3065,19 +2982,10 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump * Set the current overexpansion * * @param overExpansion the amount of overexpansion to apply - * @param isFromGesture is this amount from a gesture and needs to be rubberBanded? */ - private void setOverExpansionInternal(float overExpansion, boolean isFromGesture) { - if (!isFromGesture) { - mLastGesturedOverExpansion = -1; - setOverExpansion(overExpansion); - } else if (mLastGesturedOverExpansion != overExpansion) { - mLastGesturedOverExpansion = overExpansion; - final float heightForFullOvershoot = mView.getHeight() / 3.0f; - float newExpansion = MathUtils.saturate(overExpansion / heightForFullOvershoot); - newExpansion = Interpolators.getOvershootInterpolation(newExpansion); - setOverExpansion(newExpansion * mPanelFlingOvershootAmount * 2.0f); - } + private void setOverExpansionInternal(float overExpansion) { + mLastGesturedOverExpansion = -1; + setOverExpansion(overExpansion); } /** Sets the expanded height relative to a number from 0 to 1. */ @@ -3173,29 +3081,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } /** - * Phase 2: Bounce down. - */ - private void startUnlockHintAnimationPhase2(final Runnable onAnimationFinished) { - ValueAnimator animator = createHeightAnimator(getMaxPanelHeight()); - animator.setDuration(450); - animator.setInterpolator(mBounceInterpolator); - animator.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - setAnimator(null); - onAnimationFinished.run(); - updateExpansionAndVisibility(); - } - }); - animator.start(); - setAnimator(animator); - } - - private ValueAnimator createHeightAnimator(float targetHeight) { - return createHeightAnimator(targetHeight, 0.0f /* performOvershoot */); - } - - /** * Create an animator that can also overshoot * * @param targetHeight the target height @@ -3215,7 +3100,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mPanelFlingOvershootAmount * overshootAmount, Interpolators.FAST_OUT_SLOW_IN.getInterpolation( animator.getAnimatedFraction())); - setOverExpansionInternal(expansion, false /* isFromGesture */); + setOverExpansionInternal(expansion); } setExpandedHeightInternal((float) animation.getAnimatedValue()); }); @@ -3270,8 +3155,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump mFixedDuration = NO_FIXED_DURATION; } - boolean postToView(Runnable action) { - return mView.post(action); + void postToView(Runnable action) { + mView.post(action); } /** Sends an external (e.g. Status Bar) intercept touch event to the Shade touch handler. */ @@ -3350,7 +3235,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump return mShadeExpansionStateManager; } - void onQsExpansionChanged(boolean expanded) { + void onQsExpansionChanged() { updateExpandedHeightToMaxHeight(); updateSystemUiStateFlags(); NavigationBarView navigationBarView = @@ -3362,7 +3247,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump @VisibleForTesting void onQsSetExpansionHeightCalled(boolean qsFullyExpanded) { - requestScrollerTopPaddingUpdate(false); + requestScrollerTopPaddingUpdate(); mKeyguardStatusBarViewController.updateViewState(); int barState = getBarState(); if (barState == SHADE_LOCKED || barState == KEYGUARD) { @@ -3403,7 +3288,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump private void onExpansionHeightSetToMax(boolean requestPaddingUpdate) { if (requestPaddingUpdate) { - requestScrollerTopPaddingUpdate(false /* animate */); + requestScrollerTopPaddingUpdate(); } updateExpandedHeightToMaxHeight(); } @@ -3427,7 +3312,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump ? (ExpandableNotificationRow) firstChildNotGone : null; if (firstRow != null && (view == firstRow || (firstRow.getNotificationParent() == firstRow))) { - requestScrollerTopPaddingUpdate(false /* animate */); + requestScrollerTopPaddingUpdate(); } updateExpandedHeightToMaxHeight(); } @@ -3507,7 +3392,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump boolean animatingUnlockedShadeToKeyguardBypass ) { boolean goingToFullShade = mStatusBarStateController.goingToFullShade(); - boolean keyguardFadingAway = mKeyguardStateController.isKeyguardFadingAway(); int oldState = mBarState; boolean keyguardShowing = statusBarState == KEYGUARD; @@ -3728,17 +3612,13 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } if (state == STATE_CLOSED) { mQsController.setExpandImmediate(false); - // Close the status bar in the next frame so we can show the end of the - // animation. - if (!mIsAnyMultiShadeExpanded) { - mView.post(mMaybeHideExpandedRunnable); - } + // Close the status bar in the next frame so we can show the end of the animation. + mView.post(mMaybeHideExpandedRunnable); } mCurrentPanelState = state; } - private Consumer<Float> setDreamLockscreenTransitionAlpha( - NotificationStackScrollLayoutController stackScroller) { + private Consumer<Float> setDreamLockscreenTransitionAlpha() { return (Float alpha) -> { // Also animate the status bar's alpha during transitions between the lockscreen and // dreams. @@ -4275,4 +4155,3 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump } } } - diff --git a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java index 14087a0efcfc..d05837261b89 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/shade/QuickSettingsControllerImpl.java @@ -114,9 +114,7 @@ import java.io.PrintWriter; import javax.inject.Inject; import javax.inject.Provider; -/** Handles QuickSettings touch handling, expansion and animation state - * TODO (b/264460656) make this dumpable - */ +/** Handles QuickSettings touch handling, expansion and animation state. */ @SysUISingleton public class QuickSettingsControllerImpl implements QuickSettingsController, Dumpable { public static final String TAG = "QuickSettingsController"; @@ -294,7 +292,6 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum private ValueAnimator mSizeChangeAnimator; private ExpansionHeightListener mExpansionHeightListener; - private QsStateUpdateListener mQsStateUpdateListener; private ApplyClippingImmediatelyListener mApplyClippingImmediatelyListener; private FlingQsWithoutClickListener mFlingQsWithoutClickListener; private ExpansionHeightSetToMaxListener mExpansionHeightSetToMaxListener; @@ -401,10 +398,6 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum mExpansionHeightListener = listener; } - void setQsStateUpdateListener(QsStateUpdateListener listener) { - mQsStateUpdateListener = listener; - } - void setApplyClippingImmediatelyListener(ApplyClippingImmediatelyListener listener) { mApplyClippingImmediatelyListener = listener; } @@ -562,7 +555,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum } // TODO (b/265193930): remove dependency on NPVC // Let's reject anything at the very bottom around the home handle in gesture nav - if (mPanelViewControllerLazy.get().isInGestureNavHomeHandleArea(x, y)) { + if (mPanelViewControllerLazy.get().isInGestureNavHomeHandleArea(y)) { return false; } return y <= mNotificationStackScrollLayoutController.getBottomMostNotificationBottom() @@ -804,7 +797,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum if (changed) { mShadeRepository.setLegacyIsQsExpanded(expanded); updateQsState(); - mPanelViewControllerLazy.get().onQsExpansionChanged(expanded); + mPanelViewControllerLazy.get().onQsExpansionChanged(); mShadeLog.logQsExpansionChanged("QS Expansion Changed.", expanded, getMinExpansionHeight(), getMaxExpansionHeight(), mStackScrollerOverscrolling, mAnimatorExpand, mAnimating); @@ -1021,10 +1014,6 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum } void updateQsState() { - if (mQsStateUpdateListener != null) { - mQsStateUpdateListener.onQsStateUpdated(getExpanded(), mStackScrollerOverscrolling); - } - if (mQs == null) return; mQs.setExpanded(getExpanded()); } @@ -1203,7 +1192,7 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum /** * Applies clipping to quick settings, notifications layout and * updates bounds of the notifications background (notifications scrim). - * + * <p> * The parameters are bounds of the notifications area rectangle, this function * calculates bounds for the QS clipping based on the notifications bounds. */ @@ -2395,10 +2384,6 @@ public class QuickSettingsControllerImpl implements QuickSettingsController, Dum void onQsSetExpansionHeightCalled(boolean qsFullyExpanded); } - interface QsStateUpdateListener { - void onQsStateUpdated(boolean qsExpanded, boolean isStackScrollerOverscrolling); - } - interface ApplyClippingImmediatelyListener { void onQsClippingImmediatelyApplied(boolean clipStatusView, Rect lastQsClipBounds, int top, boolean qsFragmentCreated, boolean qsVisible); |