1 /* 2 * Copyright (C) 2018 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.telephony.ims; 18 19 import android.annotation.SystemApi; 20 import android.os.Parcel; 21 import android.os.Parcelable; 22 23 /** 24 * Provides the call forward information for the supplementary service configuration. 25 * 26 * @hide 27 */ 28 @SystemApi 29 public final class ImsCallForwardInfo implements Parcelable { 30 // Refer to ImsUtInterface#CDIV_CF_XXX 31 /** @hide */ 32 // TODO: Make private, do not modify this field directly, use getter. 33 public int mCondition; 34 // 0: disabled, 1: enabled 35 /** @hide */ 36 // TODO: Make private, do not modify this field directly, use getter. 37 public int mStatus; 38 // 0x91: International, 0x81: Unknown 39 /** @hide */ 40 // TODO: Make private, do not modify this field directly, use getter. 41 public int mToA; 42 // Service class 43 /** @hide */ 44 // TODO: Make private, do not modify this field directly, use getter. 45 public int mServiceClass; 46 // Number (it will not include the "sip" or "tel" URI scheme) 47 /** @hide */ 48 // TODO: Make private, do not modify this field directly, use getter. 49 public String mNumber; 50 // No reply timer for CF 51 /** @hide */ 52 // TODO: Make private, do not modify this field directly, use getter. 53 public int mTimeSeconds; 54 55 /** @hide */ 56 // TODO: Will be removed in the future, use public constructor instead. ImsCallForwardInfo()57 public ImsCallForwardInfo() { 58 } 59 60 /** 61 * IMS Call Forward Information. 62 */ ImsCallForwardInfo(int condition, int status, int toA, int serviceClass, String number, int replyTimerSec)63 public ImsCallForwardInfo(int condition, int status, int toA, int serviceClass, String number, 64 int replyTimerSec) { 65 mCondition = condition; 66 mStatus = status; 67 mToA = toA; 68 mServiceClass = serviceClass; 69 mNumber = number; 70 mTimeSeconds = replyTimerSec; 71 } 72 73 /** @hide */ ImsCallForwardInfo(Parcel in)74 public ImsCallForwardInfo(Parcel in) { 75 readFromParcel(in); 76 } 77 78 @Override describeContents()79 public int describeContents() { 80 return 0; 81 } 82 83 @Override writeToParcel(Parcel out, int flags)84 public void writeToParcel(Parcel out, int flags) { 85 out.writeInt(mCondition); 86 out.writeInt(mStatus); 87 out.writeInt(mToA); 88 out.writeString(mNumber); 89 out.writeInt(mTimeSeconds); 90 out.writeInt(mServiceClass); 91 } 92 93 @Override toString()94 public String toString() { 95 return super.toString() + ", Condition: " + mCondition 96 + ", Status: " + ((mStatus == 0) ? "disabled" : "enabled") 97 + ", ToA: " + mToA 98 + ", Service Class: " + mServiceClass 99 + ", Number=" + mNumber 100 + ", Time (seconds): " + mTimeSeconds; 101 } 102 readFromParcel(Parcel in)103 private void readFromParcel(Parcel in) { 104 mCondition = in.readInt(); 105 mStatus = in.readInt(); 106 mToA = in.readInt(); 107 mNumber = in.readString(); 108 mTimeSeconds = in.readInt(); 109 mServiceClass = in.readInt(); 110 } 111 112 public static final Creator<ImsCallForwardInfo> CREATOR = 113 new Creator<ImsCallForwardInfo>() { 114 @Override 115 public ImsCallForwardInfo createFromParcel(Parcel in) { 116 return new ImsCallForwardInfo(in); 117 } 118 119 @Override 120 public ImsCallForwardInfo[] newArray(int size) { 121 return new ImsCallForwardInfo[size]; 122 } 123 }; 124 getCondition()125 public int getCondition() { 126 return mCondition; 127 } 128 getStatus()129 public int getStatus() { 130 return mStatus; 131 } 132 getToA()133 public int getToA() { 134 return mToA; 135 } 136 getServiceClass()137 public int getServiceClass() { 138 return mServiceClass; 139 } 140 getNumber()141 public String getNumber() { 142 return mNumber; 143 } 144 getTimeSeconds()145 public int getTimeSeconds() { 146 return mTimeSeconds; 147 } 148 } 149