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

Commit 85df79c1 authored by Justin Weir's avatar Justin Weir Committed by Android (Google) Code Review
Browse files

Merge "Replace ShadeStateEvents.onPanelCollapsingChanged with a flow" into main

parents ca834953 f957aaba
Loading
Loading
Loading
Loading
+9 −13
Original line number Diff line number Diff line
@@ -563,7 +563,6 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    private boolean mHasLayoutedSinceDown;
    private float mUpdateFlingVelocity;
    private boolean mUpdateFlingOnLayout;
    private boolean mClosing;
    private boolean mTouchSlopExceeded;
    private int mTrackingPointer;
    private int mTouchSlop;
@@ -2934,10 +2933,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

    @VisibleForTesting
    void setClosing(boolean isClosing) {
        if (mClosing != isClosing) {
            mClosing = isClosing;
            mShadeExpansionStateManager.notifyPanelCollapsingChanged(isClosing);
        }
        mShadeRepository.setLegacyIsClosing(isClosing);
        mAmbientState.setIsClosing(isClosing);
    }

@@ -3468,7 +3464,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
        ipw.print("mHasLayoutedSinceDown="); ipw.println(mHasLayoutedSinceDown);
        ipw.print("mUpdateFlingVelocity="); ipw.println(mUpdateFlingVelocity);
        ipw.print("mUpdateFlingOnLayout="); ipw.println(mUpdateFlingOnLayout);
        ipw.print("mClosing="); ipw.println(mClosing);
        ipw.print("isClosing()="); ipw.println(isClosing());
        ipw.print("mTouchSlopExceeded="); ipw.println(mTouchSlopExceeded);
        ipw.print("mTrackingPointer="); ipw.println(mTrackingPointer);
        ipw.print("mTouchSlop="); ipw.println(mTouchSlop);
@@ -3807,7 +3803,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    private void endClosing() {
        if (mClosing) {
        if (isClosing()) {
            setClosing(false);
            onClosingFinished();
        }
@@ -3927,7 +3923,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
            mExpandedHeight = Math.min(h, maxPanelHeight);
            // If we are closing the panel and we are almost there due to a slow decelerating
            // interpolator, abort the animation.
            if (mExpandedHeight < 1f && mExpandedHeight != 0f && mClosing) {
            if (mExpandedHeight < 1f && mExpandedHeight != 0f && isClosing()) {
                mExpandedHeight = 0f;
                if (mHeightAnimator != null) {
                    mHeightAnimator.end();
@@ -4002,7 +3998,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

    @Override
    public boolean isCollapsing() {
        return mClosing || mIsLaunchAnimationRunning;
        return isClosing() || mIsLaunchAnimationRunning;
    }

    public boolean isTracking() {
@@ -4011,7 +4007,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

    @Override
    public boolean canBeCollapsed() {
        return !isFullyCollapsed() && !isTracking() && !mClosing;
        return !isFullyCollapsed() && !isTracking() && !isClosing();
    }

    @Override
@@ -4126,7 +4122,7 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump

    @VisibleForTesting
    boolean isClosing() {
        return mClosing;
        return mShadeRepository.getLegacyIsClosing().getValue();
    }

    @Override
@@ -4839,11 +4835,11 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
                    mAnimatingOnDown = mHeightAnimator != null && !mIsSpringBackAnimation;
                    mMinExpandHeight = 0.0f;
                    mDownTime = mSystemClock.uptimeMillis();
                    if (mAnimatingOnDown && mClosing) {
                    if (mAnimatingOnDown && isClosing()) {
                        cancelHeightAnimator();
                        mTouchSlopExceeded = true;
                        mShadeLog.v("NotificationPanelViewController MotionEvent intercepted:"
                                + " mAnimatingOnDown: true, mClosing: true");
                                + " mAnimatingOnDown: true, isClosing(): true");
                        return true;
                    }

+8 −0
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@
package com.android.systemui.shade

import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorEmptyImpl
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeInteractorEmptyImpl
import dagger.Binds
@@ -36,4 +38,10 @@ abstract class ShadeEmptyImplModule {
    @Binds
    @SysUISingleton
    abstract fun bindsShadeInteractor(si: ShadeInteractorEmptyImpl): ShadeInteractor

    @Binds
    @SysUISingleton
    abstract fun bindsShadeAnimationInteractor(
        sai: ShadeAnimationInteractorEmptyImpl
    ): ShadeAnimationInteractor
}
+0 −6
Original line number Diff line number Diff line
@@ -163,12 +163,6 @@ class ShadeExpansionStateManager @Inject constructor() : ShadeStateEvents {
        }
    }

    fun notifyPanelCollapsingChanged(isCollapsing: Boolean) {
        for (cb in shadeStateEventsListeners) {
            cb.onPanelCollapsingChanged(isCollapsing)
        }
    }

    private fun debugLog(msg: String) {
        if (!DEBUG) return
        Log.v(TAG, msg)
+17 −0
Original line number Diff line number Diff line
@@ -19,6 +19,9 @@ package com.android.systemui.shade
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.scene.shared.flag.SceneContainerFlags
import com.android.systemui.shade.domain.interactor.BaseShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractor
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorLegacyImpl
import com.android.systemui.shade.domain.interactor.ShadeAnimationInteractorSceneContainerImpl
import com.android.systemui.shade.domain.interactor.ShadeInteractor
import com.android.systemui.shade.domain.interactor.ShadeInteractorImpl
import com.android.systemui.shade.domain.interactor.ShadeInteractorLegacyImpl
@@ -45,6 +48,20 @@ abstract class ShadeModule {
                sceneContainerOff.get()
            }
        }

        @Provides
        @SysUISingleton
        fun provideShadeAnimationInteractor(
            sceneContainerFlags: SceneContainerFlags,
            sceneContainerOn: Provider<ShadeAnimationInteractorSceneContainerImpl>,
            sceneContainerOff: Provider<ShadeAnimationInteractorLegacyImpl>
        ): ShadeAnimationInteractor {
            return if (sceneContainerFlags.isEnabled()) {
                sceneContainerOn.get()
            } else {
                sceneContainerOff.get()
            }
        }
    }

    @Binds
+0 −4
Original line number Diff line number Diff line
@@ -27,10 +27,6 @@ interface ShadeStateEvents {

    /** Callbacks for certain notification panel events. */
    interface ShadeStateEventsListener {

        /** Invoked when the notification panel starts or stops collapsing. */
        fun onPanelCollapsingChanged(isCollapsing: Boolean) {}

        /**
         * Invoked when the notification panel starts or stops launching an [android.app.Activity].
         */
Loading