OSDN Git Service

Vr HAL uses "default" service name
authorChris Phoenix <cphoenix@google.com>
Thu, 19 Jan 2017 02:20:05 +0000 (18:20 -0800)
committerYifan Hong <elsk@google.com>
Sat, 25 Feb 2017 00:45:35 +0000 (16:45 -0800)
The getService() and registerAsService() methods of interface objects
now have default parameters of "default" for the service name. HALs
will not have to use any service name unless they want to register
more than one service.

Test: builds

Bug: 33844934

Change-Id: I2bd735cff9674ec5955ae30efed27359041ed723

vr/1.0/default/Vr.cpp
vr/1.0/default/service.cpp
vr/1.0/vts/functional/VtsHalVrV1_0TargetTest.cpp

index a0de998..345db99 100644 (file)
@@ -42,16 +42,16 @@ Return<void> Vr::setVrMode(bool enabled)  {
     return Void();
 }
 
-IVr* HIDL_FETCH_IVr(const char *name) {
+IVr* HIDL_FETCH_IVr(const char * /*name*/) {
     vr_module_t *vr_module;
     const hw_module_t *hw_module = NULL;
 
-    int ret = hw_get_module(name, &hw_module);
+    int ret = hw_get_module(VR_HARDWARE_MODULE_ID, &hw_module);
     if (ret == 0) {
         return new Vr(reinterpret_cast<vr_module_t*>(
                 const_cast<hw_module_t*>(hw_module)));
     } else {
-        ALOGE("hw_get_module %s failed: %d", name, ret);
+        ALOGE("hw_get_module %s failed: %d", VR_HARDWARE_MODULE_ID, ret);
         return nullptr;
     }
 }
index c27ceaf..22fb7d1 100644 (file)
@@ -23,5 +23,5 @@ using android::hardware::vr::V1_0::IVr;
 using android::hardware::defaultPassthroughServiceImplementation;
 
 int main() {
-    return defaultPassthroughServiceImplementation<IVr>("vr");
+    return defaultPassthroughServiceImplementation<IVr>();
 }
index 29888fd..c7ec076 100644 (file)
@@ -26,13 +26,11 @@ using ::android::hardware::Return;
 using ::android::hardware::Void;
 using ::android::sp;
 
-#define VR_SERVICE_NAME "vr"
-
 // The main test class for VR HIDL HAL.
 class VrHidlTest : public ::testing::Test {
  public:
   void SetUp() override {
-    vr = IVr::getService(VR_SERVICE_NAME);
+    vr = IVr::getService();
     ASSERT_NE(vr, nullptr);
   }