Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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_SERVERS_CAMERA_CAMERAPROVIDER_H |
| 18 | #define ANDROID_SERVERS_CAMERA_CAMERAPROVIDER_H |
| 19 | |
| 20 | #include <vector> |
Yin-Chia Yeh | dc3134e | 2017-03-23 15:26:59 -0700 | [diff] [blame] | 21 | #include <set> |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 22 | #include <string> |
| 23 | #include <mutex> |
| 24 | |
| 25 | #include <camera/CameraParameters2.h> |
| 26 | #include <camera/CameraMetadata.h> |
| 27 | #include <camera/CameraBase.h> |
| 28 | #include <utils/Errors.h> |
| 29 | #include <android/hardware/camera/common/1.0/types.h> |
| 30 | #include <android/hardware/camera/provider/2.4/ICameraProvider.h> |
| 31 | //#include <android/hardware/camera/provider/2.4/ICameraProviderCallbacks.h> |
| 32 | #include <android/hidl/manager/1.0/IServiceNotification.h> |
Yin-Chia Yeh | 067428c | 2017-01-13 15:19:24 -0800 | [diff] [blame] | 33 | #include <camera/VendorTagDescriptor.h> |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 34 | |
| 35 | namespace android { |
| 36 | |
| 37 | /** |
Yin-Chia Yeh | 067428c | 2017-01-13 15:19:24 -0800 | [diff] [blame] | 38 | * The vendor tag descriptor class that takes HIDL vendor tag information as |
| 39 | * input. Not part of VendorTagDescriptor class because that class is used |
| 40 | * in AIDL generated sources which don't have access to HIDL headers. |
| 41 | */ |
| 42 | class HidlVendorTagDescriptor : public VendorTagDescriptor { |
| 43 | public: |
| 44 | /** |
| 45 | * Create a VendorTagDescriptor object from the HIDL VendorTagSection |
| 46 | * vector. |
| 47 | * |
| 48 | * Returns OK on success, or a negative error code. |
| 49 | */ |
| 50 | static status_t createDescriptorFromHidl( |
| 51 | const hardware::hidl_vec<hardware::camera::common::V1_0::VendorTagSection>& vts, |
| 52 | /*out*/ |
| 53 | sp<VendorTagDescriptor>& descriptor); |
| 54 | }; |
| 55 | |
| 56 | /** |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 57 | * A manager for all camera providers available on an Android device. |
| 58 | * |
| 59 | * Responsible for enumerating providers and the individual camera devices |
| 60 | * they export, both at startup and as providers and devices are added/removed. |
| 61 | * |
| 62 | * Provides methods for requesting information about individual devices and for |
| 63 | * opening them for active use. |
| 64 | * |
| 65 | */ |
| 66 | class CameraProviderManager : virtual public hidl::manager::V1_0::IServiceNotification { |
| 67 | public: |
| 68 | |
| 69 | ~CameraProviderManager(); |
| 70 | |
| 71 | // Tiny proxy for the static methods in a HIDL interface that communicate with the hardware |
| 72 | // service manager, to be replacable in unit tests with a fake. |
| 73 | struct ServiceInteractionProxy { |
| 74 | virtual bool registerForNotifications( |
| 75 | const std::string &serviceName, |
| 76 | const sp<hidl::manager::V1_0::IServiceNotification> |
| 77 | ¬ification) = 0; |
| 78 | virtual sp<hardware::camera::provider::V2_4::ICameraProvider> getService( |
| 79 | const std::string &serviceName) = 0; |
| 80 | virtual ~ServiceInteractionProxy() {} |
| 81 | }; |
| 82 | |
| 83 | // Standard use case - call into the normal generated static methods which invoke |
| 84 | // the real hardware service manager |
| 85 | struct HardwareServiceInteractionProxy : public ServiceInteractionProxy { |
| 86 | virtual bool registerForNotifications( |
| 87 | const std::string &serviceName, |
| 88 | const sp<hidl::manager::V1_0::IServiceNotification> |
| 89 | ¬ification) override { |
| 90 | return hardware::camera::provider::V2_4::ICameraProvider::registerForNotifications( |
| 91 | serviceName, notification); |
| 92 | } |
| 93 | virtual sp<hardware::camera::provider::V2_4::ICameraProvider> getService( |
| 94 | const std::string &serviceName) override { |
| 95 | return hardware::camera::provider::V2_4::ICameraProvider::getService(serviceName); |
| 96 | } |
| 97 | }; |
| 98 | |
| 99 | /** |
| 100 | * Listener interface for device/torch status changes |
| 101 | */ |
| 102 | struct StatusListener : virtual public RefBase { |
| 103 | ~StatusListener() {} |
| 104 | |
| 105 | virtual void onDeviceStatusChanged(const String8 &cameraId, |
| 106 | hardware::camera::common::V1_0::CameraDeviceStatus newStatus) = 0; |
| 107 | virtual void onTorchStatusChanged(const String8 &cameraId, |
| 108 | hardware::camera::common::V1_0::TorchModeStatus newStatus) = 0; |
| 109 | }; |
| 110 | |
| 111 | /** |
| 112 | * Initialize the manager and give it a status listener; optionally accepts a service |
| 113 | * interaction proxy. |
| 114 | * |
| 115 | * The default proxy communicates via the hardware service manager; alternate proxies can be |
| 116 | * used for testing. The lifetime of the proxy must exceed the lifetime of the manager. |
| 117 | */ |
| 118 | status_t initialize(wp<StatusListener> listener, |
| 119 | ServiceInteractionProxy *proxy = &sHardwareServiceInteractionProxy); |
| 120 | |
| 121 | /** |
| 122 | * Retrieve the total number of available cameras. This value may change dynamically as cameras |
| 123 | * are added or removed. |
| 124 | */ |
| 125 | int getCameraCount() const; |
| 126 | |
| 127 | /** |
| 128 | * Retrieve the number of 'standard' cameras; these are internal and |
| 129 | * backwards-compatible. This is the set of cameras that will be |
| 130 | * accessible via the old camera API, with IDs in range of |
| 131 | * [0, getStandardCameraCount()-1]. This value is not expected to change dynamically. |
| 132 | */ |
| 133 | int getStandardCameraCount() const; |
| 134 | |
| 135 | std::vector<std::string> getCameraDeviceIds() const; |
| 136 | |
Yin-Chia Yeh | dc3134e | 2017-03-23 15:26:59 -0700 | [diff] [blame] | 137 | std::vector<std::string> getStandardCameraDeviceIds() const; |
| 138 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 139 | /** |
| 140 | * Return true if a device with a given ID and major version exists |
| 141 | */ |
| 142 | bool isValidDevice(const std::string &id, uint16_t majorVersion) const; |
| 143 | |
| 144 | /** |
| 145 | * Return true if a device with a given ID has a flash unit. Returns false |
| 146 | * for devices that are unknown. |
| 147 | */ |
| 148 | bool hasFlashUnit(const std::string &id) const; |
| 149 | |
| 150 | /** |
| 151 | * Return the resource cost of this camera device |
| 152 | */ |
| 153 | status_t getResourceCost(const std::string &id, |
| 154 | hardware::camera::common::V1_0::CameraResourceCost* cost) const; |
| 155 | |
| 156 | /** |
| 157 | * Return the old camera API camera info |
| 158 | */ |
| 159 | status_t getCameraInfo(const std::string &id, |
| 160 | hardware::CameraInfo* info) const; |
| 161 | |
| 162 | /** |
| 163 | * Return API2 camera characteristics - returns NAME_NOT_FOUND if a device ID does |
| 164 | * not have a v3 or newer HAL version. |
| 165 | */ |
| 166 | status_t getCameraCharacteristics(const std::string &id, |
| 167 | CameraMetadata* characteristics) const; |
| 168 | |
| 169 | /** |
| 170 | * Return the highest supported device interface version for this ID |
| 171 | */ |
| 172 | status_t getHighestSupportedVersion(const std::string &id, |
| 173 | hardware::hidl_version *v); |
| 174 | |
| 175 | /** |
Yin-Chia Yeh | dc3134e | 2017-03-23 15:26:59 -0700 | [diff] [blame] | 176 | * Check if a given camera device support setTorchMode API. |
| 177 | */ |
| 178 | bool supportSetTorchMode(const std::string &id); |
| 179 | |
| 180 | /** |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 181 | * Turn on or off the flashlight on a given camera device. |
Yin-Chia Yeh | dc3134e | 2017-03-23 15:26:59 -0700 | [diff] [blame] | 182 | * May fail if the device does not support this API, is in active use, or if the device |
| 183 | * doesn't exist, etc. |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 184 | */ |
| 185 | status_t setTorchMode(const std::string &id, bool enabled); |
| 186 | |
| 187 | /** |
Yin-Chia Yeh | 067428c | 2017-01-13 15:19:24 -0800 | [diff] [blame] | 188 | * Setup vendor tags for all registered providers |
| 189 | */ |
| 190 | status_t setUpVendorTags(); |
| 191 | |
| 192 | /** |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 193 | * Open an active session to a camera device. |
| 194 | * |
| 195 | * This fully powers on the camera device hardware, and returns a handle to a |
| 196 | * session to be used for hardware configuration and operation. |
| 197 | */ |
| 198 | status_t openSession(const std::string &id, |
| 199 | const sp<hardware::camera::device::V3_2::ICameraDeviceCallback>& callback, |
| 200 | /*out*/ |
| 201 | sp<hardware::camera::device::V3_2::ICameraDeviceSession> *session); |
| 202 | |
| 203 | status_t openSession(const std::string &id, |
| 204 | const sp<hardware::camera::device::V1_0::ICameraDeviceCallback>& callback, |
| 205 | /*out*/ |
| 206 | sp<hardware::camera::device::V1_0::ICameraDevice> *session); |
| 207 | |
| 208 | /** |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 209 | * IServiceNotification::onRegistration |
| 210 | * Invoked by the hardware service manager when a new camera provider is registered |
| 211 | */ |
| 212 | virtual hardware::Return<void> onRegistration(const hardware::hidl_string& fqName, |
| 213 | const hardware::hidl_string& name, |
| 214 | bool preexisting) override; |
| 215 | |
| 216 | /** |
| 217 | * Dump out information about available providers and devices |
| 218 | */ |
| 219 | status_t dump(int fd, const Vector<String16>& args); |
| 220 | |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 221 | /** |
| 222 | * Conversion methods between HAL Status and status_t and strings |
| 223 | */ |
| 224 | static status_t mapToStatusT(const hardware::camera::common::V1_0::Status& s); |
| 225 | static const char* statusToString(const hardware::camera::common::V1_0::Status& s); |
| 226 | |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 227 | /* |
| 228 | * Return provider type for a specific device. |
| 229 | */ |
| 230 | metadata_vendor_id_t getProviderTagIdLocked(const std::string& id, |
| 231 | hardware::hidl_version minVersion = hardware::hidl_version{0,0}, |
| 232 | hardware::hidl_version maxVersion = hardware::hidl_version{1000,0}) const; |
| 233 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 234 | private: |
| 235 | // All private members, unless otherwise noted, expect mInterfaceMutex to be locked before use |
| 236 | mutable std::mutex mInterfaceMutex; |
| 237 | |
Yin-Chia Yeh | 52778d4 | 2016-12-22 18:20:43 -0800 | [diff] [blame] | 238 | // the status listener update callbacks will lock mStatusMutex |
| 239 | mutable std::mutex mStatusListenerMutex; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 240 | wp<StatusListener> mListener; |
| 241 | ServiceInteractionProxy* mServiceProxy; |
| 242 | |
| 243 | static HardwareServiceInteractionProxy sHardwareServiceInteractionProxy; |
| 244 | |
Eino-Ville Talvala | 8d942f9 | 2017-03-13 10:09:51 -0700 | [diff] [blame] | 245 | struct ProviderInfo : |
| 246 | virtual public hardware::camera::provider::V2_4::ICameraProviderCallback, |
| 247 | virtual public hardware::hidl_death_recipient |
| 248 | { |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 249 | const std::string mProviderName; |
| 250 | const sp<hardware::camera::provider::V2_4::ICameraProvider> mInterface; |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 251 | const metadata_vendor_id_t mProviderTagid; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 252 | |
| 253 | ProviderInfo(const std::string &providerName, |
| 254 | sp<hardware::camera::provider::V2_4::ICameraProvider>& interface, |
| 255 | CameraProviderManager *manager); |
| 256 | ~ProviderInfo(); |
| 257 | |
| 258 | status_t initialize(); |
| 259 | |
| 260 | const std::string& getType() const; |
| 261 | |
| 262 | status_t addDevice(const std::string& name, |
| 263 | hardware::camera::common::V1_0::CameraDeviceStatus initialStatus = |
| 264 | hardware::camera::common::V1_0::CameraDeviceStatus::PRESENT, |
| 265 | /*out*/ std::string *parsedId = nullptr); |
| 266 | |
| 267 | status_t dump(int fd, const Vector<String16>& args) const; |
| 268 | |
| 269 | // ICameraProviderCallbacks interface - these lock the parent mInterfaceMutex |
| 270 | virtual hardware::Return<void> cameraDeviceStatusChange( |
| 271 | const hardware::hidl_string& cameraDeviceName, |
| 272 | hardware::camera::common::V1_0::CameraDeviceStatus newStatus) override; |
| 273 | virtual hardware::Return<void> torchModeStatusChange( |
| 274 | const hardware::hidl_string& cameraDeviceName, |
| 275 | hardware::camera::common::V1_0::TorchModeStatus newStatus) override; |
| 276 | |
Eino-Ville Talvala | 8d942f9 | 2017-03-13 10:09:51 -0700 | [diff] [blame] | 277 | // hidl_death_recipient interface - this locks the parent mInterfaceMutex |
| 278 | virtual void serviceDied(uint64_t cookie, const wp<hidl::base::V1_0::IBase>& who) override; |
| 279 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 280 | // Basic device information, common to all camera devices |
| 281 | struct DeviceInfo { |
| 282 | const std::string mName; // Full instance name |
| 283 | const std::string mId; // ID section of full name |
| 284 | const hardware::hidl_version mVersion; |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 285 | const metadata_vendor_id_t mProviderTagid; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 286 | |
| 287 | const hardware::camera::common::V1_0::CameraResourceCost mResourceCost; |
| 288 | |
| 289 | hardware::camera::common::V1_0::CameraDeviceStatus mStatus; |
| 290 | |
| 291 | bool hasFlashUnit() const { return mHasFlashUnit; } |
| 292 | virtual status_t setTorchMode(bool enabled) = 0; |
| 293 | virtual status_t getCameraInfo(hardware::CameraInfo *info) const = 0; |
| 294 | virtual status_t getCameraCharacteristics(CameraMetadata *characteristics) const { |
| 295 | (void) characteristics; |
| 296 | return INVALID_OPERATION; |
| 297 | } |
| 298 | |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 299 | DeviceInfo(const std::string& name, const metadata_vendor_id_t tagId, |
| 300 | const std::string &id, const hardware::hidl_version& version, |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 301 | const hardware::camera::common::V1_0::CameraResourceCost& resourceCost) : |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 302 | mName(name), mId(id), mVersion(version), mProviderTagid(tagId), |
| 303 | mResourceCost(resourceCost), |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 304 | mStatus(hardware::camera::common::V1_0::CameraDeviceStatus::PRESENT), |
| 305 | mHasFlashUnit(false) {} |
| 306 | virtual ~DeviceInfo(); |
| 307 | protected: |
| 308 | bool mHasFlashUnit; |
| 309 | |
| 310 | template<class InterfaceT> |
| 311 | static status_t setTorchMode(InterfaceT& interface, bool enabled); |
| 312 | }; |
| 313 | std::vector<std::unique_ptr<DeviceInfo>> mDevices; |
Yin-Chia Yeh | dc3134e | 2017-03-23 15:26:59 -0700 | [diff] [blame] | 314 | std::set<std::string> mUniqueCameraIds; |
Yin-Chia Yeh | e8e9e19 | 2017-03-16 15:23:51 -0700 | [diff] [blame] | 315 | int mUniqueDeviceCount; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 316 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 317 | // HALv1-specific camera fields, including the actual device interface |
| 318 | struct DeviceInfo1 : public DeviceInfo { |
| 319 | typedef hardware::camera::device::V1_0::ICameraDevice InterfaceT; |
| 320 | const sp<InterfaceT> mInterface; |
| 321 | |
| 322 | virtual status_t setTorchMode(bool enabled) override; |
| 323 | virtual status_t getCameraInfo(hardware::CameraInfo *info) const override; |
| 324 | |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 325 | DeviceInfo1(const std::string& name, const metadata_vendor_id_t tagId, |
| 326 | const std::string &id, uint16_t minorVersion, |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 327 | const hardware::camera::common::V1_0::CameraResourceCost& resourceCost, |
| 328 | sp<InterfaceT> interface); |
| 329 | virtual ~DeviceInfo1(); |
| 330 | private: |
| 331 | CameraParameters2 mDefaultParameters; |
| 332 | }; |
| 333 | |
| 334 | // HALv3-specific camera fields, including the actual device interface |
| 335 | struct DeviceInfo3 : public DeviceInfo { |
| 336 | typedef hardware::camera::device::V3_2::ICameraDevice InterfaceT; |
| 337 | const sp<InterfaceT> mInterface; |
| 338 | |
| 339 | virtual status_t setTorchMode(bool enabled) override; |
| 340 | virtual status_t getCameraInfo(hardware::CameraInfo *info) const override; |
| 341 | virtual status_t getCameraCharacteristics( |
| 342 | CameraMetadata *characteristics) const override; |
| 343 | |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 344 | DeviceInfo3(const std::string& name, const metadata_vendor_id_t tagId, |
| 345 | const std::string &id, uint16_t minorVersion, |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 346 | const hardware::camera::common::V1_0::CameraResourceCost& resourceCost, |
| 347 | sp<InterfaceT> interface); |
| 348 | virtual ~DeviceInfo3(); |
| 349 | private: |
| 350 | CameraMetadata mCameraCharacteristics; |
| 351 | }; |
| 352 | |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 353 | private: |
| 354 | std::string mType; |
| 355 | uint32_t mId; |
| 356 | |
Eino-Ville Talvala | 8d942f9 | 2017-03-13 10:09:51 -0700 | [diff] [blame] | 357 | std::mutex mLock; |
| 358 | |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 359 | CameraProviderManager *mManager; |
| 360 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 361 | // Templated method to instantiate the right kind of DeviceInfo and call the |
| 362 | // right CameraProvider getCameraDeviceInterface_* method. |
| 363 | template<class DeviceInfoT> |
| 364 | std::unique_ptr<DeviceInfo> initializeDeviceInfo(const std::string &name, |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 365 | const metadata_vendor_id_t tagId, const std::string &id, |
| 366 | uint16_t minorVersion) const; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 367 | |
| 368 | // Helper for initializeDeviceInfo to use the right CameraProvider get method. |
| 369 | template<class InterfaceT> |
| 370 | sp<InterfaceT> getDeviceInterface(const std::string &name) const; |
| 371 | |
| 372 | // Parse provider instance name for type and id |
| 373 | static status_t parseProviderName(const std::string& name, |
| 374 | std::string *type, uint32_t *id); |
| 375 | |
| 376 | // Parse device instance name for device version, type, and id. |
| 377 | static status_t parseDeviceName(const std::string& name, |
| 378 | uint16_t *major, uint16_t *minor, std::string *type, std::string *id); |
Emilian Peev | 71c73a2 | 2017-03-21 16:35:51 +0000 | [diff] [blame] | 379 | |
| 380 | // Generate vendor tag id |
| 381 | static metadata_vendor_id_t generateVendorTagId(const std::string &name); |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 382 | }; |
| 383 | |
| 384 | // Utility to find a DeviceInfo by ID; pointer is only valid while mInterfaceMutex is held |
| 385 | // and the calling code doesn't mutate the list of providers or their lists of devices. |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 386 | // Finds the first device of the given ID that falls within the requested version range |
| 387 | // minVersion <= deviceVersion < maxVersion |
| 388 | // No guarantees on the order of traversal |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 389 | ProviderInfo::DeviceInfo* findDeviceInfoLocked(const std::string& id, |
Eino-Ville Talvala | 0b1cb14 | 2016-12-19 16:29:17 -0800 | [diff] [blame] | 390 | hardware::hidl_version minVersion = hardware::hidl_version{0,0}, |
| 391 | hardware::hidl_version maxVersion = hardware::hidl_version{1000,0}) const; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 392 | |
Eino-Ville Talvala | 8d942f9 | 2017-03-13 10:09:51 -0700 | [diff] [blame] | 393 | status_t addProviderLocked(const std::string& newProvider, bool expected = true); |
| 394 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 395 | status_t removeProvider(const std::string& provider); |
Eino-Ville Talvala | 8d942f9 | 2017-03-13 10:09:51 -0700 | [diff] [blame] | 396 | sp<StatusListener> getStatusListener() const; |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 397 | |
| 398 | bool isValidDeviceLocked(const std::string &id, uint16_t majorVersion) const; |
| 399 | |
| 400 | std::vector<sp<ProviderInfo>> mProviders; |
| 401 | |
Eino-Ville Talvala | 2f09bac | 2016-12-13 11:29:54 -0800 | [diff] [blame] | 402 | static const char* deviceStatusToString( |
| 403 | const hardware::camera::common::V1_0::CameraDeviceStatus&); |
| 404 | static const char* torchStatusToString( |
| 405 | const hardware::camera::common::V1_0::TorchModeStatus&); |
| 406 | |
| 407 | }; |
| 408 | |
| 409 | } // namespace android |
| 410 | |
| 411 | #endif |