diff options
author | Lucas Gates <lucasgates@google.com> | 2022-08-01 20:06:47 +0000 |
---|---|---|
committer | Lucas Gates <lucasgates@google.com> | 2022-08-15 09:51:18 +0000 |
commit | df79eb31f11576ad837843ee3efad9ec97e949c3 (patch) | |
tree | c268b0524fcba6fa4d2677ba3ff405d7cd1a5032 /src/com/android | |
parent | 8bc84dfee5d8d70e80ceb79daed9b882ab84efc7 (diff) | |
download | TV-df79eb31f11576ad837843ee3efad9ec97e949c3.tar.gz |
LiveTv TIAS Integration Create manager and view
This CL begins the process of adding TIAS integration
into our LiveTv app by adding and initializing
TvInteractiveApp managers and views, as well as creating
callbacks to be filled out in future CLs.
Bug: 241110408
Test: Manual with Cuttlefish
Change-Id: Ia569048fb70565b68c93a7bc4c415055fe8d7140
Diffstat (limited to 'src/com/android')
-rw-r--r-- | src/com/android/tv/MainActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/tv/interactive/IAppManager.java | 120 |
2 files changed, 126 insertions, 0 deletions
diff --git a/src/com/android/tv/MainActivity.java b/src/com/android/tv/MainActivity.java index 8dbafe47..4eb38c68 100644 --- a/src/com/android/tv/MainActivity.java +++ b/src/com/android/tv/MainActivity.java @@ -115,6 +115,7 @@ import com.android.tv.dvr.ui.DvrStopRecordingFragment; import com.android.tv.dvr.ui.DvrUiHelper; import com.android.tv.features.TvFeatures; import com.android.tv.guide.ProgramItemView; +import com.android.tv.interactive.IAppManager; import com.android.tv.menu.Menu; import com.android.tv.onboarding.OnboardingActivity; import com.android.tv.parental.ContentRatingsManager; @@ -365,6 +366,8 @@ public class MainActivity extends Activity private String mLastInputIdFromIntent; + private IAppManager mIAppManager; + private final Handler mHandler = new MainActivityHandler(this); private final Set<OnActionClickListener> mOnActionClickListeners = new ArraySet<>(); @@ -732,6 +735,9 @@ public class MainActivity extends Activity mDvrConflictChecker = new ConflictChecker(this); } initForTest(); + if (TvFeatures.HAS_TIAF.isEnabled(this)) { + mIAppManager = new IAppManager(this); + } Debug.getTimer(Debug.TAG_START_UP_TIMER).log("MainActivity.onCreate end"); } diff --git a/src/com/android/tv/interactive/IAppManager.java b/src/com/android/tv/interactive/IAppManager.java new file mode 100644 index 00000000..b3061bc6 --- /dev/null +++ b/src/com/android/tv/interactive/IAppManager.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2022 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.tv.interactive; + +import android.annotation.TargetApi; +import android.graphics.Rect; +import android.media.tv.interactive.TvInteractiveAppManager; +import android.media.tv.interactive.TvInteractiveAppView; +import android.net.Uri; +import android.os.Build; +import android.os.Bundle; +import android.util.Log; + +import com.android.tv.MainActivity; +import com.android.tv.R; +import com.android.tv.common.SoftPreconditions; +import com.android.tv.features.TvFeatures; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +@TargetApi(Build.VERSION_CODES.TIRAMISU) +public class IAppManager { + private static final String TAG = "IAppManager"; + + private final MainActivity mMainActivity; + private final TvInteractiveAppManager mTvIAppManager; + private final TvInteractiveAppView mTvIAppView; + + public IAppManager(MainActivity parentActivity) { + SoftPreconditions.checkFeatureEnabled(parentActivity, TvFeatures.HAS_TIAF, TAG); + + mMainActivity = parentActivity; + mTvIAppManager = mMainActivity.getSystemService(TvInteractiveAppManager.class); + mTvIAppView = mMainActivity.findViewById(R.id.tv_app_view); + if (mTvIAppManager == null || mTvIAppView == null) { + Log.e(TAG, "Could not find interactive app view or manager"); + return; + } + + ExecutorService executor = Executors.newSingleThreadExecutor(); + mTvIAppManager.registerCallback( + executor, + new MyInteractiveAppManagerCallback() + ); + mTvIAppView.setCallback( + executor, + new MyInteractiveAppViewCallback() + ); + } + + private class MyInteractiveAppManagerCallback extends + TvInteractiveAppManager.TvInteractiveAppCallback { + @Override + public void onInteractiveAppServiceAdded(String iAppServiceId) {} + + @Override + public void onInteractiveAppServiceRemoved(String iAppServiceId) {} + + @Override + public void onInteractiveAppServiceUpdated(String iAppServiceId) {} + + @Override + public void onTvInteractiveAppServiceStateChanged(String iAppServiceId, int type, int state, + int err) {} + } + + private class MyInteractiveAppViewCallback extends + TvInteractiveAppView.TvInteractiveAppCallback { + @Override + public void onPlaybackCommandRequest(String iAppServiceId, String cmdType, + Bundle parameters) {} + + @Override + public void onStateChanged(String iAppServiceId, int state, int err) {} + + @Override + public void onBiInteractiveAppCreated(String iAppServiceId, Uri biIAppUri, + String biIAppId) {} + + @Override + public void onTeletextAppStateChanged(String iAppServiceId, int state) {} + + @Override + public void onSetVideoBounds(String iAppServiceId, Rect rect) {} + + @Override + public void onRequestCurrentChannelUri(String iAppServiceId) {} + + @Override + public void onRequestCurrentChannelLcn(String iAppServiceId) {} + + @Override + public void onRequestStreamVolume(String iAppServiceId) {} + + @Override + public void onRequestTrackInfoList(String iAppServiceId) {} + + @Override + public void onRequestCurrentTvInputId(String iAppServiceId) {} + + @Override + public void onRequestSigning(String iAppServiceId, String signingId, String algorithm, + String alias, byte[] data) {} + } +} |