alfataks/android_frameworks_base — pull request #21 by alfataks (2013-07-14 17:43:01+00:00)
Title: Fix occasionally flickering music control widget.

The problem was seemingly related to the player abandoning audio focus
while the playback state was still set to 'playing'. In that case, the
transport control was removed from the keyguard host because it had no
listener anymore, but later was re-added due to isMusicPlaying() still
returning true. Re-adding it lead to it re-registering with audio
service, which cleared the display due to nothing being connected, which
lead to the detachment listener being called again, which in turned
closed the loop.

While this may be a sign of a buggy player app (it should stop its
playback prior to abandoning audio focus), this situation still should
be handled gracefully. Fix the problem by simply reporting no music
being played while no remote control client is connected.

Change-Id: Id6834d38bc6faa3b6455ac66b413443f85606785