Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 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 ANDROID_HARDWARE_ICAMERASERVICE_H |
| 18 | #define ANDROID_HARDWARE_ICAMERASERVICE_H |
| 19 | |
| 20 | #include <utils/RefBase.h> |
| 21 | #include <binder/IInterface.h> |
| 22 | #include <binder/Parcel.h> |
| 23 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 24 | namespace android { |
| 25 | |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 26 | class ICamera; |
| 27 | class ICameraClient; |
| 28 | class IProCameraUser; |
| 29 | class IProCameraCallbacks; |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 30 | class ICameraServiceListener; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 31 | class ICameraDeviceUser; |
| 32 | class ICameraDeviceCallbacks; |
Zhijun He | 2b59be8 | 2013-09-25 10:14:30 -0700 | [diff] [blame] | 33 | class CameraMetadata; |
Ruben Brunk | d1176ef | 2014-02-21 10:51:38 -0800 | [diff] [blame^] | 34 | class VendorTagDescriptor; |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 35 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 36 | class ICameraService : public IInterface |
| 37 | { |
| 38 | public: |
Igor Murashkin | bef3f23 | 2013-05-30 17:47:38 -0700 | [diff] [blame] | 39 | /** |
| 40 | * Keep up-to-date with ICameraService.aidl in frameworks/base |
| 41 | */ |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 42 | enum { |
Chih-Chung Chang | 35a055b | 2010-05-06 16:36:58 +0800 | [diff] [blame] | 43 | GET_NUMBER_OF_CAMERAS = IBinder::FIRST_CALL_TRANSACTION, |
Chih-Chung Chang | ddbdb35 | 2010-06-10 13:32:16 +0800 | [diff] [blame] | 44 | GET_CAMERA_INFO, |
Igor Murashkin | 634a515 | 2013-02-20 17:15:11 -0800 | [diff] [blame] | 45 | CONNECT, |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 46 | CONNECT_PRO, |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 47 | CONNECT_DEVICE, |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 48 | ADD_LISTENER, |
| 49 | REMOVE_LISTENER, |
Zhijun He | 2b59be8 | 2013-09-25 10:14:30 -0700 | [diff] [blame] | 50 | GET_CAMERA_CHARACTERISTICS, |
Ruben Brunk | d1176ef | 2014-02-21 10:51:38 -0800 | [diff] [blame^] | 51 | GET_CAMERA_VENDOR_TAG_DESCRIPTOR, |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 52 | }; |
| 53 | |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 54 | enum { |
| 55 | USE_CALLING_UID = -1 |
| 56 | }; |
| 57 | |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 58 | public: |
| 59 | DECLARE_META_INTERFACE(CameraService); |
| 60 | |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 61 | virtual int32_t getNumberOfCameras() = 0; |
| 62 | virtual status_t getCameraInfo(int cameraId, |
Chih-Chung Chang | ddbdb35 | 2010-06-10 13:32:16 +0800 | [diff] [blame] | 63 | struct CameraInfo* cameraInfo) = 0; |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 64 | |
Zhijun He | 2b59be8 | 2013-09-25 10:14:30 -0700 | [diff] [blame] | 65 | virtual status_t getCameraCharacteristics(int cameraId, |
| 66 | CameraMetadata* cameraInfo) = 0; |
| 67 | |
Ruben Brunk | d1176ef | 2014-02-21 10:51:38 -0800 | [diff] [blame^] | 68 | virtual status_t getCameraVendorTagDescriptor(sp<VendorTagDescriptor>& desc) = 0; |
| 69 | |
Igor Murashkin | bfc9915 | 2013-02-27 12:55:20 -0800 | [diff] [blame] | 70 | // Returns 'OK' if operation succeeded |
| 71 | // - Errors: ALREADY_EXISTS if the listener was already added |
| 72 | virtual status_t addListener(const sp<ICameraServiceListener>& listener) |
| 73 | = 0; |
| 74 | // Returns 'OK' if operation succeeded |
| 75 | // - Errors: BAD_VALUE if specified listener was not in the listener list |
| 76 | virtual status_t removeListener(const sp<ICameraServiceListener>& listener) |
| 77 | = 0; |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 78 | /** |
| 79 | * clientPackageName and clientUid are used for permissions checking. if |
| 80 | * clientUid == USE_CALLING_UID, then the calling UID is used instead. Only |
| 81 | * trusted callers can set a clientUid other than USE_CALLING_UID. |
| 82 | */ |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 83 | virtual status_t connect(const sp<ICameraClient>& cameraClient, |
Eino-Ville Talvala | ceb388d | 2013-02-19 10:40:14 -0800 | [diff] [blame] | 84 | int cameraId, |
| 85 | const String16& clientPackageName, |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 86 | int clientUid, |
| 87 | /*out*/ |
| 88 | sp<ICamera>& device) = 0; |
Igor Murashkin | 634a515 | 2013-02-20 17:15:11 -0800 | [diff] [blame] | 89 | |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 90 | virtual status_t connectPro(const sp<IProCameraCallbacks>& cameraCb, |
Igor Murashkin | c073ba5 | 2013-02-26 14:32:34 -0800 | [diff] [blame] | 91 | int cameraId, |
| 92 | const String16& clientPackageName, |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 93 | int clientUid, |
| 94 | /*out*/ |
| 95 | sp<IProCameraUser>& device) = 0; |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 96 | |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 97 | virtual status_t connectDevice( |
Igor Murashkin | e7ee763 | 2013-06-11 18:10:18 -0700 | [diff] [blame] | 98 | const sp<ICameraDeviceCallbacks>& cameraCb, |
| 99 | int cameraId, |
| 100 | const String16& clientPackageName, |
Ruben Brunk | 0f61d8f | 2013-08-08 13:07:18 -0700 | [diff] [blame] | 101 | int clientUid, |
| 102 | /*out*/ |
| 103 | sp<ICameraDeviceUser>& device) = 0; |
Mathias Agopian | 3cf6135 | 2010-02-09 17:46:37 -0800 | [diff] [blame] | 104 | }; |
| 105 | |
| 106 | // ---------------------------------------------------------------------------- |
| 107 | |
| 108 | class BnCameraService: public BnInterface<ICameraService> |
| 109 | { |
| 110 | public: |
| 111 | virtual status_t onTransact( uint32_t code, |
| 112 | const Parcel& data, |
| 113 | Parcel* reply, |
| 114 | uint32_t flags = 0); |
| 115 | }; |
| 116 | |
| 117 | }; // namespace android |
| 118 | |
| 119 | #endif |