in
Android
- 25 7月, 2015
デバッグで良く使うコマンド dumpsys編 その3 Activity
前回に引き続きdumpsysコマンドについて紹介します。
前回まではwindowに関する情報について書いてきましたが、今回はActivityに関する情報の取得方法や読み方を紹介します。
dumpsysでActivityの情報のみ取得する場合のコマンドは下記となります。
$ adb shell activity activities
上記のコマンドを実行すると下記のような情報を取得することが出来きます。
ACTIVITY MANAGER ACTIVITIES (dumpsys activity activities)
Stack #0:
Task id #1
* TaskRecord{b3fca690 #1 A=com.android.launcher U=0 sz=1}
numActivities=1 rootWasReset=false userId=0 mTaskType=1 numFullscreen=1 mOnTopOfHome=false
affinity=com.android.launcher
intent={act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/com.android.launcher2.Launcher}
realActivity=com.android.launcher/com.android.launcher2.Launcher
Activities=[ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}]
askedCompatMode=false
lastThumbnail=null lastDescription=null
lastActiveTime=111900 (inactive for 228s)
* Hist #0: ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}
packageName=com.android.launcher processName=com.android.launcher
launchedFromUid=0 launchedFromPackage=null userId=0
app=ProcessRecord{b3ff0b58 630:com.android.launcher/u0a8}
Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/com.android.launcher2.Launcher }
frontOfTask=true task=TaskRecord{b3fca690 #1 A=com.android.launcher U=0 sz=1}
taskAffinity=com.android.launcher
realActivity=com.android.launcher/com.android.launcher2.Launcher
baseDir=/system/priv-app/Launcher2.apk
dataDir=/data/user/0/com.android.launcher
stateNotNeeded=true componentSpecified=false mActivityType=1
compat={213dpi always-compat} labelRes=0x7f0d0000 icon=0x7f030001 theme=0x7f0e0001
config={1.0 310mcc260mnc en_US ldltr sw600dp w600dp h888dp 213dpi lrg port finger qwerty/v/v -nav/h s.5}
launchFailed=false launchCount=1 lastLaunchTime=-3m48s291ms
haveState=false icicle=null
state=RESUMED stopped=false delayedResume=false finishing=false
keysPaused=false inHistory=true visible=true sleeping=false idle=true
fullscreen=true noDisplay=false immersive=false launchMode=2
frozenBeforeDestroy=false thumbnailNeeded=false forceNewConfig=false
mActivityType=HOME_ACTIVITY_TYPE
thumbHolder: b3fca690 bm=null desc=null
waitingVisible=false nowVisible=true lastVisibleTime=-3m17s956ms
Running activities (most recent first):
TaskRecord{b3fca690 #1 A=com.android.launcher U=0 sz=1}
Run #0: ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}
mResumedActivity: ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}
mFocusedActivity: ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}
mDismissKeyguardOnNextActivity=false
mFocusedStack=null mStackState=STACK_STATE_HOME_IN_FRONT
mSleepTimeout=false
mCurTaskId=1
mUserStackInFront={}
Recent tasks:
* Recent #0: TaskRecord{b3fca690 #1 A=com.android.launcher U=0 sz=1}
numActivities=1 rootWasReset=false userId=0 mTaskType=1 numFullscreen=1 mOnTopOfHome=false
affinity=com.android.launcher
intent={act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/com.android.launcher2.Launcher}
realActivity=com.android.launcher/com.android.launcher2.Launcher
Activities=[ActivityRecord{b3e069e0 u0 com.android.launcher/com.android.launcher2.Launcher t1}]
askedCompatMode=false
lastThumbnail=null lastDescription=null
lastActiveTime=111900 (inactive for 228s)
上記ではActivityが一つしか起動していないためstackとtaskの情報が一つしかありませんが、複数のActivityが起動している場合はActivityがどのように重なっているか確認することが出来ます。
基本的にActivityの重なり方を確認するために上記を使用していますが、その他にも下記の情報利用することがあります。
・state:Activityのライフサイクルの状態を表します。
・config:ActvityのConfigurationを表します。
端末の向きや画面サイズ等がわかります。
・packageName:Activityのパッケージ名がわかります。
名前通りですが、パッケージ名が分かるとamコマンドで起動できるので確認することが多いです。
他にも有用な情報がありますが残りは次回紹介します。


