Hide SFPS wakeup setting when it's not supported

Change-Id: I22d4eb745379a6ca56b8fe23e1584131c4e945a6
This commit is contained in:
Michael Bestas
2023-03-20 02:40:07 +02:00
parent 1062719df9
commit acd39854ce
2 changed files with 15 additions and 8 deletions

View File

@@ -217,7 +217,7 @@ public class FingerprintSettings extends SubSettings {
if (manager == null || !manager.isHardwareDetected()) {
return null;
}
if (manager.isPowerbuttonFps()) {
if (manager.isPowerbuttonFps() && isScreenOffUnlcokSupported()) {
controllers.add(
new FingerprintUnlockCategoryController(
context,
@@ -658,7 +658,7 @@ public class FingerprintSettings extends SubSettings {
column2.mTitle = getText(
R.string.security_fingerprint_disclaimer_lockscreen_disabled_2
);
if (isSfps()) {
if (isSfps() && isScreenOffUnlcokSupported()) {
column2.mLearnMoreOverrideText = getText(
R.string.security_settings_fingerprint_settings_footer_learn_more);
}
@@ -706,6 +706,9 @@ public class FingerprintSettings extends SubSettings {
if (isUdfps()) {
return getContext().getResources().getBoolean(
com.android.internal.R.bool.config_screen_off_udfps_enabled);
} else if (isSfps()) {
return getContext().getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock);
}
return false;
}
@@ -752,7 +755,8 @@ 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() || (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())
if ((isSfps() && isScreenOffUnlcokSupported())
|| (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())
|| getExtPreferenceProvider().getSize() > 0) {
scrollToPreference(fpPrefKey);
addFingerprintUnlockCategory();
@@ -851,7 +855,7 @@ public class FingerprintSettings extends SubSettings {
mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
mFingerprintUnlockCategoryPreferenceController.setCategoryHasChildrenSupplier(
this::fingerprintUnlockCategoryHasChild);
if (isSfps()) {
if (isSfps() && isScreenOffUnlcokSupported()) {
// For both SFPS "screen on to auth" and "rest to unlock"
final Preference restToUnlockPreference = FeatureFactory.getFeatureFactory()
.getFingerprintFeatureProvider()
@@ -872,8 +876,10 @@ public class FingerprintSettings extends SubSettings {
setupFingerprintUnlockCategoryPreferencesForScreenOffUnlock();
}
setupExtFingerprintPreferences();
if (mFingerprintUnlockCategoryPreferenceController != null) {
updateFingerprintUnlockCategoryVisibility();
}
}
private void updateFingerprintUnlockCategoryVisibility() {
final int categoryStatus =
@@ -979,7 +985,8 @@ public class FingerprintSettings extends SubSettings {
private void updatePreferencesAfterFingerprintRemoved() {
updateAddPreference();
updateUseFingerprintToEnableStatus();
if (isSfps() || (screenOffUnlockUdfps() && isScreenOffUnlcokSupported())) {
if ((isSfps() && isScreenOffUnlcokSupported()) ||
(screenOffUnlockUdfps() && isScreenOffUnlcokSupported())) {
updateFingerprintUnlockCategoryVisibility();
}
updatePreferences();
@@ -1246,7 +1253,7 @@ public class FingerprintSettings extends SubSettings {
private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers =
createThePreferenceControllers(context);
if (isSfps()) {
if (isSfps() && isScreenOffUnlcokSupported()) {
for (AbstractPreferenceController controller : controllers) {
if (controller.getPreferenceKey() == KEY_FINGERPRINT_UNLOCK_CATEGORY) {
mFingerprintUnlockCategoryPreferenceController =

View File

@@ -61,7 +61,7 @@ public class FingerprintSettingsRequireScreenOnToAuthPreferenceController
getUserHandle());
if (toReturn == -1) {
toReturn = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_performantAuthDefault) ? 1 : 0;
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock) ? 1 : 0;
Settings.Secure.putIntForUser(mContext.getContentResolver(),
Settings.Secure.SFPS_PERFORMANT_AUTH_ENABLED, toReturn, getUserHandle());
}