TIAF: unhide APIs of setup session use case

Sequence diagram of the use case:
https://screenshot.googleplex.com/4qAsMgdCD6itwWj.png

Bug: 208651889
Test: atest android.media.tv.interactive.cts.TvInteractiveAppServiceTest
Change-Id: I89a2d7c00256669be74cf891ed9bdea2b41b8309
This commit is contained in:
shubang
2022-01-12 01:11:07 -08:00
parent f267dc1655
commit 18359310db
7 changed files with 75 additions and 42 deletions

View File

@@ -26177,6 +26177,15 @@ package android.media.session {
package android.media.tv {
public final class AitInfo implements android.os.Parcelable {
ctor public AitInfo(int, int);
method public int describeContents();
method public int getType();
method public int getVersion();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.AitInfo> CREATOR;
}
public final class TvContentRating {
method public boolean contains(@NonNull android.media.tv.TvContentRating);
method public static android.media.tv.TvContentRating createRating(String, String, String, java.lang.String...);
@@ -26747,6 +26756,7 @@ package android.media.tv {
public abstract static class TvInputService.Session implements android.view.KeyEvent.Callback {
ctor public TvInputService.Session(android.content.Context);
method public void layoutSurface(int, int, int, int);
method public void notifyAitInfoUpdated(@NonNull android.media.tv.AitInfo);
method public void notifyChannelRetuned(android.net.Uri);
method public void notifyContentAllowed();
method public void notifyContentBlocked(@NonNull android.media.tv.TvContentRating);
@@ -26766,6 +26776,7 @@ package android.media.tv {
method public abstract void onRelease();
method public boolean onSelectTrack(int, @Nullable String);
method public abstract void onSetCaptionEnabled(boolean);
method public void onSetInteractiveAppNotificationEnabled(boolean);
method public abstract void onSetStreamVolume(@FloatRange(from=0.0, to=1.0) float);
method public abstract boolean onSetSurface(@Nullable android.view.Surface);
method public void onSurfaceChanged(int, int, int);
@@ -26867,6 +26878,7 @@ package android.media.tv {
method public void sendAppPrivateCommand(@NonNull String, android.os.Bundle);
method public void setCallback(@Nullable android.media.tv.TvView.TvInputCallback);
method public void setCaptionEnabled(boolean);
method public void setInteractiveAppNotificationEnabled(boolean);
method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener);
method public void setStreamVolume(@FloatRange(from=0.0, to=1.0) float);
method public void setTimeShiftPositionCallback(@Nullable android.media.tv.TvView.TimeShiftPositionCallback);
@@ -26893,6 +26905,7 @@ package android.media.tv {
public abstract static class TvView.TvInputCallback {
ctor public TvView.TvInputCallback();
method public void onAitInfoUpdated(@NonNull String, @NonNull android.media.tv.AitInfo);
method public void onChannelRetuned(String, android.net.Uri);
method public void onConnectionFailed(String);
method public void onContentAllowed(String);
@@ -26925,26 +26938,69 @@ package android.media.tv.interactive {
public final class TvInteractiveAppManager {
method @NonNull public java.util.List<android.media.tv.interactive.TvInteractiveAppInfo> getTvInteractiveAppServiceList();
method public void registerCallback(@NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback, @NonNull java.util.concurrent.Executor);
method public void unregisterCallback(@NonNull android.media.tv.interactive.TvInteractiveAppManager.TvInteractiveAppCallback);
field public static final int ERROR_BLOCKED = 5; // 0x5
field public static final int ERROR_ENCRYPTED = 6; // 0x6
field public static final int ERROR_NONE = 0; // 0x0
field public static final int ERROR_NOT_SUPPORTED = 2; // 0x2
field public static final int ERROR_RESOURCE_UNAVAILABLE = 4; // 0x4
field public static final int ERROR_UNKNOWN = 1; // 0x1
field public static final int ERROR_UNKNOWN_CHANNEL = 7; // 0x7
field public static final int ERROR_WEAK_SIGNAL = 3; // 0x3
field public static final int INTERACTIVE_APP_STATE_ERROR = 3; // 0x3
field public static final int INTERACTIVE_APP_STATE_RUNNING = 2; // 0x2
field public static final int INTERACTIVE_APP_STATE_STOPPED = 1; // 0x1
field public static final int SERVICE_STATE_ERROR = 4; // 0x4
field public static final int SERVICE_STATE_PREPARING = 2; // 0x2
field public static final int SERVICE_STATE_READY = 3; // 0x3
field public static final int SERVICE_STATE_UNREALIZED = 1; // 0x1
}
public abstract static class TvInteractiveAppManager.TvInteractiveAppCallback {
ctor public TvInteractiveAppManager.TvInteractiveAppCallback();
method public void onTvInteractiveAppServiceStateChanged(@NonNull String, int, int, int);
}
public abstract class TvInteractiveAppService extends android.app.Service {
ctor public TvInteractiveAppService();
method public final void notifyStateChanged(int, int, int);
method public final android.os.IBinder onBind(android.content.Intent);
method @Nullable public abstract android.media.tv.interactive.TvInteractiveAppService.Session onCreateSession(@NonNull String, int);
method public abstract void onPrepare(int);
field public static final String SERVICE_INTERFACE = "android.media.tv.interactive.TvInteractiveAppService";
field public static final String SERVICE_META_DATA = "android.media.tv.interactive.app";
}
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 void notifySessionStateChanged(int, int);
method public boolean onKeyDown(int, @NonNull android.view.KeyEvent);
method public boolean onKeyLongPress(int, @NonNull android.view.KeyEvent);
method public boolean onKeyMultiple(int, int, @NonNull android.view.KeyEvent);
method public boolean onKeyUp(int, @NonNull android.view.KeyEvent);
method public abstract boolean onSetSurface(@Nullable android.view.Surface);
method public void onStartInteractiveApp();
method public void onStopInteractiveApp();
method public void onSurfaceChanged(int, int, int);
}
public class TvInteractiveAppView extends android.view.ViewGroup {
ctor public TvInteractiveAppView(@NonNull android.content.Context);
ctor public TvInteractiveAppView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
ctor public TvInteractiveAppView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int);
method public void clearCallback();
method public void prepareInteractiveApp(@NonNull String, int);
method public void setCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppView.TvInteractiveAppCallback);
method public int setTvView(@Nullable android.media.tv.TvView);
method public void startInteractiveApp();
method public void stopInteractiveApp();
}
public abstract static class TvInteractiveAppView.TvInteractiveAppCallback {
ctor public TvInteractiveAppView.TvInteractiveAppCallback();
method public void onStateChanged(@NonNull String, int, int);
}
}

View File

@@ -23,7 +23,6 @@ import android.os.Parcelable;
/**
* AIT (Application Information Table) info.
* @hide
*/
public final class AitInfo implements Parcelable {
static final String TAG = "AitInfo";

View File

@@ -947,12 +947,11 @@ public abstract class TvInputService extends Service {
/**
* Informs the app that the AIT (Application Information Table) is updated.
*
* <p>This method should also be call when
* <p>This method should also be called when
* {@link #onSetInteractiveAppNotificationEnabled(boolean)} is called to send the first AIT
* info.
*
* @see #onSetInteractiveAppNotificationEnabled(boolean)
* @hide
*/
public void notifyAitInfoUpdated(@NonNull final AitInfo aitInfo) {
executeOrPostRunnableOnMainThread(new Runnable() {
@@ -1214,7 +1213,6 @@ public abstract class TvInputService extends Service {
*
* @see TvView#setInteractiveAppNotificationEnabled(boolean)
* @see Session#notifyAitInfoUpdated(android.media.tv.AitInfo)
* @hide
*/
public void onSetInteractiveAppNotificationEnabled(boolean enabled) {
}

View File

@@ -493,7 +493,6 @@ public class TvView extends ViewGroup {
*
* @see TvInputService.Session#notifyAitInfoUpdated(android.media.tv.AitInfo)
* @see android.media.tv.interactive.TvInteractiveAppView#setTvView(TvView)
* @hide
*/
public void setInteractiveAppNotificationEnabled(boolean enabled) {
if (mSession != null) {
@@ -1074,7 +1073,6 @@ public class TvView extends ViewGroup {
* This is called when the AIT (Application Information Table) info has been updated.
*
* @param aitInfo The current AIT info.
* @hide
*/
public void onAitInfoUpdated(@NonNull String inputId, @NonNull AitInfo aitInfo) {
}

View File

@@ -57,7 +57,7 @@ import java.util.concurrent.Executor;
/**
* Central system API to the overall TV interactive application framework (TIAF) architecture, which
* arbitrates interaction between applications and interactive apps.
* arbitrates interaction between Android applications and TV interactive apps.
*/
@SystemService(Context.TV_INTERACTIVE_APP_SERVICE)
public final class TvInteractiveAppManager {
@@ -75,22 +75,22 @@ public final class TvInteractiveAppManager {
/**
* Unrealized state of interactive app service.
* @hide
*/
public static final int SERVICE_STATE_UNREALIZED = 1;
/**
* Preparing state of interactive app service.
* @hide
*/
public static final int SERVICE_STATE_PREPARING = 2;
/**
* Ready state of interactive app service.
* @hide
*
* <p>In this state, the interactive app service is ready, and interactive apps can be started.
*
* @see TvInteractiveAppView#startInteractiveApp()
*/
public static final int SERVICE_STATE_READY = 3;
/**
* Error state of interactive app service.
* @hide
*/
public static final int SERVICE_STATE_ERROR = 4;
@@ -105,17 +105,14 @@ public final class TvInteractiveAppManager {
/**
* Stopped (or not started) state of interactive application.
* @hide
*/
public static final int INTERACTIVE_APP_STATE_STOPPED = 1;
/**
* Running state of interactive application.
* @hide
*/
public static final int INTERACTIVE_APP_STATE_RUNNING = 2;
/**
* Error state of interactive application.
* @hide
*/
public static final int INTERACTIVE_APP_STATE_ERROR = 3;
@@ -136,46 +133,37 @@ public final class TvInteractiveAppManager {
/**
* No error.
* @hide
*/
public static final int ERROR_NONE = 0;
/**
* Unknown error code.
* @hide
*/
public static final int ERROR_UNKNOWN = 1;
/**
* Error code for an unsupported channel.
* @hide
*/
public static final int ERROR_NOT_SUPPORTED = 2;
/**
* Error code for weak signal.
* @hide
*/
public static final int ERROR_WEAK_SIGNAL = 3;
/**
* Error code when resource (e.g. tuner) is unavailable.
* @hide
*/
public static final int ERROR_RESOURCE_UNAVAILABLE = 4;
/**
* Error code for blocked contents.
* @hide
*/
public static final int ERROR_BLOCKED = 5;
/**
* Error code when the key or module is missing for the encrypted channel.
* @hide
*/
public static final int ERROR_ENCRYPTED = 6;
/**
* Error code when the current channel is an unknown channel.
* @hide
*/
public static final int ERROR_UNKNOWN_CHANNEL = 7;
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@IntDef(flag = false, prefix = "TELETEXT_APP_STATE_", value = {
@@ -561,7 +549,6 @@ public final class TvInteractiveAppManager {
/**
* Callback used to monitor status of the TV Interactive App.
* @hide
*/
public abstract static class TvInteractiveAppCallback {
/**
@@ -796,7 +783,6 @@ public final class TvInteractiveAppManager {
*
* @param callback A callback used to monitor status of the TV Interactive App services.
* @param executor A {@link Executor} that the status change will be delivered to.
* @hide
*/
public void registerCallback(
@NonNull TvInteractiveAppCallback callback,
@@ -812,7 +798,6 @@ public final class TvInteractiveAppManager {
* Unregisters the existing {@link TvInteractiveAppCallback}.
*
* @param callback The existing callback to remove.
* @hide
*/
public void unregisterCallback(@NonNull final TvInteractiveAppCallback callback) {
Preconditions.checkNotNull(callback);

View File

@@ -34,6 +34,7 @@ import android.media.tv.BroadcastInfoResponse;
import android.media.tv.TvContentRating;
import android.media.tv.TvInputManager;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvView;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Bundle;
@@ -65,7 +66,8 @@ import java.util.ArrayList;
import java.util.List;
/**
* The TvInteractiveAppService class represents a TV interactive applications RTE.
* A TV interactive application service is a service that provides runtime environment and runs TV
* interactive applications.
*/
public abstract class TvInteractiveAppService extends Service {
private static final boolean DEBUG = false;
@@ -201,10 +203,8 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Prepares TV Interactive App service for the given type.
* @hide
*/
public void onPrepare(@TvInteractiveAppInfo.InteractiveAppType int type) {
}
public abstract void onPrepare(@TvInteractiveAppInfo.InteractiveAppType int type);
/**
* Registers App link info.
@@ -239,14 +239,11 @@ public abstract class TvInteractiveAppService extends Service {
*
* @param iAppServiceId The ID of the TV Interactive App associated with the session.
* @param type The type of the TV Interactive App associated with the session.
* @hide
*/
@Nullable
public Session onCreateSession(
public abstract Session onCreateSession(
@NonNull String iAppServiceId,
@TvInteractiveAppInfo.InteractiveAppType int type) {
return null;
}
@TvInteractiveAppInfo.InteractiveAppType int type);
/**
* Notifies the system when the state of the interactive app RTE has been changed.
@@ -256,7 +253,6 @@ public abstract class TvInteractiveAppService extends Service {
* @param error the error code for error state. {@link TvInteractiveAppManager#ERROR_NONE} is
* used when the state is not
* {@link TvInteractiveAppManager#SERVICE_STATE_ERROR}.
* @hide
*/
public final void notifyStateChanged(
@TvInteractiveAppInfo.InteractiveAppType int type,
@@ -272,7 +268,12 @@ public abstract class TvInteractiveAppService extends Service {
/**
* Base class for derived classes to implement to provide a TV interactive app session.
* @hide
*
* <p>A session is associated with a {@link TvInteractiveAppView} instance and handles
* corresponding communications. It also handles the communications with
* {@link android.media.tv.TvInputService.Session} if connected.
*
* @see TvInteractiveAppView#setTvView(TvView)
*/
public abstract static class Session implements KeyEvent.Callback {
private final KeyEvent.DispatcherState mDispatcherState = new KeyEvent.DispatcherState();

View File

@@ -387,7 +387,6 @@ public class TvInteractiveAppView extends ViewGroup {
* {@link TvInteractiveAppInfo#getId()}.
*
* @see android.media.tv.interactive.TvInteractiveAppManager#getTvInteractiveAppServiceList()
* @hide
*/
public void prepareInteractiveApp(
@NonNull String iAppServiceId,
@@ -416,7 +415,6 @@ public class TvInteractiveAppView extends ViewGroup {
/**
* Stops the interactive application.
* @hide
*/
public void stopInteractiveApp() {
if (DEBUG) {
@@ -564,7 +562,6 @@ public class TvInteractiveAppView extends ViewGroup {
*
* @param tvView the TvView to be linked to this TvInteractiveAppView via linking of Sessions.
* @return The result of the operation.
* @hide
*/
public int setTvView(@Nullable TvView tvView) {
if (tvView == null) {
@@ -623,14 +620,13 @@ public class TvInteractiveAppView extends ViewGroup {
}
/**
* This is called when the session state is changed.
* This is called when the state of corresponding interactive app is changed.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
* @param state the current state.
* @param err the error code for error state. {@link TvInteractiveAppManager#ERROR_NONE}
* is used when the state is not
* {@link TvInteractiveAppManager#INTERACTIVE_APP_STATE_ERROR}.
* @hide
*/
public void onStateChanged(
@NonNull String iAppServiceId,