1/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.hardware.fingerprint;
17
18import android.os.Bundle;
19import android.hardware.fingerprint.IFingerprintServiceReceiver;
20import android.hardware.fingerprint.IFingerprintServiceLockoutResetCallback;
21import android.hardware.fingerprint.Fingerprint;
22import java.util.List;
23
24/**
25 * Communication channel from client to the fingerprint service.
26 * @hide
27 */
28interface IFingerprintService {
29    // Authenticate the given sessionId with a fingerprint
30    void authenticate(IBinder token, long sessionId, int userId,
31            IFingerprintServiceReceiver receiver, int flags, String opPackageName);
32
33    // Cancel authentication for the given sessionId
34    void cancelAuthentication(IBinder token, String opPackageName);
35
36    // Start fingerprint enrollment
37    void enroll(IBinder token, in byte [] cryptoToken, int groupId, IFingerprintServiceReceiver receiver,
38            int flags);
39
40    // Cancel enrollment in progress
41    void cancelEnrollment(IBinder token);
42
43    // Any errors resulting from this call will be returned to the listener
44    void remove(IBinder token, int fingerId, int groupId, IFingerprintServiceReceiver receiver);
45
46    // Rename the fingerprint specified by fingerId and groupId to the given name
47    void rename(int fingerId, int groupId, String name);
48
49    // Get a list of enrolled fingerprints in the given group.
50    List<Fingerprint> getEnrolledFingerprints(int groupId, String opPackageName);
51
52    // Determine if HAL is loaded and ready
53    boolean isHardwareDetected(long deviceId, String opPackageName);
54
55    // Get a pre-enrollment authentication token
56    long preEnroll(IBinder token);
57
58    // Finish an enrollment sequence and invalidate the authentication token
59    int postEnroll(IBinder token);
60
61    // Determine if a user has at least one enrolled fingerprint
62    boolean hasEnrolledFingerprints(int groupId, String opPackageName);
63
64    // Gets the number of hardware devices
65    // int getHardwareDeviceCount();
66
67    // Gets the unique device id for hardware enumerated at i
68    // long getHardwareDevice(int i);
69
70    // Gets the authenticator ID for fingerprint
71    long getAuthenticatorId(String opPackageName);
72
73    // Reset the timeout when user authenticates with strong auth (e.g. PIN, pattern or password)
74    void resetTimeout(in byte [] cryptoToken);
75
76    // Add a callback which gets notified when the fingerprint lockout period expired.
77    void addLockoutResetCallback(IFingerprintServiceLockoutResetCallback callback);
78}
79