3

Sometimes I need to have my phone shut down as fast as possible. In older phones I was able to remove the battery, but after some "innovations" this feature is no longer present. Is there any better option than using casual shutdown and waiting for long seconds until it gets down? It is especially bad when I pour water on my phone and the touchscreen refuses to work.

I am using Xiaomo Pocophone F1 with Android 9.0.

4
  • Just to be clear, would a solution be acceptable which shutdown phone normally but without requiring touch input? (This would require root access though.) Power key can be setup to initiate that shutdown on long-press of X number of seconds. It is best if you mention the Android device and version you are using.
    – Firelord
    Aug 12, 2019 at 12:55
  • I would like to kill it instantly if possible. Long press of some key is usually too long to be considered "instant"
    – radrow
    Aug 12, 2019 at 13:12
  • You are missing the point. If touch fails to work, only volume or power button can be depended upon. You can either configure them to shutdown the phone on just one touch or on long-press. If configured for a single press you would lose original functionality from those buttons, so the choice is yours to make for the trade off because the OS cannot know automatically (unless some sensor is built to do that) that water has entered into the device.
    – Firelord
    Aug 12, 2019 at 14:13
  • just for fun: set MacroDroid to execute reboot -p on shake sensor as trigger. if your phone gets wet, just smash it down, it will immediately shut off (combination of all suggestions)
    – alecxs
    Aug 12, 2019 at 15:15

3 Answers 3

6
+100

In fact without removing battery it's not possible to shut down a device completely in order to avoid the loss that could possibly occur due to short circuit caused by water.

Let's have a brief look at what shut down means and what are possible options to achieve this.

HOW SHUTDOWN WORKS?
Android is based on Linux kernel which is 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. On shutdown, reverse of this happens.

INIT
When you tap Power Off from Power Menu, or when you issue reboot -p command from terminal app or adb, it sets Android property sys.powerctl to shutdown (with an optional reason for shutdown) which tells init it's time to save any unsaved work to persistent storage, stop all services and processes gracefully (or brutally), sync filesystem caches, un-mount filesystems and then hand over charge to kernel by making syscall reboot (ref). Kernel then makes sure all userspace processes are stopped including init, forcibly unmounts any stubborn filesystems and ultimately powers down hardware devices including CPUs and RAM.

Android's init supports two modes: shutdown and reboot. Linux init has some more shutdown options including halt and poweroff. See this answer for more details.

KERNEL
Most of the time during shut down is taken by init. In order to save time you can bypass init and ask kernel directly for a poweroff by making syscall:

reboot(LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2, LINUX_REBOOT_CMD_POWER_OFF)

That's what busybox poweroff -f command or the magic SysRq key O (equivalent to Alt-SysRq-O on a PC) would do (ref). Both should be preceded by sync to avoid damaging filesystems. From commandline we can do:

~# echo 1 >/proc/sys/kernel/sysrq 
~# echo s >/proc/sysrq-trigger
~# echo o >/proc/sysrq-trigger

This is the fastest way to shutdown OS on rooted device.

HARD REBOOT
But how to power down the device if even the kernel becomes non-responsive? Hardware can usually take care of this i.e. if you keep power button pressed for a fixed time interval. There's some hard-coded value (mostly 10 seconds) inside Power Management Unit (PMIC). No process will be stopped, no filesystem would be unmounted, no goodbye would be conveyed, just the power will be cut to CPU, RAM and other relevant hardware resources. Most SoCs (which have PMIC embedded inside) implement this as reboot, not shut down.


So to summarize the above lines, there are two ways to shutdown device: through init or calling kernel directly. Both can be achieved through simple shell commands or can be mapped to some hardware key or special key combination. But water can make any hardware key useless, so this method can't be a universal solution.


POWER BUTTON
But the point is, your device isn't fully powered off whichever path you have chosen. During boot process there are things which are powered up before the OS loads (and possibly be powered up even when there is no OS on device). There must be a circuitry in PMIC (e.g. a microcontroller in low-power mode and may be some software stack too) which is always powered up so than it can listen to your request for switching on the device when you press power button for a few seconds, or even when you connect a charger to device in powered-off state.

COMMUNICATION PROCESSOR
Also the baseband processor (BP) - which runs modem and is responsible for all communication through mobile networks e.g. call, SMS and internet - is totally isolated from Application Processor (the one we call CPU) and is not governed by Android kernel; it runs an independent RTOS. And as they say, government agencies may use it to track you even when you think your device is powered off. So it means it may possibly be (partially or fully or periodically) running when Android isn't running.


If nothing else, at least battery terminals are always live, connected to some part of motherboard which may get short when got wet. So if your device isn't water resistant and the battery doesn't have some short-circuit protection built-in, you can never be dead sure your device won't get damaged when water poured on it.

2
  • 1
    Thx! i watched all episodes of Mr. Robot but i didn't learn that NSA can hack baseband processor even when phone switched off! :) Now we know the reason for this "innovation" of non-removable batteries!
    – alecxs
    Aug 13, 2019 at 18:40
  • 2
    @alecxs baseband processors are one of overly closed-source products. Don't know what the dominant factor is. If the giants like Qualcomm are keeping backdoors or hiding their security vulnerabilities or don't want to put users' privacy at stake. Aug 13, 2019 at 19:09
1

You can shut down your device by holding

Volume Up + Power Button

simultaneously for several seconds.

0

If you continue to press the power key, it will shut down without confirmation. That takes yet a few more seconds but doesn't require the touchscreen in the event you've described.

p.s. Going on a tangent, I find that locking my screen and wiping it often works if a bit of water messes with the touch screen. But if it's drenched shutting it down would be better for the electronics.

1
  • In my case it reboots the phone
    – radrow
    Aug 12, 2019 at 12:30

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .