Skip to content

Commit

Permalink
toolbox: new applet restart
Browse files Browse the repository at this point in the history
- stop + start
- for the lazy.

Change-Id: Ie0ef0e27f5b7819a5575ece6b82c5813f4e38420
  • Loading branch information
chirayudesai authored and Steve Kondik committed Sep 3, 2016
1 parent 00b1b8d commit be285f5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions toolbox/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ OUR_TOOLS := \
newfs_msdos \
ps \
prlimit \
restart \
sendevent \
start \
stop \
Expand Down
27 changes: 27 additions & 0 deletions toolbox/restart.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include <cutils/properties.h>

int restart_main(int argc, char *argv[])
{
char buf[1024];

if(argc > 1) {
property_set("ctl.stop", argv[1]);
property_set("ctl.start", argv[1]);
} else {
/* defaults to stopping and starting the common services */
property_set("ctl.stop", "zygote_secondary");
property_set("ctl.stop", "zygote");
property_set("ctl.stop", "surfaceflinger");
property_set("ctl.stop", "netd");
property_set("ctl.start", "netd");
property_set("ctl.start", "surfaceflinger");
property_set("ctl.start", "zygote");
property_set("ctl.start", "zygote_secondary");
}

return 0;
}

0 comments on commit be285f5

Please sign in to comment.