Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4c0b536a authored by huangyy's avatar huangyy Committed by shubang
Browse files

TIAF:add toggle teletext api



Bug: 213954653
Test: mmm

Signed-off-by: default avatarhuangyy <yuyao.huang@seraphic-corp.com>
Change-Id: I2547c31a257fb6a8badd2fd58f59fbd00e4c6e44
parent 891645ea
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ interface ITvIAppManager {
    void createBiInteractiveApp(
            in IBinder sessionToken, in Uri biIAppUri, in Bundle params, int userId);
    void destroyBiInteractiveApp(in IBinder sessionToken, in String biIAppId, int userId);
    void setTeletextAppEnabled(in IBinder sessionToken, boolean enable, int userId);
    void sendCurrentChannelUri(in IBinder sessionToken, in Uri channelUri, int userId);
    void sendCurrentChannelLcn(in IBinder sessionToken, int lcn, int userId);
    void sendStreamVolume(in IBinder sessionToken, float volume, int userId);
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ oneway interface ITvInteractiveAppClient {
    void onRemoveBroadcastInfo(int id, int seq);
    void onSessionStateChanged(int state, int seq);
    void onBiInteractiveAppCreated(in Uri biIAppUri, in String biIAppId, int seq);
    void onTeletextAppStateChanged(int state, int seq);
    void onCommandRequest(in String cmdType, in Bundle parameters, int seq);
    void onSetVideoBounds(in Rect rect, int seq);
    void onRequestCurrentChannelUri(int seq);
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ oneway interface ITvInteractiveAppSession {
    void resetInteractiveApp();
    void createBiInteractiveApp(in Uri biIAppUri, in Bundle params);
    void destroyBiInteractiveApp(in String biIAppId);
    void setTeletextAppEnabled(boolean enable);
    void sendCurrentChannelUri(in Uri channelUri);
    void sendCurrentChannelLcn(int lcn);
    void sendStreamVolume(float volume);
+1 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ oneway interface ITvInteractiveAppSessionCallback {
    void onRemoveBroadcastInfo(int id);
    void onSessionStateChanged(int state);
    void onBiInteractiveAppCreated(in Uri biIAppUri, in String biIAppId);
    void onTeletextAppStateChanged(int state);
    void onCommandRequest(in String cmdType, in Bundle parameters);
    void onSetVideoBounds(in Rect rect);
    void onRequestCurrentChannelUri();
+68 −0
Original line number Diff line number Diff line
@@ -92,6 +92,30 @@ public final class TvIAppManager {
     */
    public static final int TV_INTERACTIVE_APP_RTE_STATE_ERROR = 4;

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef(flag = false, prefix = "TELETEXT_APP_STATE_", value = {
            TELETEXT_APP_STATE_SHOW,
            TELETEXT_APP_STATE_HIDE,
            TELETEXT_APP_STATE_ERROR})
    public @interface TeletextAppState {}

    /**
     * Show state of Teletext app.
     * @hide
     */
    public static final int TELETEXT_APP_STATE_SHOW = 1;
    /**
     * Hide state of Teletext app.
     * @hide
     */
    public static final int TELETEXT_APP_STATE_HIDE = 2;
    /**
     * Error state of Teletext app.
     * @hide
     */
    public static final int TELETEXT_APP_STATE_ERROR = 3;

    /**
     * Key for package name in app link.
     * <p>Type: String
@@ -381,6 +405,18 @@ public final class TvIAppManager {
                    record.postBiInteractiveAppCreated(biIAppUri, biIAppId);
                }
            }

            @Override
            public void onTeletextAppStateChanged(int state, int seq) {
                synchronized (mSessionCallbackRecordMap) {
                    SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
                    if (record == null) {
                        Log.e(TAG, "Callback not found for seq " + seq);
                        return;
                    }
                    record.postTeletextAppStateChanged(state);
                }
            }
        };
        ITvInteractiveAppManagerCallback managerCallback =
                new ITvInteractiveAppManagerCallback.Stub() {
@@ -801,6 +837,18 @@ public final class TvIAppManager {
            }
        }

        void setTeletextAppEnabled(boolean enable) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.setTeletextAppEnabled(mToken, enable, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

        void sendCurrentChannelUri(@Nullable Uri channelUri) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
@@ -1522,6 +1570,15 @@ public final class TvIAppManager {
                }
            });
        }

        void postTeletextAppStateChanged(int state) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mSessionCallback.onTeletextAppStateChanged(mSession, state);
                }
            });
        }
    }

    /**
@@ -1647,5 +1704,16 @@ public final class TvIAppManager {
         */
        public void onBiInteractiveAppCreated(Session session, Uri biIAppUri, String biIAppId) {
        }

        /**
         * This is called when {@link TvIAppService.Session#notifyTeletextAppStateChanged} is
         * called.
         *
         * @param session A {@link TvIAppManager.Session} associated with this callback.
         * @param state the current state.
         */
        public void onTeletextAppStateChanged(
                Session session, @TvIAppManager.TeletextAppState int state) {
        }
    }
}
Loading