Reboot Android Device without Using reboot Command

less than 1 minute read

When I am writing plugin for workload automation, I met a issue that execution will fail when I want to enter android recovery mode with:

self.target.execute('reboot recovery')

For this workload, a reboot is mandatory, I need to find another way to enter recovery mode, this question was answered in stackexchange, by using setprop or svc, I’ve tested the following commands on Android 8.1:

# Enter Recovery Mode
setprop sys.powerctl reboot,recovery
svc power reboot recovery

And below commands are put here as a memo, may be used some other day:

# Reboot Android Device
setprop sys.powerctl reboot
svc power reboot

# Shutdown Android Device
setprop sys.powerctl shutdown
svc power shutdown