OSDN Git Service

Handle hidl transaction errors in ConfigStore
authorPavel Maltsev <pavelm@google.com>
Mon, 20 Mar 2017 21:58:59 +0000 (14:58 -0700)
committerJaesoo Lee <jaesoo@google.com>
Thu, 6 Apr 2017 02:10:03 +0000 (11:10 +0900)
Test: surface flinger not failing, android now bootsup

Bug: b/36445794
Change-Id: I64cc404bec71f5e4eea2e0034f07b86fb60a3e32
Merged-In: I22fa7aab9fa92bc04333aaa0eef45891ebeba8e7
(cherry picked from commit 076b792ade608a7fdf4e600a42550ad17296a39e)

configstore/utils/include/configstore/Utils.h

index 98ccae9..42bf002 100644 (file)
 #include <hidl/Status.h>
 #include <stdatomic.h>
 
+#pragma push_macro("LOG_TAG")
+#undef LOG_TAG
+#define LOG_TAG "ConfigStoreUtil"
+
 namespace android {
 namespace hardware {
 namespace configstore {
@@ -39,9 +43,11 @@ decltype(V::value) get(const decltype(V::value) &defValue) {
             // fallback to the default value
             ret.specified = false;
         } else {
-            (*configs.*func)([&ret](V v) {
-                ret = v;
-            });
+            auto status = (*configs.*func)([&ret](V v) { ret = v; });
+            if (!status.isOk()) {
+                ALOGE("HIDL call failed. %s", status.description().c_str());
+                ret.specified = false;
+            }
         }
 
         return ret;
@@ -91,4 +97,6 @@ std::string getString(const std::string &defValue) {
 }  // namespace hardware
 }  // namespace android
 
+#pragma pop_macro("LOG_TAG")
+
 #endif  // ANDROID_HARDWARE_CONFIGSTORE_UTILS_H