Merge "Add config to override face unlock bypass setting" into sc-dev

This commit is contained in:
Curtis Belmonte
2021-04-14 20:11:49 +00:00
committed by Android (Google) Code Review
2 changed files with 31 additions and 1 deletions

View File

@@ -656,4 +656,10 @@
<!-- Y -->
<!-- radius -->
</integer-array>
<!-- Overrides the behavior of the face unlock keyguard bypass setting:
0 - Don't override the setting (default)
1 - Override the setting to always bypass keyguard
2 - Override the setting to never bypass keyguard -->
<integer name="config_face_unlock_bypass_override">0</integer>
</resources>

View File

@@ -16,11 +16,13 @@
package com.android.systemui.statusbar.phone
import android.annotation.IntDef
import android.content.Context
import android.content.pm.PackageManager
import android.hardware.biometrics.BiometricSourceType
import android.provider.Settings
import com.android.systemui.Dumpable
import com.android.systemui.R
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dump.DumpManager
import com.android.systemui.plugins.statusbar.StatusBarStateController
@@ -37,9 +39,18 @@ open class KeyguardBypassController : Dumpable {
private val mKeyguardStateController: KeyguardStateController
private val statusBarStateController: StatusBarStateController
@BypassOverride private val bypassOverride: Int
private var hasFaceFeature: Boolean
private var pendingUnlock: PendingUnlock? = null
@IntDef(
FACE_UNLOCK_BYPASS_NO_OVERRIDE,
FACE_UNLOCK_BYPASS_ALWAYS,
FACE_UNLOCK_BYPASS_NEVER
)
@Retention(AnnotationRetention.SOURCE)
private annotation class BypassOverride
/**
* Pending unlock info:
*
@@ -60,7 +71,14 @@ open class KeyguardBypassController : Dumpable {
* If face unlock dismisses the lock screen or keeps user on keyguard for the current user.
*/
var bypassEnabled: Boolean = false
get() = field && mKeyguardStateController.isFaceAuthEnabled
get() {
val enabled = when (bypassOverride) {
FACE_UNLOCK_BYPASS_ALWAYS -> true
FACE_UNLOCK_BYPASS_NEVER -> false
else -> field
}
return enabled && mKeyguardStateController.isFaceAuthEnabled
}
private set
var bouncerShowing: Boolean = false
@@ -86,6 +104,8 @@ open class KeyguardBypassController : Dumpable {
this.mKeyguardStateController = keyguardStateController
this.statusBarStateController = statusBarStateController
bypassOverride = context.resources.getInteger(R.integer.config_face_unlock_bypass_override)
hasFaceFeature = context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_FACE)
if (!hasFaceFeature) {
return
@@ -198,5 +218,9 @@ open class KeyguardBypassController : Dumpable {
companion object {
const val BYPASS_PANEL_FADE_DURATION = 67
private const val FACE_UNLOCK_BYPASS_NO_OVERRIDE = 0
private const val FACE_UNLOCK_BYPASS_ALWAYS = 1
private const val FACE_UNLOCK_BYPASS_NEVER = 2
}
}