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

Commit c1e7b635 authored by Felipe Leme's avatar Felipe Leme
Browse files

Use 'cmd activity' instead 'am' to send a broadcast.

'am' is a deprecated binary that calls the ActivityManager shell
command behind the scenes, so calling 'cmd activity' directly
eliminates a process fork.

Bug: 34833915
Test: manual verification

Change-Id: Ia156897d784aa1d64f60317f92828987d64936e3
parent a491a766
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -711,7 +711,8 @@ void Dumpstate::RunDumpsys(const std::string& title, const std::vector<std::stri
}

void send_broadcast(const std::string& action, const std::vector<std::string>& args) {
    std::vector<std::string> am = {"/system/bin/am", "broadcast", "--user", "0", "-a", action};
    std::vector<std::string> am = {
        "/system/bin/cmd", "activity", "broadcast", "--user", "0", "-a", action};

    am.insert(am.end(), args.begin(), args.end());