summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorChulwoo Lee <chulwoo@google.com>2014-08-26 10:55:05 +0900
committerChulwoo Lee <chulwoo@google.com>2014-08-26 11:29:17 +0900
commit984d99b584b4d24c160a8725e1624c68ac70f122 (patch)
tree3a441f674ba35557a34260849258f865dd774d2a /media
parentad3fc407377597a23dd97cd92c72abaad1acca6c (diff)
downloadframeworks_base-984d99b584b4d24c160a8725e1624c68ac70f122.zip
frameworks_base-984d99b584b4d24c160a8725e1624c68ac70f122.tar.gz
frameworks_base-984d99b584b4d24c160a8725e1624c68ac70f122.tar.bz2
Fix checking trackId
BUG: 17261638 Change-Id: I141b7c9de1289c49f29d2f1e1ac534045abb333d
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/tv/TvInputManager.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/media/java/android/media/tv/TvInputManager.java b/media/java/android/media/tv/TvInputManager.java
index 45aa6d6..13937e2 100644
--- a/media/java/android/media/tv/TvInputManager.java
+++ b/media/java/android/media/tv/TvInputManager.java
@@ -1170,16 +1170,19 @@ public final class TvInputManager {
*/
public void selectTrack(int type, String trackId) {
if (type == TvTrackInfo.TYPE_AUDIO) {
- if (trackId != null && !mAudioTracks.contains(trackId)) {
+ if (trackId != null && !containsTrack(mAudioTracks, trackId)) {
Log.w(TAG, "Invalid audio trackId: " + trackId);
+ return;
}
} else if (type == TvTrackInfo.TYPE_VIDEO) {
- if (trackId != null && !mVideoTracks.contains(trackId)) {
+ if (trackId != null && !containsTrack(mVideoTracks, trackId)) {
Log.w(TAG, "Invalid video trackId: " + trackId);
+ return;
}
} else if (type == TvTrackInfo.TYPE_SUBTITLE) {
- if (trackId != null && !mSubtitleTracks.contains(trackId)) {
+ if (trackId != null && !containsTrack(mSubtitleTracks, trackId)) {
Log.w(TAG, "Invalid subtitle trackId: " + trackId);
+ return;
}
} else {
throw new IllegalArgumentException("invalid type: " + type);
@@ -1195,6 +1198,15 @@ public final class TvInputManager {
}
}
+ private boolean containsTrack(List<TvTrackInfo> tracks, String trackId) {
+ for (TvTrackInfo track : tracks) {
+ if (track.getId().equals(trackId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Returns the list of tracks for a given type. Returns {@code null} if the information is
* not available.