summaryrefslogtreecommitdiffstats
path: root/cmds/dumpstate/dumpstate.c
diff options
context:
space:
mode:
Diffstat (limited to 'cmds/dumpstate/dumpstate.c')
-rw-r--r--cmds/dumpstate/dumpstate.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index dbe9832..89bea91 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -101,8 +101,14 @@ static void dumpstate() {
run_command("LIST OF OPEN FILES", 10, SU_PATH, "root", "lsof", NULL);
+ if (screenshot_path[0]) {
+ ALOGI("taking screenshot\n");
+ run_command(NULL, 10, "/system/bin/screencap", "-p", screenshot_path, NULL);
+ ALOGI("wrote screenshot: %s\n", screenshot_path);
+ }
+
for_each_pid(do_showmap, "SMAPS OF ALL PROCESSES");
- for_each_pid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS");
+ for_each_tid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS");
// dump_file("EVENT LOG TAGS", "/etc/event-log-tags");
run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL);
@@ -159,12 +165,6 @@ static void dumpstate() {
dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console");
dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads");
- if (screenshot_path[0]) {
- ALOGI("taking screenshot\n");
- run_command(NULL, 5, SU_PATH, "root", "screenshot", screenshot_path, NULL);
- ALOGI("wrote screenshot: %s\n", screenshot_path);
- }
-
run_command("SYSTEM SETTINGS", 20, SU_PATH, "root", "sqlite3",
"/data/data/com.android.providers.settings/databases/settings.db",
"pragma user_version; select * from system; select * from secure; select * from global;", NULL);
@@ -196,13 +196,13 @@ static void dumpstate() {
property_get("dhcp.wlan0.gateway", network, "");
if (network[0])
- run_command("PING GATEWAY", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
+ run_command("PING GATEWAY", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
property_get("dhcp.wlan0.dns1", network, "");
if (network[0])
- run_command("PING DNS1", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
+ run_command("PING DNS1", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
property_get("dhcp.wlan0.dns2", network, "");
if (network[0])
- run_command("PING DNS2", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL);
+ run_command("PING DNS2", 10, "ping", "-c", "3", "-i", ".5", network, NULL);
#ifdef FWDUMP_bcmdhd
run_command("DUMP WIFI STATUS", 20,
SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL);
@@ -216,7 +216,7 @@ static void dumpstate() {
run_command("VOLD DUMP", 10, "vdc", "dump", NULL);
run_command("SECURE CONTAINERS", 10, "vdc", "asec", "list", NULL);
- run_command("FILESYSTEMS & FREE SPACE", 10, SU_PATH, "root", "df", NULL);
+ run_command("FILESYSTEMS & FREE SPACE", 10, "df", NULL);
run_command("PACKAGE SETTINGS", 20, SU_PATH, "root", "cat", "/data/system/packages.xml", NULL);
dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt");
@@ -311,6 +311,7 @@ static void usage() {
" -b: play sound file instead of vibrate, at beginning of job\n"
" -e: play sound file instead of vibrate, at end of job\n"
" -q: disable vibrate\n"
+ " -B: send broadcast when finished (requires -o and -p)\n"
);
}
@@ -329,6 +330,7 @@ int main(int argc, char *argv[]) {
char* end_sound = 0;
int use_socket = 0;
int do_fb = 0;
+ int do_broadcast = 0;
if (getuid() != 0) {
// Old versions of the adb client would call the
@@ -356,7 +358,7 @@ int main(int argc, char *argv[]) {
dump_traces_path = dump_traces();
int c;
- while ((c = getopt(argc, argv, "b:de:ho:svqzp")) != -1) {
+ while ((c = getopt(argc, argv, "b:de:ho:svqzpB")) != -1) {
switch (c) {
case 'b': begin_sound = optarg; break;
case 'd': do_add_date = 1; break;
@@ -367,6 +369,7 @@ int main(int argc, char *argv[]) {
case 'q': do_vibrate = 0; break;
case 'z': do_compress = 6; break;
case 'p': do_fb = 1; break;
+ case 'B': do_broadcast = 1; break;
case '?': printf("\n");
case 'h':
usage();
@@ -482,6 +485,14 @@ int main(int argc, char *argv[]) {
fprintf(stderr, "rename(%s, %s): %s\n", tmp_path, path, strerror(errno));
}
+ if (do_broadcast && use_outfile && do_fb) {
+ run_command(NULL, 5, "/system/bin/am", "broadcast", "--user", "0",
+ "-a", "android.intent.action.BUGREPORT_FINISHED",
+ "--es", "android.intent.extra.BUGREPORT", path,
+ "--es", "android.intent.extra.SCREENSHOT", screenshot_path,
+ "--receiver-permission", "android.permission.DUMP", NULL);
+ }
+
ALOGI("done\n");
return 0;