Loading policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java +8 −14 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,6 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick private IRemoteControlDisplayWeak mIRCD; private IRemoteControlDisplayWeak mIRCD; private boolean mMusicClientPresent = true; private boolean mMusicClientPresent = true; private boolean mShouldBeShown = true; private boolean mShouldBeShown = true; private boolean mAttachNotified = false; /** /** * The metadata which should be populated into the view once we've been attached * The metadata which should be populated into the view once we've been attached Loading Loading @@ -217,13 +216,13 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick protected void onListenerDetached() { protected void onListenerDetached() { mMusicClientPresent = false; mMusicClientPresent = false; if (DEBUG) Log.v(TAG, "onListenerDetached()"); if (DEBUG) Log.v(TAG, "onListenerDetached()"); callCallbackIfNeeded(); callAppropriateCallback(); } } private void onListenerAttached() { private void onListenerAttached() { mMusicClientPresent = true; mMusicClientPresent = true; if (DEBUG) Log.v(TAG, "onListenerAttached()"); if (DEBUG) Log.v(TAG, "onListenerAttached()"); callCallbackIfNeeded(); callAppropriateCallback(); } } private void updateSettings() { private void updateSettings() { Loading @@ -232,7 +231,7 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; if (DEBUG) Log.v(TAG, "updateSettings(): mShouldBeShown=" + mShouldBeShown); if (DEBUG) Log.v(TAG, "updateSettings(): mShouldBeShown=" + mShouldBeShown); if (oldShown != mShouldBeShown) { if (oldShown != mShouldBeShown) { callCallbackIfNeeded(); callAppropriateCallback(); if (mShouldBeShown && mMusicClientPresent if (mShouldBeShown && mMusicClientPresent && mCurrentPlayState != RemoteControlClient.PLAYSTATE_NONE) { && mCurrentPlayState != RemoteControlClient.PLAYSTATE_NONE) { // send out the play state change event that we suppressed earlier // send out the play state change event that we suppressed earlier Loading @@ -241,24 +240,19 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick } } } } private void callCallbackIfNeeded() { private void callAppropriateCallback() { if (mTransportCallback == null) { if (mTransportCallback == null) { Log.w(TAG, "callCallbackIfNeeded: no callback"); Log.w(TAG, "callAppropriateCallback: no callback"); return; return; } } boolean shouldBeAttached = mMusicClientPresent && mShouldBeShown; boolean shouldBeAttached = mMusicClientPresent && mShouldBeShown; if (DEBUG) { if (DEBUG) Log.v(TAG, "callAppropriateCallback(): shouldBeAttached=" + shouldBeAttached); Log.v(TAG, "callCallbackIfNeeded(): shouldBeAttached=" + shouldBeAttached + ", mAttachNotified=" + mAttachNotified); } if (shouldBeAttached && !mAttachNotified) { if (shouldBeAttached) { mTransportCallback.onListenerAttached(); mTransportCallback.onListenerAttached(); mAttachNotified = true; } else { } else if (!shouldBeAttached && mAttachNotified) { mTransportCallback.onListenerDetached(); mTransportCallback.onListenerDetached(); mAttachNotified = false; } } } } Loading Loading
policy/src/com/android/internal/policy/impl/keyguard/KeyguardTransportControlView.java +8 −14 Original line number Original line Diff line number Diff line Loading @@ -79,7 +79,6 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick private IRemoteControlDisplayWeak mIRCD; private IRemoteControlDisplayWeak mIRCD; private boolean mMusicClientPresent = true; private boolean mMusicClientPresent = true; private boolean mShouldBeShown = true; private boolean mShouldBeShown = true; private boolean mAttachNotified = false; /** /** * The metadata which should be populated into the view once we've been attached * The metadata which should be populated into the view once we've been attached Loading Loading @@ -217,13 +216,13 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick protected void onListenerDetached() { protected void onListenerDetached() { mMusicClientPresent = false; mMusicClientPresent = false; if (DEBUG) Log.v(TAG, "onListenerDetached()"); if (DEBUG) Log.v(TAG, "onListenerDetached()"); callCallbackIfNeeded(); callAppropriateCallback(); } } private void onListenerAttached() { private void onListenerAttached() { mMusicClientPresent = true; mMusicClientPresent = true; if (DEBUG) Log.v(TAG, "onListenerAttached()"); if (DEBUG) Log.v(TAG, "onListenerAttached()"); callCallbackIfNeeded(); callAppropriateCallback(); } } private void updateSettings() { private void updateSettings() { Loading @@ -232,7 +231,7 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; Settings.System.LOCKSCREEN_MUSIC_CONTROLS, 1, UserHandle.USER_CURRENT) != 0; if (DEBUG) Log.v(TAG, "updateSettings(): mShouldBeShown=" + mShouldBeShown); if (DEBUG) Log.v(TAG, "updateSettings(): mShouldBeShown=" + mShouldBeShown); if (oldShown != mShouldBeShown) { if (oldShown != mShouldBeShown) { callCallbackIfNeeded(); callAppropriateCallback(); if (mShouldBeShown && mMusicClientPresent if (mShouldBeShown && mMusicClientPresent && mCurrentPlayState != RemoteControlClient.PLAYSTATE_NONE) { && mCurrentPlayState != RemoteControlClient.PLAYSTATE_NONE) { // send out the play state change event that we suppressed earlier // send out the play state change event that we suppressed earlier Loading @@ -241,24 +240,19 @@ public class KeyguardTransportControlView extends FrameLayout implements OnClick } } } } private void callCallbackIfNeeded() { private void callAppropriateCallback() { if (mTransportCallback == null) { if (mTransportCallback == null) { Log.w(TAG, "callCallbackIfNeeded: no callback"); Log.w(TAG, "callAppropriateCallback: no callback"); return; return; } } boolean shouldBeAttached = mMusicClientPresent && mShouldBeShown; boolean shouldBeAttached = mMusicClientPresent && mShouldBeShown; if (DEBUG) { if (DEBUG) Log.v(TAG, "callAppropriateCallback(): shouldBeAttached=" + shouldBeAttached); Log.v(TAG, "callCallbackIfNeeded(): shouldBeAttached=" + shouldBeAttached + ", mAttachNotified=" + mAttachNotified); } if (shouldBeAttached && !mAttachNotified) { if (shouldBeAttached) { mTransportCallback.onListenerAttached(); mTransportCallback.onListenerAttached(); mAttachNotified = true; } else { } else if (!shouldBeAttached && mAttachNotified) { mTransportCallback.onListenerDetached(); mTransportCallback.onListenerDetached(); mAttachNotified = false; } } } } Loading