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 881c801e64
commit c56b21910b
No known key found for this signature in database
2 changed files with 17 additions and 8 deletions

View file

@ -175,7 +175,8 @@ public class FingerprintSettings extends SubSettings {
if (manager == null || !manager.isHardwareDetected()) {
return null;
}
if (manager.isPowerbuttonFps()) {
if (manager.isPowerbuttonFps() && context.getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)) {
controllers.add(
new FingerprintUnlockCategoryController(
context,
@ -244,6 +245,7 @@ public class FingerprintSettings extends SubSettings {
private PreferenceCategory mFingerprintsEnrolledCategory;
private PreferenceCategory mFingerprintUnlockCategory;
private PreferenceCategory mFingerprintUnlockFooter;
private boolean mFingerprintWakeAndUnlock;
private FingerprintManager mFingerprintManager;
private FingerprintUpdater mFingerprintUpdater;
@ -328,7 +330,7 @@ public class FingerprintSettings extends SubSettings {
case MSG_REFRESH_FINGERPRINT_TEMPLATES:
removeFingerprintPreference(msg.arg1);
updateAddPreference();
if (isSfps()) {
if (isSfps() && mFingerprintWakeAndUnlock) {
updateFingerprintUnlockCategoryVisibility();
}
updatePreferences();
@ -418,6 +420,8 @@ public class FingerprintSettings extends SubSettings {
mFingerprintManager = Utils.getFingerprintManagerOrNull(activity);
mFingerprintUpdater = new FingerprintUpdater(activity, mFingerprintManager);
mSensorProperties = mFingerprintManager.getSensorPropertiesInternal();
mFingerprintWakeAndUnlock = getContext().getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock);
mToken = getIntent().getByteArrayExtra(
ChooseLockSettingsHelper.EXTRA_KEY_CHALLENGE_TOKEN);
@ -519,7 +523,7 @@ public class FingerprintSettings extends SubSettings {
R.string.security_fingerprint_disclaimer_lockscreen_disabled_2
);
if (helpIntent != null) {
if (isSfps()) {
if (isSfps() && mFingerprintWakeAndUnlock) {
column2.mLearnMoreOverrideText = getText(
R.string.security_settings_fingerprint_settings_footer_learn_more);
}
@ -601,7 +605,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()) {
if (isSfps() && mFingerprintWakeAndUnlock) {
scrollToPreference(fpPrefKey);
addFingerprintUnlockCategory();
}
@ -651,7 +655,9 @@ public class FingerprintSettings extends SubSettings {
private void addFingerprintUnlockCategory() {
mFingerprintUnlockCategory = findPreference(KEY_FINGERPRINT_UNLOCK_CATEGORY);
setupFingerprintUnlockCategoryPreferences();
if (mRequireScreenOnToAuthPreferenceController != null) {
setupFingerprintUnlockCategoryPreferences();
}
final Preference restToUnlockPreference = FeatureFactory.getFeatureFactory()
.getFingerprintFeatureProvider()
.getSfpsRestToUnlockFeature(getContext())
@ -665,7 +671,9 @@ public class FingerprintSettings extends SubSettings {
mRequireScreenOnToAuthPreference.setOnPreferenceChangeListener(
restToUnlockPreference.getOnPreferenceChangeListener());
}
updateFingerprintUnlockCategoryVisibility();
if (mFingerprintUnlockCategoryPreferenceController != null) {
updateFingerprintUnlockCategoryVisibility();
}
}
private void updateFingerprintUnlockCategoryVisibility() {
@ -920,7 +928,8 @@ public class FingerprintSettings extends SubSettings {
private List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers =
createThePreferenceControllers(context);
if (isSfps()) {
if (isSfps() && context.getResources().getBoolean(
org.lineageos.platform.internal.R.bool.config_fingerprintWakeAndUnlock)) {
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());
}