指纹图标的显示隐藏
指纹的显示由UdfpsController
控制,
UdfpsOverlayController
通过FingerprintManager
绑定了FingerprintService
final UdfpsOverlayController mUdfpsOverlayController = new UdfpsOverlayController();
mFingerprintManager.setUdfpsOverlayController(mUdfpsOverlayController);
oneway interface IUdfpsOverlayController {
// Shows the overlay for the given sensor with a reason from BiometricOverlayConstants.
void showUdfpsOverlay(long requestId, int sensorId, int reason, IUdfpsOverlayControllerCallback callback);
// Hides the overlay.
void hideUdfpsOverlay(int sensorId);
// Check acquiredInfo for the acquired type (BiometricFingerprintConstants#FingerprintAcquired).
// Check BiometricFingerprintConstants#shouldTurnOffHbm for whether the acquiredInfo
// should turn off HBM.
void onAcquired(int sensorId, int acquiredInfo);
// Notifies of enrollment progress changes.
void onEnrollmentProgress(int sensorId, int remaining);
// Notifies when a non-terminal error occurs (e.g. user moved their finger too fast).
void onEnrollmentHelp(int sensorId);
// Shows debug messages on the UDFPS overlay.
void setDebugMessage(int sensorId, String message);
}
showUdfpsOverlay
显示指纹图标,hideUdfpsOverlay
隐藏指纹图标
调用指纹
通过FingerprintManager
的authenticate
方法可以调用起指纹
fingerprintManagerCompat.authenticate(null, 0 /* flags */, cancellationSignal, callback, null /* handler */);
指纹的授权结果,主要通过AuthenticationCallback
进行回调反馈
public static abstract class AuthenticationCallback {
/**
* Called when an unrecoverable error has been encountered and the operation is complete.
* No further callbacks will be made on this object.
* @param errMsgId An integer identifying the error message
* @param errString A human-readable error string that can be shown in UI
*/
public void onAuthenticationError(int errMsgId, CharSequence errString) { }
/**
* Called when a recoverable error has been encountered during authentication. The help
* string is provided to give the user guidance for what went wrong, such as
* "Sensor dirty, please clean it."
* @param helpMsgId An integer identifying the error message
* @param helpString A human-readable string that can be shown in UI
*/
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) { }
/**
* Called when a fingerprint is recognized.
* @param result An object containing authentication-related data
*/
public void onAuthenticationSucceeded(AuthenticationResult result) { }
/**
* Called when a fingerprint is valid but not recognized.
*/
public void onAuthenticationFailed() { }
}