blob: da2607356d6ca30ae5159ecafbd0781cc6c42c05 [file] [log] [blame]
Anju Mathapatif604fc32016-03-10 12:57:21 -08001/*
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 com.android.ims;
18
19import android.net.Uri;
20import android.os.Parcel;
21import android.os.Parcelable;
Tyler Gunnc96b5e02016-07-07 22:53:57 -070022import android.telecom.Log;
Anju Mathapatif604fc32016-03-10 12:57:21 -080023import android.telephony.Rlog;
24
25/*
26 * This file contains all the api's through which
27 * information received in Dialog Event Package can be
28 * queried
29 */
30
31/**
Anju Mathapati65314502016-03-10 12:57:21 -080032 * Parcelable object to handle MultiEndpoint Dialog Information
Anju Mathapatif604fc32016-03-10 12:57:21 -080033 * @hide
34 */
35public class ImsExternalCallState implements Parcelable {
36
37 private static final String TAG = "ImsExternalCallState";
38
39 // Dialog States
40 public static final int CALL_STATE_CONFIRMED = 1;
41 public static final int CALL_STATE_TERMINATED = 2;
42 // Dialog Id
Anju Mathapati65314502016-03-10 12:57:21 -080043 private int mCallId;
Anju Mathapatif604fc32016-03-10 12:57:21 -080044 // Number
Anju Mathapati65314502016-03-10 12:57:21 -080045 private Uri mAddress;
46 private boolean mIsPullable;
Anju Mathapatif604fc32016-03-10 12:57:21 -080047 // CALL_STATE_CONFIRMED / CALL_STATE_TERMINATED
Anju Mathapati65314502016-03-10 12:57:21 -080048 private int mCallState;
Anju Mathapatif604fc32016-03-10 12:57:21 -080049 // ImsCallProfile#CALL_TYPE_*
Anju Mathapati65314502016-03-10 12:57:21 -080050 private int mCallType;
51 private boolean mIsHeld;
Anju Mathapatif604fc32016-03-10 12:57:21 -080052
53 public ImsExternalCallState() {
54 }
55
Anju Mathapati65314502016-03-10 12:57:21 -080056 public ImsExternalCallState(int callId, Uri address, boolean isPullable, int callState,
57 int callType, boolean isCallheld) {
58 mCallId = callId;
59 mAddress = address;
60 mIsPullable = isPullable;
61 mCallState = callState;
62 mCallType = callType;
63 mIsHeld = isCallheld;
64 Rlog.d(TAG, "ImsExternalCallState = " + this);
65 }
66
Anju Mathapatif604fc32016-03-10 12:57:21 -080067 public ImsExternalCallState(Parcel in) {
68 mCallId = in.readInt();
69 ClassLoader classLoader = ImsExternalCallState.class.getClassLoader();
70 mAddress = in.readParcelable(classLoader);
71 mIsPullable = (in.readInt() != 0);
72 mCallState = in.readInt();
73 mCallType = in.readInt();
74 mIsHeld = (in.readInt() != 0);
Anju Mathapati65314502016-03-10 12:57:21 -080075 Rlog.d(TAG, "ImsExternalCallState const = " + this);
Anju Mathapatif604fc32016-03-10 12:57:21 -080076 }
77
78 @Override
79 public int describeContents() {
80 return 0;
81 }
82
83 @Override
84 public void writeToParcel(Parcel out, int flags) {
85 out.writeInt(mCallId);
86 out.writeParcelable(mAddress, 0);
87 out.writeInt(mIsPullable ? 1 : 0);
88 out.writeInt(mCallState);
89 out.writeInt(mCallType);
90 out.writeInt(mIsHeld ? 1 : 0);
Anju Mathapati65314502016-03-10 12:57:21 -080091 Rlog.d(TAG, "ImsExternalCallState writeToParcel = " + out.toString());
Anju Mathapatif604fc32016-03-10 12:57:21 -080092 }
93
94 public static final Parcelable.Creator<ImsExternalCallState> CREATOR =
95 new Parcelable.Creator<ImsExternalCallState>() {
96 @Override
97 public ImsExternalCallState createFromParcel(Parcel in) {
98 return new ImsExternalCallState(in);
99 }
100
101 @Override
102 public ImsExternalCallState[] newArray(int size) {
103 return new ImsExternalCallState[size];
104 }
105 };
106
107 public int getCallId() {
108 return mCallId;
109 }
110
111 public Uri getAddress() {
112 return mAddress;
113 }
114
115 public boolean isCallPullable() {
116 return mIsPullable;
117 }
118
119 public int getCallState() {
120 return mCallState;
121 }
122
123 public int getCallType() {
124 return mCallType;
125 }
126
127 public boolean isCallHeld() {
128 return mIsHeld;
129 }
130
131 @Override
132 public String toString() {
133 return "ImsExternalCallState { mCallId = " + mCallId +
Tyler Gunnc96b5e02016-07-07 22:53:57 -0700134 ", mAddress = " + Log.pii(mAddress) +
Anju Mathapatif604fc32016-03-10 12:57:21 -0800135 ", mIsPullable = " + mIsPullable +
136 ", mCallState = " + mCallState +
137 ", mCallType = " + mCallType +
138 ", mIsHeld = " + mIsHeld + "}";
139 }
140}