Merge "TIAF API review: Setup Interactive App session" into tm-dev

This commit is contained in:
Shubang Lu
2022-03-10 23:53:41 +00:00
committed by Android (Google) Code Review
3 changed files with 37 additions and 20 deletions

View File

@@ -26088,7 +26088,7 @@ package android.media.tv.interactive {
method @NonNull public java.util.List<android.media.tv.interactive.TvInteractiveAppInfo> getTvInteractiveAppServiceList();
method public void prepare(@NonNull String, int);
method public void registerAppLinkInfo(@NonNull String, @NonNull android.media.tv.interactive.AppLinkInfo);
method public void registerCallback(@NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback, @NonNull java.util.concurrent.Executor);
method public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback);
method public void sendAppLinkCommand(@NonNull String, @NonNull android.os.Bundle);
method public void unregisterAppLinkInfo(@NonNull String, @NonNull android.media.tv.interactive.AppLinkInfo);
method public void unregisterCallback(@NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback);
@@ -26158,10 +26158,10 @@ package android.media.tv.interactive {
public abstract static class TvInteractiveAppService.Session implements android.view.KeyEvent.Callback {
ctor public TvInteractiveAppService.Session(@NonNull android.content.Context);
method public void layoutSurface(int, int, int, int);
method public final void notifyBiInteractiveAppCreated(@NonNull android.net.Uri, @Nullable String);
method public void notifySessionStateChanged(int, int);
method public final void notifyTeletextAppStateChanged(int);
method @CallSuper public void layoutSurface(int, int, int, int);
method @CallSuper public final void notifyBiInteractiveAppCreated(@NonNull android.net.Uri, @Nullable String);
method @CallSuper public void notifySessionStateChanged(int, int);
method @CallSuper public final void notifyTeletextAppStateChanged(int);
method public void onAdResponse(@NonNull android.media.tv.AdResponse);
method public void onBroadcastInfoResponse(@NonNull android.media.tv.BroadcastInfoResponse);
method public void onContentAllowed();
@@ -26195,17 +26195,17 @@ package android.media.tv.interactive {
method public void onTuned(@NonNull android.net.Uri);
method public void onVideoAvailable();
method public void onVideoUnavailable(int);
method public void removeBroadcastInfo(int);
method public void requestAd(@NonNull android.media.tv.AdRequest);
method public void requestBroadcastInfo(@NonNull android.media.tv.BroadcastInfoRequest);
method public void requestCurrentChannelLcn();
method public void requestCurrentChannelUri();
method public void requestCurrentTvInputId();
method public void requestStreamVolume();
method public void requestTrackInfoList();
method public void sendPlaybackCommandRequest(@NonNull String, @Nullable android.os.Bundle);
method public void setMediaViewEnabled(boolean);
method public void setVideoBounds(@NonNull android.graphics.Rect);
method @CallSuper public void removeBroadcastInfo(int);
method @CallSuper public void requestAd(@NonNull android.media.tv.AdRequest);
method @CallSuper public void requestBroadcastInfo(@NonNull android.media.tv.BroadcastInfoRequest);
method @CallSuper public void requestCurrentChannelLcn();
method @CallSuper public void requestCurrentChannelUri();
method @CallSuper public void requestCurrentTvInputId();
method @CallSuper public void requestStreamVolume();
method @CallSuper public void requestTrackInfoList();
method @CallSuper public void sendPlaybackCommandRequest(@NonNull String, @Nullable android.os.Bundle);
method @CallSuper public void setMediaViewEnabled(boolean);
method @CallSuper public void setVideoBounds(@NonNull android.graphics.Rect);
}
public class TvInteractiveAppView extends android.view.ViewGroup {

View File

@@ -626,6 +626,7 @@ public final class TvInteractiveAppManager {
/**
* This is called when the state of the interactive app service is changed.
*
* @param iAppServiceId The ID of the TV Interactive App service.
* @param type the interactive app type
* @param state the current state of the service of the given type
* @param err the error code for error state. {@link #ERROR_NONE} is used when the state is
@@ -815,8 +816,8 @@ public final class TvInteractiveAppManager {
* @param executor A {@link Executor} that the status change will be delivered to.
*/
public void registerCallback(
@NonNull TvInteractiveAppCallback callback,
@CallbackExecutor @NonNull Executor executor) {
@CallbackExecutor @NonNull Executor executor,
@NonNull TvInteractiveAppCallback callback) {
Preconditions.checkNotNull(callback);
Preconditions.checkNotNull(executor);
synchronized (mLock) {

View File

@@ -16,6 +16,7 @@
package android.media.tv.interactive;
import android.annotation.CallSuper;
import android.annotation.MainThread;
import android.annotation.NonNull;
import android.annotation.Nullable;
@@ -351,6 +352,7 @@ public abstract class TvInteractiveAppService extends Service {
* @param enable {@code true} if you want to enable the media view. {@code false}
* otherwise.
*/
@CallSuper
public void setMediaViewEnabled(final boolean enable) {
mHandler.post(new Runnable() {
@Override
@@ -467,11 +469,11 @@ public abstract class TvInteractiveAppService extends Service {
* in {@link #onSetSurface}. This method is always called at least once, after
* {@link #onSetSurface} is called with non-null surface.
*
* @param format The new PixelFormat of the surface.
* @param format The new {@link PixelFormat} of the surface.
* @param width The new width of the surface.
* @param height The new height of the surface.
*/
public void onSurfaceChanged(int format, int width, int height) {
public void onSurfaceChanged(@PixelFormat.Format int format, int width, int height) {
}
/**
@@ -631,6 +633,7 @@ public abstract class TvInteractiveAppService extends Service {
* @param right Right position in pixels, relative to the overlay view.
* @param bottom Bottom position in pixels, relative to the overlay view.
*/
@CallSuper
public void layoutSurface(final int left, final int top, final int right,
final int bottom) {
if (left > right || top > bottom) {
@@ -659,6 +662,7 @@ public abstract class TvInteractiveAppService extends Service {
* Requests broadcast related information from the related TV input.
* @param request the request for broadcast info
*/
@CallSuper
public void requestBroadcastInfo(@NonNull final BroadcastInfoRequest request) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -683,6 +687,7 @@ public abstract class TvInteractiveAppService extends Service {
* Remove broadcast information request from the related TV input.
* @param requestId the ID of the request
*/
@CallSuper
public void removeBroadcastInfo(final int requestId) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -709,6 +714,7 @@ public abstract class TvInteractiveAppService extends Service {
* @param cmdType type of the specific command
* @param parameters parameters of the specific command
*/
@CallSuper
public void sendPlaybackCommandRequest(
@PlaybackCommandType @NonNull String cmdType, @Nullable Bundle parameters) {
executeOrPostRunnableOnMainThread(new Runnable() {
@@ -733,6 +739,7 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Sets broadcast video bounds.
*/
@CallSuper
public void setVideoBounds(@NonNull Rect rect) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -755,6 +762,7 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Requests the URI of the current channel.
*/
@CallSuper
public void requestCurrentChannelUri() {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -777,6 +785,7 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Requests the logic channel number (LCN) of the current channel.
*/
@CallSuper
public void requestCurrentChannelLcn() {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -799,6 +808,7 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Requests stream volume.
*/
@CallSuper
public void requestStreamVolume() {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -821,6 +831,7 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Requests the list of {@link TvTrackInfo}.
*/
@CallSuper
public void requestTrackInfoList() {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -845,6 +856,7 @@ public abstract class TvInteractiveAppService extends Service {
*
* @see android.media.tv.TvInputInfo
*/
@CallSuper
public void requestCurrentTvInputId() {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -869,6 +881,7 @@ public abstract class TvInteractiveAppService extends Service {
*
* @param request The advertisement request
*/
@CallSuper
public void requestAd(@NonNull final AdRequest request) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@@ -1032,6 +1045,7 @@ public abstract class TvInteractiveAppService extends Service {
* used when the state is not
* {@link TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR}.
*/
@CallSuper
public void notifySessionStateChanged(
@TvInteractiveAppManager.InteractiveAppState int state,
@TvInteractiveAppManager.ErrorCode int err) {
@@ -1062,6 +1076,7 @@ public abstract class TvInteractiveAppService extends Service {
*
* @see #onCreateBiInteractiveApp(Uri, Bundle)
*/
@CallSuper
public final void notifyBiInteractiveAppCreated(
@NonNull Uri biIAppUri, @Nullable String biIAppId) {
executeOrPostRunnableOnMainThread(new Runnable() {
@@ -1087,6 +1102,7 @@ public abstract class TvInteractiveAppService extends Service {
* Notifies when the digital teletext app state is changed.
* @param state the current state.
*/
@CallSuper
public final void notifyTeletextAppStateChanged(
@TvInteractiveAppManager.TeletextAppState int state) {
executeOrPostRunnableOnMainThread(new Runnable() {