1. List your usb connected devices.
$ adb devices
or...
adb devices -l
2. List focused app package name:
adb shell dumpsys window windows | grep -E 'mFocusedApp'| cut -d / -f 1 | cut -d " " -f 7
Useful for creating a list of frequently used apps. Allowing you to recognize what is putting something unusual up on your phone and maybe head off a problem. I created this list with the above command and a bit of vi editing...
com.google.android.apps.messaging - text messaging
com.android.chrome - standard android web browser
com.google.android.apps.magazines - googles maddening "news" feed
com.google.android.keep - google note taker
com.google.android.dialer - manual dialer (call blocking)
com.motorola.camera2 - camera UI
com.google.android.googlequicksearchbox - weather?
com.google.android.gm - gmail
com.google.android.calendar - google calendar
com.google.android.projection.gearhead - android auto UI
com.google.android.contacts - contacts app
com.android.settings - settings
com.android.vending - android play store
us.zoom.videomeetings - zoom meetings
com.motorola.launcher3 - normal desktop launcher