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

Commit aa51c8c5 authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "Check for errors for IServiceManager::get and list."

am: a09202e9

Change-Id: I530107b1067810c4107cf22f4408d910190c9f7b
parents 83f8bba2 a09202e9
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -521,7 +521,7 @@ static void pokeHalServices()
    Parcel data;

    sp<IServiceManager> sm = ::android::hardware::defaultServiceManager();
    sm->list([&](const auto &interfaces) {
    auto listRet = sm->list([&](const auto &interfaces) {
        for (size_t i = 0; i < interfaces.size(); i++) {
            string fqInstanceName = interfaces[i];
            string::size_type n = fqInstanceName.find("/");
@@ -529,13 +529,21 @@ static void pokeHalServices()
                continue;
            hidl_string fqInterfaceName = fqInstanceName.substr(0, n);
            hidl_string instanceName = fqInstanceName.substr(n+1, std::string::npos);
            sm->get(fqInterfaceName, instanceName, [&](const auto &interface) {
            auto getRet = sm->get(fqInterfaceName, instanceName, [&](const auto &interface) {
                // TODO(b/32756130)
                // Once IServiceManager returns IBase, use interface->notifySyspropsChanged() here
                interface->transact(IBinder::SYSPROPS_TRANSACTION, data, nullptr, 0, nullptr);
            });
            if (!getRet.isOk()) {
                fprintf(stderr, "failed to get service %s: %s\n",
                        fqInstanceName.c_str(),
                        getRet.getStatus().toString8().string());
            }
        }
    });
    if (!listRet.isOk()) {
        fprintf(stderr, "failed to list services: %s\n", listRet.getStatus().toString8().string());
    }
}

// Set the trace tags that userland tracing uses, and poke the running