diff options
author | Danny Baumann <dannybaumann@web.de> | 2013-07-11 10:02:18 +0200 |
---|---|---|
committer | Danny Baumann <dannybaumann@web.de> | 2013-07-11 10:05:08 +0200 |
commit | 6c8de14a2a43f330bfda0f7d0a1279a123c998d6 (patch) | |
tree | 74ef582cd89fbb1391f16f730f53c5f3e8ecae75 /policy | |
parent | c9141ca299a4df03c42f6f8a6745ba7d5d989c60 (diff) | |
download | frameworks_base-6c8de14a2a43f330bfda0f7d0a1279a123c998d6.zip frameworks_base-6c8de14a2a43f330bfda0f7d0a1279a123c998d6.tar.gz frameworks_base-6c8de14a2a43f330bfda0f7d0a1279a123c998d6.tar.bz2 |
Always call out to KeyguardHostView when something in our state changes.
KeyguardHostView already takes care to not add or remove the transport
control twice.
This should hopefully fix some conditions where the transport control
was still being shown although the media player already abandoned audio
focus.
Change-Id: Ib4577cdbfcea0a89efbbd0df70646afe8e677e0d
Diffstat (limited to 'policy')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java | 22 |
1 files changed, 8 insertions, 14 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 e8ee81e..20be303 100644 --- a/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java +++ b/policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java @@ -79,7 +79,6 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick private IRemoteControlDisplayWeak mIRCD; private boolean mMusicClientPresent = true; private boolean mShouldBeShown = true; - private boolean mAttachNotified = false; /** * The metadata which should be populated into the view once we've been attached @@ -217,13 +216,13 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick protected void onListenerDetached() { mMusicClientPresent = false; if (DEBUG) Log.v(TAG, "onListenerDetached()"); - callCallbackIfNeeded(); + callAppropriateCallback(); } private void onListenerAttached() { mMusicClientPresent = true; if (DEBUG) Log.v(TAG, "onListenerAttached()"); - callCallbackIfNeeded(); + callAppropriateCallback(); } private void updateSettings() { @@ -232,7 +231,7 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; if (DEBUG) Log.v(TAG, "updateSettings(): mShouldBeShown=" + mShouldBeShown); if (oldShown != mShouldBeShown) { - callCallbackIfNeeded(); + callAppropriateCallback(); if (mShouldBeShown && mMusicClientPresent && mCurrentPlayState != RemoteControlClient.PLAYSTATE_NONE) { // send out the play state change event that we suppressed earlier @@ -241,24 +240,19 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick } } - private void callCallbackIfNeeded() { + private void callAppropriateCallback() { if (mTransportCallback == null) { - Log.w(TAG, "callCallbackIfNeeded: no callback"); + Log.w(TAG, "callAppropriateCallback: no callback"); return; } boolean shouldBeAttached = mMusicClientPresent && mShouldBeShown; - if (DEBUG) { - Log.v(TAG, "callCallbackIfNeeded(): shouldBeAttached=" + shouldBeAttached + - ", mAttachNotified=" + mAttachNotified); - } + if (DEBUG) Log.v(TAG, "callAppropriateCallback(): shouldBeAttached=" + shouldBeAttached); - if (shouldBeAttached && !mAttachNotified) { + if (shouldBeAttached) { mTransportCallback.onListenerAttached(); - mAttachNotified = true; - } else if (!shouldBeAttached && mAttachNotified) { + } else { mTransportCallback.onListenerDetached(); - mAttachNotified = false; } } |