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

Commit 5a0f7ba8 authored by William Xiao's avatar William Xiao Committed by Android (Google) Code Review
Browse files

Merge "Fix shade not opening after opening widgets on lockscreen" into main

parents 97a20098 09cbcfb3
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -1304,6 +1304,16 @@ flag {
  }
}

flag {
  name: "communal_shade_touch_handling_fixes"
  namespace: "systemui"
  description: "Flags some minor bug fixes for opening the shade on the hub"
  bug: "409682586"
  metadata {
    purpose: PURPOSE_BUGFIX
  }
}

flag {
    name: "dream_overlay_updated_ui"
    namespace: "systemui"
+26 −11
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.shade;

import static com.android.systemui.Flags.shadeLaunchAccessibility;
import static com.android.systemui.Flags.communalShadeTouchHandlingFixes;
import static com.android.systemui.keyguard.shared.model.KeyguardState.DREAMING;
import static com.android.systemui.keyguard.shared.model.KeyguardState.LOCKSCREEN;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;
@@ -155,6 +156,10 @@ public class NotificationShadeWindowViewController implements Dumpable {
     * intercepted and all future touch events for the gesture should be processed by this view.
     */
    private boolean mExternalTouchIntercepted = false;
    /**
     * True if we are in the process of handling an external touch event.
     */
    private boolean mHandlingExternalTouch = false;
    private boolean mIsTrackingBarGesture = false;
    private boolean mIsOcclusionTransitionRunning = false;
    private DisableSubpixelTextTransitionListener mDisableSubpixelTextTransitionListener;
@@ -345,6 +350,10 @@ public class NotificationShadeWindowViewController implements Dumpable {
     * @param event The event to forward.
     */
    public void handleExternalTouch(MotionEvent event) {
        try {
            if (communalShadeTouchHandlingFixes()) {
                mHandlingExternalTouch = true;
            }
            if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
                mExternalTouchIntercepted = false;
            }
@@ -358,6 +367,9 @@ public class NotificationShadeWindowViewController implements Dumpable {
            if (mExternalTouchIntercepted) {
                mView.onTouchEvent(event);
            }
        } finally {
            mHandlingExternalTouch = false;
        }
    }

    /** Inflates the {@link R.layout#status_bar_expanded} layout and sets it up. */
@@ -431,6 +443,9 @@ public class NotificationShadeWindowViewController implements Dumpable {
                }

                if (!SceneContainerFlag.isEnabled()
                        // External touches are never intended to go the hub, only for opening the
                        // shade.
                        && !mHandlingExternalTouch
                        && mGlanceableHubContainerController.onTouchEvent(ev)) {
                    // GlanceableHubContainerController is only used pre-flexiglass.
                    return logDownDispatch(ev, "dispatched to glanceable hub container", true);
+18 −0
Original line number Diff line number Diff line
@@ -522,6 +522,24 @@ class NotificationShadeWindowViewControllerTest(flags: FlagsParameterization) :
        verify(view, never()).onTouchEvent(any())
    }

    @Test
    @EnableFlags(Flags.FLAG_COMMUNAL_SHADE_TOUCH_HANDLING_FIXES)
    @DisableSceneContainer
    fun handleExternalTouch_hubDoesNotSeeTouches() {
        underTest.setStatusBarViewController(phoneStatusBarViewController)
        whenever(view.dispatchTouchEvent(any())).thenAnswer { invocation ->
            interactionEventHandler.handleDispatchTouchEvent(
                invocation.arguments.first() as MotionEvent?
            )
            true
        }

        underTest.handleExternalTouch(DOWN_EVENT)

        // Glanceable hub never receives any external touches.
        verify(mGlanceableHubContainerController, never()).onTouchEvent(any())
    }

    @Test
    fun testGetKeyguardMessageArea() =
        testScope.runTest {