Make ADB work for you

# Turn on the screen
adb shell input keyevent KEYCODE_POWER
# Enter the pass code
adb shell input text yourpasscode
# Press Enter
adb shell input keyevent KEYCODE_ENTER
alias ul=’adb shell input keyevent KEYCODE_POWER && adb shell input text mypasscode && adb shell input keyevent KEYCODE_ENTER’
#pull status bar
adb shell service call statusbar 1
#collapse status bar
adb shell service call statusbar 2
#open app : adb shell monkey -p packagename 1
Open gmail => adb shell monkey -p com.google.android.gm 1
#close app :adb shell am force-stop packagename
Close gmail => adb shell am force-stop com.google.android.gm
adb shell input tap x y 
Invokes a touch event at coordinates x,y on the screen
# dump the current screen ui
adb shell uiautomator dump
# copy the xml file to computer
adb pull sdcard/window_dump.xml ~/Desktop/
<node bounds=”[1090,98][1258,266]” checkable=”false” checked=”false” class=”android.widget.ImageButton” clickable=”true” content-desc=”Search” enabled=”true” focusable=”true” focused=”false” index=”1" long-clickable=”false” package=”com.google.android.apps.youtube.music” password=”false” resource-id=”com.google.android.apps.youtube.music:id/action_search_button” scrollable=”false” selected=”false” text=””/>
adb shell input tap 1090,98 triggers a tap on search icon
All coordinates are for Pixel 2 XL Device#click search music icon [on home page]
alias sm=’adb shell input tap 1090 98'
#click clear search icon [on search page]
alias cs=’adb shell input tap 1272 98'
#select first result from suggestions [on search page]
alias sf=’adb shell input tap 252 270'
#play first result [on search page]
alias pf=’adb shell input tap 0 668'
#play or pause [on song page]
alias pp=’adb shell input tap 622 2201'
#click next song icon [on song page]
alias ns=’adb shell input tap 881 2215'
#click prev song icon [on song page]
alias ps=’adb shell input tap 391 2215'
#Go to previous page [i..e emulate back key press]
alias gb='adb shell input keyevent KEYCODE_BACK'
#Search for a song [focus should be on search box already]
# Ex: ss songnamewithnospaces
ss(){
adb shell input text “$1”
}
#Change Device volume b/w level 0–25
#Ex, for setting volume to lev 16 : cv 16
cv(){
adb shell media volume — set “$1”
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store