• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
17 package com.android.ims;
18 
19 import android.net.Uri;
20 import android.os.Parcel;
21 import android.os.Parcelable;
22 import android.telecom.Log;
23 import 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 /**
32  * Parcelable object to handle MultiEndpoint Dialog Information
33  * @hide
34  */
35 public 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
43     private int mCallId;
44     // Number
45     private Uri mAddress;
46     private boolean mIsPullable;
47     // CALL_STATE_CONFIRMED / CALL_STATE_TERMINATED
48     private int mCallState;
49     // ImsCallProfile#CALL_TYPE_*
50     private int mCallType;
51     private boolean mIsHeld;
52 
ImsExternalCallState()53     public ImsExternalCallState() {
54     }
55 
ImsExternalCallState(int callId, Uri address, boolean isPullable, int callState, int callType, boolean isCallheld)56     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 
ImsExternalCallState(Parcel in)67     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);
75         Rlog.d(TAG, "ImsExternalCallState const = " + this);
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(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);
91         Rlog.d(TAG, "ImsExternalCallState writeToParcel = " + out.toString());
92     }
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 
getCallId()107     public int getCallId() {
108         return mCallId;
109     }
110 
getAddress()111     public Uri getAddress() {
112         return mAddress;
113     }
114 
isCallPullable()115     public boolean isCallPullable() {
116         return mIsPullable;
117     }
118 
getCallState()119     public int getCallState() {
120         return mCallState;
121     }
122 
getCallType()123     public int getCallType() {
124         return mCallType;
125     }
126 
isCallHeld()127     public boolean isCallHeld() {
128         return mIsHeld;
129     }
130 
131     @Override
toString()132     public String toString() {
133         return "ImsExternalCallState { mCallId = " + mCallId +
134                 ", mAddress = " + Log.pii(mAddress) +
135                 ", mIsPullable = " + mIsPullable +
136                 ", mCallState = " + mCallState +
137                 ", mCallType = " + mCallType +
138                 ", mIsHeld = " + mIsHeld + "}";
139     }
140 }
141