memtrack 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; verify HAL still works

Bug: 33844934
Change-Id: Ide36b5470a393b5ed0f60fd37661dd50d0db817b
This commit is contained in:
Chris Phoenix
2017-01-23 13:59:13 -08:00
parent aadf1586a3
commit 5985dedba2
3 changed files with 6 additions and 6 deletions

View File

@@ -73,19 +73,19 @@ Return<void> Memtrack::getMemory(int32_t pid, MemtrackType type,
}
IMemtrack* HIDL_FETCH_IMemtrack(const char* name) {
IMemtrack* HIDL_FETCH_IMemtrack(const char* /* name */) {
const hw_module_t* hw_module = nullptr;
const memtrack_module_t* memtrack_module = nullptr;
int err = hw_get_module(name, &hw_module);
int err = hw_get_module(MEMTRACK_HARDWARE_MODULE_ID, &hw_module);
if (err) {
ALOGE ("hw_get_module %s failed: %d", name, err);
ALOGE ("hw_get_module %s failed: %d", MEMTRACK_HARDWARE_MODULE_ID, err);
return nullptr;
}
if (!hw_module->methods || !hw_module->methods->open) {
memtrack_module = reinterpret_cast<const memtrack_module_t*>(hw_module);
} else {
err = hw_module->methods->open(hw_module, name,
err = hw_module->methods->open(hw_module, MEMTRACK_HARDWARE_MODULE_ID,
reinterpret_cast<hw_device_t**>(const_cast<memtrack_module_t**>(&memtrack_module)));
if (err) {
ALOGE("Passthrough failed to load legacy HAL.");

View File

@@ -23,5 +23,5 @@ using android::hardware::memtrack::V1_0::IMemtrack;
using android::hardware::defaultPassthroughServiceImplementation;
int main() {
return defaultPassthroughServiceImplementation<IMemtrack>("memtrack");
return defaultPassthroughServiceImplementation<IMemtrack>();
}

View File

@@ -37,7 +37,7 @@ using std::count_if;
class MemtrackHidlTest : public ::testing::Test {
public:
virtual void SetUp() override {
memtrack = IMemtrack::getService("memtrack");
memtrack = IMemtrack::getService();
ASSERT_NE(memtrack, nullptr);
}