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 ParcelableRttCall( int rttMode, ParcelFileDescriptor transmitStream, ParcelFileDescriptor receiveStream)38 public ParcelableRttCall( 39 int rttMode, 40 ParcelFileDescriptor transmitStream, 41 ParcelFileDescriptor receiveStream) { 42 mRttMode = rttMode; 43 mTransmitStream = transmitStream; 44 mReceiveStream = receiveStream; 45 } 46 ParcelableRttCall(Parcel in)47 protected ParcelableRttCall(Parcel in) { 48 mRttMode = in.readInt(); 49 mTransmitStream = in.readParcelable(ParcelFileDescriptor.class.getClassLoader()); 50 mReceiveStream = in.readParcelable(ParcelFileDescriptor.class.getClassLoader()); 51 } 52 53 public static final @android.annotation.NonNull Creator<ParcelableRttCall> CREATOR = new Creator<ParcelableRttCall>() { 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 describeContents()66 public int describeContents() { 67 return 0; 68 } 69 70 @Override writeToParcel(Parcel dest, int flags)71 public void writeToParcel(Parcel dest, int flags) { 72 dest.writeInt(mRttMode); 73 dest.writeParcelable(mTransmitStream, flags); 74 dest.writeParcelable(mReceiveStream, flags); 75 } 76 getRttMode()77 public int getRttMode() { 78 return mRttMode; 79 } 80 getReceiveStream()81 public ParcelFileDescriptor getReceiveStream() { 82 return mReceiveStream; 83 } 84 getTransmitStream()85 public ParcelFileDescriptor getTransmitStream() { 86 return mTransmitStream; 87 } 88 } 89