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

Commit d236ee3a authored by Lucas Dupin's avatar Lucas Dupin
Browse files

Do not update cache on screen lifecycle

The authentication state is unrelated to the screen lifecycle, keyguard
visibility events should be used instead to track the state.
We still have #onKeyguardVisibilityChanged and #onBiometricsCleared that
will make sure that the state will be updated properly and callbacks
will be triggered.

The call to #onScreenTurnedOff was introduced to work around face auth
when the device was not interactive. This CL doesn't cause a regression
because 1) the device now wakes up whenver face auth happens, 2) the new
biometrics cleared callback would be invoked.

(Also using this CL to daggerize some components since tests started to
fail with dependency entanglement ⚛️)

Test: atest KeyguardStateControllerTest
Test: reach, auth, sleep, reach
Bug: 139363827
Bug: 138786270
Change-Id: I0a1e86f3e8a69ffab4a621f9ce15034a0e35fa31
parent 9e3402dc
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -99,6 +99,7 @@ import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.TelephonyIntents;
import com.android.internal.widget.LockPatternUtils;
import com.android.settingslib.WirelessUtils;
import com.android.systemui.DejankUtils;
import com.android.systemui.R;
import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.TaskStackChangeListener;
@@ -1437,6 +1438,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
    }

    private void handleScreenTurnedOff() {
        final String tag = "KeyguardUpdateMonitor#handleScreenTurnedOff";
        DejankUtils.startDetectingBlockingIpcs(tag);
        checkIsHandlerThread();
        mHardwareFingerprintUnavailableRetryCount = 0;
        mHardwareFaceUnavailableRetryCount = 0;
@@ -1446,6 +1449,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
                cb.onScreenTurnedOff();
            }
        }
        DejankUtils.stopDetectingBlockingIpcs(tag);
    }

    private void handleDreamingStateChanged(int dreamStart) {
+6 −2
Original line number Diff line number Diff line
@@ -49,6 +49,7 @@ import com.android.systemui.shared.system.ActivityManagerWrapper;
import com.android.systemui.shared.system.DevicePolicyManagerWrapper;
import com.android.systemui.shared.system.PackageManagerWrapper;
import com.android.systemui.statusbar.NavigationBarController;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
import com.android.systemui.statusbar.phone.AutoHideController;
import com.android.systemui.statusbar.phone.ConfigurationControllerImpl;
import com.android.systemui.statusbar.policy.ConfigurationController;
@@ -204,8 +205,11 @@ public class DependencyProvider {
    @Singleton
    @Provides
    public AutoHideController provideAutoHideController(Context context,
            @Named(MAIN_HANDLER_NAME) Handler mainHandler) {
        return new AutoHideController(context, mainHandler);
            @Named(MAIN_HANDLER_NAME) Handler mainHandler,
            NotificationRemoteInputManager notificationRemoteInputManager,
            IWindowManager iWindowManager) {
        return new AutoHideController(context, mainHandler, notificationRemoteInputManager,
                iWindowManager);
    }

    @Singleton
+3 −1
Original line number Diff line number Diff line
@@ -152,7 +152,9 @@ public class NavigationBarController implements Callbacks {
            //                    Dependency problem.
            AutoHideController autoHideController = isOnDefaultDisplay
                    ? Dependency.get(AutoHideController.class)
                    : new AutoHideController(context, mHandler);
                    : new AutoHideController(context, mHandler,
                            Dependency.get(NotificationRemoteInputManager.class),
                            Dependency.get(IWindowManager.class));
            navBar.setAutoHideController(autoHideController);
            navBar.restoreSystemUiVisibilityState();
            mNavigationBars.append(displayId, navBar);
+6 −4
Original line number Diff line number Diff line
@@ -473,8 +473,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    private int mHeadsUpInset;
    private HeadsUpAppearanceController mHeadsUpAppearanceController;
    private NotificationIconAreaController mIconAreaController;
    private final NotificationLockscreenUserManager mLockscreenUserManager =
            Dependency.get(NotificationLockscreenUserManager.class);
    private final NotificationLockscreenUserManager mLockscreenUserManager;
    private final Rect mTmpRect = new Rect();
    private final NotificationEntryManager mEntryManager =
            Dependency.get(NotificationEntryManager.class);
@@ -497,8 +496,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
    private NotificationPanelView mNotificationPanel;
    private final ShadeController mShadeController = Dependency.get(ShadeController.class);

    private final NotificationGutsManager
            mNotificationGutsManager = Dependency.get(NotificationGutsManager.class);
    private final NotificationGutsManager mNotificationGutsManager;
    private final NotificationSectionsManager mSectionsManager;
    private boolean mAnimateBottomOnLayout;
    private float mLastSentAppear;
@@ -518,6 +516,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd
            HeadsUpManagerPhone headsUpManager,
            KeyguardBypassController keyguardBypassController,
            FalsingManager falsingManager,
            NotificationLockscreenUserManager notificationLockscreenUserManager,
            NotificationGutsManager notificationGutsManager,
            NotificationSectionsFeatureManager sectionsFeatureManager) {
        super(context, attrs, 0, 0);
        Resources res = getResources();
@@ -526,6 +526,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements ScrollAd

        mRoundnessManager = notificationRoundnessManager;

        mLockscreenUserManager = notificationLockscreenUserManager;
        mNotificationGutsManager = notificationGutsManager;
        mHeadsUpManager = headsUpManager;
        mHeadsUpManager.addListener(mRoundnessManager);
        mHeadsUpManager.setAnimationStateHandler(this::setHeadsUpGoingAwayAnimationsAllowed);
+5 −4
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.view.MotionEvent;
import android.view.View;

import com.android.internal.annotations.VisibleForTesting;
import com.android.systemui.Dependency;
import com.android.systemui.SysUiServiceProvider;
import com.android.systemui.statusbar.CommandQueue;
import com.android.systemui.statusbar.NotificationRemoteInputManager;
@@ -68,12 +67,14 @@ public class AutoHideController implements CommandQueue.Callbacks {
    };

    @Inject
    public AutoHideController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler) {
    public AutoHideController(Context context, @Named(MAIN_HANDLER_NAME) Handler handler,
            NotificationRemoteInputManager notificationRemoteInputManager,
            IWindowManager iWindowManager) {
        mCommandQueue = SysUiServiceProvider.getComponent(context, CommandQueue.class);
        mCommandQueue.addCallback(this);
        mHandler = handler;
        mRemoteInputManager = Dependency.get(NotificationRemoteInputManager.class);
        mWindowManagerService = Dependency.get(IWindowManager.class);
        mRemoteInputManager = notificationRemoteInputManager;
        mWindowManagerService = iWindowManager;

        mDisplayId = context.getDisplayId();
    }
Loading