I prefer parsing results of dumpsys window windows
over dumpsys activity
adb shell dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
Keyguard or Recent tasks list used to not show up as Activities but you were able to see them with mCurrentFocus
. I have explained why in this answer.