Merge "Audio: Add XML schema for audio effects configuration"
diff --git a/camera/device/3.2/default/CameraDeviceSession.cpp b/camera/device/3.2/default/CameraDeviceSession.cpp
index 61be82d..bad406f 100644
--- a/camera/device/3.2/default/CameraDeviceSession.cpp
+++ b/camera/device/3.2/default/CameraDeviceSession.cpp
@@ -403,12 +403,14 @@
         if (result.inputBuffer.releaseFence.getNativeHandle() != nullptr) {
             native_handle_t* handle = const_cast<native_handle_t*>(
                     result.inputBuffer.releaseFence.getNativeHandle());
+            native_handle_close(handle);
             native_handle_delete(handle);
         }
         for (auto& buf : result.outputBuffers) {
             if (buf.releaseFence.getNativeHandle() != nullptr) {
                 native_handle_t* handle = const_cast<native_handle_t*>(
                         buf.releaseFence.getNativeHandle());
+                native_handle_close(handle);
                 native_handle_delete(handle);
             }
         }
diff --git a/configstore/utils/include/configstore/Utils.h b/configstore/utils/include/configstore/Utils.h
index c9c830b..b107a20 100644
--- a/configstore/utils/include/configstore/Utils.h
+++ b/configstore/utils/include/configstore/Utils.h
@@ -42,6 +42,15 @@
 using ::android::hardware::configstore::V1_0::OptionalUInt64;
 using ::android::hardware::configstore::V1_0::OptionalString;
 
+// a function to retrieve and cache the service handle
+// for a particular interface
+template <typename I>
+sp<I> getService() {
+    // static initializer used for synchronizations
+    static sp<I> configs = I::getService();
+    return configs;
+}
+
 // arguments V: type for the value (i.e., OptionalXXX)
 //           I: interface class name
 //           func: member function pointer
@@ -49,9 +58,10 @@
         (std::function<void(const V&)>)>
 decltype(V::value) get(const decltype(V::value) &defValue) {
     using namespace android::hardware::details;
+    // static initializer used for synchronizations
     auto getHelper = []()->V {
         V ret;
-        sp<I> configs = I::getService();
+        sp<I> configs = getService<I>();
 
         if (!configs.get()) {
             // fallback to the default value