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

Commit 4d4c754d authored by Justin Weir's avatar Justin Weir
Browse files

Remove reference to NPVC

NotificationShadeWindowViewController will still exist in a scene based
System UI, so it cannot directly depend on NPVC. Unfortunately, this
required the addition of one method to SVC. Some of its other methods
have also been deprecated in this change, since they will not be called
with the scene container flag enabled.

Flag: ACONFIG com.android.systemui.scene_container DEVELOPMENT
Test: Updated and ran affected tests
Test: Manual
Bug: 303267342
Change-Id: Ic64d4c251cdf0a300c1f1cfce0cc07f960a8d050
parent 68249429
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -4160,7 +4160,8 @@ public final class NotificationPanelViewController implements ShadeSurface, Dump
    }

    /** Sends an external (e.g. Status Bar) intercept touch event to the Shade touch handler. */
    boolean handleExternalInterceptTouch(MotionEvent event) {
    @Override
    public boolean handleExternalInterceptTouch(MotionEvent event) {
        try {
            mUseExternalTouch = true;
            return mTouchHandler.onInterceptTouchEvent(event);
+12 −8
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.TransitionState;
import com.android.systemui.keyguard.shared.model.TransitionStep;
import com.android.systemui.res.R;
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor;
import com.android.systemui.shared.animation.DisableSubpixelTextTransitionListener;
import com.android.systemui.statusbar.DragDownHelper;
import com.android.systemui.statusbar.LockscreenShadeTransitionController;
@@ -132,7 +133,8 @@ public class NotificationShadeWindowViewController implements Dumpable {
    private DragDownHelper mDragDownHelper;
    private boolean mExpandingBelowNotch;
    private final DockManager mDockManager;
    private final NotificationPanelViewController mNotificationPanelViewController;
    private final ShadeViewController mShadeViewController;
    private final PanelExpansionInteractor mPanelExpansionInteractor;
    private final ShadeExpansionStateManager mShadeExpansionStateManager;

    private boolean mIsTrackingBarGesture = false;
@@ -154,7 +156,8 @@ public class NotificationShadeWindowViewController implements Dumpable {
            DockManager dockManager,
            NotificationShadeDepthController depthController,
            NotificationShadeWindowView notificationShadeWindowView,
            NotificationPanelViewController notificationPanelViewController,
            ShadeViewController shadeViewController,
            PanelExpansionInteractor panelExpansionInteractor,
            ShadeExpansionStateManager shadeExpansionStateManager,
            NotificationStackScrollLayoutController notificationStackScrollLayoutController,
            StatusBarKeyguardViewManager statusBarKeyguardViewManager,
@@ -187,7 +190,8 @@ public class NotificationShadeWindowViewController implements Dumpable {
        mStatusBarStateController = statusBarStateController;
        mView = notificationShadeWindowView;
        mDockManager = dockManager;
        mNotificationPanelViewController = notificationPanelViewController;
        mShadeViewController = shadeViewController;
        mPanelExpansionInteractor = panelExpansionInteractor;
        mShadeExpansionStateManager = shadeExpansionStateManager;
        mDepthController = depthController;
        mNotificationStackScrollLayoutController = notificationStackScrollLayoutController;
@@ -374,7 +378,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                }

                if (!mIsTrackingBarGesture && isDown
                        && mNotificationPanelViewController.isFullyCollapsed()) {
                        && mPanelExpansionInteractor.isFullyCollapsed()) {
                    float x = ev.getRawX();
                    float y = ev.getRawY();
                    if (mStatusBarViewController.touchIsWithinView(x, y)) {
@@ -447,7 +451,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                } else {
                    bouncerShowing = mService.isBouncerShowing();
                }
                if (mNotificationPanelViewController.isFullyExpanded()
                if (mPanelExpansionInteractor.isFullyExpanded()
                        && !bouncerShowing
                        && !mStatusBarStateController.isDozing()) {
                    if (mDragDownHelper.isDragDownEnabled()) {
@@ -503,7 +507,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                cancellation.setAction(MotionEvent.ACTION_CANCEL);
                mStackScrollLayout.onInterceptTouchEvent(cancellation);
                if (!MigrateClocksToBlueprint.isEnabled()) {
                    mNotificationPanelViewController.handleExternalInterceptTouch(cancellation);
                    mShadeViewController.handleExternalInterceptTouch(cancellation);
                }
                cancellation.recycle();
            }
@@ -522,7 +526,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
                        // we still want to finish our drag down gesture when locking the screen
                        handled |= mDragDownHelper.onTouchEvent(ev) || handled;
                    }
                    if (!handled && mNotificationPanelViewController.handleExternalTouch(ev)) {
                    if (!handled && mShadeViewController.handleExternalTouch(ev)) {
                        return true;
                    }
                } else {
@@ -611,7 +615,7 @@ public class NotificationShadeWindowViewController implements Dumpable {
            // Since NotificationStackScrollLayout is now a sibling of notification_panel, we need
            // to also ask NotificationPanelViewController directly, in order to process swipe up
            // events originating from notifications
            if (mNotificationPanelViewController.handleExternalInterceptTouch(ev)) {
            if (mShadeViewController.handleExternalInterceptTouch(ev)) {
                mShadeLogger.d("NSWVC: NPVC intercepted");
                return true;
            }
+5 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ interface ShadeViewController {
    fun startExpandLatencyTracking()

    /** Sets the alpha value of the shade to a value between 0 and 255. */
    @Deprecated("No longer supported. Do not add new calls to this.")
    fun setAlpha(alpha: Int, animate: Boolean)

    /**
@@ -45,6 +46,7 @@ interface ShadeViewController {
     *
     * @see .setAlpha
     */
    @Deprecated("No longer supported. Do not add new calls to this.")
    fun setAlphaChangeAnimationEndAction(r: Runnable)

    /** Sets Qs ScrimEnabled and updates QS state. */
@@ -58,7 +60,7 @@ interface ShadeViewController {
    @Deprecated("Does nothing when scene container is enabled.") fun updateSystemUiStateFlags()

    /** Ensures that the touchable region is updated. */
    fun updateTouchableRegion()
    @Deprecated("No longer supported. Do not add new calls to this.") fun updateTouchableRegion()

    /**
     * Sends an external (e.g. Status Bar) touch event to the Shade touch handler.
@@ -69,6 +71,8 @@ interface ShadeViewController {
     */
    fun handleExternalTouch(event: MotionEvent): Boolean

    fun handleExternalInterceptTouch(event: MotionEvent): Boolean

    /**
     * Triggered when an input focus transfer gesture has started.
     *
+5 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ import javax.inject.Inject
import kotlinx.coroutines.flow.flowOf

/** Empty implementation of ShadeViewController for variants with no shade. */
class ShadeViewControllerEmptyImpl @Inject constructor() :
open class ShadeViewControllerEmptyImpl @Inject constructor() :
    ShadeViewController,
    ShadeBackActionInteractor,
    ShadeLockscreenInteractor,
@@ -81,6 +81,10 @@ class ShadeViewControllerEmptyImpl @Inject constructor() :
    override fun handleExternalTouch(event: MotionEvent): Boolean {
        return false
    }
    override fun handleExternalInterceptTouch(event: MotionEvent): Boolean {
        return false
    }

    override fun startInputFocusTransfer() {}
    override fun cancelInputFocusTransfer() {}
    override fun finishInputFocusTransfer(velocity: Float) {}
+12 −9
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.res.R
import com.android.systemui.shade.NotificationShadeWindowView.InteractionEventHandler
import com.android.systemui.shade.domain.interactor.PanelExpansionInteractor
import com.android.systemui.statusbar.DragDownHelper
import com.android.systemui.statusbar.LockscreenShadeTransitionController
import com.android.systemui.statusbar.NotificationInsetsController
@@ -68,6 +69,7 @@ import com.android.systemui.util.mockito.any
import com.android.systemui.util.mockito.eq
import com.android.systemui.util.time.FakeSystemClock
import com.google.common.truth.Truth.assertThat
import java.util.Optional
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.emptyFlow
@@ -85,7 +87,6 @@ import org.mockito.Mockito.never
import org.mockito.Mockito.times
import org.mockito.Mockito.verify
import org.mockito.MockitoAnnotations
import java.util.Optional
import org.mockito.Mockito.`when` as whenever

@OptIn(ExperimentalCoroutinesApi::class)
@@ -100,7 +101,8 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
    @Mock private lateinit var dozeServiceHost: DozeServiceHost
    @Mock private lateinit var dozeScrimController: DozeScrimController
    @Mock private lateinit var dockManager: DockManager
    @Mock private lateinit var notificationPanelViewController: NotificationPanelViewController
    @Mock private lateinit var shadeViewController: ShadeViewController
    @Mock private lateinit var panelExpansionInteractor: PanelExpansionInteractor
    @Mock private lateinit var notificationShadeDepthController: NotificationShadeDepthController
    @Mock private lateinit var notificationShadeWindowController: NotificationShadeWindowController
    @Mock private lateinit var keyguardUnlockAnimationController: KeyguardUnlockAnimationController
@@ -177,7 +179,8 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
                dockManager,
                notificationShadeDepthController,
                view,
                notificationPanelViewController,
                shadeViewController,
                panelExpansionInteractor,
                ShadeExpansionStateManager(),
                stackScrollLayoutController,
                statusBarKeyguardViewManager,
@@ -263,7 +266,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        testScope.runTest {
            underTest.setStatusBarViewController(phoneStatusBarViewController)
            whenever(statusBarWindowStateController.windowIsShowing()).thenReturn(true)
            whenever(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
            whenever(panelExpansionInteractor.isFullyCollapsed).thenReturn(true)
            whenever(phoneStatusBarViewController.touchIsWithinView(anyFloat(), anyFloat()))
                .thenReturn(true)
            whenever(phoneStatusBarViewController.sendTouchToView(DOWN_EVENT)).thenReturn(true)
@@ -282,7 +285,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
            whenever(phoneStatusBarViewController.touchIsWithinView(anyFloat(), anyFloat()))
                .thenReturn(true)
            // Item we're testing
            whenever(notificationPanelViewController.isFullyCollapsed).thenReturn(false)
            whenever(panelExpansionInteractor.isFullyCollapsed).thenReturn(false)

            val returnVal = interactionEventHandler.handleDispatchTouchEvent(DOWN_EVENT)

@@ -295,7 +298,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        testScope.runTest {
            underTest.setStatusBarViewController(phoneStatusBarViewController)
            whenever(statusBarWindowStateController.windowIsShowing()).thenReturn(true)
            whenever(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
            whenever(panelExpansionInteractor.isFullyCollapsed).thenReturn(true)
            // Item we're testing
            whenever(phoneStatusBarViewController.touchIsWithinView(anyFloat(), anyFloat()))
                .thenReturn(false)
@@ -310,7 +313,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
    fun handleDispatchTouchEvent_sbWindowNotShowing_noSendTouchToSbAndReturnsTrue() =
        testScope.runTest {
            underTest.setStatusBarViewController(phoneStatusBarViewController)
            whenever(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
            whenever(panelExpansionInteractor.isFullyCollapsed).thenReturn(true)
            whenever(phoneStatusBarViewController.touchIsWithinView(anyFloat(), anyFloat()))
                .thenReturn(true)
            // Item we're testing
@@ -327,7 +330,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        testScope.runTest {
            underTest.setStatusBarViewController(phoneStatusBarViewController)
            whenever(statusBarWindowStateController.windowIsShowing()).thenReturn(true)
            whenever(notificationPanelViewController.isFullyCollapsed).thenReturn(true)
            whenever(panelExpansionInteractor.isFullyCollapsed).thenReturn(true)
            whenever(phoneStatusBarViewController.touchIsWithinView(anyFloat(), anyFloat()))
                .thenReturn(true)

@@ -486,7 +489,7 @@ class NotificationShadeWindowViewControllerTest : SysuiTestCase() {
        // AND bouncer is not showing
        whenever(centralSurfaces.isBouncerShowing()).thenReturn(false)
        // AND panel view controller wants it
        whenever(notificationPanelViewController.handleExternalInterceptTouch(DOWN_EVENT))
        whenever(shadeViewController.handleExternalInterceptTouch(DOWN_EVENT))
            .thenReturn(true)

        mSetFlagsRule.enableFlags(Flags.FLAG_MIGRATE_CLOCKS_TO_BLUEPRINT)
Loading