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

Commit 18bfd887 authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "Fix MediaFocusControl index management for PlayerRecord"

parents f74b8a77 0d908768
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -1250,8 +1250,6 @@ public class MediaFocusControl implements OnFinished {
                }
                if (prse.hasMatchingMediaButtonIntent(mediaIntent)) {
                    inStackIndex = index;
                    // found it, ok to stop here
                    break;
                }
            }

@@ -1272,7 +1270,11 @@ public class MediaFocusControl implements OnFinished {
                        mPRStack.push(prse);
                    } else {
                        // and put it after the ones with active playback
                        if (inStackIndex > lastPlayingIndex) {
                            mPRStack.add(lastPlayingIndex, prse);
                        } else {
                            mPRStack.add(lastPlayingIndex - 1, prse);
                        }
                    }
                }
            }
@@ -2151,13 +2153,13 @@ public class MediaFocusControl implements OnFinished {
                // of this RemoteControlClient (note that it may not be in the stack)
                for (int index = mPRStack.size()-1; index >= 0; index--) {
                    prse = mPRStack.elementAt(index);
                    if (prse.isPlaybackActive()) {
                        lastPlayingIndex = index;
                    }
                    if (prse.getRccId() == rccId) {
                        inStackIndex = index;
                        prse.mPlaybackState = newState;
                    }
                    if (prse.isPlaybackActive()) {
                        lastPlayingIndex = index;
                    }
                }

                if (inStackIndex != -1) {
@@ -2177,7 +2179,11 @@ public class MediaFocusControl implements OnFinished {
                            mPRStack.push(prse);
                        } else {
                            // and put it after the ones with active playback
                            if (inStackIndex > lastPlayingIndex) {
                                mPRStack.add(lastPlayingIndex, prse);
                            } else {
                                mPRStack.add(lastPlayingIndex - 1, prse);
                            }
                        }
                    }