Search in sources :

Example 6 with IFingerprintServiceReceiver

use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by AOSPA.

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;
    }
}
Also used : IFingerprintServiceReceiver(android.hardware.fingerprint.IFingerprintServiceReceiver) RemoteException(android.os.RemoteException)

Example 7 with IFingerprintServiceReceiver

use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by ResurrectionRemix.

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;
    }
}
Also used : IFingerprintServiceReceiver(android.hardware.fingerprint.IFingerprintServiceReceiver) RemoteException(android.os.RemoteException)

Example 8 with IFingerprintServiceReceiver

use of android.hardware.fingerprint.IFingerprintServiceReceiver in project platform_frameworks_base by android.

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;
}
Also used : Fingerprint(android.hardware.fingerprint.Fingerprint) IFingerprintServiceReceiver(android.hardware.fingerprint.IFingerprintServiceReceiver) RemoteException(android.os.RemoteException)

Example 9 with IFingerprintServiceReceiver

use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by crdroidandroid.

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;
}
Also used : Fingerprint(android.hardware.fingerprint.Fingerprint) IFingerprintServiceReceiver(android.hardware.fingerprint.IFingerprintServiceReceiver) RemoteException(android.os.RemoteException)

Example 10 with IFingerprintServiceReceiver

use of android.hardware.fingerprint.IFingerprintServiceReceiver in project android_frameworks_base by crdroidandroid.

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;
    }
}
Also used : IFingerprintServiceReceiver(android.hardware.fingerprint.IFingerprintServiceReceiver) RemoteException(android.os.RemoteException)

Aggregations

IFingerprintServiceReceiver (android.hardware.fingerprint.IFingerprintServiceReceiver)10 RemoteException (android.os.RemoteException)10 Fingerprint (android.hardware.fingerprint.Fingerprint)5