summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2014-04-30 23:58:02 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-30 23:58:02 +0000
commit18bfd887f62391e21a85a58a7be2f3a05cc4f798 (patch)
treebeb7752f09d8420ae73d9186fa9bb7773462869e /media
parentf74b8a7738edeb69db746d15394a0be1b66bf134 (diff)
parent0d90876893c69a2e26867b775c76b45774c22390 (diff)
downloadframeworks_base-18bfd887f62391e21a85a58a7be2f3a05cc4f798.zip
frameworks_base-18bfd887f62391e21a85a58a7be2f3a05cc4f798.tar.gz
frameworks_base-18bfd887f62391e21a85a58a7be2f3a05cc4f798.tar.bz2
Merge "Fix MediaFocusControl index management for PlayerRecord"
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/MediaFocusControl.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/media/java/android/media/MediaFocusControl.java b/media/java/android/media/MediaFocusControl.java
index 2dea509..1c73c05 100644
--- a/media/java/android/media/MediaFocusControl.java
+++ b/media/java/android/media/MediaFocusControl.java
@@ -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
- mPRStack.add(lastPlayingIndex, prse);
+ 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
- mPRStack.add(lastPlayingIndex, prse);
+ if (inStackIndex > lastPlayingIndex) {
+ mPRStack.add(lastPlayingIndex, prse);
+ } else {
+ mPRStack.add(lastPlayingIndex - 1, prse);
+ }
}
}