Vr HAL uses "default" service name

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
This commit is contained in:
Chris Phoenix
2017-01-18 18:20:05 -08:00
committed by Yifan Hong
parent 8c171a5c58
commit aa011ee002
3 changed files with 5 additions and 7 deletions

View 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;
}
}

View 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>();
}

View 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);
}