diff options
author | Florian Mayer <fmayer@google.com> | 2020-02-26 11:52:10 +0000 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2020-02-26 14:45:49 +0000 |
commit | e2811af2c48a001793e63bce409e6dc392848c67 (patch) | |
tree | b3b608f8b0bcfb5229b9364f512fd740d0f278a1 | |
parent | aa59a8b100c30c20e50a9cedd04d76b3610f0de3 (diff) | |
download | native-e2811af2c48a001793e63bce409e6dc392848c67.tar.gz |
Never send Binder / HIDL txn from atrace.
Test: atrace ss
atrace wm
sanity check output
Bug: 137366208
Change-Id: I98b6933db9b168ab290f04286535d1a109b59843
-rw-r--r-- | cmds/atrace/atrace.cpp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp index cf75bbab3b..544e26c666 100644 --- a/cmds/atrace/atrace.cpp +++ b/cmds/atrace/atrace.cpp @@ -571,81 +571,6 @@ static bool setPrintTgidEnableIfPresent(bool enable) return true; } -// Poke all the binder-enabled processes in the system to get them to re-read -// their system properties. -static bool pokeBinderServices() -{ - sp<IServiceManager> sm = defaultServiceManager(); - Vector<String16> services = sm->listServices(); - for (size_t i = 0; i < services.size(); i++) { - sp<IBinder> obj = sm->checkService(services[i]); - if (obj != nullptr) { - Parcel data; - if (obj->transact(IBinder::SYSPROPS_TRANSACTION, data, - nullptr, 0) != OK) { - if (false) { - // XXX: For some reason this fails on tablets trying to - // poke the "phone" service. It's not clear whether some - // are expected to fail. - String8 svc(services[i]); - fprintf(stderr, "error poking binder service %s\n", - svc.string()); - return false; - } - } - } - } - return true; -} - -// Poke all the HAL processes in the system to get them to re-read -// their system properties. -static void pokeHalServices() -{ - using ::android::hidl::base::V1_0::IBase; - using ::android::hidl::manager::V1_0::IServiceManager; - using ::android::hardware::hidl_string; - using ::android::hardware::Return; - - sp<IServiceManager> sm = ::android::hardware::defaultServiceManager(); - - if (sm == nullptr) { - fprintf(stderr, "failed to get IServiceManager to poke hal services\n"); - return; - } - - 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('/'); - if (n == std::string::npos || interfaces[i].size() == n+1) - continue; - hidl_string fqInterfaceName = fqInstanceName.substr(0, n); - hidl_string instanceName = fqInstanceName.substr(n+1, std::string::npos); - Return<sp<IBase>> interfaceRet = sm->get(fqInterfaceName, instanceName); - if (!interfaceRet.isOk()) { - // ignore - continue; - } - - sp<IBase> interface = interfaceRet; - if (interface == nullptr) { - // ignore - continue; - } - - auto notifyRet = interface->notifySyspropsChanged(); - if (!notifyRet.isOk()) { - // ignore - } - } - }); - if (!listRet.isOk()) { - // TODO(b/34242478) fix this when we determine the correct ACL - //fprintf(stderr, "failed to list services: %s\n", listRet.description().c_str()); - } -} - // Set the trace tags that userland tracing uses, and poke the running // processes to pick up the new value. static bool setTagsProperty(uint64_t tags) @@ -876,10 +801,6 @@ static bool setUpUserspaceTracing() } ok &= setAppCmdlineProperty(&packageList[0]); ok &= setTagsProperty(tags); -#if !ATRACE_SHMEM - ok &= pokeBinderServices(); - pokeHalServices(); -#endif if (g_tracePdx) { ok &= ServiceUtility::PokeServices(); } @@ -891,8 +812,6 @@ static void cleanUpUserspaceTracing() { setTagsProperty(0); clearAppProperties(); - pokeBinderServices(); - pokeHalServices(); if (g_tracePdx) { ServiceUtility::PokeServices(); |