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
This commit is contained in:
Terminator-J
2023-06-29 18:23:45 -07:00
committed by Michael Bestas
parent acd39854ce
commit fd16ae4d80
2 changed files with 24 additions and 11 deletions

View File

@@ -217,7 +217,17 @@ public class FingerprintSettings extends SubSettings {
if (manager == null || !manager.isHardwareDetected()) {
return null;
}
if (manager.isPowerbuttonFps() && isScreenOffUnlcokSupported()) {
List<FingerprintSensorPropertiesInternal> sensorProperties =
manager.getSensorPropertiesInternal();
boolean isUdfps = false;
for (FingerprintSensorPropertiesInternal prop : sensorProperties) {
if (prop.isAnyUdfpsType()) {
isUdfps = true;
break;
}
}
if (!isUdfps && context.getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)) {
controllers.add(
new FingerprintUnlockCategoryController(
context,
@@ -658,7 +668,7 @@ public class FingerprintSettings extends SubSettings {
column2.mTitle = getText(
R.string.security_fingerprint_disclaimer_lockscreen_disabled_2
);
if (isSfps() && isScreenOffUnlcokSupported()) {
if (!isUdfps() && isScreenOffUnlcokSupported()) {
column2.mLearnMoreOverrideText = getText(
R.string.security_settings_fingerprint_settings_footer_learn_more);
}
@@ -681,9 +691,13 @@ public class FingerprintSettings extends SubSettings {
}
private boolean isUdfps() {
for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
if (prop.isAnyUdfpsType()) {
return true;
mFingerprintManager = Utils.getFingerprintManagerOrNull(getActivity());
if (mFingerprintManager != null) {
mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
for (FingerprintSensorPropertiesInternal prop : mSensorProperties) {
if (prop.isAnyUdfpsType()) {
return true;
}
}
}
return false;
@@ -755,7 +769,7 @@ public class FingerprintSettings extends SubSettings {
// This needs to be after setting ids, otherwise
// |mRequireScreenOnToAuthPreferenceController.isChecked| is always checking the primary
// user instead of the user with |mUserId|.
if ((isSfps() && isScreenOffUnlcokSupported())
if ((!isUdfps() && isScreenOffUnlcokSupported())
|| (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())
|| getExtPreferenceProvider().getSize() > 0) {
scrollToPreference(fpPrefKey);
@@ -855,7 +869,7 @@ public class FingerprintSettings extends SubSettings {
mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
mFingerprintUnlockCategoryPreferenceController.setCategoryHasChildrenSupplier(
this::fingerprintUnlockCategoryHasChild);
if (isSfps() && isScreenOffUnlcokSupported()) {
if (!isUdfps() && isScreenOffUnlcokSupported()) {
// For both SFPS "screen on to auth" and "rest to unlock"
final Preference restToUnlockPreference = FeatureFactory.getFeatureFactory()
.getFingerprintFeatureProvider()
@@ -985,7 +999,7 @@ public class FingerprintSettings extends SubSettings {
private void updatePreferencesAfterFingerprintRemoved() {
updateAddPreference();
updateUseFingerprintToEnableStatus();
if ((isSfps() && isScreenOffUnlcokSupported()) ||
if ((!isUdfps() && isScreenOffUnlcokSupported()) ||
(screenOffUnlockUdfps() && isScreenOffUnlcokSupported())) {
updateFingerprintUnlockCategoryVisibility();
}
@@ -1253,7 +1267,7 @@ public class FingerprintSettings extends SubSettings {
private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers =
createThePreferenceControllers(context);
if (isSfps() && isScreenOffUnlcokSupported()) {
if (!isUdfps() && isScreenOffUnlcokSupported()) {
for (AbstractPreferenceController controller : controllers) {
if (controller.getPreferenceKey() == KEY_FINGERPRINT_UNLOCK_CATEGORY) {
mFingerprintUnlockCategoryPreferenceController =

View File

@@ -96,8 +96,7 @@ public class FingerprintSettingsRequireScreenOnToAuthPreferenceController
@Override
public int getAvailabilityStatus() {
if (mFingerprintManager != null
&& mFingerprintManager.isHardwareDetected()
&& mFingerprintManager.isPowerbuttonFps()) {
&& mFingerprintManager.isHardwareDetected()) {
return mFingerprintManager.hasEnrolledTemplates(getUserId())
? AVAILABLE : CONDITIONALLY_UNAVAILABLE;
} else {