diff options
-rw-r--r-- | cmds/atrace/Android.bp | 4 | ||||
-rw-r--r-- | cmds/atrace/atrace.cpp | 33 | ||||
-rw-r--r-- | cmds/atrace/atrace.rc | 2 | ||||
-rw-r--r-- | cmds/flatland/GLHelper.cpp | 1 |
4 files changed, 39 insertions, 1 deletions
diff --git a/cmds/atrace/Android.bp b/cmds/atrace/Android.bp index 194a5650c9..69ed416388 100644 --- a/cmds/atrace/Android.bp +++ b/cmds/atrace/Android.bp @@ -6,6 +6,10 @@ cc_binary { shared_libs: [ "libbinder", + "libhwbinder", + "android.hidl.manager@1.0", + "libhidlbase", + "libhidltransport", "liblog", "libcutils", "libutils", diff --git a/cmds/atrace/atrace.cpp b/cmds/atrace/atrace.cpp index 290d7a85a6..f6f337ca58 100644 --- a/cmds/atrace/atrace.cpp +++ b/cmds/atrace/atrace.cpp @@ -37,6 +37,8 @@ #include <binder/IServiceManager.h> #include <binder/Parcel.h> +#include <android/hidl/manager/1.0/IServiceManager.h> +#include <hidl/ServiceManagement.h> #include <cutils/properties.h> #include <utils/String8.h> @@ -47,6 +49,7 @@ using namespace android; +using std::string; #define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) #define MAX_SYS_FILES 10 @@ -505,6 +508,35 @@ static bool pokeBinderServices() 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::manager::V1_0::IServiceManager; + using ::android::hardware::IBinder; + using ::android::hardware::hidl_string; + using ::android::hardware::Parcel; + + Parcel data; + + sp<IServiceManager> sm = ::android::hardware::defaultServiceManager(); + 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); + 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); + }); + } + }); +} + // 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) @@ -747,6 +779,7 @@ static bool setUpTrace() } ok &= setAppCmdlineProperty(&packageList[0]); ok &= pokeBinderServices(); + pokeHalServices(); // Disable all the sysfs enables. This is done as a separate loop from // the enables to allow the same enable to exist in multiple categories. diff --git a/cmds/atrace/atrace.rc b/cmds/atrace/atrace.rc index e3cc9da5f3..747cc69282 100644 --- a/cmds/atrace/atrace.rc +++ b/cmds/atrace/atrace.rc @@ -1,6 +1,6 @@ ## Permissions to allow system-wide tracing to the kernel trace buffer. ## -on fs +on post-fs # Allow writing to the kernel trace log. chmod 0222 /sys/kernel/debug/tracing/trace_marker diff --git a/cmds/flatland/GLHelper.cpp b/cmds/flatland/GLHelper.cpp index ddf3aa8686..5c04f6cf19 100644 --- a/cmds/flatland/GLHelper.cpp +++ b/cmds/flatland/GLHelper.cpp @@ -365,6 +365,7 @@ static bool compileShaderLines(GLenum shaderType, const char* const* lines, if (!result) { fprintf(stderr, "Shader source:\n"); printShaderSource(lines); + delete[] src; return false; } delete[] src; |