What do adb shell start
and adb shell stop
actually do?
I think they call /system/bin/start
and /system/bin/stop
. But these two executables don't give any clue about what they do. When tested on a real device, I found the zygote process is started and stopped. So these two commands seem to control the Android runtime (which corresponds to the yellow and blue parts in the figure below).
But what exact processes/services are started/stopped with these two commands?
Android Shell Commands. ADB is Android Debug Bridge which is a command line utility included with Google's Android SDK. It provides a terminal interface to control your Android device connected to a computer using a USB. ADB can be used to run shell commands, transfer files, install/uninstall apps, reboot and more.
In Devices view you will find all running processes. Choose the process and click on Stop . It will kill only background process of an application. adb shell am kill [options] <PACKAGE> => Kill all processes associated with (the app's package name).
adb reboot is completely different in that it immediately restarts the device. It is also different from rebooting from the power menu because adb reboot doesn't close apps, disconnect from the cell towers, or show the shutdown animation, it immediately kills the device like a battery pull.
To exit adb and return to the system shell use the $q or $Q command. To stop the debugger press <Ctrl>D. NOTE: adb cannot be stopped by pressing the Quit or Interrupt key. adb ignores Quit; Interrupt is caught by adb and causes it to wait for a new command.
Basically, all your Android services are restarted; those that are created and registered in SystemServer.java
. This is called within the "Context of Zygote". So yes, Zygote is stopped.
All your services registered with ServiceManager
in Android will get removed within ServiceManager
. To restart them, do adb shell start
.
Also note that SystemServer
is started by Zygote, so init.rc
tells that if Zygote is stopped, then even SystemServer
must be stopped. Even SurfaceFlinger
dies, since it's started from SystemServer
but natively.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With