| Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 1 | /* | 
|  | 2 | * Copyright (C) 2017 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 |  | 
|  | 17 | package android.telecom; | 
|  | 18 |  | 
|  | 19 | import android.os.Parcel; | 
|  | 20 | import android.os.ParcelFileDescriptor; | 
|  | 21 | import android.os.Parcelable; | 
|  | 22 |  | 
|  | 23 | import java.io.FileInputStream; | 
|  | 24 | import java.io.FileOutputStream; | 
|  | 25 | import java.io.InputStreamReader; | 
|  | 26 | import java.io.OutputStreamWriter; | 
|  | 27 | import java.nio.charset.StandardCharsets; | 
|  | 28 |  | 
|  | 29 | /** | 
|  | 30 | * Data container for information associated with the RTT connection on a call. | 
|  | 31 | * @hide | 
|  | 32 | */ | 
|  | 33 | public class ParcelableRttCall implements Parcelable { | 
|  | 34 | private final int mRttMode; | 
|  | 35 | private final ParcelFileDescriptor mTransmitStream; | 
|  | 36 | private final ParcelFileDescriptor mReceiveStream; | 
|  | 37 |  | 
|  | 38 | public ParcelableRttCall( | 
|  | 39 | int rttMode, | 
|  | 40 | ParcelFileDescriptor transmitStream, | 
|  | 41 | ParcelFileDescriptor receiveStream) { | 
|  | 42 | mRttMode = rttMode; | 
|  | 43 | mTransmitStream = transmitStream; | 
|  | 44 | mReceiveStream = receiveStream; | 
|  | 45 | } | 
|  | 46 |  | 
|  | 47 | protected ParcelableRttCall(Parcel in) { | 
|  | 48 | mRttMode = in.readInt(); | 
| Bernardo Rufino | 90bb370 | 2021-12-07 20:01:45 +0000 | [diff] [blame^] | 49 | mTransmitStream = in.readParcelable(ParcelFileDescriptor.class.getClassLoader(), android.os.ParcelFileDescriptor.class); | 
|  | 50 | mReceiveStream = in.readParcelable(ParcelFileDescriptor.class.getClassLoader(), android.os.ParcelFileDescriptor.class); | 
| Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 51 | } | 
|  | 52 |  | 
| Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 53 | public static final @android.annotation.NonNull Creator<ParcelableRttCall> CREATOR = new Creator<ParcelableRttCall>() { | 
| Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 54 | @Override | 
|  | 55 | public ParcelableRttCall createFromParcel(Parcel in) { | 
|  | 56 | return new ParcelableRttCall(in); | 
|  | 57 | } | 
|  | 58 |  | 
|  | 59 | @Override | 
|  | 60 | public ParcelableRttCall[] newArray(int size) { | 
|  | 61 | return new ParcelableRttCall[size]; | 
|  | 62 | } | 
|  | 63 | }; | 
|  | 64 |  | 
|  | 65 | @Override | 
|  | 66 | public int describeContents() { | 
|  | 67 | return 0; | 
|  | 68 | } | 
|  | 69 |  | 
|  | 70 | @Override | 
|  | 71 | public void writeToParcel(Parcel dest, int flags) { | 
|  | 72 | dest.writeInt(mRttMode); | 
|  | 73 | dest.writeParcelable(mTransmitStream, flags); | 
|  | 74 | dest.writeParcelable(mReceiveStream, flags); | 
|  | 75 | } | 
|  | 76 |  | 
|  | 77 | public int getRttMode() { | 
|  | 78 | return mRttMode; | 
|  | 79 | } | 
|  | 80 |  | 
|  | 81 | public ParcelFileDescriptor getReceiveStream() { | 
|  | 82 | return mReceiveStream; | 
|  | 83 | } | 
|  | 84 |  | 
|  | 85 | public ParcelFileDescriptor getTransmitStream() { | 
|  | 86 | return mTransmitStream; | 
|  | 87 | } | 
|  | 88 | } |