Skip to content
BigBro222's Blog
LinkedInGitHub

ADB Debug

Android1 min read

ADB Debug

This is a record for understanding some of the ADB command that could be useful for ADB debugging:

1adb connect 127.0.0.1: (Device portal)
2
3adb devices (check the current connection status)
4
5adb shell :use linux command for operation, after adb shell, we will be entering adb shell and operate as linux command(In Android shell , we can use "exit" command to exit)
6
7adb install [path]
8
9adb uninstall [package name]:

Package interaction

1adb shell pm list package (list all the package installed in the device)
2adb shell pm list packages -s (list all system package installed in the device)
3adb shell pm list package -3 (list all third-party package installed in the device)
4
5Explanation: use adb shell go to the inner linux system and call the pm function: which is the pm script inside the system/bin

Activity interaction

1To start the application, you will need to active the "start" activity to accomplish that.
2(Here activity refers to a component in Android development)(https://developer.android.com/guide/components/activities/intro-activities)
3
4adb shell am start -W -S [Package name]/[activity to start the application]
5adb shell am force-stop com.tenda.smarthome.app (force stop application)
6
7adb pull [Android path][Computer path] (Download Android file to PC)
8adb exec-out screencap -p > sc.png (ScreenShot to save on PC)
9adb shell screenrecord /sdcard/filename.mp4 (Screen recording, Ctrl+c can end the screen recording, default is 180s)
10
11adp push[Computer path][Android path] (Upload PC file to Android)

Open Current Activity interface

1adb shell dumpsys activity|findstr “mFocuse”
2
3adb shell monkey -p [package name] -v-v -v1
4
5 通过查看日志信息中,找到using开头的那一句,其中的activity名字就是启动界面
6
7adb 使用 sdk 中的aapt工具来进行apk包的解析

Input

1adb shell input text [content]
2
3adb shell input tap [x,y]
4
5adb shell input keyevent [keycode]
6
7adb shell input swipe [startingX startingY endX endY operationTime(s)] (Long press is simulated by a short-distance&long-duration press)
8adb shell input keyevent --longpress 26 (also long press event)
9
10By wrting these operation into a text and write as a bat file could implement a very simple auto test script!

Settings for Quest 2 : 16:9

1adb shell setprop debug.oculus.capture.width 1920
2adb shell setprop debug.oculus.capture.height 1080
3adb shell setprop debug.oculus.capture.bitrate 10000000
4adb shell setprop debug.oculus.foveation.level 0
5adb shell setprop debug.oculus.capture.fps 60

Detailed instructions:

  1. Download SideQuest and run it.

  2. Connect the headset to the computer.

  3. Allow permissions on the headset needed by the SideQuest

  4. In SideQuest click “ADB Commands” / "Custom commands"

  5. Run each of the following commands by typing them in one by one followed by clicking "run command" for each.

    THESE SETTINGS ARE FOR QUEST (1)

    1. adb shell setprop debug.oculus.capture.width 1280
    2. adb shell setprop debug.oculus.capture.height 720
    3. adb shell setprop debug.oculus.capture.bitrate 100000
    4. adb shell setprop debug.oculus.foveation.level 0
    5. adb shell setprop debug.oculus.capture.fps 60
    6. Then when recording the video as usual from within the quest, the video will be created using those settings - i.e. not squared etc.
  6. Now - I experienced the output from the above recommended commands to be pixelated. After testing it out for a bit these commands worked best for me:

    1. adb shell setprop debug.oculus.capture.width 1280
    2. adb shell setprop debug.oculus.capture.height 720
    3. adb shell setprop debug.oculus.capture.bitrate 5000000
    4. adb shell setprop debug.oculus.foveation.level 0
    5. adb shell setprop debug.oculus.capture.fps 60
  7. I did also try to use a higher resolution:

    1. adb shell setprop debug.oculus.capture.width 1920
    2. adb shell setprop debug.oculus.capture.height 1080
  8. NOTE: When the Quest is restarted the default settings will be automatically set so this would have to be done again.


Reference

https://developer.android.com/tools/adb

https://developer.android.com/guide/components/activities/intro-activities

https://www.cnblogs.com/lihongtaoya/p/17553171.html

https://hiyongz.github.io/posts/appium-adb/

How-to: Enable landscape screen recording & improve quality and resolution using ADB commands

TEST - Recording videos on quest with specific dimensions

© 2023 by BigBro222's Blog. All rights reserved.