Settings: Show single-touch wakeup setting on rear & front fps devices
Not sure why Google assumed that showing this setting is only useful
for devices with FP sensor built into a side-mounted power button.
Change logic to preserve check for side mounted (really, power-button
mounted) FP sensors, but allow any device which has a a rear or front
mounted sensor to show the relevant setting; so users can toggle it.
Bug: Enchilada (Oneplus 6, capacitive FP sensor on the back) no longer
wakes & unlocks from screen-off with FP sensor touch after QPR3 merge.
Test: Apply commit. "Touch to unlock anytime" setting is now visible;
enabling once again allows one-touch wakeup-and-unlock-on-successful-
FP-auth, does nothing with failed FP auth, while disabling toggle
requires pressing power button to wake screen first before FP auth
will unlock.
Change-Id: I4d8204b5fed7d43baa93d6793e7280260ae404d6
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
index 700f635..f038915 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettings.java
@@ -248,7 +248,7 @@
}
private void updateDialog() {
- if (isSfps() && mFingerprintWakeAndUnlock) {
+ if (!isUdfps() && mFingerprintWakeAndUnlock) {
setRequireScreenOnToAuthVisibility();
}
RenameDialog renameDialog = (RenameDialog) getFragmentManager().
@@ -524,7 +524,7 @@
return true;
});
mFingerprintUnlockCategory.setVisible(false);
- if (isSfps() && mFingerprintWakeAndUnlock) {
+ if (!isUdfps() && mFingerprintWakeAndUnlock) {
setRequireScreenOnToAuthVisibility();
}
setPreferenceScreen(root);
diff --git a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
index 01e6b82..93056b3 100644
--- a/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
+++ b/src/com/android/settings/biometrics/fingerprint/FingerprintSettingsRequireScreenOnToAuthPreferenceController.java
@@ -18,6 +18,7 @@
import android.content.Context;
import android.hardware.fingerprint.FingerprintManager;
+import android.hardware.fingerprint.FingerprintSensorPropertiesInternal;
import android.os.UserHandle;
import android.provider.Settings;
@@ -26,6 +27,8 @@
import com.android.internal.annotations.VisibleForTesting;
import com.android.settings.Utils;
+import java.util.List;
+
/**
* Preference controller that controls whether a SFPS device is required to be interactive for
* fingerprint authentication to unlock the device.
@@ -37,11 +40,13 @@
@VisibleForTesting
protected FingerprintManager mFingerprintManager;
+ private List<FingerprintSensorPropertiesInternal> mSensorProperties;
public FingerprintSettingsRequireScreenOnToAuthPreferenceController(
Context context, String prefKey) {
super(context, prefKey);
mFingerprintManager = Utils.getFingerprintManagerOrNull(context);
+ mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
}
@Override
@@ -92,7 +97,7 @@
public int getAvailabilityStatus() {
if (mFingerprintManager != null
&& mFingerprintManager.isHardwareDetected()
- && mFingerprintManager.isPowerbuttonFps()) {
+ && !isUdfps()) {
return mFingerprintManager.hasEnrolledTemplates(getUserId())
? AVAILABLE : DISABLED_DEPENDENT_SETTING;
} else {
@@ -104,4 +109,13 @@
return UserHandle.of(getUserId()).getIdentifier();
}
+ private boolean isUdfps() {
+ for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
+ if (prop.isAnyUdfpsType()) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}