Fix fingerprint unlock stuck after renaming
FingerprintAuthenticationClient wasn't cancelled successfully because cancelletion signal was set to null. Test: Manual - rename an existing fingerprint and observe fingerprint unlock can be entered again Test: atest FingerprintSettingsFragmentTest Fixes: 283926104 Change-Id: Id33cc3d3e8052f5cc39eddac26a75047d3139633
This commit is contained in:
@@ -21,6 +21,7 @@ import android.hardware.fingerprint.FingerprintManager;
|
||||
import android.hardware.fingerprint.FingerprintManager.AuthenticationResult;
|
||||
import android.os.CancellationSignal;
|
||||
|
||||
import com.android.internal.annotations.VisibleForTesting;
|
||||
import com.android.settings.core.InstrumentedFragment;
|
||||
|
||||
/**
|
||||
@@ -80,7 +81,6 @@ public class FingerprintAuthenticateSidecar extends InstrumentedFragment {
|
||||
|
||||
@Override
|
||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||
mCancellationSignal = null;
|
||||
if (mListener != null) {
|
||||
mListener.onAuthenticationError(errMsgId, errString);
|
||||
} else {
|
||||
@@ -108,10 +108,12 @@ public class FingerprintAuthenticateSidecar extends InstrumentedFragment {
|
||||
}
|
||||
|
||||
public void stopAuthentication() {
|
||||
if (mCancellationSignal != null && !mCancellationSignal.isCanceled()) {
|
||||
if (mCancellationSignal != null) {
|
||||
// This will automatically check if the cancel has been sent and if so
|
||||
// it won't send it again.
|
||||
mCancellationSignal.cancel();
|
||||
mCancellationSignal = null;
|
||||
}
|
||||
mCancellationSignal = null;
|
||||
}
|
||||
|
||||
public void setListener(Listener listener) {
|
||||
@@ -129,4 +131,9 @@ public class FingerprintAuthenticateSidecar extends InstrumentedFragment {
|
||||
}
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
boolean isCancelled() {
|
||||
return mCancellationSignal == null || mCancellationSignal.isCanceled();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user