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

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

Merge "Move isFullyExpanded and isCollapsing" into main

parents 4866fc9b 276731c2
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -131,6 +131,7 @@ import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.settings.UserContextProvider;
import com.android.systemui.settings.UserTracker;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor;
import com.android.systemui.shared.navigationbar.RegionSamplingHelper;
import com.android.systemui.shared.recents.utilities.Utilities;
import com.android.systemui.shared.rotation.RotationButton;
@@ -199,6 +200,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
    private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
    private final KeyguardStateController mKeyguardStateController;
    private final ShadeViewController mShadeViewController;
    private final PanelExpansionInteractor mPanelExpansionInteractor;
    private final NotificationRemoteInputManager mNotificationRemoteInputManager;
    private final OverviewProxyService mOverviewProxyService;
    private final NavigationModeController mNavigationModeController;
@@ -537,6 +539,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
            KeyguardStateController keyguardStateController,
            ShadeViewController shadeViewController,
            PanelExpansionInteractor panelExpansionInteractor,
            NotificationRemoteInputManager notificationRemoteInputManager,
            NotificationShadeDepthController notificationShadeDepthController,
            @Main Handler mainHandler,
@@ -575,6 +578,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        mCentralSurfacesOptionalLazy = centralSurfacesOptionalLazy;
        mKeyguardStateController = keyguardStateController;
        mShadeViewController = shadeViewController;
        mPanelExpansionInteractor = panelExpansionInteractor;
        mNotificationRemoteInputManager = notificationRemoteInputManager;
        mOverviewProxyService = overviewProxyService;
        mNavigationModeController = navigationModeController;
@@ -749,7 +753,7 @@ public class NavigationBar extends ViewController<NavigationBarView> implements
        final Display display = mView.getDisplay();
        mView.setComponents(mRecentsOptional);
        if (mCentralSurfacesOptionalLazy.get().isPresent()) {
            mView.setComponents(mShadeViewController);
            mView.setComponents(mShadeViewController, mPanelExpansionInteractor);
        }
        mView.setDisabledFlags(mDisabledFlags1, mSysUiFlagsContainer);
        mView.setOnVerticalChangedListener(this::onVerticalChanged);
+12 −7
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ import com.android.systemui.recents.Recents;
import com.android.systemui.res.R;
import com.android.systemui.settings.DisplayTracker;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor;
import com.android.systemui.shared.rotation.FloatingRotationButton;
import com.android.systemui.shared.rotation.RotationButton.RotationButtonUpdatesCallback;
import com.android.systemui.shared.rotation.RotationButtonController;
@@ -149,7 +150,9 @@ public class NavigationBarView extends FrameLayout {
    private NavigationBarInflaterView mNavigationInflaterView;
    private Optional<Recents> mRecentsOptional = Optional.empty();
    @Nullable
    private ShadeViewController mPanelView;
    private ShadeViewController mShadeViewController;
    @Nullable
    private PanelExpansionInteractor mPanelExpansionInteractor;
    private RotationContextButton mRotationContextButton;
    private FloatingRotationButton mFloatingRotationButton;
    private RotationButtonController mRotationButtonController;
@@ -347,8 +350,9 @@ public class NavigationBarView extends FrameLayout {
    }

    /** */
    public void setComponents(ShadeViewController panel) {
        mPanelView = panel;
    public void setComponents(ShadeViewController svc, PanelExpansionInteractor pei) {
        mShadeViewController = svc;
        mPanelExpansionInteractor = pei;
        updatePanelSystemUiStateFlags();
    }

@@ -750,10 +754,10 @@ public class NavigationBarView extends FrameLayout {

    private void updatePanelSystemUiStateFlags() {
        if (SysUiState.DEBUG) {
            Log.d(TAG, "Updating panel sysui state flags: panelView=" + mPanelView);
            Log.d(TAG, "Updating panel sysui state flags: panelView=" + mShadeViewController);
        }
        if (mPanelView != null) {
            mPanelView.updateSystemUiStateFlags();
        if (mShadeViewController != null) {
            mShadeViewController.updateSystemUiStateFlags();
        }
    }

@@ -801,7 +805,8 @@ public class NavigationBarView extends FrameLayout {
     */
    void updateSlippery() {
        setSlippery(!isQuickStepSwipeUpEnabled() ||
                (mPanelView != null && mPanelView.isFullyExpanded() && !mPanelView.isCollapsing()));
                (mPanelExpansionInteractor != null && mPanelExpansionInteractor.isFullyExpanded()
                        && !mPanelExpansionInteractor.isCollapsing()));
    }

    void setSlippery(boolean slippery) {
+0 −16
Original line number Diff line number Diff line
@@ -37,9 +37,6 @@ interface ShadeViewController {
     */
    val isPanelExpanded: Boolean

    /** Returns whether the shade is in the process of collapsing. */
    val isCollapsing: Boolean

    /** Returns whether shade's height is zero. */
    val isFullyCollapsed: Boolean

@@ -101,19 +98,6 @@ interface ShadeViewController {
     */
    fun showAodUi()

    /**
     * This method should not be used anymore, you should probably use [.isShadeFullyOpen] instead.
     * It was overused as indicating if shade is open or we're on keyguard/AOD. Moving forward we
     * should be explicit about the what state we're checking.
     *
     * @return if panel is covering the screen, which means we're in expanded shade or keyguard/AOD
     */
    @Deprecated(
        "depends on the state you check, use {@link #isShadeFullyExpanded()},\n" +
            "{@link #isOnAod()}, {@link #isOnKeyguard()} instead."
    )
    fun isFullyExpanded(): Boolean

    /**
     * Sends an external (e.g. Status Bar) touch event to the Shade touch handler.
     *
+17 −10
Original line number Diff line number Diff line
@@ -33,31 +33,33 @@ class ShadeViewControllerEmptyImpl @Inject constructor() :
    ShadeBackActionInteractor,
    ShadeLockscreenInteractor,
    PanelExpansionInteractor {
    override fun expandToNotifications() {}
    override val isExpanded: Boolean = false
    @Deprecated("Use ShadeInteractor instead") override fun expandToNotifications() {}
    @Deprecated("Use ShadeInteractor instead") override val isExpanded: Boolean = false
    override val isPanelExpanded: Boolean = false
    override fun animateCollapseQs(fullyCollapse: Boolean) {}
    override fun canBeCollapsed(): Boolean = false
    override val isCollapsing: Boolean = false
    @Deprecated("Use ShadeAnimationInteractor instead") override val isCollapsing: Boolean = false
    override val isFullyCollapsed: Boolean = false
    override val isTracking: Boolean = false
    override val isViewEnabled: Boolean = false
    override fun shouldHideStatusBarIconsWhenExpanded() = false
    override fun blockExpansionForCurrentTouch() {}
    @Deprecated("Not supported by scenes") override fun blockExpansionForCurrentTouch() {}
    override fun disableHeader(state1: Int, state2: Int, animated: Boolean) {}
    override fun startExpandLatencyTracking() {}
    override fun startBouncerPreHideAnimation() {}
    override fun dozeTimeTick() {}
    override fun resetViews(animate: Boolean) {}
    override val barState: Int = 0
    @Deprecated("Only supported by very old devices that will not adopt scenes.")
    override fun closeUserSwitcherIfOpen(): Boolean {
        return false
    }
    override fun onBackPressed() {}
    @Deprecated("According to b/318376223, shade predictive back is not be supported.")
    override fun onBackProgressed(progressFraction: Float) {}
    override fun setAlpha(alpha: Int, animate: Boolean) {}
    override fun setAlphaChangeAnimationEndAction(r: Runnable) {}
    override fun setPulsing(pulsing: Boolean) {}
    @Deprecated("Not supported by scenes") override fun setPulsing(pulsing: Boolean) {}
    override fun setQsScrimEnabled(qsScrimEnabled: Boolean) {}
    override fun setAmbientIndicationTop(ambientIndicationTop: Int, ambientTextVisible: Boolean) {}
    override fun updateSystemUiStateFlags() {}
@@ -66,14 +68,18 @@ class ShadeViewControllerEmptyImpl @Inject constructor() :
    override fun removeOnGlobalLayoutListener(listener: ViewTreeObserver.OnGlobalLayoutListener) {}
    override fun transitionToExpandedShade(delay: Long) {}

    override fun resetViewGroupFade() {}
    @Deprecated("Not supported by scenes") override fun resetViewGroupFade() {}
    @Deprecated("Not supported by scenes")
    override fun setKeyguardTransitionProgress(keyguardAlpha: Float, keyguardTranslationY: Int) {}
    override fun setOverStretchAmount(amount: Float) {}
    @Deprecated("Not supported by scenes") override fun setOverStretchAmount(amount: Float) {}
    @Deprecated("TODO(b/325072511) delete this")
    override fun setKeyguardStatusBarAlpha(alpha: Float) {}
    override fun showAodUi() {}
    override fun isFullyExpanded(): Boolean {
        return false
    }
    @Deprecated(
        "depends on the state you check, use {@link #isShadeFullyExpanded()},\n" +
            "{@link #isOnAod()}, {@link #isOnKeyguard()} instead."
    )
    override val isFullyExpanded = false
    override fun handleExternalTouch(event: MotionEvent): Boolean {
        return false
    }
@@ -84,6 +90,7 @@ class ShadeViewControllerEmptyImpl @Inject constructor() :

    override val shadeHeadsUpTracker = ShadeHeadsUpTrackerEmptyImpl()
    override val shadeFoldAnimator = ShadeFoldAnimatorEmptyImpl()
    @Deprecated("Use SceneInteractor.currentScene instead.")
    override val legacyPanelExpansion = flowOf(0f)
}

+16 −0
Original line number Diff line number Diff line
@@ -41,4 +41,20 @@ interface PanelExpansionInteractor {
     * backwards-compatibility and should not be consumed by newer code.
     */
    @Deprecated("Use SceneInteractor.currentScene instead.") val legacyPanelExpansion: Flow<Float>

    /**
     * This method should not be used anymore, you should probably use [.isShadeFullyOpen] instead.
     * It was overused as indicating if shade is open or we're on keyguard/AOD. Moving forward we
     * should be explicit about the what state we're checking.
     *
     * @return if panel is covering the screen, which means we're in expanded shade or keyguard/AOD
     */
    @Deprecated(
        "depends on the state you check, use {@link #isShadeFullyExpanded()},\n" +
            "{@link #isOnAod()}, {@link #isOnKeyguard()} instead."
    )
    val isFullyExpanded: Boolean

    /** Returns whether the shade is in the process of collapsing. */
    @Deprecated("Use ShadeAnimationInteractor instead") val isCollapsing: Boolean
}
Loading