Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0ec234e0 authored by Emilian Peev's avatar Emilian Peev
Browse files

Camera: Extend vendor tag helper methods

Allow 'CameraMetadata' clients to query the vendor id for the
respective 'camera_metadata'.
Allow vendor tag cache clients to check the descriptor availability.

Bug: 164187235
Test: Manual using TestingCamera2,
Camera CTS

Change-Id: I463c1e091bc60e71549e10fbbe836fb1d714e890
parent c20a6c85
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@

#include <binder/Parcel.h>
#include <camera/CameraMetadata.h>
#include <camera_metadata_hidden.h>

namespace android {

@@ -872,5 +873,8 @@ status_t CameraMetadata::getTagFromName(const char *name,
    return OK;
}

metadata_vendor_id_t CameraMetadata::getVendorId() {
    return get_camera_metadata_vendor_id(mBuffer);
}

}; // namespace android
+10 −0
Original line number Diff line number Diff line
@@ -660,6 +660,16 @@ sp<VendorTagDescriptorCache> VendorTagDescriptorCache::getGlobalVendorTagCache()
    return sGlobalVendorTagDescriptorCache;
}

bool VendorTagDescriptorCache::isVendorCachePresent(metadata_vendor_id_t vendorId) {
    Mutex::Autolock al(sLock);
    if ((sGlobalVendorTagDescriptorCache.get() != nullptr) &&
            (sGlobalVendorTagDescriptorCache->getVendorIdsAndTagDescriptors().find(vendorId) !=
             sGlobalVendorTagDescriptorCache->getVendorIdsAndTagDescriptors().end())) {
        return true;
    }
    return false;
}

extern "C" {

int vendor_tag_descriptor_get_tag_count(const vendor_tag_ops_t* /*v*/) {
+5 −0
Original line number Diff line number Diff line
@@ -237,6 +237,11 @@ class CameraMetadata: public Parcelable {
    static status_t getTagFromName(const char *name,
            const VendorTagDescriptor* vTags, uint32_t *tag);

    /**
     * Return the current vendor tag id associated with this metadata.
     */
    metadata_vendor_id_t getVendorId();

  private:
    camera_metadata_t *mBuffer;
    mutable bool       mLocked;
+6 −0
Original line number Diff line number Diff line
@@ -249,6 +249,12 @@ class VendorTagDescriptorCache :
     */
    static void clearGlobalVendorTagCache();

    /**
     * Return true if given vendor id is present in the vendor tag caches, return
     * false otherwise.
     */
    static bool isVendorCachePresent(metadata_vendor_id_t vendorId);

};

} /* namespace android */