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

Commit 206360a6 authored by Shawn Lee's avatar Shawn Lee
Browse files

Extract most QS code from NPVC

Moved QS-related code from NPVC to a new class that handles QS panel expansion

Bug: 254870148
Test: manual, atest
Change-Id: Ic1cbdc6c02e25cd3efaea4badbf2b8835895459b
parent 934de388
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ public class DebugDrawable extends Drawable {
    private final NotificationPanelView mView;
    private final NotificationStackScrollLayoutController mNotificationStackScrollLayoutController;
    private final LockIconViewController mLockIconViewController;
    private final QuickSettingsController mQsController;
    private final Set<Integer> mDebugTextUsedYPositions;
    private final Paint mDebugPaint;

@@ -46,12 +47,14 @@ public class DebugDrawable extends Drawable {
            NotificationPanelViewController notificationPanelViewController,
            NotificationPanelView notificationPanelView,
            NotificationStackScrollLayoutController notificationStackScrollLayoutController,
            LockIconViewController lockIconViewController
            LockIconViewController lockIconViewController,
            QuickSettingsController quickSettingsController
    ) {
        mNotificationPanelViewController = notificationPanelViewController;
        mView = notificationPanelView;
        mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
        mLockIconViewController = lockIconViewController;
        mQsController = quickSettingsController;
        mDebugTextUsedYPositions = new HashSet<>();
        mDebugPaint = new Paint();
    }
@@ -71,12 +74,19 @@ public class DebugDrawable extends Drawable {
                Color.RED, "getMaxPanelHeight()");
        drawDebugInfo(canvas, (int) mNotificationPanelViewController.getExpandedHeight(),
                Color.BLUE, "getExpandedHeight()");
        drawDebugInfo(canvas, mNotificationPanelViewController.calculatePanelHeightQsExpanded(),
        drawDebugInfo(canvas, mQsController.calculatePanelHeightExpanded(
                        mNotificationPanelViewController.getClockPositionResult()
                                .stackScrollerPadding),
                Color.GREEN, "calculatePanelHeightQsExpanded()");
        drawDebugInfo(canvas, mNotificationPanelViewController.calculatePanelHeightQsExpanded(),
        drawDebugInfo(canvas, mQsController.calculatePanelHeightExpanded(
                        mNotificationPanelViewController.getClockPositionResult()
                                .stackScrollerPadding),
                Color.YELLOW, "calculatePanelHeightShade()");
        drawDebugInfo(canvas,
                (int) mNotificationPanelViewController.calculateNotificationsTopPadding(),
                (int) mQsController.calculateNotificationsTopPadding(
                        mNotificationPanelViewController.isExpanding(),
                        mNotificationPanelViewController.getKeyguardNotificationStaticPadding(),
                        mNotificationPanelViewController.getExpandedFraction()),
                Color.MAGENTA, "calculateNotificationsTopPadding()");
        drawDebugInfo(canvas, mNotificationPanelViewController.getClockPositionResult().clockY,
                Color.GRAY, "mClockPositionResult.clockY");
+296 −1797

File changed.

Preview size limit exceeded, changes collapsed.

+2050 −0

File added.

Preview size limit exceeded, changes collapsed.

+5 −9
Original line number Diff line number Diff line
@@ -50,7 +50,6 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
        h: Float,
        touchSlop: Float,
        qsExpanded: Boolean,
        collapsedOnDown: Boolean,
        keyguardShowing: Boolean,
        qsExpansionEnabled: Boolean
    ) {
@@ -63,13 +62,12 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
                long1 = h.toLong()
                double1 = touchSlop.toDouble()
                bool1 = qsExpanded
                bool2 = collapsedOnDown
                bool3 = keyguardShowing
                bool4 = qsExpansionEnabled
                bool2 = keyguardShowing
                bool3 = qsExpansionEnabled
            },
            {
                "QsTrackingNotStarted: initTouchY=$int1,y=$int2,h=$long1,slop=$double1,qsExpanded" +
                    "=$bool1,collapsedDown=$bool2,keyguardShowing=$bool3,qsExpansion=$bool4"
                    "=$bool1,keyguardShowing=$bool2,qsExpansion=$bool3"
            }
        )
    }
@@ -158,7 +156,6 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
            qsMinExpansionHeight: Int,
            qsMaxExpansionHeight: Int,
            stackScrollerOverscrolling: Boolean,
            dozing: Boolean,
            qsAnimatorExpand: Boolean,
            animatingQs: Boolean
    ) {
@@ -171,14 +168,13 @@ class ShadeLogger @Inject constructor(@ShadeLog private val buffer: LogBuffer) {
                int1 = qsMinExpansionHeight
                int2 = qsMaxExpansionHeight
                bool2 = stackScrollerOverscrolling
                bool3 = dozing
                bool4 = qsAnimatorExpand
                bool3 = qsAnimatorExpand
                // 0 = false, 1 = true
                long1 = animatingQs.compareTo(false).toLong()
            },
            {
                "$str1 qsExpanded=$bool1,qsMinExpansionHeight=$int1,qsMaxExpansionHeight=$int2," +
                    "stackScrollerOverscrolling=$bool2,dozing=$bool3,qsAnimatorExpand=$bool4," +
                    "stackScrollerOverscrolling=$bool2,qsAnimatorExpand=$bool3," +
                    "animatingQs=$long1"
            }
        )
+28 −5
Original line number Diff line number Diff line
@@ -187,6 +187,8 @@ class LockscreenShadeTransitionController @Inject constructor(

    private val qsTransitionController = qsTransitionControllerFactory.create { qS }

    private val callbacks = mutableListOf<Callback>()

    /** See [LockscreenShadeQsTransitionController.qsTransitionFraction].*/
    @get:FloatRange(from = 0.0, to = 1.0)
    val qSDragProgress: Float
@@ -320,8 +322,8 @@ class LockscreenShadeTransitionController @Inject constructor(
                                    true /* drag down is always an open */)
                        }
                        notificationPanelController.animateToFullShade(delay)
                        notificationPanelController.setTransitionToFullShadeAmount(0f,
                                true /* animated */, delay)
                        callbacks.forEach { it.setTransitionToFullShadeAmount(0f,
                                true /* animated */, delay) }

                        // Let's reset ourselves, ready for the next animation

@@ -425,8 +427,8 @@ class LockscreenShadeTransitionController @Inject constructor(

                    qsTransitionController.dragDownAmount = value

                    notificationPanelController.setTransitionToFullShadeAmount(field,
                            false /* animate */, 0 /* delay */)
                    callbacks.forEach { it.setTransitionToFullShadeAmount(field,
                            false /* animate */, 0 /* delay */) }

                    mediaHierarchyManager.setTransitionToFullShadeAmount(field)
                    scrimTransitionController.dragDownAmount = value
@@ -689,7 +691,7 @@ class LockscreenShadeTransitionController @Inject constructor(
        if (cancelled) {
            setPulseHeight(0f, animate = true)
        } else {
            notificationPanelController.onPulseExpansionFinished()
            callbacks.forEach { it.onPulseExpansionFinished() }
            setPulseHeight(0f, animate = false)
        }
    }
@@ -721,6 +723,27 @@ class LockscreenShadeTransitionController @Inject constructor(
                "${animationHandlerOnKeyguardDismiss != null}")
        }
    }


    fun addCallback(callback: Callback) {
        if (!callbacks.contains(callback)) {
            callbacks.add(callback)
        }
    }

    /**
     * Callback for authentication events.
     */
    interface Callback {
        /** TODO: comment here  */
        fun onPulseExpansionFinished() {}

        /**
         * Sets the amount of pixels we have currently dragged down if we're transitioning
         * to the full shade. 0.0f means we're not transitioning yet.
         */
        fun setTransitionToFullShadeAmount(pxAmount: Float, animate: Boolean, delay: Long) {}
    }
}

/**
Loading