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

Commit 9124a290 authored by Selim Cinek's avatar Selim Cinek Committed by android-build-merger
Browse files

Merge "Not bypassing the lockscreen anymore when the user has pulled down" into qt-r1-dev

am: 541c6d9e

Change-Id: I6118a48a69975479f758dbc627f6046d88eda9e8
parents d71f26f3 541c6d9e
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        mHandler = handler;
        mWakeUpDelay = wakeUpDelay;
        mKeyguardBypassController = keyguardBypassController;
        mKeyguardBypassController.setUnlockController(this);
    }

    public void setStatusBarKeyguardViewManager(
@@ -234,6 +235,14 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
        }
        mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
                .setType(MetricsEvent.TYPE_SUCCESS).setSubtype(toSubtype(biometricSourceType)));
        boolean unlockAllowed = mKeyguardBypassController.onBiometricAuthenticated(
                biometricSourceType);
        if (unlockAllowed) {
            startWakeAndUnlock(biometricSourceType);
        }
    }

    private void startWakeAndUnlock(BiometricSourceType biometricSourceType) {
        startWakeAndUnlock(calculateMode(biometricSourceType));
    }

+0 −2
Original line number Diff line number Diff line
@@ -16,8 +16,6 @@

package com.android.systemui.statusbar.phone;

import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.content.Context;
+24 −3
Original line number Diff line number Diff line
@@ -17,17 +17,22 @@
package com.android.systemui.statusbar.phone

import android.content.Context
import android.hardware.biometrics.BiometricSourceType
import android.hardware.face.FaceManager
import android.provider.Settings
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.plugins.statusbar.StatusBarStateController
import com.android.systemui.statusbar.StatusBarState
import com.android.systemui.tuner.TunerService

import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class KeyguardBypassController {

    private val unlockMethodCache: UnlockMethodCache
    private val statusBarStateController: StatusBarStateController

    /**
     * If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
     */
@@ -35,11 +40,13 @@ class KeyguardBypassController {
        get() = field && unlockMethodCache.isUnlockingWithFacePossible
        private set

    private val unlockMethodCache: UnlockMethodCache
    lateinit var unlockController: BiometricUnlockController

    @Inject
    constructor(context: Context, tunerService: TunerService) {
    constructor(context: Context, tunerService: TunerService,
                statusBarStateController: StatusBarStateController) {
        unlockMethodCache = UnlockMethodCache.getInstance(context)
        this.statusBarStateController = statusBarStateController
        val faceManager = context.getSystemService(FaceManager::class.java)
        if (faceManager?.isHardwareDetected != true) {
            return
@@ -58,4 +65,18 @@ class KeyguardBypassController {
            }
        }, Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD)
    }

    /**
     * Notify that the biometric unlock has happened.
     *
     * @return false if we can not wake and unlock right now
     */
    fun onBiometricAuthenticated(biometricSourceType: BiometricSourceType): Boolean {
        if (bypassEnabled && statusBarStateController.state != StatusBarState.KEYGUARD) {
            // We're bypassing but not actually on the lockscreen, the user should decide when
            // to unlock
            return false
        }
        return true
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
        when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
        when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
        when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true);
        when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
        mContext.addMockSystemService(PowerManager.class, mPowerManager);
        mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
        mDependency.injectTestDependency(StatusBarWindowController.class,
+1 −1
Original line number Diff line number Diff line
@@ -112,7 +112,7 @@ public class NotificationPanelViewTest extends SysuiTestCase {
        mDependency.injectMockDependency(ConfigurationController.class);
        mDependency.injectMockDependency(ZenModeController.class);
        KeyguardBypassController bypassController = new KeyguardBypassController(mContext,
                mock(TunerService.class));
                mock(TunerService.class), mStatusBarStateController);
        NotificationWakeUpCoordinator coordinator =
                new NotificationWakeUpCoordinator(mContext,
                        mock(HeadsUpManagerPhone.class),