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

Commit a3ec3925 authored by Caitlin Shkuratov's avatar Caitlin Shkuratov
Browse files

[CS] Remove CS#isKeyguardShowing from SystemActions.

Bug: 277764509
Test: verified via logging that the DISMISS_NOTIFICATION_SHADE
accessibility action is never registered while on lockscreen (even if
the shade is open). Verified that it *is* registered when the shade is
open while unlocked, and unregistered when the shade is closed.
Test: atest SystemActionsTest

Change-Id: If47c11388291f725efa446db6b75e43af8d466de
parent 7050b6e2
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.accessibility;

import static android.view.WindowManager.ScreenshotSource.SCREENSHOT_ACCESSIBILITY_ACTIONS;

import static com.android.internal.accessibility.common.ShortcutConstants.CHOOSER_PACKAGE_NAME;

import android.accessibilityservice.AccessibilityService;
@@ -59,6 +58,7 @@ import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.phone.StatusBarWindowCallback;
import com.android.systemui.statusbar.policy.KeyguardStateController;
import com.android.systemui.util.Assert;

import dagger.Lazy;
@@ -188,6 +188,7 @@ public class SystemActions implements CoreStartable {
    private final AccessibilityManager mA11yManager;
    private final Lazy<Optional<CentralSurfaces>> mCentralSurfacesOptionalLazy;
    private final NotificationShadeWindowController mNotificationShadeController;
    private final KeyguardStateController mKeyguardStateController;
    private final ShadeController mShadeController;
    private final Lazy<ShadeViewController> mShadeViewController;
    private final StatusBarWindowCallback mNotificationShadeCallback;
@@ -197,6 +198,7 @@ public class SystemActions implements CoreStartable {
    public SystemActions(Context context,
            UserTracker userTracker,
            NotificationShadeWindowController notificationShadeController,
            KeyguardStateController keyguardStateController,
            ShadeController shadeController,
            Lazy<ShadeViewController> shadeViewController,
            Lazy<Optional<CentralSurfaces>> centralSurfacesOptionalLazy,
@@ -204,6 +206,7 @@ public class SystemActions implements CoreStartable {
            DisplayTracker displayTracker) {
        mContext = context;
        mUserTracker = userTracker;
        mKeyguardStateController = keyguardStateController;
        mShadeController = shadeController;
        mShadeViewController = shadeViewController;
        mRecentsOptional = recentsOptional;
@@ -329,13 +332,8 @@ public class SystemActions implements CoreStartable {
    private void registerOrUnregisterDismissNotificationShadeAction() {
        Assert.isMainThread();

        // Saving state in instance variable since this callback is called quite often to avoid
        // binder calls
        final Optional<CentralSurfaces> centralSurfacesOptional =
                mCentralSurfacesOptionalLazy.get();
        if (centralSurfacesOptional.isPresent()
                && mShadeViewController.get().isPanelExpanded()
                && !centralSurfacesOptional.get().isKeyguardShowing()) {
        if (mShadeViewController.get().isPanelExpanded()
                && !mKeyguardStateController.isShowing()) {
            if (!mDismissNotificationShadeActionRegistered) {
                mA11yManager.registerSystemAction(
                        createRemoteAction(
+13 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.systemui.accessibility;

import static com.google.common.truth.Truth.assertThat;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.doAnswer;
@@ -42,6 +41,7 @@ import com.android.systemui.shade.ShadeController;
import com.android.systemui.shade.ShadeViewController;
import com.android.systemui.statusbar.NotificationShadeWindowController;
import com.android.systemui.statusbar.phone.CentralSurfaces;
import com.android.systemui.statusbar.policy.KeyguardStateController;

import dagger.Lazy;

@@ -64,6 +64,8 @@ public class SystemActionsTest extends SysuiTestCase {
    @Mock
    private NotificationShadeWindowController mNotificationShadeController;
    @Mock
    private KeyguardStateController mKeyguardStateController;
    @Mock
    private ShadeController mShadeController;
    @Mock
    private ShadeViewController mShadeViewController;
@@ -84,9 +86,16 @@ public class SystemActionsTest extends SysuiTestCase {
        MockitoAnnotations.initMocks(this);
        mContext.addMockSystemService(TelecomManager.class, mTelecomManager);
        mContext.addMockSystemService(InputManager.class, mInputManager);
        mSystemActions = new SystemActions(mContext, mUserTracker, mNotificationShadeController,
                mShadeController, () -> mShadeViewController, mCentralSurfacesOptionalLazy,
                mRecentsOptional, mDisplayTracker);
        mSystemActions = new SystemActions(
                mContext,
                mUserTracker,
                mNotificationShadeController,
                mKeyguardStateController,
                mShadeController,
                () -> mShadeViewController,
                mCentralSurfacesOptionalLazy,
                mRecentsOptional,
                mDisplayTracker);
    }

    @Test