summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanny Baumann <dannybaumann@web.de>2013-07-12 09:51:53 +0200
committerDanny Baumann <dannybaumann@web.de>2013-07-12 09:51:53 +0200
commit780caff380fad5da59c72f8706932a8ae72520f3 (patch)
tree578aba2750328e8a652e056b0b1084e1b7d3cff7
parente5fd7135ae982590da670edefe691569684af82c (diff)
downloadframeworks_base-780caff380fad5da59c72f8706932a8ae72520f3.zip
frameworks_base-780caff380fad5da59c72f8706932a8ae72520f3.tar.gz
frameworks_base-780caff380fad5da59c72f8706932a8ae72520f3.tar.bz2
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
-rw-r--r--policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
index 20be303..b880d5f 100644
--- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
+++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java
@@ -382,8 +382,11 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick
}
public boolean isMusicPlaying() {
- return mCurrentPlayState == RemoteControlClient.PLAYSTATE_PLAYING
- || mCurrentPlayState == RemoteControlClient.PLAYSTATE_BUFFERING;
+ if (!mMusicClientPresent) {
+ return false;
+ }
+ return mCurrentPlayState == RemoteControlClient.PLAYSTATE_PLAYING
+ || mCurrentPlayState == RemoteControlClient.PLAYSTATE_BUFFERING;
}
private static void setVisibilityBasedOnFlag(View view, int flags, int flag) {