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

Commit 60fbdc30 authored by Alejandro Nijamkin's avatar Alejandro Nijamkin
Browse files

[flexiglass] Attempt device entry when told to dismiss by system server

When system server asks System UI to dismiss the keyguard, attempt
device entry.

Before this change, there would be a crash from unexpectedly calling
legacy bouncer code while on Flexiglass.

With this change, the bouncer or alternate bouncer show up as needed.

The bug described in the attached bug is still occuring however: back
navigation on the alternate bouncer affects the scene containe and not
the alternate bouncer. Working on that next.

Bug: 360109685
Test: manually verified that the bouncer shows up if fingerprint isn't
set up, the alternate bouncer shows up if fingerprint is set up
Flag: com.android.systemui.scene_container

Change-Id: I3989a3df475f1245ece4d47c6516f7140dfc9d39
parent c4f9c296
Loading
Loading
Loading
Loading
+20 −12
Original line number Diff line number Diff line
@@ -16,12 +16,14 @@

package com.android.systemui.deviceentry.domain.interactor

import com.android.internal.policy.IKeyguardDismissCallback
import com.android.systemui.authentication.domain.interactor.AuthenticationInteractor
import com.android.systemui.authentication.shared.model.AuthenticationMethodModel
import com.android.systemui.bouncer.domain.interactor.AlternateBouncerInteractor
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.deviceentry.data.repository.DeviceEntryRepository
import com.android.systemui.keyguard.DismissCallbackRegistry
import com.android.systemui.scene.domain.interactor.SceneInteractor
import com.android.systemui.scene.shared.model.Scenes
import com.android.systemui.utils.coroutines.flow.mapLatestConflated
@@ -56,6 +58,7 @@ constructor(
    private val sceneInteractor: SceneInteractor,
    private val deviceUnlockedInteractor: DeviceUnlockedInteractor,
    private val alternateBouncerInteractor: AlternateBouncerInteractor,
    private val dismissCallbackRegistry: DismissCallbackRegistry,
) {
    /**
     * Whether the device is unlocked.
@@ -126,11 +129,8 @@ constructor(
                },
                isLockscreenEnabled,
                deviceUnlockedInteractor.deviceUnlockStatus,
                isDeviceEntered) {
                    isNoneAuthMethod,
                    isLockscreenEnabled,
                    deviceUnlockStatus,
                    isDeviceEntered ->
                isDeviceEntered
            ) { isNoneAuthMethod, isLockscreenEnabled, deviceUnlockStatus, isDeviceEntered ->
                val isSwipeAuthMethod = isNoneAuthMethod && isLockscreenEnabled
                (isSwipeAuthMethod ||
                    (deviceUnlockStatus.isUnlocked &&
@@ -150,8 +150,16 @@ constructor(
    /**
     * Attempt to enter the device and dismiss the lockscreen. If authentication is required to
     * unlock the device it will transition to bouncer.
     *
     * @param callback An optional callback to invoke when the attempt succeeds, fails, or is
     *   canceled
     */
    fun attemptDeviceEntry() {
    @JvmOverloads
    fun attemptDeviceEntry(
        callback: IKeyguardDismissCallback? = null,
    ) {
        callback?.let { dismissCallbackRegistry.addCallback(it) }

        // TODO (b/307768356),
        //       1. Check if the device is already authenticated by trust agent/passive biometrics
        //       2. Show SPFS/UDFPS bouncer if it is available AlternateBouncerInteractor.show
+8 −2
Original line number Diff line number Diff line
@@ -76,6 +76,7 @@ import com.android.keyguard.mediator.ScreenOnCoordinator;
import com.android.systemui.SystemUIApplication;
import com.android.systemui.dagger.qualifiers.Application;
import com.android.systemui.dagger.qualifiers.Main;
import com.android.systemui.deviceentry.domain.interactor.DeviceEntryInteractor;
import com.android.systemui.flags.FeatureFlags;
import com.android.systemui.keyguard.domain.interactor.KeyguardDismissInteractor;
import com.android.systemui.keyguard.domain.interactor.KeyguardEnabledInteractor;
@@ -122,6 +123,7 @@ public class KeyguardService extends Service {
    private final PowerInteractor mPowerInteractor;
    private final KeyguardInteractor mKeyguardInteractor;
    private final Lazy<SceneInteractor> mSceneInteractorLazy;
    private final Lazy<DeviceEntryInteractor> mDeviceEntryInteractorLazy;
    private final Executor mMainExecutor;
    private final Lazy<KeyguardStateCallbackStartable> mKeyguardStateCallbackStartableLazy;

@@ -347,7 +349,8 @@ public class KeyguardService extends Service {
            KeyguardEnabledInteractor keyguardEnabledInteractor,
            Lazy<KeyguardStateCallbackStartable> keyguardStateCallbackStartableLazy,
            KeyguardWakeDirectlyToGoneInteractor keyguardWakeDirectlyToGoneInteractor,
            KeyguardDismissInteractor keyguardDismissInteractor) {
            KeyguardDismissInteractor keyguardDismissInteractor,
            Lazy<DeviceEntryInteractor> deviceEntryInteractorLazy) {
        super();
        mKeyguardViewMediator = keyguardViewMediator;
        mKeyguardLifecyclesDispatcher = keyguardLifecyclesDispatcher;
@@ -360,6 +363,7 @@ public class KeyguardService extends Service {
        mSceneInteractorLazy = sceneInteractorLazy;
        mMainExecutor = mainExecutor;
        mKeyguardStateCallbackStartableLazy = keyguardStateCallbackStartableLazy;
        mDeviceEntryInteractorLazy = deviceEntryInteractorLazy;

        if (KeyguardWmStateRefactor.isEnabled()) {
            WindowManagerLockscreenVisibilityViewBinder.bind(
@@ -484,7 +488,9 @@ public class KeyguardService extends Service {
        public void dismiss(IKeyguardDismissCallback callback, CharSequence message) {
            trace("dismiss message=" + message);
            checkPermission();
            if (KeyguardWmStateRefactor.isEnabled()) {
            if (SceneContainerFlag.isEnabled()) {
                mDeviceEntryInteractorLazy.get().attemptDeviceEntry(callback);
            } else if (KeyguardWmStateRefactor.isEnabled()) {
                mKeyguardDismissInteractor.dismissKeyguardWithCallback(callback);
            } else {
                mKeyguardViewMediator.dismiss(callback, message);
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.systemui.deviceentry.domain.interactor
import com.android.systemui.authentication.domain.interactor.authenticationInteractor
import com.android.systemui.bouncer.domain.interactor.alternateBouncerInteractor
import com.android.systemui.deviceentry.data.repository.deviceEntryRepository
import com.android.systemui.keyguard.dismissCallbackRegistry
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.scene.domain.interactor.sceneInteractor
@@ -34,5 +35,6 @@ val Kosmos.deviceEntryInteractor by
            sceneInteractor = sceneInteractor,
            deviceUnlockedInteractor = deviceUnlockedInteractor,
            alternateBouncerInteractor = alternateBouncerInteractor,
            dismissCallbackRegistry = dismissCallbackRegistry,
        )
    }