[Moto G Power Questions & Answers] jpurban:
I posted this to PowerAmp forums, but thought I'd post here too... Is anyone else having this issue?

Issue: Wired headset media controls do NOT function properly when screen is locked AND dark (off). Controls (generally) work fine when the phone screen is on (even if screen is locked).

I have attempted a wide variety of fixes, including a factory reset/flash of the phone, reinstalling Poweramp, various setting changes in Poweramp (keep notification, wakelock), allowing background app (battery optimization off), etc.

All is normal when the screen is not locked... Log below of a "pause" action followed by a "play" action when working as expected:

==================
11:04:48.413 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_DOWN name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34307806 playerState=1
==================
11:04:48.426 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_UP name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34307806 playerState=1
==================
11:04:49.036 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver pausePlaying
==================
11:04:51.839 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_DOWN name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34311245 playerState=2
==================
11:04:51.859 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying
==================
11:04:51.870 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_UP name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34311246 playerState=1

Things get crazy when taking the same "pause" and "play" actions once the power button is pressed to lock the screen (and turn it off). Button press/release is the same, but the subsequent actions are not:

==================
11:06:48.336 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_DOWN name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34427741 playerState=1
==================
11:06:48.343 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_UP name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34427741 playerState=1
==================
11:06:48.502 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:06:48.502 HeadsetPlugReceiver cmd_player_pause_playing
==================
11:06:48.966 PlayerService TOGGLE_PLAY_PAUSE
from PSMediaButtonReceiver resumePlaying
==================
11:06:50.996 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:06:50.996 HeadsetPlugReceiver cmd_player_pause_playing
==================
11:06:51.011 HeadsetPlugReceiver headset event
connection BT=false am mode=0
==================
11:06:54.704 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:06:55.775 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:06:55.903 HeadsetPlugReceiver headset event
connection BT=false am mode=0
==================
11:07:01.297 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_DOWN name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34440695 playerState=2
==================
11:07:01.366 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_UP name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34440695 playerState=2
==================
11:07:01.441 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:01.622 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying
==================
11:07:04.164 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:04.164 HeadsetPlugReceiver cmd_player_pause_playing
==================
11:07:04.173 HeadsetPlugReceiver headset event
connection BT=false am mode=0
==================
11:07:07.565 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:08.621 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:08.746 HeadsetPlugReceiver headset event
connection BT=false am mode=0
==================
11:07:14.606 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_DOWN name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34454018 playerState=2
==================
11:07:14.644 PSMediaButtonReceiver android.intent.action.MEDIA_BUTTON
KEYCODE_HEADSETHOOK ACTION_UP name=trinket-moto-snd-card Button Jack source=0x101 virt=false repeat=0 actionTime=34454018 playerState=2
==================
11:07:14.767 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:14.904 PlayerService RESUME
from PSMediaButtonReceiver resumePlaying
==================
11:07:17.269 HeadsetPlugReceiver headset event
disconnection BT=false am mode=0 no_keep_notif_on_dscn=false
==================
11:07:17.269 HeadsetPlugReceiver cmd_player_pause_playing
==================
11:07:17.280 HeadsetPlugReceiver headset event
connection BT=false am mode=0

This issue is happening on a new phone... a Moto G Power (2020) with Android 10

Version Info ======================
Build: v3-build-884-arm64-play full verified
Store: Play
Unlocker: build-302
Arch: 64
Skin: ActivityTheme_Black
Device: motorola moto g power sofia sofia sofia_retail [arm64-v8a, armeabi-v7a, armeabi]
Installer: com.android.vending (22.4.25-21 [0] [PR] 337959405)
Android: 10 motorola/sofia_retail/sofia:10/QPMS30.80-51-8/c3480:user/release-keys en_US

I don't think this is a bug particular to Poweramp. I confirmed the same behavior occurs in Pulsar.