While the other answer correctly states a way to force a (very) soft reboot, I'd like to add some in-depth details (which may not make sense to everyone :).
WHAT IS HOT / WARM REBOOT?
In order to answer your question we need to define what a hot (or warm) reboot is on an Android device. Terms cold (or hard) boot and warm (or soft) boot are more associated with PCs, particularly Windows. For mobile phones or embedded devices it's difficult to draw a clear line between cold and warm boot. In case of cold reboot, usually power is cut to CPUs, and also possibly to RAM and even to whole motherboard. Soft reboot only kills and starts the processes, while retaining power to hardware components. Power management is part of open-source ACPI/UEFI/BIOS standard on PCs while on phones PMIC firmware is usually used with SoCs.
HOW REBOOT WORKS ON ANDROID?
On (re)boot SoC firmware loads bootloaders in memory which then load executable binaries and start processes (actual OS). From my answer to What is the fastest way to shutdown un-rooted Android phone?: Android is based on Linux kernel - the very first executable of operating system which is run during boot process. Kernel initializes necessary hardware and prepares a basic environment before executing init
- the very first userspace process we can see. It's init
which then starts and takes care of all services and processes.
A civilized way to do reboot or shutdown is to let all processes terminate themselves saving any pending work, un-mount filesystems and then ask the kernel to reverse the boot process. init
can handle this on modern OSes or you can do manually through /proc/sysrq-trigger
interface. Or we can ask kernel to perform a quick reboot killing everything. However this may cause data loss, particularly due to filesystem corruption.
A brutal way is the long press of power button (handled by PMIC) which is a cold reboot (or shutdown) in true sense because the power to CPUs (and RAM) is suddenly cut without waiting for userspace processes and kernel to terminate gracefully.
DOES ANDROID PERFORM COLD REBOOT?
On Android phones (and on other systems as well) a normal reboot is not completely cold as power is not cut at least to RAM because it holds an area where kernel panic logs are stored which can be accessed on next boot (refer to ramoops
used for last_kmsg
or pstore
). See some more hints in bootloader boot reason specification. Similarly some other memory regions allocated to SoC components and signed firmware which are isolated from application processor (AP on which main OS runs) may also not be erased. They include Baseband Processor (modem), Digital Signal Processor (DSP), WiFi / BT module etc.
However a normal reboot isn't a warm reboot either. During reboot kernel kills itself and hands over the control to bootloader(s) which may boot device in different possible modes (fastboot/bootloader, recovery or normal boot). The low level details are vendor and hardware specific; if a device performs a complete power-on reset (PoR) or if the hardware is not reset at all. Which components are powered down during different types of reboots depends on the interaction between kernel, bootloader, SoC, PMIC, watchdog hardware etc.
HOW TO DO A HOT REBOOT?
Linux kernel also supports another form of warm reboot: kexec
. Kernel can terminate userspace processes and itself, executing a new kernel which then may start new userspace environment without doing hardware reset, POST and re-initialization by BIOS. See kexec-reboot for instance. However the new kernel has to consider that the hardware devices aren't reset, so they won't be in sane state. This approach is theoretically possible on Android too i.e. kernel re-executes itself with proper commandline and then starts init
. But it requires some device-specific changes to kernel and ROM. See an example use case of kexecboot
.
Stock Android doesn't provide soft reboot functionality but some custom ROMs implement this feature by triggering restart method of activity
service. This kills zygote
and its associated processes including wificond
, netd
, mediaserver
, cameraserver
, audioserver
and some vendor daemons. However init
itself and other core daemons like ueventd
, vold
, installd
, surfaceflinger
, logd
, servicemanager
, healthd
and a long list of vendor daemons aren't restarted.
ActivityManagerService.restart
requires android.permission.SET_ACTIVITY_WATCHER
and calls ActivityManagerService.shutdown
which requires android.permission.SHUTDOWN
. Both permissions have Protection Level signature
, so third party apps can't have them. adb shell
also doesn't have the SHUTDOWN
permission, so root is required.
On Android 9 code for restart
method is 179
, so to initiate a soft reboot:
~# service call activity 179
Or you can ask init
to restart zygote
and dependent services (SELinux won't let the property be set, so root is required):
~# setprop ctl.restart zygote
It's also possible to restart more init
services from comamndline, or change init
code to kill and start all userspace processes instead of calling kernel on reboot. It depends on your actual purpose of hot reboot.