Merge "Not bypassing the lockscreen anymore when the user has pulled down" into qt-r1-dev
This commit is contained in:
@@ -163,6 +163,7 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
|
|||||||
mHandler = handler;
|
mHandler = handler;
|
||||||
mWakeUpDelay = wakeUpDelay;
|
mWakeUpDelay = wakeUpDelay;
|
||||||
mKeyguardBypassController = keyguardBypassController;
|
mKeyguardBypassController = keyguardBypassController;
|
||||||
|
mKeyguardBypassController.setUnlockController(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusBarKeyguardViewManager(
|
public void setStatusBarKeyguardViewManager(
|
||||||
@@ -234,6 +235,14 @@ public class BiometricUnlockController extends KeyguardUpdateMonitorCallback {
|
|||||||
}
|
}
|
||||||
mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
|
mMetricsLogger.write(new LogMaker(MetricsEvent.BIOMETRIC_AUTH)
|
||||||
.setType(MetricsEvent.TYPE_SUCCESS).setSubtype(toSubtype(biometricSourceType)));
|
.setType(MetricsEvent.TYPE_SUCCESS).setSubtype(toSubtype(biometricSourceType)));
|
||||||
|
boolean unlockAllowed = mKeyguardBypassController.onBiometricAuthenticated(
|
||||||
|
biometricSourceType);
|
||||||
|
if (unlockAllowed) {
|
||||||
|
startWakeAndUnlock(biometricSourceType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void startWakeAndUnlock(BiometricSourceType biometricSourceType) {
|
||||||
startWakeAndUnlock(calculateMode(biometricSourceType));
|
startWakeAndUnlock(calculateMode(biometricSourceType));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.systemui.statusbar.phone;
|
package com.android.systemui.statusbar.phone;
|
||||||
|
|
||||||
import static com.android.systemui.util.InjectionInflationController.VIEW_CONTEXT;
|
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
import android.annotation.Nullable;
|
import android.annotation.Nullable;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|||||||
@@ -17,17 +17,22 @@
|
|||||||
package com.android.systemui.statusbar.phone
|
package com.android.systemui.statusbar.phone
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.hardware.biometrics.BiometricSourceType
|
||||||
import android.hardware.face.FaceManager
|
import android.hardware.face.FaceManager
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor
|
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 com.android.systemui.tuner.TunerService
|
||||||
|
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class KeyguardBypassController {
|
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.
|
* 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
|
get() = field && unlockMethodCache.isUnlockingWithFacePossible
|
||||||
private set
|
private set
|
||||||
|
|
||||||
private val unlockMethodCache: UnlockMethodCache
|
lateinit var unlockController: BiometricUnlockController
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
constructor(context: Context, tunerService: TunerService) {
|
constructor(context: Context, tunerService: TunerService,
|
||||||
|
statusBarStateController: StatusBarStateController) {
|
||||||
unlockMethodCache = UnlockMethodCache.getInstance(context)
|
unlockMethodCache = UnlockMethodCache.getInstance(context)
|
||||||
|
this.statusBarStateController = statusBarStateController
|
||||||
val faceManager = context.getSystemService(FaceManager::class.java)
|
val faceManager = context.getSystemService(FaceManager::class.java)
|
||||||
if (faceManager?.isHardwareDetected != true) {
|
if (faceManager?.isHardwareDetected != true) {
|
||||||
return
|
return
|
||||||
@@ -58,4 +65,18 @@ class KeyguardBypassController {
|
|||||||
}
|
}
|
||||||
}, Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD)
|
}, 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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,6 +81,7 @@ public class BiometricsUnlockControllerTest extends SysuiTestCase {
|
|||||||
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
when(mStatusBarKeyguardViewManager.isShowing()).thenReturn(true);
|
||||||
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
|
when(mUpdateMonitor.isDeviceInteractive()).thenReturn(true);
|
||||||
when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true);
|
when(mUnlockMethodCache.isUnlockingWithFacePossible()).thenReturn(true);
|
||||||
|
when(mKeyguardBypassController.onBiometricAuthenticated(any())).thenReturn(true);
|
||||||
mContext.addMockSystemService(PowerManager.class, mPowerManager);
|
mContext.addMockSystemService(PowerManager.class, mPowerManager);
|
||||||
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
|
mDependency.injectTestDependency(NotificationMediaManager.class, mMediaManager);
|
||||||
mDependency.injectTestDependency(StatusBarWindowController.class,
|
mDependency.injectTestDependency(StatusBarWindowController.class,
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ public class NotificationPanelViewTest extends SysuiTestCase {
|
|||||||
mDependency.injectMockDependency(ConfigurationController.class);
|
mDependency.injectMockDependency(ConfigurationController.class);
|
||||||
mDependency.injectMockDependency(ZenModeController.class);
|
mDependency.injectMockDependency(ZenModeController.class);
|
||||||
KeyguardBypassController bypassController = new KeyguardBypassController(mContext,
|
KeyguardBypassController bypassController = new KeyguardBypassController(mContext,
|
||||||
mock(TunerService.class));
|
mock(TunerService.class), mStatusBarStateController);
|
||||||
NotificationWakeUpCoordinator coordinator =
|
NotificationWakeUpCoordinator coordinator =
|
||||||
new NotificationWakeUpCoordinator(mContext,
|
new NotificationWakeUpCoordinator(mContext,
|
||||||
mock(HeadsUpManagerPhone.class),
|
mock(HeadsUpManagerPhone.class),
|
||||||
|
|||||||
Reference in New Issue
Block a user