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

Commit 19a1dd02 authored by shubang's avatar shubang
Browse files

TIAF: create & destroy BI IApp

Bug: 211886434
Test: mmm
Change-Id: Ie2b4d1d34b57487318f18a6fcdda116a05f9547f
parent 17facee4
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.media.tv.interactive;

import android.media.tv.BroadcastInfoRequest;
import android.net.Uri;
import android.os.Bundle;
import android.view.InputChannel;

@@ -31,5 +32,6 @@ oneway interface ITvIAppClient {
    void onLayoutSurface(int left, int top, int right, int bottom, int seq);
    void onBroadcastInfoRequest(in BroadcastInfoRequest request, int seq);
    void onSessionStateChanged(int state, int seq);
    void onBiInteractiveAppCreated(in Uri biIAppUri, in String biIAppId, int seq);
    void onCommandRequest(in String cmdType, in Bundle parameters, int seq);
}
+3 −0
Original line number Diff line number Diff line
@@ -35,6 +35,9 @@ interface ITvIAppManager {
    void notifyAppLinkInfo(String tiasId, in Bundle info, int userId);
    void sendAppLinkCommand(String tiasId, in Bundle command, int userId);
    void startIApp(in IBinder sessionToken, int userId);
    void createBiInteractiveApp(
            in IBinder sessionToken, in Uri biIAppUri, in Bundle params, int userId);
    void destroyBiInteractiveApp(in IBinder sessionToken, in String biIAppId, int userId);
    void createSession(
            in ITvIAppClient client, in String iAppServiceId, int type, int seq, int userId);
    void releaseSession(in IBinder sessionToken, int userId);
+4 −2
Original line number Diff line number Diff line
@@ -17,10 +17,10 @@
package android.media.tv.interactive;

import android.graphics.Rect;
import android.net.Uri;
import android.media.tv.BroadcastInfoResponse;
import android.net.Uri;
import android.os.Bundle;
import android.view.Surface;
import android.media.tv.BroadcastInfoResponse;

/**
 * Sub-interface of ITvIAppService.aidl which is created per session and has its own context.
@@ -28,6 +28,8 @@ import android.media.tv.BroadcastInfoResponse;
 */
oneway interface ITvIAppSession {
    void startIApp();
    void createBiInteractiveApp(in Uri biIAppUri, in Bundle params);
    void destroyBiInteractiveApp(in String biIAppId);
    void release();
    void notifyTuned(in Uri channelUri);
    void setSurface(in Surface surface);
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package android.media.tv.interactive;
import android.media.tv.BroadcastInfoRequest;
import android.media.tv.interactive.ITvIAppSession;
import android.media.tv.BroadcastInfoRequest;
import android.net.Uri;
import android.os.Bundle;

/**
@@ -31,5 +32,6 @@ oneway interface ITvIAppSessionCallback {
    void onLayoutSurface(int left, int top, int right, int bottom);
    void onBroadcastInfoRequest(in BroadcastInfoRequest request);
    void onSessionStateChanged(int state);
    void onBiInteractiveAppCreated(in Uri biIAppUri, in String biIAppId);
    void onCommandRequest(in String cmdType, in Bundle parameters);
}
+58 −1
Original line number Diff line number Diff line
@@ -267,6 +267,18 @@ public final class TvIAppManager {
                    record.postSessionStateChanged(state);
                }
            }

            @Override
            public void onBiInteractiveAppCreated(Uri biIAppUri, String biIAppId, int seq) {
                synchronized (mSessionCallbackRecordMap) {
                    SessionCallbackRecord record = mSessionCallbackRecordMap.get(seq);
                    if (record == null) {
                        Log.e(TAG, "Callback not found for seq " + seq);
                        return;
                    }
                    record.postBiInteractiveAppCreated(biIAppUri, biIAppId);
                }
            }
        };
        ITvIAppManagerCallback managerCallback = new ITvIAppManagerCallback.Stub() {
            @Override
@@ -375,7 +387,6 @@ public final class TvIAppManager {
        public void onTvIAppInfoUpdated(TvIAppInfo iAppInfo) {
        }


        /**
         * This is called when the state of the interactive app service is changed.
         * @hide
@@ -622,6 +633,30 @@ public final class TvIAppManager {
            }
        }

        void createBiInteractiveApp(Uri biIAppUri, Bundle params) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.createBiInteractiveApp(mToken, biIAppUri, params, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

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

        /**
         * Sets the {@link android.view.Surface} for this session.
         *
@@ -1077,6 +1112,15 @@ public final class TvIAppManager {
                }
            });
        }

        void postBiInteractiveAppCreated(Uri biIAppUri, String biIAppId) {
            mHandler.post(new Runnable() {
                @Override
                public void run() {
                    mSessionCallback.onBiInteractiveAppCreated(mSession, biIAppUri, biIAppId);
                }
            });
        }
    }

    /**
@@ -1134,5 +1178,18 @@ public final class TvIAppManager {
         */
        public void onSessionStateChanged(Session session, int state) {
        }

        /**
         * This is called when {@link TvIAppService.Session#notifyBiInteractiveAppCreated} is
         * called.
         *
         * @param session A {@link TvIAppManager.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
         *                 app.
         */
        public void onBiInteractiveAppCreated(Session session, Uri biIAppUri, String biIAppId) {
        }
    }
}
Loading