Loading camera/VendorTagDescriptor.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,11 @@ status_t VendorTagDescriptorCache::readFromParcel(const Parcel* parcel) { return res; } const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> & VendorTagDescriptorCache::getVendorIdsAndTagDescriptors() { return mVendorMap; } int VendorTagDescriptorCache::getTagCount(metadata_vendor_id_t id) const { int ret = 0; auto desc = mVendorMap.find(id); Loading camera/include/camera/VendorTagDescriptor.h +3 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,9 @@ class VendorTagDescriptorCache : public Parcelable { */ void dump(int fd, int verbosity, int indentation) const; const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> & getVendorIdsAndTagDescriptors(); protected: std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> mVendorMap; struct vendor_tag_cache_ops mVendorCacheOps; Loading services/camera/libcameraservice/hidl/HidlCameraService.cpp +45 −32 Original line number Diff line number Diff line Loading @@ -40,9 +40,11 @@ using hardware::Void; using device::V2_0::implementation::H2BCameraDeviceCallbacks; using device::V2_0::implementation::HidlCameraDeviceUser; using service::V2_0::implementation::H2BCameraServiceListener; using HCameraMetadataType = android::frameworks::cameraservice::common::V2_0::CameraMetadataType; using HVendorTag = android::frameworks::cameraservice::common::V2_0::VendorTag; using HVendorTagSection = android::frameworks::cameraservice::common::V2_0::VendorTagSection; using HCameraMetadataType = frameworks::cameraservice::common::V2_0::CameraMetadataType; using HVendorTag = frameworks::cameraservice::common::V2_0::VendorTag; using HVendorTagSection = frameworks::cameraservice::common::V2_0::VendorTagSection; using HProviderIdAndVendorTagSections = frameworks::cameraservice::common::V2_0::ProviderIdAndVendorTagSections; sp<HidlCameraService> gHidlCameraService; Loading Loading @@ -215,19 +217,24 @@ Return<HStatus> HidlCameraService::removeListener(const sp<HCameraServiceListene } Return<void> HidlCameraService::getCameraVendorTagSections(getCameraVendorTagSections_cb _hidl_cb) { hidl_vec<HVendorTagSection> hVendorTagSections; // TODO: Could this be just created on the stack since we don't set it to // global cache or anything ? HStatus hStatus = HStatus::NO_ERROR; sp<VendorTagDescriptor> desc = new VendorTagDescriptor(); binder::Status serviceRet = mAidlICameraService->getCameraVendorTagDescriptor(desc.get()); if (!serviceRet.isOk()) { ALOGE("%s: Failed to get VendorTagDescriptor", __FUNCTION__); _hidl_cb(B2HStatus(serviceRet), hVendorTagSections); sp<VendorTagDescriptorCache> gCache = VendorTagDescriptorCache::getGlobalVendorTagCache(); if (gCache == nullptr) { _hidl_cb(HStatus::UNKNOWN_ERROR, {}); return Void(); } const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> &vendorIdsAndTagDescs = gCache->getVendorIdsAndTagDescriptors(); if (vendorIdsAndTagDescs.size() == 0) { _hidl_cb(HStatus::UNKNOWN_ERROR, {}); return Void(); } hidl_vec<HProviderIdAndVendorTagSections> hTagIdsAndVendorTagSections; hTagIdsAndVendorTagSections.resize(vendorIdsAndTagDescs.size()); size_t j = 0; for (auto &vendorIdAndTagDescs : vendorIdsAndTagDescs) { hidl_vec<HVendorTagSection> hVendorTagSections; sp<VendorTagDescriptor> desc = vendorIdAndTagDescs.second; const SortedVector<String8>* sectionNames = desc->getAllSectionNames(); size_t numSections = sectionNames->size(); std::vector<std::vector<HVendorTag>> tagsBySection(numSections); Loading @@ -247,7 +254,13 @@ Return<void> HidlCameraService::getCameraVendorTagSections(getCameraVendorTagSec hVendorTagSections[s].sectionName = (*sectionNames)[s].string(); hVendorTagSections[s].tags = tagsBySection[s]; } _hidl_cb(hStatus, hVendorTagSections); HProviderIdAndVendorTagSections &hProviderIdAndVendorTagSections = hTagIdsAndVendorTagSections[j]; hProviderIdAndVendorTagSections.providerId = vendorIdAndTagDescs.first; hProviderIdAndVendorTagSections.vendorTagSections = std::move(hVendorTagSections); j++; } _hidl_cb(HStatus::NO_ERROR, hTagIdsAndVendorTagSections); return Void(); } Loading Loading
camera/VendorTagDescriptor.cpp +5 −0 Original line number Diff line number Diff line Loading @@ -411,6 +411,11 @@ status_t VendorTagDescriptorCache::readFromParcel(const Parcel* parcel) { return res; } const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> & VendorTagDescriptorCache::getVendorIdsAndTagDescriptors() { return mVendorMap; } int VendorTagDescriptorCache::getTagCount(metadata_vendor_id_t id) const { int ret = 0; auto desc = mVendorMap.find(id); Loading
camera/include/camera/VendorTagDescriptor.h +3 −0 Original line number Diff line number Diff line Loading @@ -211,6 +211,9 @@ class VendorTagDescriptorCache : public Parcelable { */ void dump(int fd, int verbosity, int indentation) const; const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> & getVendorIdsAndTagDescriptors(); protected: std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> mVendorMap; struct vendor_tag_cache_ops mVendorCacheOps; Loading
services/camera/libcameraservice/hidl/HidlCameraService.cpp +45 −32 Original line number Diff line number Diff line Loading @@ -40,9 +40,11 @@ using hardware::Void; using device::V2_0::implementation::H2BCameraDeviceCallbacks; using device::V2_0::implementation::HidlCameraDeviceUser; using service::V2_0::implementation::H2BCameraServiceListener; using HCameraMetadataType = android::frameworks::cameraservice::common::V2_0::CameraMetadataType; using HVendorTag = android::frameworks::cameraservice::common::V2_0::VendorTag; using HVendorTagSection = android::frameworks::cameraservice::common::V2_0::VendorTagSection; using HCameraMetadataType = frameworks::cameraservice::common::V2_0::CameraMetadataType; using HVendorTag = frameworks::cameraservice::common::V2_0::VendorTag; using HVendorTagSection = frameworks::cameraservice::common::V2_0::VendorTagSection; using HProviderIdAndVendorTagSections = frameworks::cameraservice::common::V2_0::ProviderIdAndVendorTagSections; sp<HidlCameraService> gHidlCameraService; Loading Loading @@ -215,19 +217,24 @@ Return<HStatus> HidlCameraService::removeListener(const sp<HCameraServiceListene } Return<void> HidlCameraService::getCameraVendorTagSections(getCameraVendorTagSections_cb _hidl_cb) { hidl_vec<HVendorTagSection> hVendorTagSections; // TODO: Could this be just created on the stack since we don't set it to // global cache or anything ? HStatus hStatus = HStatus::NO_ERROR; sp<VendorTagDescriptor> desc = new VendorTagDescriptor(); binder::Status serviceRet = mAidlICameraService->getCameraVendorTagDescriptor(desc.get()); if (!serviceRet.isOk()) { ALOGE("%s: Failed to get VendorTagDescriptor", __FUNCTION__); _hidl_cb(B2HStatus(serviceRet), hVendorTagSections); sp<VendorTagDescriptorCache> gCache = VendorTagDescriptorCache::getGlobalVendorTagCache(); if (gCache == nullptr) { _hidl_cb(HStatus::UNKNOWN_ERROR, {}); return Void(); } const std::unordered_map<metadata_vendor_id_t, sp<android::VendorTagDescriptor>> &vendorIdsAndTagDescs = gCache->getVendorIdsAndTagDescriptors(); if (vendorIdsAndTagDescs.size() == 0) { _hidl_cb(HStatus::UNKNOWN_ERROR, {}); return Void(); } hidl_vec<HProviderIdAndVendorTagSections> hTagIdsAndVendorTagSections; hTagIdsAndVendorTagSections.resize(vendorIdsAndTagDescs.size()); size_t j = 0; for (auto &vendorIdAndTagDescs : vendorIdsAndTagDescs) { hidl_vec<HVendorTagSection> hVendorTagSections; sp<VendorTagDescriptor> desc = vendorIdAndTagDescs.second; const SortedVector<String8>* sectionNames = desc->getAllSectionNames(); size_t numSections = sectionNames->size(); std::vector<std::vector<HVendorTag>> tagsBySection(numSections); Loading @@ -247,7 +254,13 @@ Return<void> HidlCameraService::getCameraVendorTagSections(getCameraVendorTagSec hVendorTagSections[s].sectionName = (*sectionNames)[s].string(); hVendorTagSections[s].tags = tagsBySection[s]; } _hidl_cb(hStatus, hVendorTagSections); HProviderIdAndVendorTagSections &hProviderIdAndVendorTagSections = hTagIdsAndVendorTagSections[j]; hProviderIdAndVendorTagSections.providerId = vendorIdAndTagDescs.first; hProviderIdAndVendorTagSections.vendorTagSections = std::move(hVendorTagSections); j++; } _hidl_cb(HStatus::NO_ERROR, hTagIdsAndVendorTagSections); return Void(); } Loading