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

Commit 5b4ba017 authored by Josh Tsuji's avatar Josh Tsuji
Browse files

Make the notif panel focusable during screen off so touch events don't go to the app behind.

Fixes: 191149706
Test: frantically tap things during screen off
Test: cancel screen off with/without power button instantly locks setting enabled, observe that things do become touchable again
Change-Id: I81843d4901f6f3bb0bb00f3d8eaa713da494b0fe
parent bdd8ff3f
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            mCallbacks = Lists.newArrayList();

    private final SysuiColorExtractor mColorExtractor;
    private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
    private float mFaceAuthDisplayBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;

    @Inject
@@ -110,7 +111,8 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
            KeyguardBypassController keyguardBypassController,
            SysuiColorExtractor colorExtractor,
            DumpManager dumpManager,
            KeyguardStateController keyguardStateController) {
            KeyguardStateController keyguardStateController,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
        mContext = context;
        mWindowManager = windowManager;
        mActivityManager = activityManager;
@@ -121,6 +123,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardBypassController = keyguardBypassController;
        mColorExtractor = colorExtractor;
        mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
        dumpManager.registerDumpable(getClass().getName(), this);

        mLockScreenDisplayTimeout = context.getResources()
@@ -300,7 +303,11 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
    private void applyFocusableFlag(State state) {
        boolean panelFocusable = state.mNotificationShadeFocusable && state.mPanelExpanded;
        if (state.mBouncerShowing && (state.mKeyguardOccluded || state.mKeyguardNeedsInput)
                || ENABLE_REMOTE_INPUT && state.mRemoteInputActive) {
                || ENABLE_REMOTE_INPUT && state.mRemoteInputActive
                // Make the panel focusable if we're doing the screen off animation, since the light
                // reveal scrim is drawing in the panel and should consume touch events so that they
                // don't go to the app behind.
                || mUnlockedScreenOffAnimationController.isScreenOffAnimationPlaying()) {
            mLpChanged.flags &= ~LayoutParams.FLAG_NOT_FOCUSABLE;
            mLpChanged.flags &= ~LayoutParams.FLAG_ALT_FOCUSABLE_IM;
        } else if (state.isKeyguardShowingAndNotOccluded() || panelFocusable) {
+3 −1
Original line number Diff line number Diff line
@@ -72,6 +72,7 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
    @Mock ColorExtractor.GradientColors mGradientColors;
    @Mock private DumpManager mDumpManager;
    @Mock private KeyguardStateController mKeyguardStateController;
    @Mock private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
    @Captor private ArgumentCaptor<WindowManager.LayoutParams> mLayoutParameters;

    private NotificationShadeWindowControllerImpl mNotificationShadeWindowController;
@@ -85,7 +86,8 @@ public class NotificationShadeWindowControllerImplTest extends SysuiTestCase {
        mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
                mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
                mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
                mColorExtractor, mDumpManager, mKeyguardStateController);
                mColorExtractor, mDumpManager, mKeyguardStateController,
                mUnlockedScreenOffAnimationController);
        mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);

        mNotificationShadeWindowController.attach();
+5 −1
Original line number Diff line number Diff line
@@ -98,6 +98,7 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowControllerImpl;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -233,6 +234,8 @@ public class BubblesTest extends SysuiTestCase {
    private ShellTaskOrganizer mShellTaskOrganizer;
    @Mock
    private KeyguardStateController mKeyguardStateController;
    @Mock
    private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;

    private TestableBubblePositioner mPositioner;

@@ -255,7 +258,8 @@ public class BubblesTest extends SysuiTestCase {
        mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
                mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
                mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
                mColorExtractor, mDumpManager, mKeyguardStateController);
                mColorExtractor, mDumpManager, mKeyguardStateController,
                mUnlockedScreenOffAnimationController);
        mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
        mNotificationShadeWindowController.attach();

+5 −1
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.NotificationShadeWindowControllerImpl;
import com.android.systemui.statusbar.phone.NotificationShadeWindowView;
import com.android.systemui.statusbar.phone.ShadeController;
import com.android.systemui.statusbar.phone.UnlockedScreenOffAnimationController;
import com.android.systemui.statusbar.policy.BatteryController;
import com.android.systemui.statusbar.policy.ConfigurationController;
import com.android.systemui.statusbar.policy.HeadsUpManager;
@@ -197,6 +198,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
    private ShellTaskOrganizer mShellTaskOrganizer;
    @Mock
    private KeyguardStateController mKeyguardStateController;
    @Mock
    private UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;

    private TestableBubblePositioner mPositioner;

@@ -218,7 +221,8 @@ public class NewNotifPipelineBubblesTest extends SysuiTestCase {
        mNotificationShadeWindowController = new NotificationShadeWindowControllerImpl(mContext,
                mWindowManager, mActivityManager, mDozeParameters, mStatusBarStateController,
                mConfigurationController, mKeyguardViewMediator, mKeyguardBypassController,
                mColorExtractor, mDumpManager, mKeyguardStateController);
                mColorExtractor, mDumpManager, mKeyguardStateController,
                mUnlockedScreenOffAnimationController);
        mNotificationShadeWindowController.setNotificationShadeView(mNotificationShadeWindowView);
        mNotificationShadeWindowController.attach();