Send broadcasts as Shell.
The BUGREPORT_STARTED was being sent as root, which would cause it to
bypass Shell restrictions when DISALLOW_DEBUGGING_FEATURES is set.
Also added the missing --receiver-background and unhardcoded shell's uid
from previous changes.
BUG: 26814173
Change-Id: I867361efafb96c7e709f83806a9301afc637a27e
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index b301058..9d42939 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -705,9 +705,9 @@
fprintf(stderr, "send_broadcast: too many arguments (%d)\n", (int) args.size());
return;
}
- const char *am_args[1024] = { "/system/bin/am", "broadcast",
+ const char *am_args[1024] = { SU_PATH, "shell", "/system/bin/am", "broadcast",
"--user", "0", "-a", action.c_str() };
- size_t am_index = 5; // Starts at the index of last initial value above.
+ size_t am_index = 7; // Starts at the index of last initial value above.
for (const std::string& arg : args) {
am_args[++am_index] = arg.c_str();
}