Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 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 | |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 17 | #include <android-base/properties.h> |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 18 | |
Jayant Chowdhary | 0c94727 | 2018-08-15 14:42:04 -0700 | [diff] [blame] | 19 | #include <hidl/AidlCameraDeviceCallbacks.h> |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 20 | #include <hidl/AidlCameraServiceListener.h> |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 21 | #include <hidl/HidlCameraService.h> |
| 22 | #include <hidl/HidlCameraDeviceUser.h> |
| 23 | #include <hidl/Utils.h> |
Avichal Rakesh | fcb78cb | 2022-10-27 15:45:54 -0700 | [diff] [blame] | 24 | #include <aidl/AidlUtils.h> |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 25 | |
| 26 | #include <hidl/HidlTransportSupport.h> |
| 27 | |
Avichal Rakesh | 74b5ae7 | 2023-12-27 16:56:45 -0800 | [diff] [blame^] | 28 | #include <utils/Utils.h> |
| 29 | |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 30 | namespace android { |
| 31 | namespace frameworks { |
| 32 | namespace cameraservice { |
| 33 | namespace service { |
| 34 | namespace V2_0 { |
| 35 | namespace implementation { |
| 36 | |
| 37 | using frameworks::cameraservice::service::V2_0::implementation::HidlCameraService; |
| 38 | using hardware::hidl_vec; |
| 39 | using hardware::cameraservice::utils::conversion::convertToHidl; |
| 40 | using hardware::cameraservice::utils::conversion::B2HStatus; |
| 41 | using hardware::Void; |
Avichal Rakesh | fcb78cb | 2022-10-27 15:45:54 -0700 | [diff] [blame] | 42 | using hardware::cameraservice::utils::conversion::aidl::filterVndkKeys; |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 43 | |
Jayant Chowdhary | 0c94727 | 2018-08-15 14:42:04 -0700 | [diff] [blame] | 44 | using device::V2_0::implementation::H2BCameraDeviceCallbacks; |
Shuzhen Wang | 316781a | 2020-08-18 18:11:01 -0700 | [diff] [blame] | 45 | using device::V2_1::implementation::HidlCameraDeviceUser; |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 46 | using service::V2_0::implementation::H2BCameraServiceListener; |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 47 | using HCameraMetadataType = frameworks::cameraservice::common::V2_0::CameraMetadataType; |
| 48 | using HVendorTag = frameworks::cameraservice::common::V2_0::VendorTag; |
| 49 | using HVendorTagSection = frameworks::cameraservice::common::V2_0::VendorTagSection; |
| 50 | using HProviderIdAndVendorTagSections = |
| 51 | frameworks::cameraservice::common::V2_0::ProviderIdAndVendorTagSections; |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 52 | |
| 53 | sp<HidlCameraService> gHidlCameraService; |
| 54 | |
| 55 | sp<HidlCameraService> HidlCameraService::getInstance(android::CameraService *cs) { |
| 56 | gHidlCameraService = new HidlCameraService(cs); |
| 57 | return gHidlCameraService; |
| 58 | } |
| 59 | |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 60 | HidlCameraService::HidlCameraService(android::CameraService *cs) : mAidlICameraService(cs) { |
Avichal Rakesh | 74b5ae7 | 2023-12-27 16:56:45 -0800 | [diff] [blame^] | 61 | mVndkVersion = getVNDKVersionFromProp(__ANDROID_API_FUTURE__); |
| 62 | } |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 63 | |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 64 | Return<void> |
| 65 | HidlCameraService::getCameraCharacteristics(const hidl_string& cameraId, |
| 66 | getCameraCharacteristics_cb _hidl_cb) { |
| 67 | android::CameraMetadata cameraMetadata; |
| 68 | HStatus status = HStatus::NO_ERROR; |
| 69 | binder::Status serviceRet = |
Austin Borger | 71d8f67 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 70 | mAidlICameraService->getCameraCharacteristics(cameraId, |
Austin Borger | 7b14d5e | 2023-03-16 10:29:20 -0700 | [diff] [blame] | 71 | /*targetSdkVersion*/__ANDROID_API_FUTURE__, /*overrideToPortrait*/false, |
Austin Borger | 18b30a7 | 2022-10-27 12:20:29 -0700 | [diff] [blame] | 72 | &cameraMetadata); |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 73 | HCameraMetadata hidlMetadata; |
| 74 | if (!serviceRet.isOk()) { |
| 75 | switch(serviceRet.serviceSpecificErrorCode()) { |
| 76 | // No ERROR_CAMERA_DISCONNECTED since we're in the same process. |
| 77 | case hardware::ICameraService::ERROR_ILLEGAL_ARGUMENT: |
| 78 | ALOGE("%s: Camera ID %s does not exist!", __FUNCTION__, cameraId.c_str()); |
| 79 | status = HStatus::ILLEGAL_ARGUMENT; |
| 80 | break; |
| 81 | default: |
| 82 | ALOGE("Get camera characteristics from camera service failed: %s", |
Tomasz Wasilczyk | 12b04a5 | 2023-08-11 15:52:22 +0000 | [diff] [blame] | 83 | serviceRet.toString8().c_str()); |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 84 | status = B2HStatus(serviceRet); |
| 85 | } |
| 86 | _hidl_cb(status, hidlMetadata); |
| 87 | return Void(); |
| 88 | } |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 89 | if (filterVndkKeys(mVndkVersion, cameraMetadata) != OK) { |
| 90 | ALOGE("%s: Unable to filter vndk metadata keys for version %d", __FUNCTION__, mVndkVersion); |
| 91 | _hidl_cb(HStatus::UNKNOWN_ERROR, hidlMetadata); |
| 92 | return Void(); |
| 93 | } |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 94 | const camera_metadata_t *rawMetadata = cameraMetadata.getAndLock(); |
| 95 | convertToHidl(rawMetadata, &hidlMetadata); |
| 96 | _hidl_cb(status, hidlMetadata); |
| 97 | cameraMetadata.unlock(rawMetadata); |
| 98 | return Void(); |
| 99 | } |
| 100 | |
| 101 | Return<void> HidlCameraService::connectDevice(const sp<HCameraDeviceCallback>& hCallback, |
| 102 | const hidl_string& cameraId, |
| 103 | connectDevice_cb _hidl_cb) { |
Jayant Chowdhary | 0c94727 | 2018-08-15 14:42:04 -0700 | [diff] [blame] | 104 | // Here, we first get ICameraDeviceUser from mAidlICameraService, then save |
| 105 | // that interface in the newly created HidlCameraDeviceUser impl class. |
| 106 | if (mAidlICameraService == nullptr) { |
| 107 | _hidl_cb(HStatus::UNKNOWN_ERROR, nullptr); |
| 108 | return Void(); |
| 109 | } |
| 110 | sp<hardware::camera2::ICameraDeviceUser> deviceRemote = nullptr; |
| 111 | // Create a hardware::camera2::ICameraDeviceCallback object which internally |
| 112 | // calls callback functions passed through hCallback. |
| 113 | sp<H2BCameraDeviceCallbacks> hybridCallbacks = new H2BCameraDeviceCallbacks(hCallback); |
Jayant Chowdhary | 2f68652 | 2022-05-09 14:52:16 +0000 | [diff] [blame] | 114 | if (!hybridCallbacks->initializeLooper(mVndkVersion)) { |
Jayant Chowdhary | 0c94727 | 2018-08-15 14:42:04 -0700 | [diff] [blame] | 115 | ALOGE("Unable to handle callbacks on device, cannot connect"); |
| 116 | _hidl_cb(HStatus::UNKNOWN_ERROR, nullptr); |
| 117 | return Void(); |
| 118 | } |
| 119 | sp<hardware::camera2::ICameraDeviceCallbacks> callbacks = hybridCallbacks; |
| 120 | binder::Status serviceRet = mAidlICameraService->connectDevice( |
Austin Borger | 71d8f67 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 121 | callbacks, cameraId, std::string(), {}, |
Shuzhen Wang | d4abdf7 | 2021-05-28 11:22:50 -0700 | [diff] [blame] | 122 | hardware::ICameraService::USE_CALLING_UID, 0/*oomScoreOffset*/, |
Austin Borger | 7b14d5e | 2023-03-16 10:29:20 -0700 | [diff] [blame] | 123 | /*targetSdkVersion*/__ANDROID_API_FUTURE__, /*overrideToPortrait*/false, |
Austin Borger | 18b30a7 | 2022-10-27 12:20:29 -0700 | [diff] [blame] | 124 | /*out*/&deviceRemote); |
Jayant Chowdhary | 0c94727 | 2018-08-15 14:42:04 -0700 | [diff] [blame] | 125 | HStatus status = HStatus::NO_ERROR; |
| 126 | if (!serviceRet.isOk()) { |
| 127 | ALOGE("%s: Unable to connect to camera device", __FUNCTION__); |
| 128 | status = B2HStatus(serviceRet); |
| 129 | _hidl_cb(status, nullptr); |
| 130 | return Void(); |
| 131 | } |
| 132 | // Now we create a HidlCameraDeviceUser class, store the deviceRemote in it, |
| 133 | // and return that back. All calls on that interface will be forwarded to |
| 134 | // the AIDL interface. |
| 135 | sp<HidlCameraDeviceUser> hDeviceRemote = new HidlCameraDeviceUser(deviceRemote); |
| 136 | if (!hDeviceRemote->initStatus()) { |
| 137 | ALOGE("%s: Unable to initialize camera device HIDL wrapper", __FUNCTION__); |
| 138 | _hidl_cb(HStatus::UNKNOWN_ERROR, nullptr); |
| 139 | return Void(); |
| 140 | } |
| 141 | hybridCallbacks->setCaptureResultMetadataQueue(hDeviceRemote->getCaptureResultMetadataQueue()); |
| 142 | _hidl_cb(status, hDeviceRemote); |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 143 | return Void(); |
| 144 | } |
| 145 | |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 146 | void HidlCameraService::addToListenerCacheLocked(sp<HCameraServiceListener> hListener, |
| 147 | sp<hardware::ICameraServiceListener> csListener) { |
| 148 | mListeners.emplace_back(std::make_pair(hListener, csListener)); |
| 149 | } |
| 150 | |
| 151 | sp<hardware::ICameraServiceListener> |
| 152 | HidlCameraService::searchListenerCacheLocked(sp<HCameraServiceListener> hListener, |
| 153 | bool shouldRemove) { |
| 154 | // Go through the mListeners list and compare the listener with the HIDL |
| 155 | // listener registered. |
| 156 | auto it = mListeners.begin(); |
| 157 | sp<ICameraServiceListener> csListener = nullptr; |
| 158 | for (;it != mListeners.end(); it++) { |
| 159 | if (hardware::interfacesEqual(it->first, hListener)) { |
| 160 | break; |
| 161 | } |
| 162 | } |
| 163 | if (it != mListeners.end()) { |
| 164 | csListener = it->second; |
| 165 | if (shouldRemove) { |
| 166 | mListeners.erase(it); |
| 167 | } |
| 168 | } |
| 169 | return csListener; |
| 170 | } |
| 171 | |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 172 | Return<void> HidlCameraService::addListener(const sp<HCameraServiceListener>& hCsListener, |
| 173 | addListener_cb _hidl_cb) { |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 174 | std::vector<hardware::CameraStatus> cameraStatusAndIds{}; |
| 175 | HStatus status = addListenerInternal<HCameraServiceListener>( |
| 176 | hCsListener, &cameraStatusAndIds); |
| 177 | if (status != HStatus::NO_ERROR) { |
| 178 | _hidl_cb(status, {}); |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 179 | return Void(); |
| 180 | } |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 181 | |
| 182 | hidl_vec<HCameraStatusAndId> hCameraStatusAndIds; |
| 183 | //Convert cameraStatusAndIds to HIDL and call callback |
| 184 | convertToHidl(cameraStatusAndIds, &hCameraStatusAndIds); |
| 185 | _hidl_cb(status, hCameraStatusAndIds); |
| 186 | |
| 187 | return Void(); |
| 188 | } |
| 189 | |
| 190 | Return<void> HidlCameraService::addListener_2_1(const sp<HCameraServiceListener2_1>& hCsListener, |
| 191 | addListener_2_1_cb _hidl_cb) { |
| 192 | std::vector<hardware::CameraStatus> cameraStatusAndIds{}; |
| 193 | HStatus status = addListenerInternal<HCameraServiceListener2_1>( |
| 194 | hCsListener, &cameraStatusAndIds); |
| 195 | if (status != HStatus::NO_ERROR) { |
| 196 | _hidl_cb(status, {}); |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 197 | return Void(); |
| 198 | } |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 199 | |
| 200 | hidl_vec<frameworks::cameraservice::service::V2_1::CameraStatusAndId> hCameraStatusAndIds; |
| 201 | //Convert cameraStatusAndIds to HIDL and call callback |
| 202 | convertToHidl(cameraStatusAndIds, &hCameraStatusAndIds); |
| 203 | _hidl_cb(status, hCameraStatusAndIds); |
| 204 | |
| 205 | return Void(); |
| 206 | } |
| 207 | |
| 208 | template<class T> |
| 209 | HStatus HidlCameraService::addListenerInternal(const sp<T>& hCsListener, |
| 210 | std::vector<hardware::CameraStatus>* cameraStatusAndIds) { |
| 211 | if (mAidlICameraService == nullptr) { |
| 212 | return HStatus::UNKNOWN_ERROR; |
| 213 | } |
| 214 | if (hCsListener == nullptr || cameraStatusAndIds == nullptr) { |
| 215 | ALOGE("%s listener and cameraStatusAndIds must not be NULL", __FUNCTION__); |
| 216 | return HStatus::ILLEGAL_ARGUMENT; |
| 217 | } |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 218 | sp<hardware::ICameraServiceListener> csListener = nullptr; |
| 219 | // Check the cache for previously registered callbacks |
| 220 | { |
| 221 | Mutex::Autolock l(mListenerListLock); |
| 222 | csListener = searchListenerCacheLocked(hCsListener); |
| 223 | if (csListener == nullptr) { |
| 224 | // Wrap an hCsListener with AidlCameraServiceListener and pass it to |
| 225 | // CameraService. |
| 226 | csListener = new H2BCameraServiceListener(hCsListener); |
| 227 | // Add to cache |
| 228 | addToListenerCacheLocked(hCsListener, csListener); |
| 229 | } else { |
| 230 | ALOGE("%s: Trying to add a listener %p already registered", |
| 231 | __FUNCTION__, hCsListener.get()); |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 232 | return HStatus::ILLEGAL_ARGUMENT; |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 233 | } |
| 234 | } |
Jayant Chowdhary | f949ddd | 2019-01-29 14:34:11 -0800 | [diff] [blame] | 235 | binder::Status serviceRet = |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 236 | mAidlICameraService->addListenerHelper(csListener, cameraStatusAndIds, true); |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 237 | HStatus status = HStatus::NO_ERROR; |
| 238 | if (!serviceRet.isOk()) { |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 239 | ALOGE("%s: Unable to add camera device status listener", __FUNCTION__); |
| 240 | status = B2HStatus(serviceRet); |
| 241 | return status; |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 242 | } |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 243 | cameraStatusAndIds->erase(std::remove_if(cameraStatusAndIds->begin(), cameraStatusAndIds->end(), |
Jayant Chowdhary | 90e6369 | 2019-10-25 14:13:01 -0700 | [diff] [blame] | 244 | [this](const hardware::CameraStatus& s) { |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 245 | bool supportsHAL3 = false; |
| 246 | binder::Status sRet = |
Austin Borger | 71d8f67 | 2023-06-01 16:51:35 -0700 | [diff] [blame] | 247 | mAidlICameraService->supportsCameraApi(s.cameraId, |
Jayant Chowdhary | 90e6369 | 2019-10-25 14:13:01 -0700 | [diff] [blame] | 248 | hardware::ICameraService::API_VERSION_2, &supportsHAL3); |
Shuzhen Wang | 4fa28d2 | 2020-01-23 15:57:25 -0800 | [diff] [blame] | 249 | return !sRet.isOk() || !supportsHAL3; |
| 250 | }), cameraStatusAndIds->end()); |
| 251 | |
| 252 | return HStatus::NO_ERROR; |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | Return<HStatus> HidlCameraService::removeListener(const sp<HCameraServiceListener>& hCsListener) { |
| 256 | if (hCsListener == nullptr) { |
| 257 | ALOGE("%s listener must not be NULL", __FUNCTION__); |
| 258 | return HStatus::ILLEGAL_ARGUMENT; |
| 259 | } |
Jayant Chowdhary | 94f79a9 | 2018-08-15 13:57:17 -0700 | [diff] [blame] | 260 | sp<ICameraServiceListener> csListener = nullptr; |
| 261 | { |
| 262 | Mutex::Autolock l(mListenerListLock); |
| 263 | csListener = searchListenerCacheLocked(hCsListener, /*removeIfFound*/true); |
| 264 | } |
| 265 | if (csListener != nullptr) { |
| 266 | mAidlICameraService->removeListener(csListener); |
| 267 | } else { |
| 268 | ALOGE("%s Removing unregistered listener %p", __FUNCTION__, hCsListener.get()); |
| 269 | return HStatus::ILLEGAL_ARGUMENT; |
| 270 | } |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 271 | return HStatus::NO_ERROR; |
| 272 | } |
| 273 | |
| 274 | Return<void> HidlCameraService::getCameraVendorTagSections(getCameraVendorTagSections_cb _hidl_cb) { |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 275 | sp<VendorTagDescriptorCache> gCache = VendorTagDescriptorCache::getGlobalVendorTagCache(); |
| 276 | if (gCache == nullptr) { |
| 277 | _hidl_cb(HStatus::UNKNOWN_ERROR, {}); |
| 278 | return Void(); |
| 279 | } |
| 280 | const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> |
| 281 | &vendorIdsAndTagDescs = gCache->getVendorIdsAndTagDescriptors(); |
| 282 | if (vendorIdsAndTagDescs.size() == 0) { |
| 283 | _hidl_cb(HStatus::UNKNOWN_ERROR, {}); |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 284 | return Void(); |
| 285 | } |
| 286 | |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 287 | hidl_vec<HProviderIdAndVendorTagSections> hTagIdsAndVendorTagSections; |
| 288 | hTagIdsAndVendorTagSections.resize(vendorIdsAndTagDescs.size()); |
| 289 | size_t j = 0; |
| 290 | for (auto &vendorIdAndTagDescs : vendorIdsAndTagDescs) { |
| 291 | hidl_vec<HVendorTagSection> hVendorTagSections; |
| 292 | sp<VendorTagDescriptor> desc = vendorIdAndTagDescs.second; |
| 293 | const SortedVector<String8>* sectionNames = desc->getAllSectionNames(); |
| 294 | size_t numSections = sectionNames->size(); |
| 295 | std::vector<std::vector<HVendorTag>> tagsBySection(numSections); |
| 296 | int tagCount = desc->getTagCount(); |
Jayant Chowdhary | 925a27f | 2021-09-13 16:25:07 -0700 | [diff] [blame] | 297 | if (tagCount <= 0) { |
| 298 | continue; |
| 299 | } |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 300 | std::vector<uint32_t> tags(tagCount); |
| 301 | desc->getTagArray(tags.data()); |
| 302 | for (int i = 0; i < tagCount; i++) { |
| 303 | HVendorTag vt; |
| 304 | vt.tagId = tags[i]; |
| 305 | vt.tagName = desc->getTagName(tags[i]); |
| 306 | vt.tagType = (HCameraMetadataType) desc->getTagType(tags[i]); |
| 307 | ssize_t sectionIdx = desc->getSectionIndex(tags[i]); |
| 308 | tagsBySection[sectionIdx].push_back(vt); |
| 309 | } |
| 310 | hVendorTagSections.resize(numSections); |
| 311 | for (size_t s = 0; s < numSections; s++) { |
Tomasz Wasilczyk | 12b04a5 | 2023-08-11 15:52:22 +0000 | [diff] [blame] | 312 | hVendorTagSections[s].sectionName = (*sectionNames)[s].c_str(); |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 313 | hVendorTagSections[s].tags = tagsBySection[s]; |
| 314 | } |
| 315 | HProviderIdAndVendorTagSections &hProviderIdAndVendorTagSections = |
| 316 | hTagIdsAndVendorTagSections[j]; |
| 317 | hProviderIdAndVendorTagSections.providerId = vendorIdAndTagDescs.first; |
| 318 | hProviderIdAndVendorTagSections.vendorTagSections = std::move(hVendorTagSections); |
| 319 | j++; |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 320 | } |
Jayant Chowdhary | 8cf9292 | 2018-11-19 15:45:17 -0800 | [diff] [blame] | 321 | _hidl_cb(HStatus::NO_ERROR, hTagIdsAndVendorTagSections); |
Jayant Chowdhary | be543d4 | 2018-08-15 13:16:14 -0700 | [diff] [blame] | 322 | return Void(); |
| 323 | } |
| 324 | |
| 325 | } // implementation |
| 326 | } // V2_0 |
| 327 | } // service |
| 328 | } // cameraservice |
| 329 | } // frameworks |
| 330 | } // android |
| 331 | |