Merge "TIAF: rename IApp -> InteractiveApp."

This commit is contained in:
Shubang Lu
2022-01-21 18:04:09 +00:00
committed by Android (Google) Code Review
15 changed files with 170 additions and 133 deletions

View File

@@ -11066,8 +11066,8 @@ package android.content {
field public static final String TELEPHONY_SUBSCRIPTION_SERVICE = "telephony_subscription_service";
field public static final String TEXT_CLASSIFICATION_SERVICE = "textclassification";
field public static final String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
field public static final String TV_IAPP_SERVICE = "tv_iapp";
field public static final String TV_INPUT_SERVICE = "tv_input";
field public static final String TV_INTERACTIVE_APP_SERVICE = "tv_interactive_app";
field public static final String UI_MODE_SERVICE = "uimode";
field public static final String USAGE_STATS_SERVICE = "usagestats";
field public static final String USB_SERVICE = "usb";
@@ -26868,16 +26868,43 @@ package android.media.tv {
package android.media.tv.interactive {
public final class TvIAppManager {
public final class TvInteractiveAppInfo implements android.os.Parcelable {
ctor public TvInteractiveAppInfo(@NonNull android.content.Context, @NonNull android.content.ComponentName);
method public int describeContents();
method @NonNull public String getId();
method @Nullable public android.content.pm.ServiceInfo getServiceInfo();
method @NonNull public int getSupportedTypes();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.interactive.TvInteractiveAppInfo> CREATOR;
field public static final int INTERACTIVE_APP_TYPE_ATSC = 2; // 0x2
field public static final int INTERACTIVE_APP_TYPE_GINGA = 4; // 0x4
field public static final int INTERACTIVE_APP_TYPE_HBBTV = 1; // 0x1
}
public abstract class TvIAppService extends android.app.Service {
ctor public TvIAppService();
public final class TvInteractiveAppManager {
method @NonNull public java.util.List<android.media.tv.interactive.TvInteractiveAppInfo> getTvInteractiveAppServiceList();
}
public abstract class TvInteractiveAppService extends android.app.Service {
ctor public TvInteractiveAppService();
method public final android.os.IBinder onBind(android.content.Intent);
field public static final String SERVICE_INTERFACE = "android.media.tv.interactive.TvIAppService";
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 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 setCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.tv.interactive.TvInteractiveAppView.TvInteractiveAppCallback);
method public void startInteractiveApp();
}
public abstract static class TvInteractiveAppView.TvInteractiveAppCallback {
ctor public TvInteractiveAppView.TvInteractiveAppCallback();
}
}
package android.mtp {

View File

@@ -124,8 +124,8 @@ import android.media.projection.MediaProjectionManager;
import android.media.soundtrigger.SoundTriggerManager;
import android.media.tv.ITvInputManager;
import android.media.tv.TvInputManager;
import android.media.tv.interactive.ITvIAppManager;
import android.media.tv.interactive.TvIAppManager;
import android.media.tv.interactive.ITvInteractiveAppManager;
import android.media.tv.interactive.TvInteractiveAppManager;
import android.media.tv.tunerresourcemanager.ITunerResourceManager;
import android.media.tv.tunerresourcemanager.TunerResourceManager;
import android.nearby.NearbyFrameworkInitializer;
@@ -964,13 +964,16 @@ public final class SystemServiceRegistry {
}
});
registerService(Context.TV_IAPP_SERVICE, TvIAppManager.class,
new CachedServiceFetcher<TvIAppManager>() {
registerService(Context.TV_INTERACTIVE_APP_SERVICE, TvInteractiveAppManager.class,
new CachedServiceFetcher<TvInteractiveAppManager>() {
@Override
public TvIAppManager createService(ContextImpl ctx) throws ServiceNotFoundException {
IBinder iBinder = ServiceManager.getServiceOrThrow(Context.TV_IAPP_SERVICE);
ITvIAppManager service = ITvIAppManager.Stub.asInterface(iBinder);
return new TvIAppManager(service, ctx.getUserId());
public TvInteractiveAppManager createService(ContextImpl ctx)
throws ServiceNotFoundException {
IBinder iBinder =
ServiceManager.getServiceOrThrow(Context.TV_INTERACTIVE_APP_SERVICE);
ITvInteractiveAppManager service =
ITvInteractiveAppManager.Stub.asInterface(iBinder);
return new TvInteractiveAppManager(service, ctx.getUserId());
}});
registerService(Context.TV_INPUT_SERVICE, TvInputManager.class,

View File

@@ -3829,7 +3829,7 @@ public abstract class Context {
PRINT_SERVICE,
CONSUMER_IR_SERVICE,
//@hide: TRUST_SERVICE,
TV_IAPP_SERVICE,
TV_INTERACTIVE_APP_SERVICE,
TV_INPUT_SERVICE,
//@hide: TV_TUNER_RESOURCE_MGR_SERVICE,
//@hide: NETWORK_SCORE_SERVICE,
@@ -5356,13 +5356,13 @@ public abstract class Context {
/**
* Use with {@link #getSystemService(String)} to retrieve a
* {@link android.media.tv.interactive.TvIAppManager} for interacting with TV interactive
* applications (TV iApp) on the device.
* {@link android.media.tv.interactive.TvInteractiveAppManager} for interacting with TV
* interactive applications on the device.
*
* @see #getSystemService(String)
* @see android.media.tv.interactive.TvIAppManager
* @see android.media.tv.interactive.TvInteractiveAppManager
*/
public static final String TV_IAPP_SERVICE = "tv_iapp";
public static final String TV_INTERACTIVE_APP_SERVICE = "tv_interactive_app";
/**
* Use with {@link #getSystemService(String)} to retrieve a

View File

@@ -9376,11 +9376,12 @@
<attr name="canPauseRecording" format="boolean" />
</declare-styleable>
<!-- Use <code>tv-iapp</code> as the root tag of the XML resource that describes a
{@link android.media.tv.interactive.TvIAppService}, which is referenced from its
{@link android.media.tv.interactive.TvIAppService#SERVICE_META_DATA} meta-data entry.
Described here are the attributes that can be included in that tag. -->
<declare-styleable name="TvIAppService">
<!-- Use <code>tv-interactive-app</code> as the root tag of the XML resource that describes a
{@link android.media.tv.interactive.TvInteractiveAppService}, which is referenced
from its
{@link android.media.tv.interactive.TvInteractiveAppService#SERVICE_META_DATA}
meta-data entry. Described here are the attributes that can be included in that tag. -->
<declare-styleable name="TvInteractiveAppService">
<!-- The interactive app types that the TV interactive app service supports.
Reference to a string array resource that describes the supported types,
e.g. HbbTv, Ginga. -->

View File

@@ -31,7 +31,7 @@ import android.graphics.Rect;
import android.media.AudioDeviceInfo;
import android.media.AudioFormat.Encoding;
import android.media.PlaybackParams;
import android.media.tv.interactive.TvIAppManager;
import android.media.tv.interactive.TvInteractiveAppManager;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -2318,7 +2318,7 @@ public final class TvInputManager {
// @GuardedBy("mMetadataLock")
private int mVideoHeight;
private TvIAppManager.Session mIAppSession;
private TvInteractiveAppManager.Session mIAppSession;
private boolean mIAppNotificationEnabled = false;
private Session(IBinder token, InputChannel channel, ITvInputManager service, int userId,
@@ -2331,11 +2331,11 @@ public final class TvInputManager {
mSessionCallbackRecordMap = sessionCallbackRecordMap;
}
public TvIAppManager.Session getInteractiveAppSession() {
public TvInteractiveAppManager.Session getInteractiveAppSession() {
return mIAppSession;
}
public void setInteractiveAppSession(TvIAppManager.Session iAppSession) {
public void setInteractiveAppSession(TvInteractiveAppManager.Session iAppSession) {
this.mIAppSession = iAppSession;
}

View File

@@ -31,7 +31,7 @@ import android.view.Surface;
* Interface to the TV interactive app service.
* @hide
*/
interface ITvIAppManager {
interface ITvInteractiveAppManager {
List<TvInteractiveAppInfo> getTvInteractiveAppServiceList(int userId);
void prepare(String tiasId, int type, int userId);
void registerAppLinkInfo(String tiasId, in Bundle info, int userId);

View File

@@ -23,7 +23,7 @@ import android.view.InputChannel;
/**
* Top-level interface to a TV Interactive App component (implemented in a Service). It's used for
* TvIAppManagerService to communicate with TvIAppService.
* TvInteractiveAppManagerService to communicate with TvInteractiveAppService.
* @hide
*/
oneway interface ITvInteractiveAppService {

View File

@@ -17,8 +17,8 @@
package android.media.tv.interactive;
/**
* Helper interface for ITvInteractiveAppService to allow the TvIAppService to notify the
* TvIAppManagerService.
* Helper interface for ITvInteractiveAppService to allow the TvInteractiveAppService to notify the
* TvInteractiveAppManagerService.
* @hide
*/
oneway interface ITvInteractiveAppServiceCallback {

View File

@@ -24,7 +24,7 @@ import android.net.Uri;
import android.os.Bundle;
/**
* Helper interface for ITvInteractiveAppSession to allow TvIAppService to notify the
* Helper interface for ITvInteractiveAppSession to allow TvInteractiveAppService to notify the
* system service when there is a related event.
* @hide
*/

View File

@@ -44,7 +44,6 @@ import java.util.List;
/**
* This class is used to specify meta information of a TV interactive app.
* @hide
*/
public final class TvInteractiveAppInfo implements Parcelable {
private static final boolean DEBUG = false;
@@ -77,7 +76,7 @@ public final class TvInteractiveAppInfo implements Parcelable {
throw new IllegalArgumentException("context cannot be null.");
}
Intent intent =
new Intent(TvIAppService.SERVICE_INTERFACE).setComponent(component);
new Intent(TvInteractiveAppService.SERVICE_INTERFACE).setComponent(component);
ResolveInfo resolveInfo = context.getPackageManager().resolveService(intent,
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA);
if (resolveInfo == null) {
@@ -171,10 +170,10 @@ public final class TvInteractiveAppInfo implements Parcelable {
ServiceInfo si = resolveInfo.serviceInfo;
PackageManager pm = context.getPackageManager();
try (XmlResourceParser parser =
si.loadXmlMetaData(pm, TvIAppService.SERVICE_META_DATA)) {
si.loadXmlMetaData(pm, TvInteractiveAppService.SERVICE_META_DATA)) {
if (parser == null) {
throw new IllegalStateException(
"No " + TvIAppService.SERVICE_META_DATA
"No " + TvInteractiveAppService.SERVICE_META_DATA
+ " meta-data found for " + si.name);
}
@@ -194,9 +193,9 @@ public final class TvInteractiveAppInfo implements Parcelable {
}
TypedArray sa = res.obtainAttributes(attrs,
com.android.internal.R.styleable.TvIAppService);
com.android.internal.R.styleable.TvInteractiveAppService);
CharSequence[] textArr = sa.getTextArray(
com.android.internal.R.styleable.TvIAppService_supportedTypes);
com.android.internal.R.styleable.TvInteractiveAppService_supportedTypes);
for (CharSequence cs : textArr) {
types.add(cs.toString().toLowerCase());
}

View File

@@ -57,10 +57,10 @@ import java.util.List;
* Central system API to the overall TV interactive application framework (TIAF) architecture, which
* arbitrates interaction between applications and interactive apps.
*/
@SystemService(Context.TV_IAPP_SERVICE)
public final class TvIAppManager {
@SystemService(Context.TV_INTERACTIVE_APP_SERVICE)
public final class TvInteractiveAppManager {
// TODO: cleanup and unhide public APIs
private static final String TAG = "TvIAppManager";
private static final String TAG = "TvInteractiveAppManager";
/** @hide */
@Retention(RetentionPolicy.SOURCE)
@@ -190,7 +190,7 @@ public final class TvIAppManager {
*/
public static final String KEY_BACK_URI = "back_uri";
private final ITvIAppManager mService;
private final ITvInteractiveAppManager mService;
private final int mUserId;
// A mapping from the sequence number of a session to its SessionCallbackRecord.
@@ -209,7 +209,7 @@ public final class TvIAppManager {
private final ITvInteractiveAppClient mClient;
/** @hide */
public TvIAppManager(ITvIAppManager service, int userId) {
public TvInteractiveAppManager(ITvInteractiveAppManager service, int userId) {
mService = service;
mUserId = userId;
mClient = new ITvInteractiveAppClient.Stub() {
@@ -285,7 +285,7 @@ public final class TvIAppManager {
@Override
public void onCommandRequest(
@TvIAppService.InteractiveAppServiceCommandType String cmdType,
@TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
Bundle parameters,
int seq) {
synchronized (mSessionCallbackRecordMap) {
@@ -484,7 +484,7 @@ public final class TvIAppManager {
* This is called when a TV Interactive App service is added to the system.
*
* <p>Normally it happens when the user installs a new TV Interactive App service package
* that implements {@link TvIAppService} interface.
* that implements {@link TvInteractiveAppService} interface.
*
* @param iAppServiceId The ID of the TV Interactive App service.
*/
@@ -635,7 +635,6 @@ public final class TvIAppManager {
*
* @return List of {@link TvInteractiveAppInfo} for each TV Interactive App service that
* describes its meta information.
* @hide
*/
@NonNull
public List<TvInteractiveAppInfo> getTvInteractiveAppServiceList() {
@@ -742,7 +741,7 @@ public final class TvIAppManager {
private static final long INPUT_SESSION_NOT_RESPONDING_TIMEOUT = 2500;
private final ITvIAppManager mService;
private final ITvInteractiveAppManager mService;
private final int mUserId;
private final int mSeq;
private final SparseArray<SessionCallbackRecord> mSessionCallbackRecordMap;
@@ -759,7 +758,7 @@ public final class TvIAppManager {
private TvInputEventSender mSender;
private InputChannel mInputChannel;
private Session(IBinder token, InputChannel channel, ITvIAppManager service,
private Session(IBinder token, InputChannel channel, ITvInteractiveAppManager service,
int userId, int seq, SparseArray<SessionCallbackRecord> sessionCallbackRecordMap) {
mToken = token;
mInputChannel = channel;
@@ -1142,7 +1141,7 @@ public final class TvIAppManager {
}
/**
* Notifies IAPP session when video is available.
* Notifies Interactive APP session when video is available.
*/
public void notifyVideoAvailable() {
if (mToken == null) {
@@ -1157,7 +1156,7 @@ public final class TvIAppManager {
}
/**
* Notifies IAPP session when video is unavailable.
* Notifies Interactive APP session when video is unavailable.
*/
public void notifyVideoUnavailable(int reason) {
if (mToken == null) {
@@ -1172,7 +1171,7 @@ public final class TvIAppManager {
}
/**
* Notifies IAPP session when content is allowed.
* Notifies Interactive APP session when content is allowed.
*/
public void notifyContentAllowed() {
if (mToken == null) {
@@ -1187,7 +1186,7 @@ public final class TvIAppManager {
}
/**
* Notifies IAPP session when content is blocked.
* Notifies Interactive APP session when content is blocked.
*/
public void notifyContentBlocked(TvContentRating rating) {
if (mToken == null) {
@@ -1478,7 +1477,7 @@ public final class TvIAppManager {
}
void postCommandRequest(
final @TvIAppService.InteractiveAppServiceCommandType String cmdType,
final @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
final Bundle parameters) {
mHandler.post(new Runnable() {
@Override
@@ -1587,28 +1586,28 @@ public final class TvIAppManager {
*/
public abstract static class SessionCallback {
/**
* This is called after {@link TvIAppManager#createSession} has been processed.
* This is called after {@link TvInteractiveAppManager#createSession} has been processed.
*
* @param session A {@link TvIAppManager.Session} instance created. This can be
* @param session A {@link TvInteractiveAppManager.Session} instance created. This can be
* {@code null} if the creation request failed.
*/
public void onSessionCreated(@Nullable Session session) {
}
/**
* This is called when {@link TvIAppManager.Session} is released.
* This is called when {@link TvInteractiveAppManager.Session} is released.
* This typically happens when the process hosting the session has crashed or been killed.
*
* @param session the {@link TvIAppManager.Session} instance released.
* @param session the {@link TvInteractiveAppManager.Session} instance released.
*/
public void onSessionReleased(@NonNull Session session) {
}
/**
* This is called when {@link TvIAppService.Session#layoutSurface} is called to
* This is called when {@link TvInteractiveAppService.Session#layoutSurface} is called to
* change the layout of surface.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
* @param left Left position.
* @param top Top position.
* @param right Right position.
@@ -1618,85 +1617,87 @@ public final class TvIAppManager {
}
/**
* This is called when {@link TvIAppService.Session#requestCommand} is called.
* This is called when {@link TvInteractiveAppService.Session#requestCommand} is called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
* @param cmdType type of the command.
* @param parameters parameters of the command.
*/
public void onCommandRequest(
Session session,
@TvIAppService.InteractiveAppServiceCommandType String cmdType,
@TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
Bundle parameters) {
}
/**
* This is called when {@link TvIAppService.Session#SetVideoBounds} is called.
* This is called when {@link TvInteractiveAppService.Session#SetVideoBounds} is called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
*/
public void onSetVideoBounds(Session session, Rect rect) {
}
/**
* This is called when {@link TvIAppService.Session#RequestCurrentChannelUri} is
* This is called when {@link TvInteractiveAppService.Session#RequestCurrentChannelUri} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
*/
public void onRequestCurrentChannelUri(Session session) {
}
/**
* This is called when {@link TvIAppService.Session#RequestCurrentChannelLcn} is
* This is called when {@link TvInteractiveAppService.Session#RequestCurrentChannelLcn} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
*/
public void onRequestCurrentChannelLcn(Session session) {
}
/**
* This is called when {@link TvIAppService.Session#RequestStreamVolume} is
* This is called when {@link TvInteractiveAppService.Session#RequestStreamVolume} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
*/
public void onRequestStreamVolume(Session session) {
}
/**
* This is called when {@link TvIAppService.Session#RequestTrackInfoList} is
* This is called when {@link TvInteractiveAppService.Session#RequestTrackInfoList} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
*/
public void onRequestTrackInfoList(Session session) {
}
/**
* This is called when {@link TvIAppService.Session#RequestCurrentTvInputId} is called.
* This is called when {@link TvInteractiveAppService.Session#RequestCurrentTvInputId} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppService.Session} associated with this callback.
* @hide
*/
public void onRequestCurrentTvInputId(Session session) {
}
/**
* This is called when {@link TvIAppService.Session#notifySessionStateChanged} is called.
* This is called when {@link TvInteractiveAppService.Session#notifySessionStateChanged} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
* @param state the current state.
*/
public void onSessionStateChanged(Session session, int state) {
}
/**
* This is called when {@link TvIAppService.Session#notifyBiInteractiveAppCreated}
* This is called when {@link TvInteractiveAppService.Session#notifyBiInteractiveAppCreated}
* is called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
* @param biIAppUri URI associated this BI interactive app. This is the same URI in
* {@link Session#createBiInteractiveApp(Uri, Bundle)}
* @param biIAppId BI interactive app ID, which can be used to destroy the BI interactive
@@ -1709,11 +1710,11 @@ public final class TvIAppManager {
* This is called when {@link TvIAppService.Session#notifyTeletextAppStateChanged} is
* called.
*
* @param session A {@link TvIAppManager.Session} associated with this callback.
* @param session A {@link TvInteractiveAppManager.Session} associated with this callback.
* @param state the current state.
*/
public void onTeletextAppStateChanged(
Session session, @TvIAppManager.TeletextAppState int state) {
Session session, @TvInteractiveAppManager.TeletextAppState int state) {
}
}
}

View File

@@ -65,11 +65,11 @@ import java.util.ArrayList;
import java.util.List;
/**
* The TvIAppService class represents a TV interactive applications RTE.
* The TvInteractiveAppService class represents a TV interactive applications RTE.
*/
public abstract class TvIAppService extends Service {
public abstract class TvInteractiveAppService extends Service {
private static final boolean DEBUG = false;
private static final String TAG = "TvIAppService";
private static final String TAG = "TvInteractiveAppService";
private static final int DETACH_MEDIA_VIEW_TIMEOUT_MS = 5000;
@@ -83,12 +83,12 @@ public abstract class TvIAppService extends Service {
* cannot abuse it.
*/
public static final String SERVICE_INTERFACE =
"android.media.tv.interactive.TvIAppService";
"android.media.tv.interactive.TvInteractiveAppService";
/**
* Name under which a TvIAppService component publishes information about itself. This
* Name under which a TvInteractiveAppService component publishes information about itself. This
* meta-data must reference an XML resource containing an
* <code>&lt;{@link android.R.styleable#TvIAppService tv-interactive-app}&gt;</code>
* <code>&lt;{@link android.R.styleable#TvInteractiveAppService tv-interactive-app}&gt;</code>
* tag.
*/
public static final String SERVICE_META_DATA = "android.media.tv.interactive.app";
@@ -247,7 +247,7 @@ public abstract class TvIAppService extends Service {
* @hide
*/
public final void notifyStateChanged(
int type, @TvIAppManager.TvInteractiveAppRteState int state) {
int type, @TvInteractiveAppManager.TvInteractiveAppRteState int state) {
mServiceHandler.obtainMessage(ServiceHandler.DO_NOTIFY_RTE_STATE_CHANGED,
type, state).sendToTarget();
}
@@ -319,14 +319,14 @@ public abstract class TvIAppService extends Service {
}
/**
* Starts TvIAppService session.
* Starts TvInteractiveAppService session.
* @hide
*/
public void onStartInteractiveApp() {
}
/**
* Stops TvIAppService session.
* Stops TvInteractiveAppService session.
* @hide
*/
public void onStopInteractiveApp() {
@@ -364,6 +364,7 @@ public abstract class TvIAppService extends Service {
/**
* To toggle Digital Teletext Application if there is one in AIT app list.
* @param enable
* @hide
*/
public void onSetTeletextAppEnabled(boolean enable) {
}
@@ -454,7 +455,7 @@ public abstract class TvIAppService extends Service {
}
/**
* Releases TvIAppService session.
* Releases TvInteractiveAppService session.
* @hide
*/
public void onRelease() {
@@ -989,8 +990,8 @@ public abstract class TvIAppService extends Service {
* Notifies when the session state is changed.
* @param state the current state.
*/
public void notifySessionStateChanged(
@TvIAppManager.TvInteractiveAppRteState int state) {
public final void notifySessionStateChanged(
@TvInteractiveAppManager.TvInteractiveAppRteState int state) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@Override
@@ -1039,8 +1040,10 @@ public abstract class TvIAppService extends Service {
/**
* Notifies when the digital teletext app state is changed.
* @param state the current state.
* @hide
*/
public final void notifyTeletextAppStateChanged(@TvIAppManager.TeletextAppState int state) {
public final void notifyTeletextAppStateChanged(
@TvInteractiveAppManager.TeletextAppState int state) {
executeOrPostRunnableOnMainThread(new Runnable() {
@MainThread
@Override
@@ -1068,7 +1071,7 @@ public abstract class TvIAppService extends Service {
if (event instanceof KeyEvent) {
KeyEvent keyEvent = (KeyEvent) event;
if (keyEvent.dispatch(this, mDispatcherState, this)) {
return TvIAppManager.Session.DISPATCH_HANDLED;
return TvInteractiveAppManager.Session.DISPATCH_HANDLED;
}
// TODO: special handlings of navigation keys and media keys
@@ -1077,20 +1080,20 @@ public abstract class TvIAppService extends Service {
final int source = motionEvent.getSource();
if (motionEvent.isTouchEvent()) {
if (onTouchEvent(motionEvent)) {
return TvIAppManager.Session.DISPATCH_HANDLED;
return TvInteractiveAppManager.Session.DISPATCH_HANDLED;
}
} else if ((source & InputDevice.SOURCE_CLASS_TRACKBALL) != 0) {
if (onTrackballEvent(motionEvent)) {
return TvIAppManager.Session.DISPATCH_HANDLED;
return TvInteractiveAppManager.Session.DISPATCH_HANDLED;
}
} else {
if (onGenericMotionEvent(motionEvent)) {
return TvIAppManager.Session.DISPATCH_HANDLED;
return TvInteractiveAppManager.Session.DISPATCH_HANDLED;
}
}
}
// TODO: handle overlay view
return TvIAppManager.Session.DISPATCH_NOT_HANDLED;
return TvInteractiveAppManager.Session.DISPATCH_NOT_HANDLED;
}
private void initialize(ITvInteractiveAppSessionCallback callback) {
@@ -1443,9 +1446,9 @@ public abstract class TvIAppService extends Service {
}
int handled = mSessionImpl.dispatchInputEvent(event, this);
if (handled != TvIAppManager.Session.DISPATCH_IN_PROGRESS) {
if (handled != TvInteractiveAppManager.Session.DISPATCH_IN_PROGRESS) {
finishInputEvent(
event, handled == TvIAppManager.Session.DISPATCH_HANDLED);
event, handled == TvInteractiveAppManager.Session.DISPATCH_HANDLED);
}
}
}
@@ -1491,7 +1494,7 @@ public abstract class TvIAppService extends Service {
return;
}
ITvInteractiveAppSession stub = new ITvInteractiveAppSessionWrapper(
android.media.tv.interactive.TvIAppService.this, sessionImpl, channel);
TvInteractiveAppService.this, sessionImpl, channel);
SomeArgs someArgs = SomeArgs.obtain();
someArgs.arg1 = sessionImpl;

View File

@@ -27,9 +27,9 @@ import android.graphics.RectF;
import android.media.tv.TvInputManager;
import android.media.tv.TvTrackInfo;
import android.media.tv.TvView;
import android.media.tv.interactive.TvIAppManager.Session;
import android.media.tv.interactive.TvIAppManager.Session.FinishedInputEventCallback;
import android.media.tv.interactive.TvIAppManager.SessionCallback;
import android.media.tv.interactive.TvInteractiveAppManager.Session;
import android.media.tv.interactive.TvInteractiveAppManager.Session.FinishedInputEventCallback;
import android.media.tv.interactive.TvInteractiveAppManager.SessionCallback;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
@@ -50,7 +50,6 @@ import java.util.concurrent.Executor;
/**
* Displays contents of interactive TV applications.
* @hide
*/
public class TvInteractiveAppView extends ViewGroup {
private static final String TAG = "TvInteractiveAppView";
@@ -61,7 +60,7 @@ public class TvInteractiveAppView extends ViewGroup {
private static final int UNSET_TVVIEW_SUCCESS = 3;
private static final int UNSET_TVVIEW_FAIL = 4;
private final TvIAppManager mTvInteractiveAppManager;
private final TvInteractiveAppManager mTvInteractiveAppManager;
private final Handler mHandler = new Handler();
private final Object mCallbackLock = new Object();
private Session mSession;
@@ -141,8 +140,8 @@ public class TvInteractiveAppView extends ViewGroup {
}
mDefStyleAttr = defStyleAttr;
resetSurfaceView();
mTvInteractiveAppManager = (TvIAppManager) getContext().getSystemService(
Context.TV_IAPP_SERVICE);
mTvInteractiveAppManager = (TvInteractiveAppManager) getContext().getSystemService(
Context.TV_INTERACTIVE_APP_SERVICE);
}
/**
@@ -152,8 +151,8 @@ public class TvInteractiveAppView extends ViewGroup {
* callback.
*/
public void setCallback(
@NonNull TvInteractiveAppCallback callback,
@NonNull @CallbackExecutor Executor executor) {
@NonNull @CallbackExecutor Executor executor,
@NonNull TvInteractiveAppCallback callback) {
synchronized (mCallbackLock) {
mCallbackExecutor = executor;
mCallback = callback;
@@ -552,7 +551,7 @@ public class TvInteractiveAppView extends ViewGroup {
/**
* Sets the TvInteractiveAppView to receive events from TIS. This method links the session of
* TvIAppManager to TvInputManager session, so the TIAS can get the TIS events.
* TvInteractiveAppManager to TvInputManager session, so the TIAS can get the TIS events.
*
* @param tvView the TvView to be linked to this TvInteractiveAppView via linking of Sessions.
* @return to be added
@@ -583,6 +582,7 @@ public class TvInteractiveAppView extends ViewGroup {
/**
* To toggle Digital Teletext Application if there is one in AIT app list.
* @param enable
* @hide
*/
public void setTeletextAppEnabled(boolean enable) {
if (DEBUG) {
@@ -609,7 +609,7 @@ public class TvInteractiveAppView extends ViewGroup {
*/
public void onCommandRequest(
@NonNull String iAppServiceId,
@NonNull @TvIAppService.InteractiveAppServiceCommandType String cmdType,
@NonNull @TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
@Nullable Bundle parameters) {
}
@@ -642,13 +642,15 @@ public class TvInteractiveAppView extends ViewGroup {
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
* @param state digital teletext app current state.
* @hide
*/
public void onTeletextAppStateChanged(
@NonNull String iAppServiceId, @TvIAppManager.TeletextAppState int state) {
@NonNull String iAppServiceId,
@TvInteractiveAppManager.TeletextAppState int state) {
}
/**
* This is called when {@link TvIAppService.Session#SetVideoBounds} is called.
* This is called when {@link TvInteractiveAppService.Session#SetVideoBounds} is called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
* @hide
@@ -657,7 +659,7 @@ public class TvInteractiveAppView extends ViewGroup {
}
/**
* This is called when {@link TvIAppService.Session#RequestCurrentChannelUri} is
* This is called when {@link TvInteractiveAppService.Session#RequestCurrentChannelUri} is
* called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
@@ -667,7 +669,7 @@ public class TvInteractiveAppView extends ViewGroup {
}
/**
* This is called when {@link TvIAppService.Session#RequestCurrentChannelLcn} is
* This is called when {@link TvInteractiveAppService.Session#RequestCurrentChannelLcn} is
* called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
@@ -677,7 +679,7 @@ public class TvInteractiveAppView extends ViewGroup {
}
/**
* This is called when {@link TvIAppService.Session#RequestStreamVolume} is
* This is called when {@link TvInteractiveAppService.Session#RequestStreamVolume} is
* called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
@@ -687,7 +689,7 @@ public class TvInteractiveAppView extends ViewGroup {
}
/**
* This is called when {@link TvIAppService.Session#RequestTrackInfoList} is
* This is called when {@link TvInteractiveAppService.Session#RequestTrackInfoList} is
* called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
@@ -700,6 +702,7 @@ public class TvInteractiveAppView extends ViewGroup {
* This is called when {@link TvIAppService.Session#RequestCurrentTvInputId} is called.
*
* @param iAppServiceId The ID of the TV interactive app service bound to this view.
* @hide
*/
public void onRequestCurrentTvInputId(@NonNull String iAppServiceId) {
}
@@ -801,7 +804,7 @@ public class TvInteractiveAppView extends ViewGroup {
@Override
public void onCommandRequest(
Session session,
@TvIAppService.InteractiveAppServiceCommandType String cmdType,
@TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
Bundle parameters) {
if (DEBUG) {
Log.d(TAG, "onCommandRequest (cmdType=" + cmdType + ", parameters="

View File

@@ -34,15 +34,15 @@ import android.media.tv.AdResponse;
import android.media.tv.BroadcastInfoRequest;
import android.media.tv.BroadcastInfoResponse;
import android.media.tv.TvTrackInfo;
import android.media.tv.interactive.ITvIAppManager;
import android.media.tv.interactive.ITvInteractiveAppClient;
import android.media.tv.interactive.ITvInteractiveAppManager;
import android.media.tv.interactive.ITvInteractiveAppManagerCallback;
import android.media.tv.interactive.ITvInteractiveAppService;
import android.media.tv.interactive.ITvInteractiveAppServiceCallback;
import android.media.tv.interactive.ITvInteractiveAppSession;
import android.media.tv.interactive.ITvInteractiveAppSessionCallback;
import android.media.tv.interactive.TvIAppService;
import android.media.tv.interactive.TvInteractiveAppInfo;
import android.media.tv.interactive.TvInteractiveAppService;
import android.net.Uri;
import android.os.Binder;
import android.os.Bundle;
@@ -79,9 +79,9 @@ import java.util.Set;
/**
* This class provides a system service that manages interactive TV applications.
*/
public class TvIAppManagerService extends SystemService {
public class TvInteractiveAppManagerService extends SystemService {
private static final boolean DEBUG = false;
private static final String TAG = "TvIAppManagerService";
private static final String TAG = "TvInteractiveAppManagerService";
// A global lock.
private final Object mLock = new Object();
private final Context mContext;
@@ -106,7 +106,7 @@ public class TvIAppManagerService extends SystemService {
*
* @param context The system server context.
*/
public TvIAppManagerService(Context context) {
public TvInteractiveAppManagerService(Context context) {
super(context);
mContext = context;
mUserManager = (UserManager) getContext().getSystemService(Context.USER_SERVICE);
@@ -122,7 +122,7 @@ public class TvIAppManagerService extends SystemService {
}
PackageManager pm = mContext.getPackageManager();
List<ResolveInfo> services = pm.queryIntentServicesAsUser(
new Intent(TvIAppService.SERVICE_INTERFACE),
new Intent(TvInteractiveAppService.SERVICE_INTERFACE),
PackageManager.GET_SERVICES | PackageManager.GET_META_DATA,
userId);
List<TvInteractiveAppInfo> iAppList = new ArrayList<>();
@@ -287,7 +287,7 @@ public class TvIAppManagerService extends SystemService {
if (DEBUG) {
Slogf.d(TAG, "onStart");
}
publishBinderService(Context.TV_IAPP_SERVICE, new BinderService());
publishBinderService(Context.TV_INTERACTIVE_APP_SERVICE, new BinderService());
}
@Override
@@ -628,7 +628,7 @@ public class TvIAppManagerService extends SystemService {
return session;
}
private final class BinderService extends ITvIAppManager.Stub {
private final class BinderService extends ITvInteractiveAppManager.Stub {
@Override
public List<TvInteractiveAppInfo> getTvInteractiveAppServiceList(int userId) {
@@ -1361,7 +1361,7 @@ public class TvIAppManagerService extends SystemService {
}
} finally {
if (surface != null) {
// surface is not used in TvIAppManagerService.
// surface is not used in TvInteractiveAppManagerService.
surface.release();
}
Binder.restoreCallingIdentity(identity);
@@ -1678,7 +1678,7 @@ public class TvIAppManagerService extends SystemService {
}
Intent i =
new Intent(TvIAppService.SERVICE_INTERFACE).setComponent(component);
new Intent(TvInteractiveAppService.SERVICE_INTERFACE).setComponent(component);
serviceState.mBound = mContext.bindServiceAsUser(
i, serviceState.mConnection,
Context.BIND_AUTO_CREATE | Context.BIND_FOREGROUND_SERVICE_WHILE_AWAKE,
@@ -2072,7 +2072,7 @@ public class TvIAppManagerService extends SystemService {
@Override
public void onCommandRequest(
@TvIAppService.InteractiveAppServiceCommandType String cmdType,
@TvInteractiveAppService.InteractiveAppServiceCommandType String cmdType,
Bundle parameters) {
synchronized (mLock) {
if (DEBUG) {

View File

@@ -194,7 +194,7 @@ import com.android.server.tracing.TracingServiceProxy;
import com.android.server.trust.TrustManagerService;
import com.android.server.tv.TvInputManagerService;
import com.android.server.tv.TvRemoteService;
import com.android.server.tv.interactive.TvIAppManagerService;
import com.android.server.tv.interactive.TvInteractiveAppManagerService;
import com.android.server.tv.tunerresourcemanager.TunerResourceManagerService;
import com.android.server.twilight.TwilightService;
import com.android.server.uri.UriGrantsManagerService;
@@ -2379,8 +2379,8 @@ public final class SystemServer implements Dumpable {
if (mPackageManager.hasSystemFeature(PackageManager.FEATURE_LIVE_TV)
|| mPackageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
t.traceBegin("StartTvIAppManager");
mSystemServiceManager.startService(TvIAppManagerService.class);
t.traceBegin("StartTvInteractiveAppManager");
mSystemServiceManager.startService(TvInteractiveAppManagerService.class);
t.traceEnd();
}