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

View File

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