Inspecting the exact Java/Kotlin class name of the currently focused foreground Android Activity is executed via ADB shell using WindowManager dumpsys logs.
ADB Dumpsys Commands
# 1. Get currently focused foreground window and Activity component
adb shell dumpsys window | grep -E "mCurrentFocus"
# 2. Get top resumed activity stack on Android 10+
adb shell dumpsys activity activities | grep -E "mResumedActivity"
Comments and corrections