From f124707283c17728b79e2ca2b439fc78a7e303be Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Thu, 11 Feb 2021 19:31:48 +0000 Subject: [PATCH] Allow to target atrace apps by glob. Test: Run trace against "com.google.android.*" and use camera. Bug: 180021291 Change-Id: I9baa7847476b152284e7557e27f1eba1ee835695 --- libcutils/trace-dev.inc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcutils/trace-dev.inc b/libcutils/trace-dev.inc index 654342649..80205bc50 100644 --- a/libcutils/trace-dev.inc +++ b/libcutils/trace-dev.inc @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -116,7 +117,7 @@ static bool atrace_is_cmdline_match(const char* cmdline) for (int i = 0; i < count; i++) { snprintf(buf, sizeof(buf), "debug.atrace.app_%d", i); property_get(buf, value, ""); - if (strcmp(value, "*") == 0 || strcmp(value, cmdline) == 0) { + if (fnmatch(value, cmdline, FNM_NOESCAPE) == 0) { return true; } }