Android shell指令應用

查看Android已安裝的package

pm list package

察看某個package的啟動用Activity

dumpsys package com.android.launcher

找到類似下面這段,其中粗體就是啟動用的Activity
      android.intent.action.MAIN:
        2cc5dc80 com.android.launcher/com.android.launcher2.Launcher filter 2cc2b7f8
          Action: "android.intent.action.MAIN"
          Category: "android.intent.category.LAUNCHER"

啟動APP的Activity

am start -n com.android.launcher/com.android.launcher2.Launcher
上面這個Launcher也就是Android桌面環境

啟動內建的Player播放某個URL的影音內容

am start -n com.android.gallery3d/com.android.gallery3d.app.MovieActivity -d http://10.11.13.14:8080/hls/test.m3u8

啟動內建的Browser

am start -n com.android.browser/.BrowserActivity

啟動Android設定頁面

am start -a android.settings.SETTINGS

察看使用容量

dumpsys diskstats
Latency: 1ms [512B Data Write]
Data-Free: 934860 K / 1015704 K total = 92% free
Cache-Free: 485316 K / 495944 K total = 97% free
System-Free: 372412 K / 793488 K total = 46% free

察看記憶體用量

dumpsys meminfo
dumpsys meminfo | grep "Total RAM: "
dumpsys meminfo | grep "Used RAM: "

或是Linux常用的
cat /proc/meminfo | grep "^MemTotal:"
cat /proc/meminfo | grep "^MemFree:"
cat /proc/meminfo | grep "^Cached:"

留言