blob: fe3f64b93b4ec7d1944ecb4cadd9e8a6832d604b [file] [log] [blame]
Jim Millera34dc462015-05-07 18:52:53 -07001/*
2 * Copyright (C) 2015 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 */
16
17#ifndef IFINGERPRINT_DAEMON_H_
18#define IFINGERPRINT_DAEMON_H_
19
20#include <binder/IInterface.h>
21#include <binder/Parcel.h>
22
23namespace android {
24
25class IFingerprintDaemonCallback;
26
27/*
28* Abstract base class for native implementation of FingerprintService.
29*
30* Note: This must be kept manually in sync with IFingerprintDaemon.aidl
31*/
32class IFingerprintDaemon : public IInterface, public IBinder::DeathRecipient {
33 public:
34 enum {
35 AUTHENTICATE = IBinder::FIRST_CALL_TRANSACTION + 0,
36 CANCEL_AUTHENTICATION = IBinder::FIRST_CALL_TRANSACTION + 1,
37 ENROLL = IBinder::FIRST_CALL_TRANSACTION + 2,
38 CANCEL_ENROLLMENT = IBinder::FIRST_CALL_TRANSACTION + 3,
39 PRE_ENROLL = IBinder::FIRST_CALL_TRANSACTION + 4,
40 REMOVE = IBinder::FIRST_CALL_TRANSACTION + 5,
41 GET_AUTHENTICATOR_ID = IBinder::FIRST_CALL_TRANSACTION + 6,
42 SET_ACTIVE_GROUP = IBinder::FIRST_CALL_TRANSACTION + 7,
43 OPEN_HAL = IBinder::FIRST_CALL_TRANSACTION + 8,
44 CLOSE_HAL = IBinder::FIRST_CALL_TRANSACTION + 9,
45 INIT = IBinder::FIRST_CALL_TRANSACTION + 10,
46 };
47
48 IFingerprintDaemon() { }
49 virtual ~IFingerprintDaemon() { }
50 virtual const android::String16& getInterfaceDescriptor() const;
51
52 // Binder interface methods
53 virtual void init(const sp<IFingerprintDaemonCallback>& callback) = 0;
54 virtual int32_t enroll(const uint8_t* token, ssize_t tokenLength, int32_t groupId,
55 int32_t timeout) = 0;
56 virtual uint64_t preEnroll() = 0;
57 virtual int32_t stopEnrollment() = 0;
58 virtual int32_t authenticate(uint64_t sessionId, uint32_t groupId) = 0;
59 virtual int32_t stopAuthentication() = 0;
60 virtual int32_t remove(int32_t fingerId, int32_t groupId) = 0;
61 virtual uint64_t getAuthenticatorId() = 0;
62 virtual int32_t setActiveGroup(int32_t groupId, const uint8_t* path, ssize_t pathLen) = 0;
63 virtual int64_t openHal() = 0;
64 virtual int32_t closeHal() = 0;
65
66 // DECLARE_META_INTERFACE - C++ client interface not needed
67 static const android::String16 descriptor;
68 static void hal_notify_callback(fingerprint_msg_t msg);
69};
70
71// ----------------------------------------------------------------------------
72
73class BnFingerprintDaemon: public BnInterface<IFingerprintDaemon> {
74 public:
75 virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
76 uint32_t flags = 0);
77 private:
78 bool checkPermission(const String16& permission);
79};
80
81} // namespace android
82
83#endif // IFINGERPRINT_DAEMON_H_
84