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

Commit e861efdc authored by shubang's avatar shubang
Browse files

TIAF cleanup: add missing APIs for main use cases

Bug: 211931006
Test: mmm
Change-Id: I48fb11278aae463c6eda81dbcd1b3bc6a175b031
parent d3f6ae61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -20,8 +20,8 @@ import android.content.ComponentName;
import android.media.tv.AitInfo;
import android.media.tv.BroadcastInfoResponse;
import android.media.tv.ITvInputSession;
import android.net.Uri;
import android.media.tv.TvTrackInfo;
import android.net.Uri;
import android.os.Bundle;
import android.view.InputChannel;

+1 −0
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ interface ITvInputManager {

    // For broadcast info
    void requestBroadcastInfo(in IBinder sessionToken, in BroadcastInfoRequest request, int userId);
    void removeBroadcastInfo(in IBinder sessionToken, int id, int userId);

    // For TV input hardware binding
    List<TvInputHardwareInfo> getHardwareList();
+1 −0
Original line number Diff line number Diff line
@@ -66,4 +66,5 @@ oneway interface ITvInputSession {

    // For broadcast info
    void requestBroadcastInfo(in BroadcastInfoRequest request);
    void removeBroadcastInfo(int id);
}
+11 −1
Original line number Diff line number Diff line
@@ -71,7 +71,8 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
    private static final int DO_PAUSE_RECORDING = 22;
    private static final int DO_RESUME_RECORDING = 23;
    private static final int DO_REQUEST_BROADCAST_INFO = 24;
    private static final int DO_SET_IAPP_NOTIFICATION_ENABLED = 25;
    private static final int DO_REMOVE_BROADCAST_INFO = 25;
    private static final int DO_SET_IAPP_NOTIFICATION_ENABLED = 26;

    private final boolean mIsRecordingSession;
    private final HandlerCaller mCaller;
@@ -240,6 +241,10 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
                mTvInputSessionImpl.requestBroadcastInfo((BroadcastInfoRequest) msg.obj);
                break;
            }
            case DO_REMOVE_BROADCAST_INFO: {
                mTvInputSessionImpl.removeBroadcastInfo(msg.arg1);
                break;
            }
            case DO_SET_IAPP_NOTIFICATION_ENABLED: {
                mTvInputSessionImpl.setIAppNotificationEnabled((Boolean) msg.obj);
                break;
@@ -404,6 +409,11 @@ public class ITvInputSessionWrapper extends ITvInputSession.Stub implements Hand
        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_REQUEST_BROADCAST_INFO, request));
    }

    @Override
    public void removeBroadcastInfo(int requestId) {
        mCaller.executeOrSendMessage(mCaller.obtainMessageI(DO_REMOVE_BROADCAST_INFO, requestId));
    }

    private final class TvInputEventReceiver extends InputEventReceiver {
        public TvInputEventReceiver(InputChannel inputChannel, Looper looper) {
            super(inputChannel, looper);
+22 −6
Original line number Diff line number Diff line
@@ -731,6 +731,9 @@ public final class TvInputManager {
                @Override
                public void run() {
                    mSessionCallback.onTracksChanged(mSession, tracks);
                    if (mSession.mIAppNotificationEnabled && mSession.getIAppSession() != null) {
                        mSession.getIAppSession().notifyTracksChanged(tracks);
                    }
                }
            });
        }
@@ -740,6 +743,9 @@ public final class TvInputManager {
                @Override
                public void run() {
                    mSessionCallback.onTrackSelected(mSession, type, trackId);
                    if (mSession.mIAppNotificationEnabled && mSession.getIAppSession() != null) {
                        mSession.getIAppSession().notifyTrackSelected(type, trackId);
                    }
                }
            });
        }
@@ -1273,12 +1279,6 @@ public final class TvInputManager {
                    }
                    record.postTuned(channelUri);
                    // TODO: synchronized and wrap the channelUri
                    if (record.mSession.mIAppNotificationEnabled) {
                        TvIAppManager.Session iappSession = record.mSession.mIAppSession;
                        if (iappSession != null) {
                            iappSession.notifyTuned(channelUri);
                        }
                    }
                }
            }

@@ -3014,7 +3014,23 @@ public final class TvInputManager {
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

        /**
         * Removes broadcast info.
         * @param requestId the corresponding request ID sent from
         *                  {@link #requestBroadcastInfo(android.media.tv.BroadcastInfoRequest)}
         */
        public void removeBroadcastInfo(int requestId) {
            if (mToken == null) {
                Log.w(TAG, "The session has been already released");
                return;
            }
            try {
                mService.removeBroadcastInfo(mToken, requestId, mUserId);
            } catch (RemoteException e) {
                throw e.rethrowFromSystemServer();
            }
        }

        private final class InputEventHandler extends Handler {
Loading