| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 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 _ACAMERA_MANAGER_H | 
|  | 18 | #define _ACAMERA_MANAGER_H | 
|  | 19 |  | 
| Colin Cross | 7e8d4ba | 2017-05-04 16:17:42 -0700 | [diff] [blame] | 20 | #include <camera/NdkCameraManager.h> | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 21 |  | 
| Yin-Chia Yeh | 03f5575 | 2018-03-14 15:28:02 -0700 | [diff] [blame] | 22 | #include <android-base/parseint.h> | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 23 | #include <android/hardware/ICameraService.h> | 
|  | 24 | #include <android/hardware/BnCameraServiceListener.h> | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 25 | #include <camera/CameraMetadata.h> | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 26 | #include <binder/IServiceManager.h> | 
|  | 27 | #include <utils/StrongPointer.h> | 
|  | 28 | #include <utils/Mutex.h> | 
|  | 29 |  | 
|  | 30 | #include <media/stagefright/foundation/ALooper.h> | 
|  | 31 | #include <media/stagefright/foundation/AHandler.h> | 
|  | 32 | #include <media/stagefright/foundation/AMessage.h> | 
|  | 33 |  | 
|  | 34 | #include <set> | 
|  | 35 | #include <map> | 
|  | 36 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 37 | namespace android { | 
| Jayant Chowdhary | 6df2607 | 2018-11-06 23:55:12 -0800 | [diff] [blame] | 38 | namespace acam { | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 39 |  | 
|  | 40 | /** | 
|  | 41 | * Per-process singleton instance of CameraManger. Shared by all ACameraManager | 
|  | 42 | * instances. Created when first ACameraManager is created and destroyed when | 
|  | 43 | * all ACameraManager instances are deleted. | 
|  | 44 | * | 
| Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 45 | * TODO: maybe CameraManagerGlobal is better suited in libcameraclient? | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 46 | */ | 
|  | 47 | class CameraManagerGlobal final : public RefBase { | 
|  | 48 | public: | 
|  | 49 | static CameraManagerGlobal& getInstance(); | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 50 | sp<hardware::ICameraService> getCameraService(); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 51 |  | 
|  | 52 | void registerAvailabilityCallback( | 
|  | 53 | const ACameraManager_AvailabilityCallbacks *callback); | 
|  | 54 | void unregisterAvailabilityCallback( | 
|  | 55 | const ACameraManager_AvailabilityCallbacks *callback); | 
|  | 56 |  | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 57 | void registerExtendedAvailabilityCallback( | 
|  | 58 | const ACameraManager_ExtendedAvailabilityCallbacks* callback); | 
|  | 59 | void unregisterExtendedAvailabilityCallback( | 
|  | 60 | const ACameraManager_ExtendedAvailabilityCallbacks* callback); | 
|  | 61 |  | 
| Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 62 | /** | 
|  | 63 | * Return camera IDs that support camera2 | 
|  | 64 | */ | 
|  | 65 | void getCameraIdList(std::vector<String8> *cameraIds); | 
|  | 66 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 67 | private: | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 68 | sp<hardware::ICameraService> mCameraService; | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 69 | const int                    kCameraServicePollDelay = 500000; // 0.5s | 
|  | 70 | const char*                  kCameraServiceName      = "media.camera"; | 
|  | 71 | Mutex                        mLock; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 72 |  | 
| Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 73 | template<class T> | 
|  | 74 | void registerAvailCallback(const T *callback); | 
|  | 75 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 76 | class DeathNotifier : public IBinder::DeathRecipient { | 
|  | 77 | public: | 
| Chih-Hung Hsieh | d19d994 | 2016-08-29 14:21:14 -0700 | [diff] [blame] | 78 | explicit DeathNotifier(CameraManagerGlobal* cm) : mCameraManager(cm) {} | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 79 | protected: | 
|  | 80 | // IBinder::DeathRecipient implementation | 
|  | 81 | virtual void binderDied(const wp<IBinder>& who); | 
|  | 82 | private: | 
|  | 83 | const wp<CameraManagerGlobal> mCameraManager; | 
|  | 84 | }; | 
|  | 85 | sp<DeathNotifier> mDeathNotifier; | 
|  | 86 |  | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 87 | class CameraServiceListener final : public hardware::BnCameraServiceListener { | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 88 | public: | 
| Chih-Hung Hsieh | d19d994 | 2016-08-29 14:21:14 -0700 | [diff] [blame] | 89 | explicit CameraServiceListener(CameraManagerGlobal* cm) : mCameraManager(cm) {} | 
| Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 90 | virtual binder::Status onStatusChanged(int32_t status, const String16& cameraId); | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 91 | virtual binder::Status onPhysicalCameraStatusChanged(int32_t status, | 
|  | 92 | const String16& cameraId, const String16& physicalCameraId); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 93 |  | 
|  | 94 | // Torch API not implemented yet | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 95 | virtual binder::Status onTorchStatusChanged(int32_t, const String16&) { | 
|  | 96 | return binder::Status::ok(); | 
|  | 97 | } | 
|  | 98 |  | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 99 | virtual binder::Status onCameraAccessPrioritiesChanged(); | 
| Shuzhen Wang | 695044d | 2020-03-06 09:02:23 -0800 | [diff] [blame] | 100 | virtual binder::Status onCameraOpened(const String16&, const String16&) { | 
|  | 101 | return binder::Status::ok(); | 
|  | 102 | } | 
|  | 103 | virtual binder::Status onCameraClosed(const String16&) { | 
|  | 104 | return binder::Status::ok(); | 
|  | 105 | } | 
| Emilian Peev | 53722fa | 2019-02-22 17:47:20 -0800 | [diff] [blame] | 106 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 107 | private: | 
|  | 108 | const wp<CameraManagerGlobal> mCameraManager; | 
|  | 109 | }; | 
|  | 110 | sp<CameraServiceListener> mCameraServiceListener; | 
|  | 111 |  | 
|  | 112 | // Wrapper of ACameraManager_AvailabilityCallbacks so we can store it in std::set | 
|  | 113 | struct Callback { | 
| Chih-Hung Hsieh | d19d994 | 2016-08-29 14:21:14 -0700 | [diff] [blame] | 114 | explicit Callback(const ACameraManager_AvailabilityCallbacks *callback) : | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 115 | mAvailable(callback->onCameraAvailable), | 
|  | 116 | mUnavailable(callback->onCameraUnavailable), | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 117 | mAccessPriorityChanged(nullptr), | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 118 | mPhysicalCamAvailable(nullptr), | 
|  | 119 | mPhysicalCamUnavailable(nullptr), | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 120 | mContext(callback->context) {} | 
|  | 121 |  | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 122 | explicit Callback(const ACameraManager_ExtendedAvailabilityCallbacks *callback) : | 
|  | 123 | mAvailable(callback->availabilityCallbacks.onCameraAvailable), | 
|  | 124 | mUnavailable(callback->availabilityCallbacks.onCameraUnavailable), | 
|  | 125 | mAccessPriorityChanged(callback->onCameraAccessPrioritiesChanged), | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 126 | mPhysicalCamAvailable(callback->onPhysicalCameraAvailable), | 
|  | 127 | mPhysicalCamUnavailable(callback->onPhysicalCameraUnavailable), | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 128 | mContext(callback->availabilityCallbacks.context) {} | 
|  | 129 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 130 | bool operator == (const Callback& other) const { | 
|  | 131 | return (mAvailable == other.mAvailable && | 
|  | 132 | mUnavailable == other.mUnavailable && | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 133 | mAccessPriorityChanged == other.mAccessPriorityChanged && | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 134 | mPhysicalCamAvailable == other.mPhysicalCamAvailable && | 
|  | 135 | mPhysicalCamUnavailable == other.mPhysicalCamUnavailable && | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 136 | mContext == other.mContext); | 
|  | 137 | } | 
|  | 138 | bool operator != (const Callback& other) const { | 
|  | 139 | return !(*this == other); | 
|  | 140 | } | 
|  | 141 | bool operator < (const Callback& other) const { | 
|  | 142 | if (*this == other) return false; | 
|  | 143 | if (mContext != other.mContext) return mContext < other.mContext; | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 144 | if (mPhysicalCamAvailable != other.mPhysicalCamAvailable) { | 
|  | 145 | return mPhysicalCamAvailable < other.mPhysicalCamAvailable; | 
|  | 146 | } | 
|  | 147 | if (mPhysicalCamUnavailable != other.mPhysicalCamUnavailable) { | 
|  | 148 | return mPhysicalCamUnavailable < other.mPhysicalCamUnavailable; | 
|  | 149 | } | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 150 | if (mAccessPriorityChanged != other.mAccessPriorityChanged) { | 
|  | 151 | return mAccessPriorityChanged < other.mAccessPriorityChanged; | 
|  | 152 | } | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 153 | if (mAvailable != other.mAvailable) return mAvailable < other.mAvailable; | 
|  | 154 | return mUnavailable < other.mUnavailable; | 
|  | 155 | } | 
|  | 156 | bool operator > (const Callback& other) const { | 
|  | 157 | return (*this != other && !(*this < other)); | 
|  | 158 | } | 
|  | 159 | ACameraManager_AvailabilityCallback mAvailable; | 
|  | 160 | ACameraManager_AvailabilityCallback mUnavailable; | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 161 | ACameraManager_AccessPrioritiesChangedCallback mAccessPriorityChanged; | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 162 | ACameraManager_PhysicalCameraAvailabilityCallback mPhysicalCamAvailable; | 
|  | 163 | ACameraManager_PhysicalCameraAvailabilityCallback mPhysicalCamUnavailable; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 164 | void*                               mContext; | 
|  | 165 | }; | 
| Shuzhen Wang | 7e54068 | 2020-04-10 13:30:25 -0700 | [diff] [blame] | 166 |  | 
|  | 167 | android::Condition mCallbacksCond; | 
|  | 168 | size_t mPendingCallbackCnt = 0; | 
|  | 169 | void onCallbackCalled(); | 
|  | 170 | void drainPendingCallbacksLocked(); | 
|  | 171 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 172 | std::set<Callback> mCallbacks; | 
|  | 173 |  | 
|  | 174 | // definition of handler and message | 
|  | 175 | enum { | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 176 | kWhatSendSingleCallback, | 
|  | 177 | kWhatSendSingleAccessCallback, | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 178 | kWhatSendSinglePhysicalCameraCallback, | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 179 | }; | 
|  | 180 | static const char* kCameraIdKey; | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 181 | static const char* kPhysicalCameraIdKey; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 182 | static const char* kCallbackFpKey; | 
|  | 183 | static const char* kContextKey; | 
| Shuzhen Wang | 7e54068 | 2020-04-10 13:30:25 -0700 | [diff] [blame] | 184 | static const nsecs_t kCallbackDrainTimeout; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 185 | class CallbackHandler : public AHandler { | 
|  | 186 | public: | 
| Shuzhen Wang | 7e54068 | 2020-04-10 13:30:25 -0700 | [diff] [blame] | 187 | CallbackHandler(wp<CameraManagerGlobal> parent) : mParent(parent) {} | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 188 | void onMessageReceived(const sp<AMessage> &msg) override; | 
| Shuzhen Wang | 7e54068 | 2020-04-10 13:30:25 -0700 | [diff] [blame] | 189 |  | 
|  | 190 | private: | 
|  | 191 | wp<CameraManagerGlobal> mParent; | 
|  | 192 | void notifyParent(); | 
|  | 193 | void onMessageReceivedInternal(const sp<AMessage> &msg); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 194 | }; | 
|  | 195 | sp<CallbackHandler> mHandler; | 
|  | 196 | sp<ALooper>         mCbLooper; // Looper thread where callbacks actually happen on | 
|  | 197 |  | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 198 | sp<hardware::ICameraService> getCameraServiceLocked(); | 
| Emilian Peev | c6f2ab3 | 2019-03-04 11:18:59 -0800 | [diff] [blame] | 199 | void onCameraAccessPrioritiesChanged(); | 
| Eino-Ville Talvala | f51fca2 | 2016-12-13 11:25:55 -0800 | [diff] [blame] | 200 | void onStatusChanged(int32_t status, const String8& cameraId); | 
|  | 201 | void onStatusChangedLocked(int32_t status, const String8& cameraId); | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 202 | void onStatusChanged(int32_t status, const String8& cameraId, const String8& physicalCameraId); | 
|  | 203 | void onStatusChangedLocked(int32_t status, const String8& cameraId, | 
|  | 204 | const String8& physicalCameraId); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 205 | // Utils for status | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 206 | static bool validStatus(int32_t status); | 
|  | 207 | static bool isStatusAvailable(int32_t status); | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 208 | bool supportsCamera2ApiLocked(const String8 &cameraId); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 209 |  | 
| Yin-Chia Yeh | 03f5575 | 2018-03-14 15:28:02 -0700 | [diff] [blame] | 210 | // The sort logic must match the logic in | 
|  | 211 | // libcameraservice/common/CameraProviderManager.cpp::getAPI1CompatibleCameraDeviceIds | 
|  | 212 | struct CameraIdComparator { | 
|  | 213 | bool operator()(const String8& a, const String8& b) const { | 
|  | 214 | uint32_t aUint = 0, bUint = 0; | 
|  | 215 | bool aIsUint = base::ParseUint(a.c_str(), &aUint); | 
|  | 216 | bool bIsUint = base::ParseUint(b.c_str(), &bUint); | 
|  | 217 |  | 
|  | 218 | // Uint device IDs first | 
|  | 219 | if (aIsUint && bIsUint) { | 
|  | 220 | return aUint < bUint; | 
|  | 221 | } else if (aIsUint) { | 
|  | 222 | return true; | 
|  | 223 | } else if (bIsUint) { | 
|  | 224 | return false; | 
|  | 225 | } | 
|  | 226 | // Simple string compare if both id are not uint | 
|  | 227 | return a < b; | 
|  | 228 | } | 
|  | 229 | }; | 
|  | 230 |  | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 231 | struct StatusAndHAL3Support { | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 232 | private: | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 233 | int32_t status = hardware::ICameraServiceListener::STATUS_NOT_PRESENT; | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 234 | mutable std::mutex mLock; | 
|  | 235 | std::set<String8> unavailablePhysicalIds; | 
|  | 236 | public: | 
|  | 237 | const bool supportsHAL3 = false; | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 238 | StatusAndHAL3Support(int32_t st, bool HAL3support): | 
|  | 239 | status(st), supportsHAL3(HAL3support) { }; | 
|  | 240 | StatusAndHAL3Support() = default; | 
| Shuzhen Wang | 4385816 | 2020-01-10 13:42:15 -0800 | [diff] [blame] | 241 |  | 
|  | 242 | bool addUnavailablePhysicalId(const String8& physicalCameraId); | 
|  | 243 | bool removeUnavailablePhysicalId(const String8& physicalCameraId); | 
|  | 244 | int32_t getStatus(); | 
|  | 245 | void updateStatus(int32_t newStatus); | 
| Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 246 | std::set<String8> getUnavailablePhysicalIds(); | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 247 | }; | 
|  | 248 |  | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 249 | // Map camera_id -> status | 
| Jayant Chowdhary | 80f128b | 2019-10-30 16:13:31 -0700 | [diff] [blame] | 250 | std::map<String8, StatusAndHAL3Support, CameraIdComparator> mDeviceStatusMap; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 251 |  | 
|  | 252 | // For the singleton instance | 
|  | 253 | static Mutex sLock; | 
|  | 254 | static CameraManagerGlobal* sInstance; | 
|  | 255 | CameraManagerGlobal() {}; | 
|  | 256 | ~CameraManagerGlobal(); | 
|  | 257 | }; | 
|  | 258 |  | 
| Jayant Chowdhary | 6df2607 | 2018-11-06 23:55:12 -0800 | [diff] [blame] | 259 | } // namespace acam; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 260 | } // namespace android; | 
|  | 261 |  | 
|  | 262 | /** | 
|  | 263 | * ACameraManager opaque struct definition | 
|  | 264 | * Leave outside of android namespace because it's NDK struct | 
|  | 265 | */ | 
|  | 266 | struct ACameraManager { | 
|  | 267 | ACameraManager() : | 
| Jayant Chowdhary | 6df2607 | 2018-11-06 23:55:12 -0800 | [diff] [blame] | 268 | mGlobalManager(&(android::acam::CameraManagerGlobal::getInstance())) {} | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 269 | ~ACameraManager(); | 
|  | 270 | camera_status_t getCameraIdList(ACameraIdList** cameraIdList); | 
|  | 271 | static void     deleteCameraIdList(ACameraIdList* cameraIdList); | 
|  | 272 |  | 
|  | 273 | camera_status_t getCameraCharacteristics( | 
| Yin-Chia Yeh | dd045bf | 2018-08-20 12:39:19 -0700 | [diff] [blame] | 274 | const char* cameraId, android::sp<ACameraMetadata>* characteristics); | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 275 | camera_status_t openCamera(const char* cameraId, | 
|  | 276 | ACameraDevice_StateCallbacks* callback, | 
|  | 277 | /*out*/ACameraDevice** device); | 
|  | 278 |  | 
|  | 279 | private: | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 280 | enum { | 
|  | 281 | kCameraIdListNotInit = -1 | 
|  | 282 | }; | 
| Eino-Ville Talvala | d56db1d | 2015-12-17 16:50:35 -0800 | [diff] [blame] | 283 | android::Mutex         mLock; | 
| Jayant Chowdhary | 6df2607 | 2018-11-06 23:55:12 -0800 | [diff] [blame] | 284 | android::sp<android::acam::CameraManagerGlobal> mGlobalManager; | 
| Yin-Chia Yeh | 0dea57f | 2015-12-09 16:46:07 -0800 | [diff] [blame] | 285 | }; | 
|  | 286 |  | 
|  | 287 | #endif //_ACAMERA_MANAGER_H |