summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-02-03 19:13:39 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-02-03 19:13:39 +0000
commit3f592af72905540ad78b2655707b515a7febc06e (patch)
tree45c637180679dd41c6993a841815d01df76841be
parent2721560ff6d931fb9321b6cb086fda3ee96245b8 (diff)
parent6d9db09a456950c168b10a8cddd6f2198206c710 (diff)
downloadextras-3f592af72905540ad78b2655707b515a7febc06e.tar.gz
Refactor property-watch optout logic am: 6d9db09a45
Change-Id: Icd801b4575116da024d4c3c118408ee8ecce76a2
-rw-r--r--toolchain-extras/profile-extras.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/toolchain-extras/profile-extras.cpp b/toolchain-extras/profile-extras.cpp
index f999a6b2..cdb19e8f 100644
--- a/toolchain-extras/profile-extras.cpp
+++ b/toolchain-extras/profile-extras.cpp
@@ -67,6 +67,18 @@ void *property_watch_loop(__unused void *arg) {
}
}
+#if defined(__ANDROID_API__) && __ANDROID_API__ >= __ANDROID_API_L__
+static char prop_watch_disabled_procs[][128] = {
+ "zygote",
+ "zygote32",
+ "app_process",
+ "app_process32",
+};
+
+static size_t prop_watch_num_disabled_procs = \
+ sizeof(prop_watch_disabled_procs) / sizeof(prop_watch_disabled_procs[0]);
+#endif
+
__attribute__((weak)) int init_profile_extras_once = 0;
// Initialize libprofile-extras:
@@ -98,11 +110,10 @@ __attribute__((constructor)) int init_profile_extras(void) {
// getprogname() was added.
#if defined(__ANDROID_API__) && __ANDROID_API__ >= __ANDROID_API_L__
const char *prog_basename = basename(getprogname());
- if (strncmp(prog_basename, "zygote", strlen("zygote")) == 0) {
- return 0;
- }
- if (strncmp(prog_basename, "app_process", strlen("app_process")) == 0) {
- return 0;
+ for (size_t i = 0; i < prop_watch_num_disabled_procs; i ++) {
+ if (strcmp(prog_basename, prop_watch_disabled_procs[i]) == 0) {
+ return 0;
+ }
}
#endif