blob: bcfbcf8bf5fab2e197ca44f67548b76ee7facbf8 [file] [log] [blame]
Robert Greenwalt37409c52016-06-02 13:43:27 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.telephony;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * Contains Carrier-specific (and opaque) Protocol configuration Option
24 * Data. In general this is only passed on to carrier-specific applications
25 * for interpretation.
26 *
27 * @hide
28 */
29public class PcoData implements Parcelable {
30
31 public final int cid;
32 public final String bearerProto;
33 public final int pcoId;
34 public final byte[] contents;
35
36 public PcoData(int cid, String bearerProto, int pcoId, byte[]contents) {
37 this.cid = cid;
38 this.bearerProto = bearerProto;
39 this.pcoId = pcoId;
40 this.contents = contents;
41 }
42
43 public PcoData(Parcel in) {
44 cid = in.readInt();
45 bearerProto = in.readString();
46 pcoId = in.readInt();
47 contents = in.createByteArray();
48 }
49
50 /**
51 * {@link Parcelable#writeToParcel}
52 */
53 public void writeToParcel(Parcel out, int flags) {
54 out.writeInt(cid);
55 out.writeString(bearerProto);
56 out.writeInt(pcoId);
57 out.writeByteArray(contents);
58 }
59
60 /**
61 * {@link Parcelable#describeContents}
62 */
63 public int describeContents() {
64 return 0;
65 }
66
67 /**
68 * {@link Parcelable.Creator}
69 *
70 * @hide
71 */
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -070072 public static final @android.annotation.NonNull Parcelable.Creator<PcoData> CREATOR = new Parcelable.Creator() {
Robert Greenwalt37409c52016-06-02 13:43:27 -070073 public PcoData createFromParcel(Parcel in) {
74 return new PcoData(in);
75 }
76
77 public PcoData[] newArray(int size) {
78 return new PcoData[size];
79 }
80 };
81
82 @Override
83 public String toString() {
84 return "PcoData(" + cid + ", " + bearerProto + ", " + pcoId + ", contents[" +
85 contents.length + "])";
86 }
87}