Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5985dedb authored by Chris Phoenix's avatar Chris Phoenix
Browse files

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
parent aadf1586
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -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 hw_module_t* hw_module = nullptr;
    const memtrack_module_t* memtrack_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) {
    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;
        return nullptr;
    }
    }


    if (!hw_module->methods || !hw_module->methods->open) {
    if (!hw_module->methods || !hw_module->methods->open) {
        memtrack_module = reinterpret_cast<const memtrack_module_t*>(hw_module);
        memtrack_module = reinterpret_cast<const memtrack_module_t*>(hw_module);
    } else {
    } 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)));
                reinterpret_cast<hw_device_t**>(const_cast<memtrack_module_t**>(&memtrack_module)));
        if (err) {
        if (err) {
            ALOGE("Passthrough failed to load legacy HAL.");
            ALOGE("Passthrough failed to load legacy HAL.");
+1 −1
Original line number Original line Diff line number Diff line
@@ -23,5 +23,5 @@ using android::hardware::memtrack::V1_0::IMemtrack;
using android::hardware::defaultPassthroughServiceImplementation;
using android::hardware::defaultPassthroughServiceImplementation;


int main() {
int main() {
    return defaultPassthroughServiceImplementation<IMemtrack>("memtrack");
    return defaultPassthroughServiceImplementation<IMemtrack>();
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -37,7 +37,7 @@ using std::count_if;
class MemtrackHidlTest : public ::testing::Test {
class MemtrackHidlTest : public ::testing::Test {
 public:
 public:
  virtual void SetUp() override {
  virtual void SetUp() override {
    memtrack = IMemtrack::getService("memtrack");
    memtrack = IMemtrack::getService();
    ASSERT_NE(memtrack, nullptr);
    ASSERT_NE(memtrack, nullptr);
  }
  }