Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c30e3e7c authored by Felipe Leme's avatar Felipe Leme Committed by Android (Google) Code Review
Browse files

Merge "Send broadcasts as Shell." into nyc-dev

parents 5d9d711a d5e724a4
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1178,7 +1178,7 @@ int main(int argc, char *argv[]) {

        if (do_update_progress) {
            std::vector<std::string> am_args = {
                 "--receiver-permission", "android.permission.DUMP",
                 "--receiver-permission", "android.permission.DUMP", "--receiver-foreground",
                 "--es", "android.intent.extra.NAME", suffix,
                 "--ei", "android.intent.extra.PID", std::to_string(getpid()),
                 "--ei", "android.intent.extra.MAX", std::to_string(WEIGHT_TOTAL),
@@ -1239,8 +1239,8 @@ int main(int argc, char *argv[]) {
    if (version == VERSION_DUMPSYS_SPLIT) {
        // Invoking the following dumpsys calls before dump_traces() to try and
        // keep the system stats as close to its initial state as possible.
        run_command("DUMPSYS MEMINFO", 30, SU_PATH, "2000", "dumpsys", "meminfo", "-a", NULL);
        run_command("DUMPSYS CPUINFO", 30, SU_PATH, "2000", "dumpsys", "cpuinfo", "-a", NULL);
        run_command("DUMPSYS MEMINFO", 30, SU_PATH, "shell", "dumpsys", "meminfo", "-a", NULL);
        run_command("DUMPSYS CPUINFO", 30, SU_PATH, "shell", "dumpsys", "cpuinfo", "-a", NULL);
    }

    /* collect stack traces from Dalvik and native processes (needs root) */
+2 −2
Original line number Diff line number Diff line
@@ -705,9 +705,9 @@ void send_broadcast(const std::string& action, const std::vector<std::string>& a
        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();
    }