aboutsummaryrefslogtreecommitdiff
path: root/src/com/android
diff options
context:
space:
mode:
authorDavid Zhao <qingxun@google.com>2022-10-20 14:30:43 -0700
committerDavid Zhao <qingxun@google.com>2022-10-24 15:03:21 -0700
commita6fc16acb1dd4dc4e663b33bcd43ede40a790b5b (patch)
tree69c26c76a073412206c6c8989c1b13e6bd035af2 /src/com/android
parentf43ec1dfbb2cf61e8f7db40dd9a14d64f62c0564 (diff)
downloadTV-a6fc16acb1dd4dc4e663b33bcd43ede40a790b5b.tar.gz
Add handling for selectTrack command
Bug: 241110408 Test: Cuttlefish manually Change-Id: I9192ae99e6381998f4deba6500ee5832ba7b52ca
Diffstat (limited to 'src/com/android')
-rw-r--r--src/com/android/tv/interactive/IAppManager.java23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/com/android/tv/interactive/IAppManager.java b/src/com/android/tv/interactive/IAppManager.java
index 7c8e04c8..29de5930 100644
--- a/src/com/android/tv/interactive/IAppManager.java
+++ b/src/com/android/tv/interactive/IAppManager.java
@@ -16,6 +16,9 @@
package com.android.tv.interactive;
+import static com.android.tv.util.CaptionSettings.OPTION_OFF;
+import static com.android.tv.util.CaptionSettings.OPTION_ON;
+
import android.annotation.TargetApi;
import android.graphics.Rect;
import android.media.tv.TvTrackInfo;
@@ -221,7 +224,25 @@ public class IAppManager {
}
break;
case TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_SELECT_TRACK:
- // TODO: Handle select track command
+ if (mTvView != null && parameters != null) {
+ int trackType = parameters.getInt(
+ TvInteractiveAppService.COMMAND_PARAMETER_KEY_TRACK_TYPE,
+ -1);
+ String trackId = parameters.getString(
+ TvInteractiveAppService.COMMAND_PARAMETER_KEY_TRACK_ID,
+ null);
+ switch (trackType) {
+ case TvTrackInfo.TYPE_AUDIO:
+ // When trackId is null, deselects current audio track.
+ mHandler.post(() -> mMainActivity.selectAudioTrack(trackId));
+ break;
+ case TvTrackInfo.TYPE_SUBTITLE:
+ // When trackId is null, turns off captions.
+ mHandler.post(() -> mMainActivity.selectSubtitleTrack(
+ trackId == null ? OPTION_OFF : OPTION_ON, trackId));
+ break;
+ }
+ }
break;
case TvInteractiveAppService.PLAYBACK_COMMAND_TYPE_SET_STREAM_VOLUME:
if (parameters == null) {