IFingerprintDaemon.h revision 7ded5799a95cd463390141d04726d1ad13dd9cff
1/*
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           POST_ENROLL = IBinder::FIRST_CALL_TRANSACTION + 11,
47        };
48
49        IFingerprintDaemon() { }
50        virtual ~IFingerprintDaemon() { }
51        virtual const android::String16& getInterfaceDescriptor() const;
52
53        // Binder interface methods
54        virtual void init(const sp<IFingerprintDaemonCallback>& callback) = 0;
55        virtual int32_t enroll(const uint8_t* token, ssize_t tokenLength, int32_t groupId,
56                int32_t timeout) = 0;
57        virtual uint64_t preEnroll() = 0;
58        virtual int32_t postEnroll() = 0;
59        virtual int32_t stopEnrollment() = 0;
60        virtual int32_t authenticate(uint64_t sessionId, uint32_t groupId) = 0;
61        virtual int32_t stopAuthentication() = 0;
62        virtual int32_t remove(int32_t fingerId, int32_t groupId) = 0;
63        virtual uint64_t getAuthenticatorId() = 0;
64        virtual int32_t setActiveGroup(int32_t groupId, const uint8_t* path, ssize_t pathLen) = 0;
65        virtual int64_t openHal() = 0;
66        virtual int32_t closeHal() = 0;
67
68        // DECLARE_META_INTERFACE - C++ client interface not needed
69        static const android::String16 descriptor;
70        static void hal_notify_callback(const fingerprint_msg_t *msg);
71};
72
73// ----------------------------------------------------------------------------
74
75class BnFingerprintDaemon: public BnInterface<IFingerprintDaemon> {
76    public:
77       virtual status_t onTransact(uint32_t code, const Parcel& data, Parcel* reply,
78               uint32_t flags = 0);
79    private:
80       bool checkPermission(const String16& permission);
81};
82
83} // namespace android
84
85#endif // IFINGERPRINT_DAEMON_H_
86
87