Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2013 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 com.android.ims; |
| 18 | |
| 19 | import android.os.Bundle; |
| 20 | import android.os.Parcel; |
| 21 | import android.os.Parcelable; |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 22 | import android.telecom.VideoProfile; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 23 | |
Jing Zhao | e647a01 | 2014-08-19 12:41:23 -0500 | [diff] [blame] | 24 | import com.android.internal.telephony.PhoneConstants; |
| 25 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 26 | /** |
| 27 | * Parcelable object to handle IMS call profile. |
| 28 | * It is created from GSMA IR.92/IR.94, 3GPP TS 24.229/TS 26.114/TS26.111. |
| 29 | * It provides the service and call type, the additional information related to the call. |
| 30 | * |
| 31 | * @hide |
| 32 | */ |
| 33 | public class ImsCallProfile implements Parcelable { |
| 34 | private static final String TAG = "ImsCallProfile"; |
| 35 | |
| 36 | /** |
| 37 | * Service types |
| 38 | */ |
| 39 | /** |
| 40 | * It is for a special case. It helps that the application can make a call |
| 41 | * without IMS connection (not registered). |
| 42 | * In the moment of the call initiation, the device try to connect to the IMS network |
| 43 | * and initiates the call. |
| 44 | */ |
| 45 | public static final int SERVICE_TYPE_NONE = 0; |
| 46 | /** |
| 47 | * It is a default type and can be selected when the device is connected to the IMS network. |
| 48 | */ |
| 49 | public static final int SERVICE_TYPE_NORMAL = 1; |
| 50 | /** |
| 51 | * It is for an emergency call. |
| 52 | */ |
| 53 | public static final int SERVICE_TYPE_EMERGENCY = 2; |
| 54 | |
| 55 | /** |
| 56 | * Call types |
| 57 | */ |
| 58 | /** |
| 59 | * IMSPhone to support IR.92 & IR.94 (voice + video upgrade/downgrade) |
| 60 | */ |
| 61 | public static final int CALL_TYPE_VOICE_N_VIDEO = 1; |
| 62 | /** |
| 63 | * IR.92 (Voice only) |
| 64 | */ |
| 65 | public static final int CALL_TYPE_VOICE = 2; |
| 66 | /** |
| 67 | * VT to support IR.92 & IR.94 (voice + video upgrade/downgrade) |
| 68 | */ |
| 69 | public static final int CALL_TYPE_VIDEO_N_VOICE = 3; |
| 70 | /** |
| 71 | * Video Telephony (audio / video two way) |
| 72 | */ |
| 73 | public static final int CALL_TYPE_VT = 4; |
| 74 | /** |
| 75 | * Video Telephony (audio two way / video TX one way) |
| 76 | */ |
| 77 | public static final int CALL_TYPE_VT_TX = 5; |
| 78 | /** |
| 79 | * Video Telephony (audio two way / video RX one way) |
| 80 | */ |
| 81 | public static final int CALL_TYPE_VT_RX = 6; |
| 82 | /** |
| 83 | * Video Telephony (audio two way / video inactive) |
| 84 | */ |
| 85 | public static final int CALL_TYPE_VT_NODIR = 7; |
| 86 | /** |
| 87 | * VideoShare (video two way) |
| 88 | */ |
| 89 | public static final int CALL_TYPE_VS = 8; |
| 90 | /** |
| 91 | * VideoShare (video TX one way) |
| 92 | */ |
| 93 | public static final int CALL_TYPE_VS_TX = 9; |
| 94 | /** |
| 95 | * VideoShare (video RX one way) |
| 96 | */ |
| 97 | public static final int CALL_TYPE_VS_RX = 10; |
| 98 | |
| 99 | /** |
| 100 | * Extra properties for IMS call. |
| 101 | */ |
| 102 | /** |
| 103 | * Boolean extra properties - "true" / "false" |
| 104 | * conference : Indicates if the session is for the conference call or not. |
| 105 | * e_call : Indicates if the session is for the emergency call or not. |
| 106 | * vms : Indicates if the session is connected to the voice mail system or not. |
| 107 | * call_mode_changeable : Indicates if the session is able to upgrade/downgrade |
| 108 | * the video during voice call. |
| 109 | * conference_avail : Indicates if the session can be extended to the conference. |
| 110 | */ |
| 111 | public static final String EXTRA_CONFERENCE = "conference"; |
| 112 | public static final String EXTRA_E_CALL = "e_call"; |
| 113 | public static final String EXTRA_VMS = "vms"; |
| 114 | public static final String EXTRA_CALL_MODE_CHANGEABLE = "call_mode_changeable"; |
| 115 | public static final String EXTRA_CONFERENCE_AVAIL = "conference_avail"; |
| 116 | |
Shriram Ganesh | 482e6da | 2014-10-13 11:31:50 -0700 | [diff] [blame] | 117 | // Extra string for internal use only. OEMs should not use |
| 118 | // this for packing extras. |
| 119 | public static final String EXTRA_OEM_EXTRAS = "OemCallExtras"; |
| 120 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 121 | /** |
| 122 | * Integer extra properties |
| 123 | * oir : Rule for originating identity (number) presentation, MO/MT. |
| 124 | * {@link ImsCallProfile#OIR_DEFAULT} |
| 125 | * {@link ImsCallProfile#OIR_PRESENTATION_RESTRICTED} |
| 126 | * {@link ImsCallProfile#OIR_PRESENTATION_NOT_RESTRICTED} |
| 127 | * cnap : Rule for calling name presentation |
| 128 | * {@link ImsCallProfile#OIR_DEFAULT} |
| 129 | * {@link ImsCallProfile#OIR_PRESENTATION_RESTRICTED} |
| 130 | * {@link ImsCallProfile#OIR_PRESENTATION_NOT_RESTRICTED} |
| 131 | * dialstring : To identify the Ims call type, MO |
| 132 | * {@link ImsCallProfile#DIALSTRING_NORMAL_CALL} |
| 133 | * {@link ImsCallProfile#DIALSTRING_SS_CONF} |
| 134 | * {@link ImsCallProfile#DIALSTRING_USSD} |
| 135 | */ |
| 136 | public static final String EXTRA_OIR = "oir"; |
| 137 | public static final String EXTRA_CNAP = "cnap"; |
| 138 | public static final String EXTRA_DIALSTRING = "dialstring"; |
| 139 | |
| 140 | /** |
| 141 | * Values for EXTRA_OIR / EXTRA_CNAP |
| 142 | */ |
| 143 | public static final int OIR_DEFAULT = 0; // "user subscription default value" |
| 144 | public static final int OIR_PRESENTATION_RESTRICTED = 1; |
| 145 | public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2; |
Shriram Ganesh | ef0cde8 | 2015-03-05 16:43:03 +0530 | [diff] [blame] | 146 | public static final int OIR_PRESENTATION_UNKNOWN = 3; |
| 147 | public static final int OIR_PRESENTATION_PAYPHONE = 4; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 148 | |
| 149 | /** |
| 150 | * Values for EXTRA_DIALSTRING |
| 151 | */ |
| 152 | // default (normal call) |
| 153 | public static final int DIALSTRING_NORMAL = 0; |
| 154 | // Call for SIP-based user configuration |
| 155 | public static final int DIALSTRING_SS_CONF = 1; |
| 156 | // Call for USSD message |
| 157 | public static final int DIALSTRING_USSD = 2; |
| 158 | |
| 159 | /** |
Shriram Ganesh | 482e6da | 2014-10-13 11:31:50 -0700 | [diff] [blame] | 160 | * Values for causes that restrict call types |
| 161 | */ |
| 162 | // Default cause not restricted at peer and HD is supported |
| 163 | public static final int CALL_RESTRICT_CAUSE_NONE = 0; |
| 164 | // Service not supported by RAT at peer |
| 165 | public static final int CALL_RESTRICT_CAUSE_RAT = 1; |
| 166 | // Service Disabled at peer |
| 167 | public static final int CALL_RESTRICT_CAUSE_DISABLED = 2; |
| 168 | // HD is not supported |
| 169 | public static final int CALL_RESTRICT_CAUSE_HD = 3; |
| 170 | |
| 171 | /** |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 172 | * String extra properties |
| 173 | * oi : Originating identity (number), MT only |
| 174 | * cna : Calling name |
| 175 | * ussd : For network-initiated USSD, MT only |
| 176 | * remote_uri : Connected user identity (it can be used for the conference) |
Shriram Ganesh | ddf570e | 2015-05-31 09:18:48 -0700 | [diff] [blame] | 177 | * ChildNum: Child number info. |
| 178 | * Codec: Codec info. |
| 179 | * DisplayText: Display text for the call. |
| 180 | * AdditionalCallInfo: Additional call info. |
Omkar Kolangade | 3b0437e | 2015-10-29 15:06:27 -0700 | [diff] [blame] | 181 | * CallRadioTech: The radio tech on which the call is placed. |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 182 | */ |
| 183 | public static final String EXTRA_OI = "oi"; |
| 184 | public static final String EXTRA_CNA = "cna"; |
| 185 | public static final String EXTRA_USSD = "ussd"; |
| 186 | public static final String EXTRA_REMOTE_URI = "remote_uri"; |
Shriram Ganesh | ddf570e | 2015-05-31 09:18:48 -0700 | [diff] [blame] | 187 | public static final String EXTRA_CHILD_NUMBER = "ChildNum"; |
| 188 | public static final String EXTRA_CODEC = "Codec"; |
| 189 | public static final String EXTRA_DISPLAY_TEXT = "DisplayText"; |
| 190 | public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo"; |
Tyler Gunn | 3ffb08a | 2015-11-02 11:24:57 -0800 | [diff] [blame] | 191 | |
| 192 | /** |
| 193 | * Extra key which the RIL can use to indicate the radio technology used for a call. |
| 194 | * Valid values are: |
| 195 | * {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_LTE}, |
| 196 | * {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_IWLAN}, and the other defined |
| 197 | * {@code RIL_RADIO_TECHNOLOGY_*} constants. |
| 198 | * Note: Despite the fact the {@link android.telephony.ServiceState} values are integer |
| 199 | * constants, the values passed for the {@link #EXTRA_CALL_RAT_TYPE} should be strings (e.g. |
| 200 | * "14" vs (int) 14). |
| 201 | * Note: This is used by {@link com.android.internal.telephony.imsphone.ImsPhoneConnection# |
| 202 | * updateWifiStateFromExtras(Bundle)} to determine whether to set the |
| 203 | * {@link android.telecom.Connection#CAPABILITY_WIFI} capability on a connection. |
| 204 | */ |
Omkar Kolangade | 3b0437e | 2015-10-29 15:06:27 -0700 | [diff] [blame] | 205 | public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech"; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 206 | |
| 207 | public int mServiceType; |
| 208 | public int mCallType; |
Shriram Ganesh | 482e6da | 2014-10-13 11:31:50 -0700 | [diff] [blame] | 209 | public int mRestrictCause = CALL_RESTRICT_CAUSE_NONE; |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 210 | public Bundle mCallExtras; |
| 211 | public ImsStreamMediaProfile mMediaProfile; |
| 212 | |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 213 | public ImsCallProfile(Parcel in) { |
| 214 | readFromParcel(in); |
| 215 | } |
| 216 | |
| 217 | public ImsCallProfile() { |
| 218 | mServiceType = SERVICE_TYPE_NORMAL; |
| 219 | mCallType = CALL_TYPE_VOICE_N_VIDEO; |
| 220 | mCallExtras = new Bundle(); |
| 221 | mMediaProfile = new ImsStreamMediaProfile(); |
| 222 | } |
| 223 | |
| 224 | public ImsCallProfile(int serviceType, int callType) { |
| 225 | mServiceType = serviceType; |
| 226 | mCallType = callType; |
| 227 | mCallExtras = new Bundle(); |
| 228 | mMediaProfile = new ImsStreamMediaProfile(); |
| 229 | } |
| 230 | |
| 231 | public String getCallExtra(String name) { |
| 232 | return getCallExtra(name, ""); |
| 233 | } |
| 234 | |
| 235 | public String getCallExtra(String name, String defaultValue) { |
| 236 | if (mCallExtras == null) { |
| 237 | return defaultValue; |
| 238 | } |
| 239 | |
| 240 | return mCallExtras.getString(name, defaultValue); |
| 241 | } |
| 242 | |
| 243 | public boolean getCallExtraBoolean(String name) { |
| 244 | return getCallExtraBoolean(name, false); |
| 245 | } |
| 246 | |
| 247 | public boolean getCallExtraBoolean(String name, boolean defaultValue) { |
| 248 | if (mCallExtras == null) { |
| 249 | return defaultValue; |
| 250 | } |
| 251 | |
| 252 | return mCallExtras.getBoolean(name, defaultValue); |
| 253 | } |
| 254 | |
| 255 | public int getCallExtraInt(String name) { |
| 256 | return getCallExtraInt(name, -1); |
| 257 | } |
| 258 | |
| 259 | public int getCallExtraInt(String name, int defaultValue) { |
| 260 | if (mCallExtras == null) { |
| 261 | return defaultValue; |
| 262 | } |
| 263 | |
| 264 | return mCallExtras.getInt(name, defaultValue); |
| 265 | } |
| 266 | |
| 267 | public void setCallExtra(String name, String value) { |
| 268 | if (mCallExtras != null) { |
| 269 | mCallExtras.putString(name, value); |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | public void setCallExtraBoolean(String name, boolean value) { |
| 274 | if (mCallExtras != null) { |
| 275 | mCallExtras.putBoolean(name, value); |
| 276 | } |
| 277 | } |
| 278 | |
| 279 | public void setCallExtraInt(String name, int value) { |
| 280 | if (mCallExtras != null) { |
| 281 | mCallExtras.putInt(name, value); |
| 282 | } |
| 283 | } |
| 284 | |
| 285 | public void updateCallType(ImsCallProfile profile) { |
| 286 | mCallType = profile.mCallType; |
| 287 | } |
| 288 | |
| 289 | public void updateCallExtras(ImsCallProfile profile) { |
| 290 | mCallExtras.clear(); |
| 291 | mCallExtras = (Bundle) profile.mCallExtras.clone(); |
| 292 | } |
| 293 | |
| 294 | @Override |
| 295 | public String toString() { |
| 296 | return "{ serviceType=" + mServiceType + |
| 297 | ", callType=" + mCallType + |
Etan Cohen | db45a01 | 2014-12-10 10:08:20 -0800 | [diff] [blame] | 298 | ", restrictCause=" + mRestrictCause + |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 299 | ", mediaProfile=" + mMediaProfile.toString() + " }"; |
| 300 | } |
| 301 | |
| 302 | @Override |
| 303 | public int describeContents() { |
| 304 | return 0; |
| 305 | } |
| 306 | |
| 307 | @Override |
| 308 | public void writeToParcel(Parcel out, int flags) { |
| 309 | out.writeInt(mServiceType); |
| 310 | out.writeInt(mCallType); |
| 311 | out.writeParcelable(mCallExtras, 0); |
| 312 | out.writeParcelable(mMediaProfile, 0); |
| 313 | } |
| 314 | |
| 315 | private void readFromParcel(Parcel in) { |
| 316 | mServiceType = in.readInt(); |
| 317 | mCallType = in.readInt(); |
| 318 | mCallExtras = in.readParcelable(null); |
| 319 | mMediaProfile = in.readParcelable(null); |
| 320 | } |
| 321 | |
| 322 | public static final Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() { |
| 323 | @Override |
| 324 | public ImsCallProfile createFromParcel(Parcel in) { |
| 325 | return new ImsCallProfile(in); |
| 326 | } |
| 327 | |
| 328 | @Override |
| 329 | public ImsCallProfile[] newArray(int size) { |
| 330 | return new ImsCallProfile[size]; |
| 331 | } |
| 332 | }; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 333 | |
| 334 | /** |
| 335 | * Converts from the call types defined in {@link com.android.ims.ImsCallProfile} to the |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 336 | * video state values defined in {@link VideoProfile}. |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 337 | * |
| 338 | * @param callType The call type. |
| 339 | * @return The video state. |
| 340 | */ |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 341 | public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) { |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 342 | int videostate = VideoProfile.STATE_AUDIO_ONLY; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 343 | switch (callProfile.mCallType) { |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 344 | case CALL_TYPE_VT_TX: |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 345 | videostate = VideoProfile.STATE_TX_ENABLED; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 346 | break; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 347 | case CALL_TYPE_VT_RX: |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 348 | videostate = VideoProfile.STATE_RX_ENABLED; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 349 | break; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 350 | case CALL_TYPE_VT: |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 351 | videostate = VideoProfile.STATE_BIDIRECTIONAL; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 352 | break; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 353 | case CALL_TYPE_VOICE: |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 354 | videostate = VideoProfile.STATE_AUDIO_ONLY; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 355 | break; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 356 | default: |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 357 | videostate = VideoProfile.STATE_AUDIO_ONLY; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 358 | break; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 359 | } |
Tyler Gunn | bc6f12e | 2015-06-09 14:34:11 -0700 | [diff] [blame] | 360 | if (callProfile.isVideoPaused() && !VideoProfile.isAudioOnly(videostate)) { |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 361 | videostate |= VideoProfile.STATE_PAUSED; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 362 | } else { |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 363 | videostate &= ~VideoProfile.STATE_PAUSED; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 364 | } |
| 365 | return videostate; |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 366 | } |
| 367 | |
| 368 | /** |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 369 | * Converts from the video state values defined in {@link VideoProfile} |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 370 | * to the call types defined in {@link ImsCallProfile}. |
| 371 | * |
| 372 | * @param videoState The video state. |
| 373 | * @return The call type. |
| 374 | */ |
| 375 | public static int getCallTypeFromVideoState(int videoState) { |
Tyler Gunn | 87b73f3 | 2015-06-03 10:09:59 -0700 | [diff] [blame] | 376 | boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED); |
| 377 | boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED); |
| 378 | boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED); |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 379 | if (isPaused) { |
| 380 | return ImsCallProfile.CALL_TYPE_VT_NODIR; |
| 381 | } else if (videoTx && !videoRx) { |
| 382 | return ImsCallProfile.CALL_TYPE_VT_TX; |
| 383 | } else if (!videoTx && videoRx) { |
| 384 | return ImsCallProfile.CALL_TYPE_VT_RX; |
| 385 | } else if (videoTx && videoRx) { |
| 386 | return ImsCallProfile.CALL_TYPE_VT; |
| 387 | } |
| 388 | return ImsCallProfile.CALL_TYPE_VOICE; |
| 389 | } |
| 390 | |
| 391 | /** |
Jing Zhao | e647a01 | 2014-08-19 12:41:23 -0500 | [diff] [blame] | 392 | * Translate presentation value to OIR value |
| 393 | * @param presentation |
| 394 | * @return OIR valuse |
| 395 | */ |
| 396 | public static int presentationToOIR(int presentation) { |
| 397 | switch (presentation) { |
| 398 | case PhoneConstants.PRESENTATION_RESTRICTED: |
| 399 | return ImsCallProfile.OIR_PRESENTATION_RESTRICTED; |
| 400 | case PhoneConstants.PRESENTATION_ALLOWED: |
| 401 | return ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED; |
Shriram Ganesh | ef0cde8 | 2015-03-05 16:43:03 +0530 | [diff] [blame] | 402 | case PhoneConstants.PRESENTATION_PAYPHONE: |
| 403 | return ImsCallProfile.OIR_PRESENTATION_PAYPHONE; |
| 404 | case PhoneConstants.PRESENTATION_UNKNOWN: |
| 405 | return ImsCallProfile.OIR_PRESENTATION_UNKNOWN; |
Jing Zhao | e647a01 | 2014-08-19 12:41:23 -0500 | [diff] [blame] | 406 | default: |
| 407 | return ImsCallProfile.OIR_DEFAULT; |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * Translate OIR value to presentation value |
| 413 | * @param oir value |
| 414 | * @return presentation value |
| 415 | */ |
| 416 | public static int OIRToPresentation(int oir) { |
| 417 | switch(oir) { |
| 418 | case ImsCallProfile.OIR_PRESENTATION_RESTRICTED: |
| 419 | return PhoneConstants.PRESENTATION_RESTRICTED; |
| 420 | case ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED: |
| 421 | return PhoneConstants.PRESENTATION_ALLOWED; |
Shriram Ganesh | ef0cde8 | 2015-03-05 16:43:03 +0530 | [diff] [blame] | 422 | case ImsCallProfile.OIR_PRESENTATION_PAYPHONE: |
| 423 | return PhoneConstants.PRESENTATION_PAYPHONE; |
| 424 | case ImsCallProfile.OIR_PRESENTATION_UNKNOWN: |
| 425 | return PhoneConstants.PRESENTATION_UNKNOWN; |
Jing Zhao | e647a01 | 2014-08-19 12:41:23 -0500 | [diff] [blame] | 426 | default: |
| 427 | return PhoneConstants.PRESENTATION_UNKNOWN; |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | /** |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 432 | * Checks if video call is paused |
| 433 | * @return true if call is video paused |
| 434 | */ |
| 435 | public boolean isVideoPaused() { |
| 436 | return mMediaProfile.mVideoDirection == ImsStreamMediaProfile.DIRECTION_INACTIVE; |
| 437 | } |
| 438 | |
| 439 | /** |
Tyler Gunn | aa07df8 | 2014-07-17 07:50:22 -0700 | [diff] [blame] | 440 | * Determines if a video state is set in a video state bit-mask. |
| 441 | * |
| 442 | * @param videoState The video state bit mask. |
| 443 | * @param videoStateToCheck The particular video state to check. |
| 444 | * @return True if the video state is set in the bit-mask. |
| 445 | */ |
| 446 | private static boolean isVideoStateSet(int videoState, int videoStateToCheck) { |
| 447 | return (videoState & videoStateToCheck) == videoStateToCheck; |
| 448 | } |
Wink Saville | f8458ff | 2014-06-25 16:08:02 -0700 | [diff] [blame] | 449 | } |