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

Commit c73571f5 authored by Steven Moreland's avatar Steven Moreland
Browse files

libbinder: waitForVintfService

Services in the VINTF interface are registered by type. This is a
convenient function to avoid needing to know and reproduce the format
when registering a service.

Bug: 136027762
Test: using the function
Change-Id: I2b2b10385525937e1b82c94858a13dafa0c4b1d2
parent 93711c8b
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -113,6 +113,13 @@ sp<INTERFACE> waitForDeclaredService(const String16& name) {
    return interface_cast<INTERFACE>(sm->waitForService(name));
}

template<typename INTERFACE>
sp<INTERFACE> waitForVintfService(
        const String16& instance = String16("default")) {
    return waitForDeclaredService<INTERFACE>(
        INTERFACE::descriptor + String16("/") + instance);
}

template<typename INTERFACE>
status_t getService(const String16& name, sp<INTERFACE>* outService)
{