OSDN Git Service

Use always fatal assertions in vr_composer_view and add one more
authorJohn Bates <jbates@google.com>
Mon, 30 Jan 2017 16:58:20 +0000 (08:58 -0800)
committerAlex Vakulenko <avakulenko@google.com>
Thu, 2 Feb 2017 02:26:33 +0000 (18:26 -0800)
Previously vr_composer_view would never trip on its assertions.

This caused it to startup in a bad state sometimes and need to be manually
restarted.

Bug: 34807059
Test: manually
Change-Id: I4b35c95fd411e3ca8e982de511de0e5e12f18483

services/vr/vr_window_manager/composer_view/Android.bp_disable
services/vr/vr_window_manager/composer_view/vr_composer_view.cpp

index 7e25c85..1658154 100644 (file)
@@ -14,6 +14,7 @@ cc_binary {
     "libbinder",
     "libhardware",
     "libhwbinder",
+    "liblog",
     "libutils",
     "libvrhwc",
   ],
index b5030e3..54dff3d 100644 (file)
@@ -26,15 +26,18 @@ int main(int, char**) {
 
   const char instance[] = "vr_hwcomposer";
   sp<IComposer> service = HIDL_FETCH_IComposer(instance);
-  LOG_FATAL_IF(!service, "Failed to get service");
-  LOG_FATAL_IF(service->isRemote(), "Service is remote");
+  LOG_ALWAYS_FATAL_IF(!service.get(), "Failed to get service");
+  LOG_ALWAYS_FATAL_IF(service->isRemote(), "Service is remote");
 
-  service->registerAsService(instance);
+  LOG_ALWAYS_FATAL_IF(service->registerAsService(instance) != ::android::OK,
+                      "Failed to register service");
 
   sp<IVrComposerView> composer_view = HIDL_FETCH_IVrComposerView(
       "DaydreamDisplay");
-  LOG_FATAL_IF(!composer_view, "Failed to get vr_composer_view service");
-  LOG_FATAL_IF(composer_view->isRemote(), "vr_composer_view service is remote");
+  LOG_ALWAYS_FATAL_IF(!composer_view.get(),
+                      "Failed to get vr_composer_view service");
+  LOG_ALWAYS_FATAL_IF(composer_view->isRemote(),
+                      "vr_composer_view service is remote");
 
   composer_view->registerAsService("DaydreamDisplay");