$ adb shell dumpsys activity activities | sed -En -e '/Stack #/p' -e '/Running activities/,/Run #0/p'
Stack #1:
Running activities (most recent first):
TaskRecord{c90e20c #265 A=com.hootsuite.droid.full U=0 sz=1}
Run #0: ActivityRecord{ec0802b u0 com.hootsuite.droid.full/.app.ui.DockingActivity t265}
Stack #0:
Running activities (most recent first):
TaskRecord{55974a7 #211 A=com.huawei.android.launcher U=0 sz=1}
Run #0: ActivityRecord{586f966 u0 com.huawei.android.launcher/.Launcher t211}
So, in above case, the app package is com.hootsuite.droid.full
and the main activity is .app.ui.DockingActivity
.
Hi there,
We can remove duplicates without losing the stack order using merge:
adb shell dumpsys activity activities | grep mActivityComponent | cut -d= -f2 | sort -u -m
Thank you @schrmh schrmh