Loading media/java/android/media/tv/interactive/ITvIAppManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.media.tv.interactive.ITvIAppClient; import android.media.tv.interactive.ITvIAppManagerCallback; import android.media.tv.interactive.TvIAppInfo; import android.net.Uri; import android.os.Bundle; import android.view.Surface; /** Loading @@ -31,6 +32,7 @@ import android.view.Surface; interface ITvIAppManager { List<TvIAppInfo> getTvIAppServiceList(int userId); void prepare(String tiasId, int type, int userId); void notifyAppLinkInfo(String tiasId, in Bundle info, int userId); void startIApp(in IBinder sessionToken, int userId); void createSession( in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); Loading media/java/android/media/tv/interactive/ITvIAppService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.media.tv.interactive; import android.media.tv.interactive.ITvIAppServiceCallback; import android.media.tv.interactive.ITvIAppSessionCallback; import android.os.Bundle; import android.view.InputChannel; /** Loading @@ -31,4 +32,5 @@ oneway interface ITvIAppService { void createSession(in InputChannel channel, in ITvIAppSessionCallback callback, in String iAppServiceId, int type); void prepare(int type); void notifyAppLinkInfo(in Bundle info); } No newline at end of file media/java/android/media/tv/interactive/TvIAppManager.java +58 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.media.tv.BroadcastInfoRequest; import android.media.tv.BroadcastInfoResponse; import android.media.tv.TvInputManager; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -87,6 +88,51 @@ public final class TvIAppManager { */ public static final int TV_IAPP_RTE_STATE_ERROR = 4; /** * Key for package name in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_PACKAGE_NAME = "package_name"; /** * Key for class name in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_CLASS_NAME = "class_name"; /** * Key for URI scheme in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_SCHEME = "uri_scheme"; /** * Key for URI host in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_HOST = "uri_host"; /** * Key for URI prefix in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_PREFIX = "uri_prefix"; private final ITvIAppManager mService; private final int mUserId; Loading Loading @@ -417,6 +463,18 @@ public final class TvIAppManager { } } /** * Notifies app link info. * @hide */ public void notifyAppLinkInfo(String tvIAppServiceId, Bundle appLinkInfo) { try { mService.notifyAppLinkInfo(tvIAppServiceId, appLinkInfo, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Registers a {@link TvIAppManager.TvIAppCallback}. * Loading media/java/android/media/tv/interactive/TvIAppService.java +14 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.media.tv.BroadcastInfoRequest; import android.media.tv.BroadcastInfoResponse; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -123,6 +124,11 @@ public abstract class TvIAppService extends Service { public void prepare(int type) { onPrepare(type); } @Override public void notifyAppLinkInfo(Bundle appLinkInfo) { onAppLinkInfo(appLinkInfo); } }; return tvIAppServiceBinder; } Loading @@ -135,6 +141,14 @@ public abstract class TvIAppService extends Service { // TODO: make it abstract when unhide } /** * Registers App link info. * @hide */ public void onAppLinkInfo(Bundle appLinkInfo) { // TODO: make it abstract when unhide } /** * Returns a concrete implementation of {@link Session}. Loading services/core/java/com/android/server/tv/interactive/TvIAppManagerService.java +60 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.media.tv.interactive.TvIAppInfo; import android.media.tv.interactive.TvIAppService; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Process; import android.os.RemoteCallbackList; Loading Loading @@ -652,6 +653,9 @@ public class TvIAppManagerService extends SystemService { userState.mServiceStateMap.put(componentName, serviceState); } else if (serviceState.mService != null) { serviceState.mService.prepare(type); } else { serviceState.mPendingPrepare = true; serviceState.mPendingPrepareType = type; } } } catch (RemoteException e) { Loading @@ -661,6 +665,40 @@ public class TvIAppManagerService extends SystemService { } } @Override public void notifyAppLinkInfo(String tiasId, Bundle appLinkInfo, int userId) { final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), Binder.getCallingUid(), userId, "notifyAppLinkInfo"); final long identity = Binder.clearCallingIdentity(); try { synchronized (mLock) { UserState userState = getOrCreateUserStateLocked(resolvedUserId); TvIAppState iAppState = userState.mIAppMap.get(tiasId); if (iAppState == null) { Slogf.e(TAG, "failed to notifyAppLinkInfo - unknown TIAS id " + tiasId); return; } ComponentName componentName = iAppState.mInfo.getComponent(); ServiceState serviceState = userState.mServiceStateMap.get(componentName); if (serviceState == null) { serviceState = new ServiceState( componentName, tiasId, resolvedUserId); serviceState.addPendingAppLink(appLinkInfo); userState.mServiceStateMap.put(componentName, serviceState); } else if (serviceState.mService != null) { serviceState.mService.notifyAppLinkInfo(appLinkInfo); } else { serviceState.addPendingAppLink(appLinkInfo); } } } catch (RemoteException e) { Slogf.e(TAG, "error in notifyAppLinkInfo", e); } finally { Binder.restoreCallingIdentity(identity); } } @Override public void createSession(final ITvIAppClient client, final String iAppServiceId, int type, int seq, int userId) { Loading Loading @@ -1237,6 +1275,7 @@ public class TvIAppManagerService extends SystemService { private final ServiceConnection mConnection; private final ComponentName mComponent; private final String mIAppSeriviceId; private final List<Bundle> mPendingAppLinkInfo = new ArrayList<>(); private boolean mPendingPrepare = false; private Integer mPendingPrepareType = null; Loading @@ -1257,6 +1296,10 @@ public class TvIAppManagerService extends SystemService { mConnection = new IAppServiceConnection(component, userId); mIAppSeriviceId = tias; } private void addPendingAppLink(Bundle info) { mPendingAppLinkInfo.add(info); } } private final class IAppServiceConnection implements ServiceConnection { Loading Loading @@ -1296,6 +1339,23 @@ public class TvIAppManagerService extends SystemService { } } if (!serviceState.mPendingAppLinkInfo.isEmpty()) { for (Iterator<Bundle> it = serviceState.mPendingAppLinkInfo.iterator(); it.hasNext(); ) { Bundle appLinkInfo = it.next(); final long identity = Binder.clearCallingIdentity(); try { serviceState.mService.notifyAppLinkInfo(appLinkInfo); it.remove(); } catch (RemoteException e) { Slogf.e(TAG, "error in notifyAppLinkInfo(" + appLinkInfo + ") when onServiceConnected", e); } finally { Binder.restoreCallingIdentity(identity); } } } List<IBinder> tokensToBeRemoved = new ArrayList<>(); // And create sessions, if any. Loading Loading
media/java/android/media/tv/interactive/ITvIAppManager.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import android.media.tv.interactive.ITvIAppClient; import android.media.tv.interactive.ITvIAppManagerCallback; import android.media.tv.interactive.TvIAppInfo; import android.net.Uri; import android.os.Bundle; import android.view.Surface; /** Loading @@ -31,6 +32,7 @@ import android.view.Surface; interface ITvIAppManager { List<TvIAppInfo> getTvIAppServiceList(int userId); void prepare(String tiasId, int type, int userId); void notifyAppLinkInfo(String tiasId, in Bundle info, int userId); void startIApp(in IBinder sessionToken, int userId); void createSession( in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); Loading
media/java/android/media/tv/interactive/ITvIAppService.aidl +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package android.media.tv.interactive; import android.media.tv.interactive.ITvIAppServiceCallback; import android.media.tv.interactive.ITvIAppSessionCallback; import android.os.Bundle; import android.view.InputChannel; /** Loading @@ -31,4 +32,5 @@ oneway interface ITvIAppService { void createSession(in InputChannel channel, in ITvIAppSessionCallback callback, in String iAppServiceId, int type); void prepare(int type); void notifyAppLinkInfo(in Bundle info); } No newline at end of file
media/java/android/media/tv/interactive/TvIAppManager.java +58 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import android.media.tv.BroadcastInfoRequest; import android.media.tv.BroadcastInfoResponse; import android.media.tv.TvInputManager; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -87,6 +88,51 @@ public final class TvIAppManager { */ public static final int TV_IAPP_RTE_STATE_ERROR = 4; /** * Key for package name in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_PACKAGE_NAME = "package_name"; /** * Key for class name in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_CLASS_NAME = "class_name"; /** * Key for URI scheme in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_SCHEME = "uri_scheme"; /** * Key for URI host in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_HOST = "uri_host"; /** * Key for URI prefix in app link. * <p>Type: String * * @see #notifyAppLinkInfo(String, Bundle) * @hide */ public static final String KEY_URI_PREFIX = "uri_prefix"; private final ITvIAppManager mService; private final int mUserId; Loading Loading @@ -417,6 +463,18 @@ public final class TvIAppManager { } } /** * Notifies app link info. * @hide */ public void notifyAppLinkInfo(String tvIAppServiceId, Bundle appLinkInfo) { try { mService.notifyAppLinkInfo(tvIAppServiceId, appLinkInfo, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Registers a {@link TvIAppManager.TvIAppCallback}. * Loading
media/java/android/media/tv/interactive/TvIAppService.java +14 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.media.tv.BroadcastInfoRequest; import android.media.tv.BroadcastInfoResponse; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading Loading @@ -123,6 +124,11 @@ public abstract class TvIAppService extends Service { public void prepare(int type) { onPrepare(type); } @Override public void notifyAppLinkInfo(Bundle appLinkInfo) { onAppLinkInfo(appLinkInfo); } }; return tvIAppServiceBinder; } Loading @@ -135,6 +141,14 @@ public abstract class TvIAppService extends Service { // TODO: make it abstract when unhide } /** * Registers App link info. * @hide */ public void onAppLinkInfo(Bundle appLinkInfo) { // TODO: make it abstract when unhide } /** * Returns a concrete implementation of {@link Session}. Loading
services/core/java/com/android/server/tv/interactive/TvIAppManagerService.java +60 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,7 @@ import android.media.tv.interactive.TvIAppInfo; import android.media.tv.interactive.TvIAppService; import android.net.Uri; import android.os.Binder; import android.os.Bundle; import android.os.IBinder; import android.os.Process; import android.os.RemoteCallbackList; Loading Loading @@ -652,6 +653,9 @@ public class TvIAppManagerService extends SystemService { userState.mServiceStateMap.put(componentName, serviceState); } else if (serviceState.mService != null) { serviceState.mService.prepare(type); } else { serviceState.mPendingPrepare = true; serviceState.mPendingPrepareType = type; } } } catch (RemoteException e) { Loading @@ -661,6 +665,40 @@ public class TvIAppManagerService extends SystemService { } } @Override public void notifyAppLinkInfo(String tiasId, Bundle appLinkInfo, int userId) { final int resolvedUserId = resolveCallingUserId(Binder.getCallingPid(), Binder.getCallingUid(), userId, "notifyAppLinkInfo"); final long identity = Binder.clearCallingIdentity(); try { synchronized (mLock) { UserState userState = getOrCreateUserStateLocked(resolvedUserId); TvIAppState iAppState = userState.mIAppMap.get(tiasId); if (iAppState == null) { Slogf.e(TAG, "failed to notifyAppLinkInfo - unknown TIAS id " + tiasId); return; } ComponentName componentName = iAppState.mInfo.getComponent(); ServiceState serviceState = userState.mServiceStateMap.get(componentName); if (serviceState == null) { serviceState = new ServiceState( componentName, tiasId, resolvedUserId); serviceState.addPendingAppLink(appLinkInfo); userState.mServiceStateMap.put(componentName, serviceState); } else if (serviceState.mService != null) { serviceState.mService.notifyAppLinkInfo(appLinkInfo); } else { serviceState.addPendingAppLink(appLinkInfo); } } } catch (RemoteException e) { Slogf.e(TAG, "error in notifyAppLinkInfo", e); } finally { Binder.restoreCallingIdentity(identity); } } @Override public void createSession(final ITvIAppClient client, final String iAppServiceId, int type, int seq, int userId) { Loading Loading @@ -1237,6 +1275,7 @@ public class TvIAppManagerService extends SystemService { private final ServiceConnection mConnection; private final ComponentName mComponent; private final String mIAppSeriviceId; private final List<Bundle> mPendingAppLinkInfo = new ArrayList<>(); private boolean mPendingPrepare = false; private Integer mPendingPrepareType = null; Loading @@ -1257,6 +1296,10 @@ public class TvIAppManagerService extends SystemService { mConnection = new IAppServiceConnection(component, userId); mIAppSeriviceId = tias; } private void addPendingAppLink(Bundle info) { mPendingAppLinkInfo.add(info); } } private final class IAppServiceConnection implements ServiceConnection { Loading Loading @@ -1296,6 +1339,23 @@ public class TvIAppManagerService extends SystemService { } } if (!serviceState.mPendingAppLinkInfo.isEmpty()) { for (Iterator<Bundle> it = serviceState.mPendingAppLinkInfo.iterator(); it.hasNext(); ) { Bundle appLinkInfo = it.next(); final long identity = Binder.clearCallingIdentity(); try { serviceState.mService.notifyAppLinkInfo(appLinkInfo); it.remove(); } catch (RemoteException e) { Slogf.e(TAG, "error in notifyAppLinkInfo(" + appLinkInfo + ") when onServiceConnected", e); } finally { Binder.restoreCallingIdentity(identity); } } } List<IBinder> tokensToBeRemoved = new ArrayList<>(); // And create sessions, if any. Loading