Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does 'adb shell start/stop' do?

Tags:

android

adb

Question

What do adb shell start and adb shell stop actually do?

Description

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).

Android Architecture

But what exact processes/services are started/stopped with these two commands?

like image 274
Cyker Avatar asked Nov 05 '12 04:11

Cyker


People also ask

What does adb shell do?

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.

How do I force quit an app using adb?

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).

What does adb reboot do?

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.

How do I disable adb shell?

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.


1 Answers

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.

like image 50
human.js Avatar answered Oct 08 '22 13:10

human.js