Merge "Refresh templates when fp removal fails" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
bc726eda18
@@ -23,6 +23,7 @@ import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
|
||||
@@ -51,7 +52,8 @@ public class FingerprintRemoveSidecar extends InstrumentedFragment {
|
||||
}
|
||||
}
|
||||
|
||||
private FingerprintManager.RemovalCallback
|
||||
@VisibleForTesting
|
||||
FingerprintManager.RemovalCallback
|
||||
mRemoveCallback = new FingerprintManager.RemovalCallback() {
|
||||
@Override
|
||||
public void onRemovalSucceeded(Fingerprint fingerprint, int remaining) {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user