Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 352c4e44 authored by Christian Göllner's avatar Christian Göllner Committed by Christian Göllner
Browse files

[Motion] Split-shade expansion: implement over scroll effect [v1]

Before, there was code to add over scroll on shade expansion, but only for the notification side of the panel.
This CL adds specific split-shade logic for over scroll, which adds over scroll to the entire panel.

Note that this first version still doesn't take into account fling velocity for the overscroll amount.
Also, this isn't a regression from the current state.

Test: Manually
Test: NotificationStackScrollLayoutTest.java
Test: NotificationPanelViewControllerTest.java
Test: ShadeTransitionControllerTest.kt
Test: SplitShadeOverScrollerTest.kt
Fixes: 228022047
Change-Id: Ic6de84d831a4a6e65139c1cdc04a2612b72dcb49
parent 8731db33
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1179,6 +1179,10 @@
    <!-- Maximum over scroll amount for the shade when transition to the full shade. -->
    <dimen name="lockscreen_shade_max_over_scroll_amount">24dp</dimen>

    <!-- Maximum over scroll amount for the shade when transition to the full shade.
         Only used for split-shade. -->
    <dimen name="shade_max_over_scroll_amount">@dimen/lockscreen_shade_max_over_scroll_amount</dimen>

    <!-- Maximum overshoot for the pulse expansion -->
    <dimen name="pulse_expansion_max_top_overshoot">32dp</dimen>

+5 −0
Original line number Diff line number Diff line
@@ -117,6 +117,7 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
import com.android.systemui.statusbar.phone.shade.transition.ShadeTransitionController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.ConfigurationController.ConfigurationListener;
import com.android.systemui.statusbar.policy.DeviceProvisionedController;
@@ -178,6 +179,7 @@ public class NotificationStackScrollLayoutController {
    private final CentralSurfaces mCentralSurfaces;
    private final SectionHeaderController mSilentHeaderController;
    private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    private final ShadeTransitionController mShadeTransitionController;
    private final InteractionJankMonitor mJankMonitor;
    private final NotificationStackSizeCalculator mNotificationStackSizeCalculator;
    private final StackStateLogger mStackStateLogger;
@@ -647,6 +649,7 @@ public class NotificationStackScrollLayoutController {
            NotifCollection notifCollection,
            NotificationEntryManager notificationEntryManager,
            LockscreenShadeTransitionController lockscreenShadeTransitionController,
            ShadeTransitionController shadeTransitionController,
            IStatusBarService iStatusBarService,
            UiEventLogger uiEventLogger,
            LayoutInflater layoutInflater,
@@ -675,6 +678,7 @@ public class NotificationStackScrollLayoutController {
        mLockscreenUserManager = lockscreenUserManager;
        mMetricsLogger = metricsLogger;
        mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
        mShadeTransitionController = shadeTransitionController;
        mFalsingCollector = falsingCollector;
        mFalsingManager = falsingManager;
        mResources = resources;
@@ -769,6 +773,7 @@ public class NotificationStackScrollLayoutController {
        mScrimController.setScrimBehindChangeRunnable(mView::updateBackgroundDimming);

        mLockscreenShadeTransitionController.setStackScroller(this);
        mShadeTransitionController.setNotificationStackScrollLayoutController(this);

        mLockscreenUserManager.addUserChangedListener(mLockscreenUserChangeListener);

+7 −1
Original line number Diff line number Diff line
@@ -179,6 +179,7 @@ import com.android.systemui.statusbar.phone.dagger.CentralSurfacesComponent;
import com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment;
import com.android.systemui.statusbar.phone.panelstate.PanelExpansionStateManager;
import com.android.systemui.statusbar.phone.panelstate.PanelState;
import com.android.systemui.statusbar.phone.shade.transition.ShadeTransitionController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.KeyguardQsUserSwitchController;
import com.android.systemui.statusbar.policy.KeyguardStateController;
@@ -310,6 +311,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private final NotificationRemoteInputManager mRemoteInputManager;

    private final LockscreenShadeTransitionController mLockscreenShadeTransitionController;
    private final ShadeTransitionController mShadeTransitionController;
    private final TapAgainViewController mTapAgainViewController;
    private final LargeScreenShadeHeaderController mLargeScreenShadeHeaderController;
    private final RecordingController mRecordingController;
@@ -745,7 +747,8 @@ public class NotificationPanelViewController extends PanelViewController {
            NotificationListContainer notificationListContainer,
            PanelEventsEmitter panelEventsEmitter,
            NotificationStackSizeCalculator notificationStackSizeCalculator,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
            ShadeTransitionController shadeTransitionController) {
        super(view,
                falsingManager,
                dozeLog,
@@ -826,7 +829,9 @@ public class NotificationPanelViewController extends PanelViewController {
        mKeyguardBypassController = bypassController;
        mUpdateMonitor = keyguardUpdateMonitor;
        mLockscreenShadeTransitionController = lockscreenShadeTransitionController;
        mShadeTransitionController = shadeTransitionController;
        lockscreenShadeTransitionController.setNotificationPanelController(this);
        shadeTransitionController.setNotificationPanelViewController(this);
        DynamicPrivacyControlListener
                dynamicPrivacyControlListener =
                new DynamicPrivacyControlListener();
@@ -3613,6 +3618,7 @@ public class NotificationPanelViewController extends PanelViewController {
                }
            });
            mLockscreenShadeTransitionController.setQS(mQs);
            mShadeTransitionController.setQs(mQs);
            mNotificationStackScrollLayoutController.setQsHeader((ViewGroup) mQs.getHeader());
            mQs.setScrollListener(mScrollListener);
            updateQsExpansion();
+13 −7
Original line number Diff line number Diff line
@@ -108,6 +108,8 @@ public abstract class PanelViewController {
     */
    private boolean mIsSpringBackAnimation;

    private boolean mInSplitShade;

    private void logf(String fmt, Object... args) {
        Log.v(TAG, (mViewName != null ? (mViewName + ": ") : "") + String.format(fmt, args));
    }
@@ -303,8 +305,9 @@ public abstract class PanelViewController {
        mSlopMultiplier = configuration.getScaledAmbiguousGestureMultiplier();
        mHintDistance = mResources.getDimension(R.dimen.hint_move_distance);
        mPanelFlingOvershootAmount = mResources.getDimension(R.dimen.panel_overshoot_amount);
        mUnlockFalsingThreshold = mResources.getDimensionPixelSize(
                R.dimen.unlock_falsing_threshold);
        mUnlockFalsingThreshold =
                mResources.getDimensionPixelSize(R.dimen.unlock_falsing_threshold);
        mInSplitShade = mResources.getBoolean(R.bool.config_use_split_notification_shade);
    }

    protected float getTouchSlop(MotionEvent event) {
@@ -600,7 +603,9 @@ public abstract class PanelViewController {
        }
        mIsFlinging = true;
        // we want to perform an overshoot animation when flinging open
        final boolean addOverscroll = expand
        final boolean addOverscroll =
                expand
                        && !mInSplitShade // Split shade has its own overscroll logic
                        && mStatusBarStateController.getState() != StatusBarState.KEYGUARD
                        && mOverExpansion == 0.0f
                        && vel >= 0;
@@ -777,7 +782,8 @@ public abstract class PanelViewController {
            }
            float maxPanelHeight = getMaxPanelHeight();
            if (mHeightAnimator == null) {
                if (mTracking) {
                // Split shade has its own overscroll logic
                if (mTracking && !mInSplitShade) {
                    float overExpansionPixels = Math.max(0, h - maxPanelHeight);
                    setOverExpansionInternal(overExpansionPixels, true /* isFromGesture */);
                }
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
package com.android.systemui.statusbar.phone.panelstate

/** A listener interface to be notified of state change events for the notification panel. */
interface PanelStateListener {
fun interface PanelStateListener {
    /** Called when the panel's expansion state has changed.   */
    fun onPanelStateChanged(@PanelState state: Int)
}
Loading