Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions core/java/android/hardware/face/FaceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,59 @@ public void authenticate(@Nullable CryptoObject crypto, @Nullable CancellationSi
}
}

/**
* Request face authentication enrollment. This call operates the face authentication hardware
* and starts capturing images. Progress will be indicated by callbacks to the
* {@link EnrollmentCallback} object. It terminates when
* {@link EnrollmentCallback#onEnrollmentError(int, CharSequence)} or
* {@link EnrollmentCallback#onEnrollmentProgress(int) is called with remaining == 0, at
* which point the object is no longer valid. The operation can be canceled by using the
* provided cancel object.
*
* @param token a unique token provided by a recent creation or verification of device
* credentials (e.g. pin, pattern or password).
* @param cancel an object that can be used to cancel enrollment
* @param flags optional flags
* @param callback an object to receive enrollment events
* @hide
*/
@RequiresPermission(MANAGE_BIOMETRIC)
public void enroll(byte[] token, CancellationSignal cancel,
EnrollmentCallback callback, int[] disabledFeatures) {
if (callback == null) {
throw new IllegalArgumentException("Must supply an enrollment callback");
}

if (cancel != null) {
if (cancel.isCanceled()) {
Log.w(TAG, "enrollment already canceled");
return;
} else {
cancel.setOnCancelListener(new OnEnrollCancelListener());
}
}

if (mService != null) {
try {
mEnrollmentCallback = callback;
Trace.beginSection("FaceManager#enroll");
mService.enrollMoto(mToken, token, mServiceReceiver,
mContext.getOpPackageName(), disabledFeatures);
} catch (RemoteException e) {
Log.w(TAG, "Remote exception in enroll: ", e);
if (callback != null) {
// Though this may not be a hardware issue, it will cause apps to give up or
// try again later.
callback.onEnrollmentError(FACE_ERROR_HW_UNAVAILABLE,
getErrorString(mContext, FACE_ERROR_HW_UNAVAILABLE,
0 /* vendorCode */));
}
} finally {
Trace.endSection();
}
}
}

/**
* Request face authentication enrollment. This call operates the face authentication hardware
* and starts capturing images. Progress will be indicated by callbacks to the
Expand Down
5 changes: 5 additions & 0 deletions core/java/android/hardware/face/IFaceService.aidl
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,9 @@ interface IFaceService {

// Initialize the OEM configured biometric strength
void initConfiguredStrength(int strength);

// Moto additions
// Start face enrollment
void enrollMoto(IBinder token, in byte [] cryptoToken, IFaceServiceReceiver receiver,
String opPackageName, in int [] disabledFeatures);
}
1 change: 1 addition & 0 deletions services/core/Android.bp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ java_library_static {
"overlayable_policy_aidl-java",
"SurfaceFlingerProperties",
"vendor.lineage.biometrics.fingerprint.inscreen-V1.0-java",
"faceunlock_utils",
],
}

Expand Down
Loading