Skip to content

Instantly share code, notes, and snippets.

@actuallymentor
Last active November 18, 2021 12:42
Show Gist options
  • Save actuallymentor/fc94af3194014f448caf53ae8030241e to your computer and use it in GitHub Desktop.
Save actuallymentor/fc94af3194014f448caf53ae8030241e to your computer and use it in GitHub Desktop.
Android Shell Commands (for use with Tasker or adb)
##
# These commands can all be run as Tasker shell commands, or through adb
# NOTE ON ROOT: I noticed many commands work through the adb shell, but fail in tasker unless using ROOT. If you tasks fail, try enabling root for it
##
## SETTING THINGS
# Enable deep doze
dumpsys deviceidle force-idle
# Disable doze
dumpsys deviceidle unforce
# Setting which radio fall under airplane mode
settings put global airplane_mode_radios cell,bluetooth,wifi,nfc,wimax
# Enable airplane mode
settings put global airplane_mode_on 1
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state true # root required
# Disable airplane mode
settings put global airplane_mode_on 0
am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false # root required
# Enable and disable wifi (useful since newer android versions give an error when enabling wifi in airplane mode)
# Errors I've gotten in the past: WiFi: enable failed, error 255 and error 1.
svc wifi enable # or disable
# Change CPU governor, first check what governors are available for your device and how many cores you have.
function setgov() {
echo $1 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $1 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo $1 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo $1 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
}
setgov "interactive/ondemand/conservative/powersave"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment