Refresh templates when fp removal fails

Test: atest
Fixes: 339556796
Flag: EXEMPT bugfix
Change-Id: I369e37f170a57bc9ced98f9728d06f2072c01263
This commit is contained in:
Joshua McCloskey
2024-07-16 20:36:29 +00:00
committed by Joshua Mccloskey
parent 2004df98f1
commit f624d6adf7
3 changed files with 64 additions and 12 deletions

View File

@@ -226,6 +226,7 @@ public class FingerprintSettings extends SubSettings {
private static final int MSG_FINGER_AUTH_FAIL = 1002;
private static final int MSG_FINGER_AUTH_ERROR = 1003;
private static final int MSG_FINGER_AUTH_HELP = 1004;
private static final int MSG_RELOAD_FINGERPRINT_TEMPLATES = 1005;
private static final int CONFIRM_REQUEST = 101;
@VisibleForTesting
@@ -313,6 +314,8 @@ public class FingerprintSettings extends SubSettings {
if (activity != null) {
Toast.makeText(activity, errString, Toast.LENGTH_SHORT);
}
mHandler.obtainMessage(MSG_RELOAD_FINGERPRINT_TEMPLATES)
.sendToTarget();
updateDialog();
}
@@ -331,11 +334,7 @@ public class FingerprintSettings extends SubSettings {
switch (msg.what) {
case MSG_REFRESH_FINGERPRINT_TEMPLATES:
removeFingerprintPreference(msg.arg1);
updateAddPreference();
if (isSfps()) {
updateFingerprintUnlockCategoryVisibility();
}
updatePreferences();
updatePreferencesAfterFingerprintRemoved();
break;
case MSG_FINGER_AUTH_SUCCESS:
highlightFingerprintItem(msg.arg1);
@@ -347,6 +346,9 @@ public class FingerprintSettings extends SubSettings {
case MSG_FINGER_AUTH_ERROR:
handleError(msg.arg1 /* errMsgId */, (CharSequence) msg.obj /* errStr */);
break;
case MSG_RELOAD_FINGERPRINT_TEMPLATES:
updatePreferencesAfterFingerprintRemoved();
break;
case MSG_FINGER_AUTH_HELP: {
// Not used
}
@@ -568,6 +570,7 @@ public class FingerprintSettings extends SubSettings {
protected void removeFingerprintPreference(int fingerprintId) {
String name = genKey(fingerprintId);
Log.e(TAG, "removeFingerprintPreference : " + fingerprintId);
Preference prefToRemove = findPreference(name);
if (prefToRemove != null) {
if (!getPreferenceScreen().removePreference(prefToRemove)) {
@@ -692,6 +695,13 @@ public class FingerprintSettings extends SubSettings {
});
}
private void updatePreferencesAfterFingerprintRemoved() {
updateAddPreference();
if (isSfps()) {
updateFingerprintUnlockCategoryVisibility();
}
}
private void updateAddPreference() {
if (getActivity() == null) {
return; // Activity went away