Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e77737f4 authored by Jim Miller's avatar Jim Miller Committed by Android Git Automerger
Browse files

am 2542fd54: am 00d4c946: Merge "Fix keyguard issue where an incoming SMS...

am 2542fd54: am 00d4c946: Merge "Fix keyguard issue where an incoming SMS would switch widget" into jb-mr2-dev

* commit '2542fd54':
  Fix keyguard issue where an incoming SMS would switch widget
parents 20914c6a 2542fd54
Loading
Loading
Loading
Loading
+15 −8
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@ public class KeyguardHostView extends KeyguardViewBase {

    private KeyguardMultiUserSelectorView mKeyguardMultiUserSelectorView;

    protected int mPlaybackState;
    protected int mClientGeneration;

    /*package*/ interface UserSwitcherCallback {
@@ -204,10 +203,9 @@ public class KeyguardHostView extends KeyguardViewBase {
                .getCachedDisplayClientState();
        mTransportState = (dcs.clearing ? TRANSPORT_GONE :
            (isMusicPlaying(dcs.playbackState) ? TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
        mPlaybackState = dcs.playbackState;

        if (DEBUG) Log.v(TAG, "Initial transport state: "
                + mTransportState + ", pbstate=" + mPlaybackState);
                + mTransportState + ", pbstate=" + dcs.playbackState);
    }

    private void cleanupAppWidgetIds() {
@@ -273,19 +271,28 @@ public class KeyguardHostView extends KeyguardViewBase {
                Log.v(TAG, (clearing ? "hide" : "show") + " transport, gen:" + clientGeneration);
            }
            mClientGeneration = clientGeneration;
            mTransportState = (clearing ? TRANSPORT_GONE : TRANSPORT_INVISIBLE);
            final int newState = (clearing ? TRANSPORT_GONE
                    : (mTransportState == TRANSPORT_VISIBLE ?
                    TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE));
            if (newState != mTransportState) {
                mTransportState = newState;
                if (DEBUGXPORT) Log.v(TAG, "update widget: transport state changed");
                KeyguardHostView.this.post(mSwitchPageRunnable);
            }
        }
        @Override
        public void onMusicPlaybackStateChanged(int playbackState, long eventTime) {
            mPlaybackState = playbackState;
            if (DEBUGXPORT) Log.v(TAG, "music state changed: " + playbackState);
            if (mTransportState != TRANSPORT_GONE) {
                mTransportState = (isMusicPlaying(mPlaybackState) ?
                final int newState = (isMusicPlaying(playbackState) ?
                        TRANSPORT_VISIBLE : TRANSPORT_INVISIBLE);
            }
                if (newState != mTransportState) {
                    mTransportState = newState;
                    if (DEBUGXPORT) Log.v(TAG, "update widget: play state changed");
                    KeyguardHostView.this.post(mSwitchPageRunnable);
                }
            }
        }
    };

    private static final boolean isMusicPlaying(int playbackState) {