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

Commit d931e912 authored by shubang's avatar shubang Committed by Shubang Lu
Browse files

Extend TIAF APIs

1. get current video bounds
2. timeline selector
3. playback command stop modes
4. extend table request / response

Bug: 264934231
Test: mmm
Change-Id: Id1f8b18e264495c37ebf841326e0e5b4ff534287
parent c28af28d
Loading
Loading
Loading
Loading
+44 −1
Original line number Diff line number Diff line
@@ -33,11 +33,54 @@ public final class TableRequest extends BroadcastInfoRequest implements Parcelab

    /** @hide */
    @Retention(RetentionPolicy.SOURCE)
    @IntDef({TABLE_NAME_PAT, TABLE_NAME_PMT})
    @IntDef({TABLE_NAME_PAT, TABLE_NAME_PMT, TABLE_NAME_CAT})
    public @interface TableName {}

    /** Program Association Table */
    public static final int TABLE_NAME_PAT = 0;
    /** Program Mapping Table */
    public static final int TABLE_NAME_PMT = 1;
    /**
     * Conditional Access Table
     * @hide
     */
    public static final int TABLE_NAME_CAT = 2;
    /**
     * Network Information Table
     * @hide
     */
    public static final int TABLE_NAME_NIT = 3;
    /**
     * Bouquet Association Table
     * @hide
     */
    public static final int TABLE_NAME_BAT = 4;
    /**
     * Service Description Table
     * @hide
     */
    public static final int TABLE_NAME_SDT = 5;
    /**
     * Event Information Table
     * @hide
     */
    public static final int TABLE_NAME_EIT = 6;
    /**
     * Time and Date Table
     * @hide
     */
    public static final int TABLE_NAME_TDT = 7;
    /**
     * Time Offset Table
     * @hide
     */
    public static final int TABLE_NAME_TOT = 8;
    /**
     * Selection Information Table
     * @hide
     */
    public static final int TABLE_NAME_SIT = 9;


    public static final @NonNull Parcelable.Creator<TableRequest> CREATOR =
            new Parcelable.Creator<TableRequest>() {
+66 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.annotation.Nullable;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.SharedMemory;

/**
 * A response for Table from broadcast signal.
@@ -46,6 +47,8 @@ public final class TableResponse extends BroadcastInfoResponse implements Parcel
    private final Uri mTableUri;
    private final int mVersion;
    private final int mSize;
    private final byte[] mTableByteArray;
    private final SharedMemory mTableSharedMemory;

    static TableResponse createFromParcelBody(Parcel in) {
        return new TableResponse(in);
@@ -54,9 +57,33 @@ public final class TableResponse extends BroadcastInfoResponse implements Parcel
    public TableResponse(int requestId, int sequence, @ResponseResult int responseResult,
            @Nullable Uri tableUri, int version, int size) {
        super(RESPONSE_TYPE, requestId, sequence, responseResult);
        mVersion = version;
        mSize = size;
        mTableUri = tableUri;
        mTableByteArray = null;
        mTableSharedMemory = null;
    }

    /** @hide */
    public TableResponse(int requestId, int sequence, @ResponseResult int responseResult,
            @NonNull byte[] tableByteArray, int version, int size) {
        super(RESPONSE_TYPE, requestId, sequence, responseResult);
        mVersion = version;
        mSize = size;
        mTableUri = null;
        mTableByteArray = tableByteArray;
        mTableSharedMemory = null;
    }

    /** @hide */
    public TableResponse(int requestId, int sequence, @ResponseResult int responseResult,
            @NonNull SharedMemory tableSharedMemory, int version, int size) {
        super(RESPONSE_TYPE, requestId, sequence, responseResult);
        mVersion = version;
        mSize = size;
        mTableUri = null;
        mTableByteArray = null;
        mTableSharedMemory = tableSharedMemory;
    }

    TableResponse(Parcel source) {
@@ -65,6 +92,14 @@ public final class TableResponse extends BroadcastInfoResponse implements Parcel
        mTableUri = uriString == null ? null : Uri.parse(uriString);
        mVersion = source.readInt();
        mSize = source.readInt();
        int arrayLength = source.readInt();
        if (arrayLength >= 0) {
            mTableByteArray = new byte[arrayLength];
            source.readByteArray(mTableByteArray);
        } else {
            mTableByteArray = null;
        }
        mTableSharedMemory = (SharedMemory) source.readTypedObject(SharedMemory.CREATOR);
    }

    /**
@@ -75,6 +110,30 @@ public final class TableResponse extends BroadcastInfoResponse implements Parcel
        return mTableUri;
    }

    /**
     * Gets the data of the table as a byte array.
     *
     * @return the table data as a byte array, or {@code null} if the data is not stored as a byte
     *         array.
     * @hide
     */
    @Nullable
    public byte[] getTableByteArray() {
        return mTableByteArray;
    }

    /**
     * Gets the data of the table as a {@link SharedMemory} object.
     *
     * @return the table data as a {@link SharedMemory} object, or {@code null} if the data is not
     *         stored in shared memory.
     * @hide
     */
    @Nullable
    public SharedMemory getTableSharedMemory() {
        return mTableSharedMemory;
    }

    /**
     * Gets the version number of requested table. If it is null, value will be -1.
     * <p>The consistency of version numbers between request and response depends on
@@ -106,5 +165,12 @@ public final class TableResponse extends BroadcastInfoResponse implements Parcel
        dest.writeString(uriString);
        dest.writeInt(mVersion);
        dest.writeInt(mSize);
        if (mTableByteArray != null) {
            dest.writeInt(mTableByteArray.length);
            dest.writeByteArray(mTableByteArray);
        } else {
            dest.writeInt(-1);
        }
        dest.writeTypedObject(mTableSharedMemory, flags);
    }
}
+24 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public final class TimelineRequest extends BroadcastInfoRequest implements Parce
            };

    private final int mIntervalMillis;
    private final String mSelector;

    static TimelineRequest createFromParcelBody(Parcel in) {
        return new TimelineRequest(in);
@@ -50,11 +51,21 @@ public final class TimelineRequest extends BroadcastInfoRequest implements Parce
    public TimelineRequest(int requestId, @RequestOption int option, int intervalMillis) {
        super(REQUEST_TYPE, requestId, option);
        mIntervalMillis = intervalMillis;
        mSelector = null;
    }

    /** @hide */
    public TimelineRequest(int requestId, @RequestOption int option, int intervalMillis,
            @NonNull String selector) {
        super(REQUEST_TYPE, requestId, option);
        mIntervalMillis = intervalMillis;
        mSelector = selector;
    }

    TimelineRequest(Parcel source) {
        super(REQUEST_TYPE, source);
        mIntervalMillis = source.readInt();
        mSelector = source.readString();
    }

    /**
@@ -64,6 +75,18 @@ public final class TimelineRequest extends BroadcastInfoRequest implements Parce
        return mIntervalMillis;
    }

    /**
     * Gets the timeline selector.
     * <p>The selector describes the type and location of timeline signalling. For example
     * {@code urn:dvb:css:timeline:pts} is a selector in DVB standard.
     *
     * @return the selector if it's set; {@code null} otherwise.
     * @hide
     */
    public String getSelector() {
        return mSelector;
    }

    @Override
    public int describeContents() {
        return 0;
@@ -73,5 +96,6 @@ public final class TimelineRequest extends BroadcastInfoRequest implements Parce
    public void writeToParcel(@NonNull Parcel dest, int flags) {
        super.writeToParcel(dest, flags);
        dest.writeInt(mIntervalMillis);
        dest.writeString(mSelector);
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ oneway interface ITvInteractiveAppClient {
    void onCommandRequest(in String cmdType, in Bundle parameters, int seq);
    void onTimeShiftCommandRequest(in String cmdType, in Bundle parameters, int seq);
    void onSetVideoBounds(in Rect rect, int seq);
    void onRequestCurrentVideoBounds(int seq);
    void onRequestCurrentChannelUri(int seq);
    void onRequestCurrentChannelLcn(int seq);
    void onRequestStreamVolume(int seq);
+1 −0
Original line number Diff line number Diff line
@@ -48,6 +48,7 @@ interface ITvInteractiveAppManager {
            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 sendCurrentVideoBounds(in IBinder sessionToken, in Rect bounds, 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);
Loading