use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by ResurrectionRemix.
the class AuthenticationClient method onAuthenticated.
@Override
public boolean onAuthenticated(int fingerId, int groupId) {
boolean result = false;
boolean authenticated = fingerId != 0;
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver != null) {
try {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_AUTH, authenticated);
if (!authenticated) {
receiver.onAuthenticationFailed(getHalDeviceId());
} else {
if (DEBUG) {
Slog.v(TAG, "onAuthenticated(owner=" + getOwnerString() + ", id=" + fingerId + ", gp=" + groupId + ")");
}
Fingerprint fp = !getIsRestricted() ? new Fingerprint("", /* TODO */
groupId, fingerId, getHalDeviceId()) : null;
receiver.onAuthenticationSucceeded(getHalDeviceId(), fp, getTargetUserId());
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify Authenticated:", e);
// client failed
result = true;
}
} else {
// client not listening
result = true;
}
if (!authenticated) {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintError(getContext());
}
// allow system-defined limit of number of attempts before giving up
boolean inLockoutMode = handleFailedAttempt();
// send lockout event in case driver doesn't enforce it.
if (inLockoutMode) {
try {
Slog.w(TAG, "Forcing lockout (fp driver code should do this!)");
receiver.onError(getHalDeviceId(), FingerprintManager.FINGERPRINT_ERROR_LOCKOUT);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify lockout:", e);
}
}
result |= inLockoutMode;
} else {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintSuccess(getContext());
}
// we have a valid fingerprint, done
result |= true;
resetFailedAttempts();
}
return result;
}
use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by DirtyUnicorns.
the class EnrollClient method sendEnrollResult.
/*
* @return true if we're done.
*/
private boolean sendEnrollResult(int fpId, int groupId, int remaining) {
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver == null)
// client not listening
return true;
FingerprintUtils.vibrateFingerprintSuccess(getContext());
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_ENROLL);
try {
receiver.onEnrollResult(getHalDeviceId(), fpId, groupId, remaining);
return remaining == 0;
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify EnrollResult:", e);
return true;
}
}
use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by AOSPA.
the class AuthenticationClient method onAuthenticated.
@Override
public boolean onAuthenticated(int fingerId, int groupId) {
boolean result = false;
boolean authenticated = fingerId != 0;
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver != null) {
try {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_AUTH, authenticated);
if (!authenticated) {
receiver.onAuthenticationFailed(getHalDeviceId());
} else {
if (DEBUG) {
Slog.v(TAG, "onAuthenticated(owner=" + getOwnerString() + ", id=" + fingerId + ", gp=" + groupId + ")");
}
Fingerprint fp = !getIsRestricted() ? new Fingerprint("", /* TODO */
groupId, fingerId, getHalDeviceId()) : null;
receiver.onAuthenticationSucceeded(getHalDeviceId(), fp, getTargetUserId());
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify Authenticated:", e);
// client failed
result = true;
}
} else {
// client not listening
result = true;
}
if (!authenticated) {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintError(getContext());
}
// allow system-defined limit of number of attempts before giving up
boolean inLockoutMode = handleFailedAttempt();
// send lockout event in case driver doesn't enforce it.
if (inLockoutMode) {
try {
Slog.w(TAG, "Forcing lockout (fp driver code should do this!)");
receiver.onError(getHalDeviceId(), FingerprintManager.FINGERPRINT_ERROR_LOCKOUT);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify lockout:", e);
}
}
result |= inLockoutMode;
} else {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintSuccess(getContext());
}
// we have a valid fingerprint, done
result |= true;
resetFailedAttempts();
}
return result;
}
use of android.hardware.fingerprint.IFingerprintServiceReceiver in project platform_frameworks_base by android.
the class EnrollClient method sendEnrollResult.
/*
* @return true if we're done.
*/
private boolean sendEnrollResult(int fpId, int groupId, int remaining) {
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver == null)
// client not listening
return true;
FingerprintUtils.vibrateFingerprintSuccess(getContext());
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_ENROLL);
try {
receiver.onEnrollResult(getHalDeviceId(), fpId, groupId, remaining);
return remaining == 0;
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify EnrollResult:", e);
return true;
}
}
use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by DirtyUnicorns.
the class AuthenticationClient method onAuthenticated.
@Override
public boolean onAuthenticated(int fingerId, int groupId) {
boolean result = false;
boolean authenticated = fingerId != 0;
IFingerprintServiceReceiver receiver = getReceiver();
if (receiver != null) {
try {
MetricsLogger.action(getContext(), MetricsEvent.ACTION_FINGERPRINT_AUTH, authenticated);
if (!authenticated) {
receiver.onAuthenticationFailed(getHalDeviceId());
} else {
if (DEBUG) {
Slog.v(TAG, "onAuthenticated(owner=" + getOwnerString() + ", id=" + fingerId + ", gp=" + groupId + ")");
}
Fingerprint fp = !getIsRestricted() ? new Fingerprint("", /* TODO */
groupId, fingerId, getHalDeviceId()) : null;
receiver.onAuthenticationSucceeded(getHalDeviceId(), fp, getTargetUserId());
}
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify Authenticated:", e);
// client failed
result = true;
}
} else {
// client not listening
result = true;
}
if (!authenticated) {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintError(getContext());
}
// allow system-defined limit of number of attempts before giving up
boolean inLockoutMode = handleFailedAttempt();
// send lockout event in case driver doesn't enforce it.
if (inLockoutMode) {
try {
Slog.w(TAG, "Forcing lockout (fp driver code should do this!)");
receiver.onError(getHalDeviceId(), FingerprintManager.FINGERPRINT_ERROR_LOCKOUT);
} catch (RemoteException e) {
Slog.w(TAG, "Failed to notify lockout:", e);
}
}
result |= inLockoutMode;
} else {
if (receiver != null) {
FingerprintUtils.vibrateFingerprintSuccess(getContext());
}
// we have a valid fingerprint, done
result |= true;
resetFailedAttempts();
}
return result;
}
Aggregations