Loading media/java/android/media/tv/TvInputManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.media.PlaybackParams; import android.media.tv.interactive.TvIAppManager; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -2073,6 +2074,8 @@ public final class TvInputManager { // @GuardedBy("mMetadataLock") private int mVideoHeight; private TvIAppManager.Session mIAppSession; private Session(IBinder token, InputChannel channel, ITvInputManager service, int userId, int seq, SparseArray<SessionCallbackRecord> sessionCallbackRecordMap) { mToken = token; Loading @@ -2083,6 +2086,14 @@ public final class TvInputManager { mSessionCallbackRecordMap = sessionCallbackRecordMap; } public TvIAppManager.Session getIAppSession() { return mIAppSession; } public void setIAppSession(TvIAppManager.Session IAppSession) { this.mIAppSession = IAppSession; } /** * Releases this session. */ Loading media/java/android/media/tv/TvView.java +7 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.media.PlaybackParams; import android.media.tv.TvInputManager.Session; import android.media.tv.TvInputManager.Session.FinishedInputEventCallback; import android.media.tv.TvInputManager.SessionCallback; import android.media.tv.interactive.TvIAppManager; import android.media.tv.interactive.TvIAppView; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -197,6 +199,11 @@ public class TvView extends ViewGroup { mCallback = callback; } /** @hide */ public Session getInputSession() { return mSession; } /** * Sets this as the main {@link TvView}. * Loading media/java/android/media/tv/interactive/TvIAppManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.content.Context; import android.media.tv.TvInputManager; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; Loading Loading @@ -150,6 +151,8 @@ public final class TvIAppManager { private IBinder mToken; private TvInputManager.Session mInputSession; private Session(IBinder token, ITvIAppManager service, int userId, int seq, SparseArray<SessionCallbackRecord> sessionCallbackRecordMap) { mToken = token; Loading @@ -159,6 +162,14 @@ public final class TvIAppManager { mSessionCallbackRecordMap = sessionCallbackRecordMap; } public TvInputManager.Session getInputSession() { return mInputSession; } public void setInputSession(TvInputManager.Session inputSession) { mInputSession = inputSession; } void startIApp() { if (mToken == null) { Log.w(TAG, "The session has been already released"); Loading media/java/android/media/tv/interactive/TvIAppView.java +41 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,12 @@ package android.media.tv.interactive; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.media.tv.TvInputManager; import android.media.tv.TvView; import android.media.tv.interactive.TvIAppManager.Session; import android.media.tv.interactive.TvIAppManager.SessionCallback; import android.os.Handler; Loading @@ -39,6 +42,11 @@ public class TvIAppView extends ViewGroup { private static final String TAG = "TvIAppView"; private static final boolean DEBUG = false; private static final int SET_TVVIEW_SUCCESS = 1; private static final int SET_TVVIEW_FAIL = 2; private static final int UNSET_TVVIEW_SUCCESS = 3; private static final int UNSET_TVVIEW_FAIL = 4; private final TvIAppManager mTvIAppManager; private final Handler mHandler = new Handler(); private Session mSession; Loading Loading @@ -213,6 +221,39 @@ public class TvIAppView extends ViewGroup { } } public Session getIAppSession() { return mSession; } /** * Sets the TvIAppView to receive events from TIS. This method links the session of * TvIAppManager to TvInputManager session, so the TIAS can get the TIS events. * * @param tvView the TvView to be linked to this TvIAppView via linking of Sessions. * @return to be added */ public int setTvView(@Nullable TvView tvView) { if (tvView == null) { return unsetTvView(); } TvInputManager.Session inputSession = tvView.getInputSession(); if (inputSession == null || mSession == null) { return SET_TVVIEW_FAIL; } mSession.setInputSession(inputSession); inputSession.setIAppSession(mSession); return SET_TVVIEW_SUCCESS; } private int unsetTvView() { if (mSession == null || mSession.getInputSession() == null) { return UNSET_TVVIEW_FAIL; } mSession.getInputSession().setIAppSession(null); mSession.setInputSession(null); return UNSET_TVVIEW_SUCCESS; } private class MySessionCallback extends SessionCallback { final String mIAppServiceId; int mType; Loading Loading
media/java/android/media/tv/TvInputManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.media.PlaybackParams; import android.media.tv.interactive.TvIAppManager; import android.net.Uri; import android.os.Binder; import android.os.Bundle; Loading Loading @@ -2073,6 +2074,8 @@ public final class TvInputManager { // @GuardedBy("mMetadataLock") private int mVideoHeight; private TvIAppManager.Session mIAppSession; private Session(IBinder token, InputChannel channel, ITvInputManager service, int userId, int seq, SparseArray<SessionCallbackRecord> sessionCallbackRecordMap) { mToken = token; Loading @@ -2083,6 +2086,14 @@ public final class TvInputManager { mSessionCallbackRecordMap = sessionCallbackRecordMap; } public TvIAppManager.Session getIAppSession() { return mIAppSession; } public void setIAppSession(TvIAppManager.Session IAppSession) { this.mIAppSession = IAppSession; } /** * Releases this session. */ Loading
media/java/android/media/tv/TvView.java +7 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ import android.media.PlaybackParams; import android.media.tv.TvInputManager.Session; import android.media.tv.TvInputManager.Session.FinishedInputEventCallback; import android.media.tv.TvInputManager.SessionCallback; import android.media.tv.interactive.TvIAppManager; import android.media.tv.interactive.TvIAppView; import android.net.Uri; import android.os.Bundle; import android.os.Handler; Loading Loading @@ -197,6 +199,11 @@ public class TvView extends ViewGroup { mCallback = callback; } /** @hide */ public Session getInputSession() { return mSession; } /** * Sets this as the main {@link TvView}. * Loading
media/java/android/media/tv/interactive/TvIAppManager.java +11 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemService; import android.content.Context; import android.media.tv.TvInputManager; import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; Loading Loading @@ -150,6 +151,8 @@ public final class TvIAppManager { private IBinder mToken; private TvInputManager.Session mInputSession; private Session(IBinder token, ITvIAppManager service, int userId, int seq, SparseArray<SessionCallbackRecord> sessionCallbackRecordMap) { mToken = token; Loading @@ -159,6 +162,14 @@ public final class TvIAppManager { mSessionCallbackRecordMap = sessionCallbackRecordMap; } public TvInputManager.Session getInputSession() { return mInputSession; } public void setInputSession(TvInputManager.Session inputSession) { mInputSession = inputSession; } void startIApp() { if (mToken == null) { Log.w(TAG, "The session has been already released"); Loading
media/java/android/media/tv/interactive/TvIAppView.java +41 −0 Original line number Diff line number Diff line Loading @@ -16,9 +16,12 @@ package android.media.tv.interactive; import android.annotation.Nullable; import android.content.Context; import android.content.res.Resources; import android.content.res.XmlResourceParser; import android.media.tv.TvInputManager; import android.media.tv.TvView; import android.media.tv.interactive.TvIAppManager.Session; import android.media.tv.interactive.TvIAppManager.SessionCallback; import android.os.Handler; Loading @@ -39,6 +42,11 @@ public class TvIAppView extends ViewGroup { private static final String TAG = "TvIAppView"; private static final boolean DEBUG = false; private static final int SET_TVVIEW_SUCCESS = 1; private static final int SET_TVVIEW_FAIL = 2; private static final int UNSET_TVVIEW_SUCCESS = 3; private static final int UNSET_TVVIEW_FAIL = 4; private final TvIAppManager mTvIAppManager; private final Handler mHandler = new Handler(); private Session mSession; Loading Loading @@ -213,6 +221,39 @@ public class TvIAppView extends ViewGroup { } } public Session getIAppSession() { return mSession; } /** * Sets the TvIAppView to receive events from TIS. This method links the session of * TvIAppManager to TvInputManager session, so the TIAS can get the TIS events. * * @param tvView the TvView to be linked to this TvIAppView via linking of Sessions. * @return to be added */ public int setTvView(@Nullable TvView tvView) { if (tvView == null) { return unsetTvView(); } TvInputManager.Session inputSession = tvView.getInputSession(); if (inputSession == null || mSession == null) { return SET_TVVIEW_FAIL; } mSession.setInputSession(inputSession); inputSession.setIAppSession(mSession); return SET_TVVIEW_SUCCESS; } private int unsetTvView() { if (mSession == null || mSession.getInputSession() == null) { return UNSET_TVVIEW_FAIL; } mSession.getInputSession().setIAppSession(null); mSession.setInputSession(null); return UNSET_TVVIEW_SUCCESS; } private class MySessionCallback extends SessionCallback { final String mIAppServiceId; int mType; Loading