Skip to content

perform pinch and multi-point swipe based on uiautomator via adb shell debugging tool

Notifications You must be signed in to change notification settings

hma02/android_ui_test

Repository files navigation

Objective:

  • need a way to send adb shell command to android device to perform actions like zoom out (pinch close) and multi-point swipe gesture on screen
  • since no existing android broadcast for this purpose, so we need to build an app that can accepts adb instrument requests
  • the resulting actions performed in this way is way smoother than using third party apps, e.g., MacroDroid

Dependencies

How to Build

gradle wrapper
yes | sdkmanager --licenses
sdkmanager "platforms;android-33" "build-tools;34.0.0"
./gradlew build
bash build.sh

Pinch

  • Note: you need to identify the UI object resource_id in order to pinch, for example, when using an photos app, resource_id ="com.sec.android.gallery3d:id/photo_view"

  • if you don't know what is the resource_id, try locate it using below command

# below command is for finding out what ui to be pinched on, feed this output to chatGPT to let it figure out
/usr/bin/adb shell uiautomator dump /sdcard/ui.xml
/usr/bin/adb pull /sdcard/ui.xml .

About

perform pinch and multi-point swipe based on uiautomator via adb shell debugging tool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published