Loading media/java/android/media/tv/interactive/ITvIAppClient.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -24,4 +24,5 @@ package android.media.tv.interactive; oneway interface ITvIAppClient { oneway interface ITvIAppClient { void onSessionCreated(in String iAppServiceId, IBinder token, int seq); void onSessionCreated(in String iAppServiceId, IBinder token, int seq); void onSessionReleased(int seq); void onSessionReleased(int seq); void onLayoutSurface(int left, int top, int right, int bottom, int seq); } } No newline at end of file media/java/android/media/tv/interactive/ITvIAppManager.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.media.tv.interactive; package android.media.tv.interactive; import android.media.tv.interactive.ITvIAppClient; import android.media.tv.interactive.ITvIAppClient; import android.view.Surface; /** /** * Interface to the TV interactive app service. * Interface to the TV interactive app service. Loading @@ -27,4 +28,7 @@ interface ITvIAppManager { void createSession( void createSession( in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); void releaseSession(in IBinder sessionToken, int userId); void releaseSession(in IBinder sessionToken, int userId); void setSurface(in IBinder sessionToken, in Surface surface, int userId); void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, int userId); } } No newline at end of file media/java/android/media/tv/interactive/ITvIAppSession.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.media.tv.interactive; package android.media.tv.interactive; import android.view.Surface; /** /** * Sub-interface of ITvIAppService.aidl which is created per session and has its own context. * Sub-interface of ITvIAppService.aidl which is created per session and has its own context. * @hide * @hide Loading @@ -23,4 +25,6 @@ package android.media.tv.interactive; oneway interface ITvIAppSession { oneway interface ITvIAppSession { void startIApp(); void startIApp(); void release(); void release(); void setSurface(in Surface surface); void dispatchSurfaceChanged(int format, int width, int height); } } No newline at end of file media/java/android/media/tv/interactive/ITvIAppSessionCallback.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -25,4 +25,5 @@ import android.media.tv.interactive.ITvIAppSession; */ */ oneway interface ITvIAppSessionCallback { oneway interface ITvIAppSessionCallback { void onSessionCreated(in ITvIAppSession session); void onSessionCreated(in ITvIAppSession session); void onLayoutSurface(int left, int top, int right, int bottom); } } No newline at end of file media/java/android/media/tv/interactive/TvIAppManager.java +74 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; import android.util.SparseArray; import android.util.SparseArray; import android.view.Surface; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; Loading Loading @@ -88,6 +89,18 @@ public final class TvIAppManager { record.postSessionReleased(); record.postSessionReleased(); } } } } @Override public void onLayoutSurface(int left, int top, int right, int bottom, int seq) { synchronized (mSessionCallbackRecordMap) { SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq); if (record == null) { Log.e(TAG, "Callback not found for seq " + seq); return; } record.postLayoutSurface(left, top, right, bottom); } } }; }; } } Loading Loading @@ -158,6 +171,44 @@ public final class TvIAppManager { } } } } /** * Sets the {@link android.view.Surface} for this session. * * @param surface A {@link android.view.Surface} used to render video. */ public void setSurface(Surface surface) { if (mToken == null) { Log.w(TAG, "The session has been already released"); return; } // surface can be null. try { mService.setSurface(mToken, surface, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Notifies of any structural changes (format or size) of the surface passed in * {@link #setSurface}. * * @param format The new PixelFormat of the surface. * @param width The new width of the surface. * @param height The new height of the surface. */ public void dispatchSurfaceChanged(int format, int width, int height) { if (mToken == null) { Log.w(TAG, "The session has been already released"); return; } try { mService.dispatchSurfaceChanged(mToken, format, width, height, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Releases this session. * Releases this session. */ */ Loading Loading @@ -211,6 +262,16 @@ public final class TvIAppManager { } } }); }); } } void postLayoutSurface(final int left, final int top, final int right, final int bottom) { mHandler.post(new Runnable() { @Override public void run() { mSessionCallback.onLayoutSurface(mSession, left, top, right, bottom); } }); } } } /** /** Loading @@ -235,5 +296,18 @@ public final class TvIAppManager { */ */ public void onSessionReleased(@NonNull Session session) { public void onSessionReleased(@NonNull Session session) { } } /** * This is called when {@link TvIAppService.Session#layoutSurface} is called to change the * layout of surface. * * @param session A {@link TvIAppManager.Session} associated with this callback. * @param left Left position. * @param top Top position. * @param right Right position. * @param bottom Bottom position. */ public void onLayoutSurface(Session session, int left, int top, int right, int bottom) { } } } } } Loading
media/java/android/media/tv/interactive/ITvIAppClient.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -24,4 +24,5 @@ package android.media.tv.interactive; oneway interface ITvIAppClient { oneway interface ITvIAppClient { void onSessionCreated(in String iAppServiceId, IBinder token, int seq); void onSessionCreated(in String iAppServiceId, IBinder token, int seq); void onSessionReleased(int seq); void onSessionReleased(int seq); void onLayoutSurface(int left, int top, int right, int bottom, int seq); } } No newline at end of file
media/java/android/media/tv/interactive/ITvIAppManager.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.media.tv.interactive; package android.media.tv.interactive; import android.media.tv.interactive.ITvIAppClient; import android.media.tv.interactive.ITvIAppClient; import android.view.Surface; /** /** * Interface to the TV interactive app service. * Interface to the TV interactive app service. Loading @@ -27,4 +28,7 @@ interface ITvIAppManager { void createSession( void createSession( in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId); void releaseSession(in IBinder sessionToken, int userId); void releaseSession(in IBinder sessionToken, int userId); void setSurface(in IBinder sessionToken, in Surface surface, int userId); void dispatchSurfaceChanged(in IBinder sessionToken, int format, int width, int height, int userId); } } No newline at end of file
media/java/android/media/tv/interactive/ITvIAppSession.aidl +4 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,8 @@ package android.media.tv.interactive; package android.media.tv.interactive; import android.view.Surface; /** /** * Sub-interface of ITvIAppService.aidl which is created per session and has its own context. * Sub-interface of ITvIAppService.aidl which is created per session and has its own context. * @hide * @hide Loading @@ -23,4 +25,6 @@ package android.media.tv.interactive; oneway interface ITvIAppSession { oneway interface ITvIAppSession { void startIApp(); void startIApp(); void release(); void release(); void setSurface(in Surface surface); void dispatchSurfaceChanged(int format, int width, int height); } } No newline at end of file
media/java/android/media/tv/interactive/ITvIAppSessionCallback.aidl +1 −0 Original line number Original line Diff line number Diff line Loading @@ -25,4 +25,5 @@ import android.media.tv.interactive.ITvIAppSession; */ */ oneway interface ITvIAppSessionCallback { oneway interface ITvIAppSessionCallback { void onSessionCreated(in ITvIAppSession session); void onSessionCreated(in ITvIAppSession session); void onLayoutSurface(int left, int top, int right, int bottom); } } No newline at end of file
media/java/android/media/tv/interactive/TvIAppManager.java +74 −0 Original line number Original line Diff line number Diff line Loading @@ -25,6 +25,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.RemoteException; import android.util.Log; import android.util.Log; import android.util.SparseArray; import android.util.SparseArray; import android.view.Surface; import com.android.internal.util.Preconditions; import com.android.internal.util.Preconditions; Loading Loading @@ -88,6 +89,18 @@ public final class TvIAppManager { record.postSessionReleased(); record.postSessionReleased(); } } } } @Override public void onLayoutSurface(int left, int top, int right, int bottom, int seq) { synchronized (mSessionCallbackRecordMap) { SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq); if (record == null) { Log.e(TAG, "Callback not found for seq " + seq); return; } record.postLayoutSurface(left, top, right, bottom); } } }; }; } } Loading Loading @@ -158,6 +171,44 @@ public final class TvIAppManager { } } } } /** * Sets the {@link android.view.Surface} for this session. * * @param surface A {@link android.view.Surface} used to render video. */ public void setSurface(Surface surface) { if (mToken == null) { Log.w(TAG, "The session has been already released"); return; } // surface can be null. try { mService.setSurface(mToken, surface, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** * Notifies of any structural changes (format or size) of the surface passed in * {@link #setSurface}. * * @param format The new PixelFormat of the surface. * @param width The new width of the surface. * @param height The new height of the surface. */ public void dispatchSurfaceChanged(int format, int width, int height) { if (mToken == null) { Log.w(TAG, "The session has been already released"); return; } try { mService.dispatchSurfaceChanged(mToken, format, width, height, mUserId); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } } /** /** * Releases this session. * Releases this session. */ */ Loading Loading @@ -211,6 +262,16 @@ public final class TvIAppManager { } } }); }); } } void postLayoutSurface(final int left, final int top, final int right, final int bottom) { mHandler.post(new Runnable() { @Override public void run() { mSessionCallback.onLayoutSurface(mSession, left, top, right, bottom); } }); } } } /** /** Loading @@ -235,5 +296,18 @@ public final class TvIAppManager { */ */ public void onSessionReleased(@NonNull Session session) { public void onSessionReleased(@NonNull Session session) { } } /** * This is called when {@link TvIAppService.Session#layoutSurface} is called to change the * layout of surface. * * @param session A {@link TvIAppManager.Session} associated with this callback. * @param left Left position. * @param top Top position. * @param right Right position. * @param bottom Bottom position. */ public void onLayoutSurface(Session session, int left, int top, int right, int bottom) { } } } } }