Extend other BroadcastInfo related classes

Bug: 206484728
Change-Id: Iae4c7140780126e75796fccc6745f0377978b57c
This commit is contained in:
Yixiao Luo
2021-12-06 15:57:47 -08:00
parent 04c77943cf
commit eef344e15c
17 changed files with 1125 additions and 31 deletions

View File

@@ -23,19 +23,35 @@ import android.annotation.NonNull;
/** @hide */
public abstract class BroadcastInfoRequest implements Parcelable {
protected static final int PARCEL_TOKEN_TS_REQUEST = 1;
// todo: change const declaration to intdef
public static final int REQUEST_OPTION_REPEAT = 11;
public static final int REQUEST_OPTION_AUTO_UPDATE = 12;
public static final @NonNull Parcelable.Creator<BroadcastInfoRequest> CREATOR =
new Parcelable.Creator<BroadcastInfoRequest>() {
@Override
public BroadcastInfoRequest createFromParcel(Parcel source) {
int token = source.readInt();
switch (token) {
case PARCEL_TOKEN_TS_REQUEST:
int type = source.readInt();
switch (type) {
case BroadcastInfoType.TS:
return TsRequest.createFromParcelBody(source);
case BroadcastInfoType.TABLE:
return TableRequest.createFromParcelBody(source);
case BroadcastInfoType.SECTION:
return SectionRequest.createFromParcelBody(source);
case BroadcastInfoType.PES:
return PesRequest.createFromParcelBody(source);
case BroadcastInfoType.STREAM_EVENT:
return StreamEventRequest.createFromParcelBody(source);
case BroadcastInfoType.DSMCC:
return DsmccRequest.createFromParcelBody(source);
case BroadcastInfoType.TV_PROPRIETARY_FUNCTION:
return TvProprietaryFunctionRequest.createFromParcelBody(source);
default:
throw new IllegalStateException(
"Unexpected broadcast info request type token in parcel.");
"Unexpected broadcast info request type (value "
+ type + ") in parcel.");
}
}
@@ -45,18 +61,32 @@ public abstract class BroadcastInfoRequest implements Parcelable {
}
};
int requestId;
protected final int mType;
protected final int mRequestId;
protected final int mOption;
public BroadcastInfoRequest(int requestId) {
this.requestId = requestId;
protected BroadcastInfoRequest(int type, int requestId, int option) {
mType = type;
mRequestId = requestId;
mOption = option;
}
protected BroadcastInfoRequest(Parcel source) {
requestId = source.readInt();
protected BroadcastInfoRequest(int type, Parcel source) {
mType = type;
mRequestId = source.readInt();
mOption = source.readInt();
}
public int getType() {
return mType;
}
public int getRequestId() {
return requestId;
return mRequestId;
}
public int getOption() {
return mOption;
}
@Override
@@ -66,6 +96,8 @@ public abstract class BroadcastInfoRequest implements Parcelable {
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(requestId);
dest.writeInt(mType);
dest.writeInt(mRequestId);
dest.writeInt(mOption);
}
}

View File

@@ -22,12 +22,37 @@ import android.os.Parcelable;
import android.annotation.NonNull;
/** @hide */
public final class BroadcastInfoResponse implements Parcelable {
public abstract class BroadcastInfoResponse implements Parcelable {
// todo: change const declaration to intdef
public static final int ERROR = 1;
public static final int OK = 2;
public static final int CANCEL = 3;
public static final @NonNull Parcelable.Creator<BroadcastInfoResponse> CREATOR =
new Parcelable.Creator<BroadcastInfoResponse>() {
@Override
public BroadcastInfoResponse createFromParcel(Parcel source) {
return new BroadcastInfoResponse(source);
int type = source.readInt();
switch (type) {
case BroadcastInfoType.TS:
return TsResponse.createFromParcelBody(source);
case BroadcastInfoType.TABLE:
return TableResponse.createFromParcelBody(source);
case BroadcastInfoType.SECTION:
return SectionResponse.createFromParcelBody(source);
case BroadcastInfoType.PES:
return PesResponse.createFromParcelBody(source);
case BroadcastInfoType.STREAM_EVENT:
return StreamEventResponse.createFromParcelBody(source);
case BroadcastInfoType.DSMCC:
return DsmccResponse.createFromParcelBody(source);
case BroadcastInfoType.TV_PROPRIETARY_FUNCTION:
return TvProprietaryFunctionResponse.createFromParcelBody(source);
default:
throw new IllegalStateException(
"Unexpected broadcast info response type (value "
+ type + ") in parcel.");
}
}
@Override
@@ -36,18 +61,39 @@ public final class BroadcastInfoResponse implements Parcelable {
}
};
int requestId;
protected final int mType;
protected final int mRequestId;
protected final int mSequence;
protected final int mResponseResult;
public BroadcastInfoResponse(int requestId) {
this.requestId = requestId;
protected BroadcastInfoResponse(int type, int requestId, int sequence, int responseResult) {
mType = type;
mRequestId = requestId;
mSequence = sequence;
mResponseResult = responseResult;
}
private BroadcastInfoResponse(Parcel source) {
requestId = source.readInt();
protected BroadcastInfoResponse(int type, Parcel source) {
mType = type;
mRequestId = source.readInt();
mSequence = source.readInt();
mResponseResult = source.readInt();
}
public int getType() {
return mType;
}
public int getRequestId() {
return requestId;
return mRequestId;
}
public int getSequence() {
return mSequence;
}
public int getResponseResult() {
return mResponseResult;
}
@Override
@@ -57,6 +103,9 @@ public final class BroadcastInfoResponse implements Parcelable {
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(requestId);
dest.writeInt(mType);
dest.writeInt(mRequestId);
dest.writeInt(mSequence);
dest.writeInt(mResponseResult);
}
}

View File

@@ -16,4 +16,17 @@
package android.media.tv;
parcelable TsRequest;
/** @hide */
public final class BroadcastInfoType {
// todo: change const declaration to intdef in TvInputManager
public static final int TS = 1;
public static final int TABLE = 2;
public static final int SECTION = 3;
public static final int PES = 4;
public static final int STREAM_EVENT = 5;
public static final int DSMCC = 6;
public static final int TV_PROPRIETARY_FUNCTION = 7;
private BroadcastInfoType() {
}
}

View File

@@ -0,0 +1,69 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class DsmccRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.DSMCC;
public static final @NonNull Parcelable.Creator<DsmccRequest> CREATOR =
new Parcelable.Creator<DsmccRequest>() {
@Override
public DsmccRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public DsmccRequest[] newArray(int size) {
return new DsmccRequest[size];
}
};
private final Uri mUri;
public static DsmccRequest createFromParcelBody(Parcel in) {
return new DsmccRequest(in);
}
public DsmccRequest(int requestId, int option, Uri uri) {
super(requestType, requestId, option);
mUri = uri;
}
protected DsmccRequest(Parcel source) {
super(requestType, source);
String uriString = source.readString();
mUri = uriString == null ? null : Uri.parse(uriString);
}
public Uri getUri() {
return mUri;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
String uriString = mUri == null ? null : mUri.toString();
dest.writeString(uriString);
}
}

View File

@@ -0,0 +1,68 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.ParcelFileDescriptor;
import android.os.Parcelable;
/** @hide */
public class DsmccResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.DSMCC;
public static final @NonNull Parcelable.Creator<DsmccResponse> CREATOR =
new Parcelable.Creator<DsmccResponse>() {
@Override
public DsmccResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public DsmccResponse[] newArray(int size) {
return new DsmccResponse[size];
}
};
private final ParcelFileDescriptor mFile;
public static DsmccResponse createFromParcelBody(Parcel in) {
return new DsmccResponse(in);
}
public DsmccResponse(int requestId, int sequence, int responseResult,
ParcelFileDescriptor file) {
super(responseType, requestId, sequence, responseResult);
mFile = file;
}
protected DsmccResponse(Parcel source) {
super(responseType, source);
mFile = source.readFileDescriptor();
}
public ParcelFileDescriptor getFile() {
return mFile;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
mFile.writeToParcel(dest, flags);
}
}

View File

@@ -0,0 +1,74 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class PesRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.PES;
public static final @NonNull Parcelable.Creator<PesRequest> CREATOR =
new Parcelable.Creator<PesRequest>() {
@Override
public PesRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public PesRequest[] newArray(int size) {
return new PesRequest[size];
}
};
private final int mTsPid;
private final int mStreamId;
public static PesRequest createFromParcelBody(Parcel in) {
return new PesRequest(in);
}
public PesRequest(int requestId, int option, int tsPid, int streamId) {
super(requestType, requestId, option);
mTsPid = tsPid;
mStreamId = streamId;
}
protected PesRequest(Parcel source) {
super(requestType, source);
mTsPid = source.readInt();
mStreamId = source.readInt();
}
public int getTsPid() {
return mTsPid;
}
public int getStreamId() {
return mStreamId;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(mTsPid);
dest.writeInt(mStreamId);
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class PesResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.PES;
public static final @NonNull Parcelable.Creator<PesResponse> CREATOR =
new Parcelable.Creator<PesResponse>() {
@Override
public PesResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public PesResponse[] newArray(int size) {
return new PesResponse[size];
}
};
private final String mSharedFilterToken;
public static PesResponse createFromParcelBody(Parcel in) {
return new PesResponse(in);
}
public PesResponse(int requestId, int sequence, int responseResult, String sharedFilterToken) {
super(responseType, requestId, sequence, responseResult);
mSharedFilterToken = sharedFilterToken;
}
protected PesResponse(Parcel source) {
super(responseType, source);
mSharedFilterToken = source.readString();
}
public String getSharedFilterToken() {
return mSharedFilterToken;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mSharedFilterToken);
}
}

View File

@@ -0,0 +1,82 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class SectionRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.SECTION;
public static final @NonNull Parcelable.Creator<SectionRequest> CREATOR =
new Parcelable.Creator<SectionRequest>() {
@Override
public SectionRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public SectionRequest[] newArray(int size) {
return new SectionRequest[size];
}
};
private final int mTsPid;
private final int mTableId;
private final int mVersion;
public static SectionRequest createFromParcelBody(Parcel in) {
return new SectionRequest(in);
}
public SectionRequest(int requestId, int option, int tsPid, int tableId, int version) {
super(requestType, requestId, option);
mTsPid = tsPid;
mTableId = tableId;
mVersion = version;
}
protected SectionRequest(Parcel source) {
super(requestType, source);
mTsPid = source.readInt();
mTableId = source.readInt();
mVersion = source.readInt();
}
public int getTsPid() {
return mTsPid;
}
public int getTableId() {
return mTableId;
}
public int getVersion() {
return mVersion;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(mTsPid);
dest.writeInt(mTableId);
dest.writeInt(mVersion);
}
}

View File

@@ -0,0 +1,84 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class SectionResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.SECTION;
public static final @NonNull Parcelable.Creator<SectionResponse> CREATOR =
new Parcelable.Creator<SectionResponse>() {
@Override
public SectionResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public SectionResponse[] newArray(int size) {
return new SectionResponse[size];
}
};
private final int mSessionId;
private final int mVersion;
private final Bundle mSessionData;
public static SectionResponse createFromParcelBody(Parcel in) {
return new SectionResponse(in);
}
public SectionResponse(int requestId, int sequence, int responseResult, int sessionId,
int version, Bundle sessionData) {
super(responseType, requestId, sequence, responseResult);
mSessionId = sessionId;
mVersion = version;
mSessionData = sessionData;
}
protected SectionResponse(Parcel source) {
super(responseType, source);
mSessionId = source.readInt();
mVersion = source.readInt();
mSessionData = source.readBundle();
}
public int getSessionId() {
return mSessionId;
}
public int getVersion() {
return mVersion;
}
public Bundle getSessionData() {
return mSessionData;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(mSessionId);
dest.writeInt(mVersion);
dest.writeBundle(mSessionData);
}
}

View File

@@ -0,0 +1,77 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class StreamEventRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.STREAM_EVENT;
public static final @NonNull Parcelable.Creator<StreamEventRequest> CREATOR =
new Parcelable.Creator<StreamEventRequest>() {
@Override
public StreamEventRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public StreamEventRequest[] newArray(int size) {
return new StreamEventRequest[size];
}
};
private final Uri mTargetUri;
private final String mEventName;
public static StreamEventRequest createFromParcelBody(Parcel in) {
return new StreamEventRequest(in);
}
public StreamEventRequest(int requestId, int option, Uri targetUri, String eventName) {
super(requestType, requestId, option);
this.mTargetUri = targetUri;
this.mEventName = eventName;
}
protected StreamEventRequest(Parcel source) {
super(requestType, source);
String uriString = source.readString();
mTargetUri = uriString == null ? null : Uri.parse(uriString);
mEventName = source.readString();
}
public Uri getTargetUri() {
return mTargetUri;
}
public String getEventName() {
return mEventName;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
String uriString = mTargetUri == null ? null : mTargetUri.toString();
dest.writeString(uriString);
dest.writeString(mEventName);
}
}

View File

@@ -0,0 +1,91 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class StreamEventResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.STREAM_EVENT;
public static final @NonNull Parcelable.Creator<StreamEventResponse> CREATOR =
new Parcelable.Creator<StreamEventResponse>() {
@Override
public StreamEventResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public StreamEventResponse[] newArray(int size) {
return new StreamEventResponse[size];
}
};
private final String mName;
private final String mText;
private final String mData;
private final String mStatus;
public static StreamEventResponse createFromParcelBody(Parcel in) {
return new StreamEventResponse(in);
}
public StreamEventResponse(int requestId, int sequence, int responseResult, String name,
String text, String data, String status) {
super(responseType, requestId, sequence, responseResult);
mName = name;
mText = text;
mData = data;
mStatus = status;
}
protected StreamEventResponse(Parcel source) {
super(responseType, source);
mName = source.readString();
mText = source.readString();
mData = source.readString();
mStatus = source.readString();
}
public String getName() {
return mName;
}
public String getText() {
return mText;
}
public String getData() {
return mData;
}
public String getStatus() {
return mStatus;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mName);
dest.writeString(mText);
dest.writeString(mData);
dest.writeString(mStatus);
}
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class TableRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.TABLE;
// todo: change const declaration to intdef
public static final int PAT = 1;
public static final int PMT = 2;
public static final @NonNull Parcelable.Creator<TableRequest> CREATOR =
new Parcelable.Creator<TableRequest>() {
@Override
public TableRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public TableRequest[] newArray(int size) {
return new TableRequest[size];
}
};
private final int mTableId;
private final int mTableName;
private final int mVersion;
public static TableRequest createFromParcelBody(Parcel in) {
return new TableRequest(in);
}
public TableRequest(int requestId, int option, int tableId, int tableName, int version) {
super(requestType, requestId, option);
mTableId = tableId;
mTableName = tableName;
mVersion = version;
}
protected TableRequest(Parcel source) {
super(requestType, source);
mTableId = source.readInt();
mTableName = source.readInt();
mVersion = source.readInt();
}
public int getTableId() {
return mTableId;
}
public int getTableName() {
return mTableName;
}
public int getVersion() {
return mVersion;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeInt(mTableId);
dest.writeInt(mTableName);
dest.writeInt(mVersion);
}
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
import android.net.Uri;
/** @hide */
public class TableResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.TABLE;
public static final @NonNull Parcelable.Creator<TableResponse> CREATOR =
new Parcelable.Creator<TableResponse>() {
@Override
public TableResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public TableResponse[] newArray(int size) {
return new TableResponse[size];
}
};
private final Uri mTableUri;
private final int mVersion;
private final int mSize;
public static TableResponse createFromParcelBody(Parcel in) {
return new TableResponse(in);
}
public TableResponse(int requestId, int sequence, int responseResult, Uri tableUri,
int version, int size) {
super(responseType, requestId, sequence, responseResult);
mTableUri = tableUri;
mVersion = version;
mSize = size;
}
protected TableResponse(Parcel source) {
super(responseType, source);
String uriString = source.readString();
mTableUri = uriString == null ? null : Uri.parse(uriString);
mVersion = source.readInt();
mSize = source.readInt();
}
public Uri getTableUri() {
return mTableUri;
}
public int getVersion() {
return mVersion;
}
public int getSize() {
return mSize;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
String uriString = mTableUri == null ? null : mTableUri.toString();
dest.writeString(uriString);
dest.writeInt(mVersion);
dest.writeInt(mSize);
}
}

View File

@@ -22,6 +22,8 @@ import android.os.Parcelable;
/** @hide */
public class TsRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.TS;
public static final @NonNull Parcelable.Creator<TsRequest> CREATOR =
new Parcelable.Creator<TsRequest>() {
@Override
@@ -36,30 +38,29 @@ public class TsRequest extends BroadcastInfoRequest implements Parcelable {
}
};
int tsPid;
private final int mTsPid;
public static TsRequest createFromParcelBody(Parcel in) {
return new TsRequest(in);
}
public TsRequest(int requestId, int tsPid) {
super(requestId);
this.tsPid = tsPid;
public TsRequest(int requestId, int option, int tsPid) {
super(requestType, requestId, option);
mTsPid = tsPid;
}
protected TsRequest(Parcel source) {
super(source);
tsPid = source.readInt();
super(requestType, source);
mTsPid = source.readInt();
}
public int getTsPid() {
return tsPid;
return mTsPid;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
dest.writeInt(PARCEL_TOKEN_TS_REQUEST);
super.writeToParcel(dest, flags);
dest.writeInt(tsPid);
dest.writeInt(mTsPid);
}
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class TsResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.TS;
public static final @NonNull Parcelable.Creator<TsResponse> CREATOR =
new Parcelable.Creator<TsResponse>() {
@Override
public TsResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public TsResponse[] newArray(int size) {
return new TsResponse[size];
}
};
private final String mSharedFilterToken;
public static TsResponse createFromParcelBody(Parcel in) {
return new TsResponse(in);
}
public TsResponse(int requestId, int sequence, int responseResult, String sharedFilterToken) {
super(responseType, requestId, sequence, responseResult);
this.mSharedFilterToken = sharedFilterToken;
}
protected TsResponse(Parcel source) {
super(responseType, source);
mSharedFilterToken = source.readString();
}
public String getSharedFilterToken() {
return mSharedFilterToken;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mSharedFilterToken);
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class TvProprietaryFunctionRequest extends BroadcastInfoRequest implements Parcelable {
public static final int requestType = BroadcastInfoType.TV_PROPRIETARY_FUNCTION;
public static final @NonNull Parcelable.Creator<TvProprietaryFunctionRequest> CREATOR =
new Parcelable.Creator<TvProprietaryFunctionRequest>() {
@Override
public TvProprietaryFunctionRequest createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public TvProprietaryFunctionRequest[] newArray(int size) {
return new TvProprietaryFunctionRequest[size];
}
};
private final String mNameSpace;
private final String mName;
private final String mArguments;
public static TvProprietaryFunctionRequest createFromParcelBody(Parcel in) {
return new TvProprietaryFunctionRequest(in);
}
public TvProprietaryFunctionRequest(int requestId, int option, String nameSpace,
String name, String arguments) {
super(requestType, requestId, option);
mNameSpace = nameSpace;
mName = name;
mArguments = arguments;
}
protected TvProprietaryFunctionRequest(Parcel source) {
super(requestType, source);
mNameSpace = source.readString();
mName = source.readString();
mArguments = source.readString();
}
public String getNameSpace() {
return mNameSpace;
}
public String getName() {
return mName;
}
public String getArguments() {
return mArguments;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mNameSpace);
dest.writeString(mName);
dest.writeString(mArguments);
}
}

View File

@@ -0,0 +1,67 @@
/*
* Copyright (C) 2021 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.media.tv;
import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;
/** @hide */
public class TvProprietaryFunctionResponse extends BroadcastInfoResponse implements Parcelable {
public static final int responseType = BroadcastInfoType.TV_PROPRIETARY_FUNCTION;
public static final @NonNull Parcelable.Creator<TvProprietaryFunctionResponse> CREATOR =
new Parcelable.Creator<TvProprietaryFunctionResponse>() {
@Override
public TvProprietaryFunctionResponse createFromParcel(Parcel source) {
source.readInt();
return createFromParcelBody(source);
}
@Override
public TvProprietaryFunctionResponse[] newArray(int size) {
return new TvProprietaryFunctionResponse[size];
}
};
private final String mResponse;
public static TvProprietaryFunctionResponse createFromParcelBody(Parcel in) {
return new TvProprietaryFunctionResponse(in);
}
public TvProprietaryFunctionResponse(int requestId, int sequence, int responseResult,
String response) {
super(responseType, requestId, sequence, responseResult);
mResponse = response;
}
protected TvProprietaryFunctionResponse(Parcel source) {
super(responseType, source);
mResponse = source.readString();
}
public String getResponse() {
return mResponse;
}
@Override
public void writeToParcel(@NonNull Parcel dest, int flags) {
super.writeToParcel(dest, flags);
dest.writeString(mResponse);
}
}