Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014, 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 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 18 | |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 19 | import android.annotation.UnsupportedAppUsage; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 20 | import android.net.Uri; |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 21 | import android.os.Bundle; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 22 | import android.os.Parcel; |
| 23 | import android.os.Parcelable; |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 24 | import android.os.RemoteException; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 25 | |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 26 | import java.util.ArrayList; |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 27 | import java.util.Collections; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 28 | import java.util.List; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 29 | |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 30 | import com.android.internal.telecom.IVideoProvider; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 31 | |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 32 | /** |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 33 | * Information about a call that is used between InCallService and Telecom. |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 34 | * @hide |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 35 | */ |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 36 | public final class ParcelableCall implements Parcelable { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 37 | private final String mId; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 38 | private final int mState; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 39 | private final DisconnectCause mDisconnectCause; |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 40 | private final List<String> mCannedSmsResponses; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 41 | private final int mCapabilities; |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 42 | private final int mProperties; |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 43 | private final int mSupportedAudioRoutes; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 44 | private final long mConnectTimeMillis; |
| 45 | private final Uri mHandle; |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 46 | private final int mHandlePresentation; |
| 47 | private final String mCallerDisplayName; |
| 48 | private final int mCallerDisplayNamePresentation; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 49 | private final GatewayInfo mGatewayInfo; |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 50 | private final PhoneAccountHandle mAccountHandle; |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 51 | private final boolean mIsVideoCallProviderChanged; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 52 | private final IVideoProvider mVideoCallProvider; |
Tyler Gunn | 584ba6c | 2015-12-08 10:53:41 -0800 | [diff] [blame] | 53 | private VideoCallImpl mVideoCall; |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 54 | private final boolean mIsRttCallChanged; |
| 55 | private final ParcelableRttCall mRttCall; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 56 | private final String mParentCallId; |
| 57 | private final List<String> mChildCallIds; |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 58 | private final StatusHints mStatusHints; |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 59 | private final int mVideoState; |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 60 | private final List<String> mConferenceableCallIds; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 61 | private final Bundle mIntentExtras; |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 62 | private final Bundle mExtras; |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 63 | private final long mCreationTimeMillis; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 64 | |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 65 | public ParcelableCall( |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 66 | String id, |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 67 | int state, |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 68 | DisconnectCause disconnectCause, |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 69 | List<String> cannedSmsResponses, |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 70 | int capabilities, |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 71 | int properties, |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 72 | int supportedAudioRoutes, |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 73 | long connectTimeMillis, |
| 74 | Uri handle, |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 75 | int handlePresentation, |
| 76 | String callerDisplayName, |
| 77 | int callerDisplayNamePresentation, |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 78 | GatewayInfo gatewayInfo, |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 79 | PhoneAccountHandle accountHandle, |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 80 | boolean isVideoCallProviderChanged, |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 81 | IVideoProvider videoCallProvider, |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 82 | boolean isRttCallChanged, |
| 83 | ParcelableRttCall rttCall, |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 84 | String parentCallId, |
Tyler Gunn | 8d83fa9 | 2014-07-01 11:31:21 -0700 | [diff] [blame] | 85 | List<String> childCallIds, |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 86 | StatusHints statusHints, |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 87 | int videoState, |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 88 | List<String> conferenceableCallIds, |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 89 | Bundle intentExtras, |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 90 | Bundle extras, |
| 91 | long creationTimeMillis) { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 92 | mId = id; |
| 93 | mState = state; |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 94 | mDisconnectCause = disconnectCause; |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 95 | mCannedSmsResponses = cannedSmsResponses; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 96 | mCapabilities = capabilities; |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 97 | mProperties = properties; |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 98 | mSupportedAudioRoutes = supportedAudioRoutes; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 99 | mConnectTimeMillis = connectTimeMillis; |
| 100 | mHandle = handle; |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 101 | mHandlePresentation = handlePresentation; |
| 102 | mCallerDisplayName = callerDisplayName; |
| 103 | mCallerDisplayNamePresentation = callerDisplayNamePresentation; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 104 | mGatewayInfo = gatewayInfo; |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 105 | mAccountHandle = accountHandle; |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 106 | mIsVideoCallProviderChanged = isVideoCallProviderChanged; |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 107 | mVideoCallProvider = videoCallProvider; |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 108 | mIsRttCallChanged = isRttCallChanged; |
| 109 | mRttCall = rttCall; |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 110 | mParentCallId = parentCallId; |
| 111 | mChildCallIds = childCallIds; |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 112 | mStatusHints = statusHints; |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 113 | mVideoState = videoState; |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 114 | mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 115 | mIntentExtras = intentExtras; |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 116 | mExtras = extras; |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 117 | mCreationTimeMillis = creationTimeMillis; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 118 | } |
| 119 | |
| 120 | /** The unique ID of the call. */ |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 121 | @UnsupportedAppUsage |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 122 | public String getId() { |
| 123 | return mId; |
| 124 | } |
| 125 | |
| 126 | /** The current state of the call. */ |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 127 | public int getState() { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 128 | return mState; |
| 129 | } |
| 130 | |
| 131 | /** |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 132 | * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid |
| 133 | * when call state is {@link CallState#DISCONNECTED}. |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 134 | */ |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 135 | @UnsupportedAppUsage |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 136 | public DisconnectCause getDisconnectCause() { |
| 137 | return mDisconnectCause; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 138 | } |
| 139 | |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 140 | /** |
| 141 | * The set of possible text message responses when this call is incoming. |
| 142 | */ |
| 143 | public List<String> getCannedSmsResponses() { |
| 144 | return mCannedSmsResponses; |
| 145 | } |
| 146 | |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 147 | // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}. |
| 148 | public int getCapabilities() { |
| 149 | return mCapabilities; |
| 150 | } |
| 151 | |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 152 | /** Bitmask of properties of the call. */ |
| 153 | public int getProperties() { return mProperties; } |
| 154 | |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 155 | /** Bitmask of supported routes of the call */ |
| 156 | public int getSupportedAudioRoutes() { |
| 157 | return mSupportedAudioRoutes; |
| 158 | } |
| 159 | |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 160 | /** The time that the call switched to the active state. */ |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 161 | @UnsupportedAppUsage |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 162 | public long getConnectTimeMillis() { |
| 163 | return mConnectTimeMillis; |
| 164 | } |
| 165 | |
| 166 | /** The endpoint to which the call is connected. */ |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 167 | @UnsupportedAppUsage |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 168 | public Uri getHandle() { |
| 169 | return mHandle; |
| 170 | } |
| 171 | |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 172 | /** |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 173 | * The presentation requirements for the handle. See {@link TelecomManager} for valid values. |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 174 | */ |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 175 | public int getHandlePresentation() { |
| 176 | return mHandlePresentation; |
| 177 | } |
| 178 | |
| 179 | /** The endpoint to which the call is connected. */ |
| 180 | public String getCallerDisplayName() { |
| 181 | return mCallerDisplayName; |
| 182 | } |
| 183 | |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 184 | /** |
| 185 | * The presentation requirements for the caller display name. |
Tyler Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 186 | * See {@link TelecomManager} for valid values. |
Nancy Chen | 9d568c0 | 2014-09-08 14:17:59 -0700 | [diff] [blame] | 187 | */ |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 188 | public int getCallerDisplayNamePresentation() { |
| 189 | return mCallerDisplayNamePresentation; |
| 190 | } |
| 191 | |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 192 | /** Gateway information for the call. */ |
| 193 | public GatewayInfo getGatewayInfo() { |
| 194 | return mGatewayInfo; |
| 195 | } |
| 196 | |
Evan Charlton | 6eb262c | 2014-07-19 18:18:19 -0700 | [diff] [blame] | 197 | /** PhoneAccountHandle information for the call. */ |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 198 | public PhoneAccountHandle getAccountHandle() { |
| 199 | return mAccountHandle; |
Nancy Chen | 5ffbfcc | 2014-06-25 14:22:55 -0700 | [diff] [blame] | 200 | } |
| 201 | |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 202 | /** |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 203 | * Returns an object for remotely communicating through the video call provider's binder. |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 204 | * |
| 205 | * @param callingPackageName the package name of the calling InCallService. |
| 206 | * @param targetSdkVersion the target SDK version of the calling InCallService. |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 207 | * @return The video call. |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 208 | */ |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 209 | public VideoCallImpl getVideoCallImpl(String callingPackageName, int targetSdkVersion) { |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 210 | if (mVideoCall == null && mVideoCallProvider != null) { |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 211 | try { |
Tyler Gunn | 159f35c | 2017-03-02 09:28:37 -0800 | [diff] [blame] | 212 | mVideoCall = new VideoCallImpl(mVideoCallProvider, callingPackageName, |
| 213 | targetSdkVersion); |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 214 | } catch (RemoteException ignored) { |
| 215 | // Ignore RemoteException. |
| 216 | } |
| 217 | } |
| 218 | |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 219 | return mVideoCall; |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 220 | } |
| 221 | |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 222 | public boolean getIsRttCallChanged() { |
| 223 | return mIsRttCallChanged; |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * RTT communication channel information |
| 228 | * @return The ParcelableRttCall |
| 229 | */ |
| 230 | public ParcelableRttCall getParcelableRttCall() { |
| 231 | return mRttCall; |
| 232 | } |
| 233 | |
Andrew Lee | 5dc3075 | 2014-06-27 17:02:19 -0700 | [diff] [blame] | 234 | /** |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 235 | * The conference call to which this call is conferenced. Null if not conferenced. |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 236 | */ |
| 237 | public String getParentCallId() { |
| 238 | return mParentCallId; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * The child call-IDs if this call is a conference call. Returns an empty list if this is not |
| 243 | * a conference call or if the conference call contains no children. |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 244 | */ |
| 245 | public List<String> getChildCallIds() { |
| 246 | return mChildCallIds; |
| 247 | } |
| 248 | |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 249 | public List<String> getConferenceableCallIds() { |
| 250 | return mConferenceableCallIds; |
| 251 | } |
| 252 | |
Tyler Gunn | 8d83fa9 | 2014-07-01 11:31:21 -0700 | [diff] [blame] | 253 | /** |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 254 | * The status label and icon. |
| 255 | * |
| 256 | * @return Status hints. |
| 257 | */ |
| 258 | public StatusHints getStatusHints() { |
| 259 | return mStatusHints; |
| 260 | } |
| 261 | |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 262 | /** |
| 263 | * The video state. |
| 264 | * @return The video state of the call. |
| 265 | */ |
| 266 | public int getVideoState() { |
| 267 | return mVideoState; |
| 268 | } |
| 269 | |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 270 | /** |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 271 | * Any extras associated with this call. |
Nancy Chen | 10798dc | 2014-08-08 14:00:25 -0700 | [diff] [blame] | 272 | * |
| 273 | * @return a bundle of extras |
| 274 | */ |
| 275 | public Bundle getExtras() { |
| 276 | return mExtras; |
| 277 | } |
| 278 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 279 | /** |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 280 | * Extras passed in as part of the original call intent. |
| 281 | * |
| 282 | * @return The intent extras. |
| 283 | */ |
| 284 | public Bundle getIntentExtras() { |
| 285 | return mIntentExtras; |
| 286 | } |
| 287 | |
| 288 | /** |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 289 | * Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the |
| 290 | * {@link android.telecom.InCallService.VideoCall} associated with this call. Since |
| 291 | * {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether |
| 292 | * the provider has changed (which can influence whether it is accessed). |
| 293 | * |
| 294 | * @return {@code true} if the video call changed, {@code false} otherwise. |
| 295 | */ |
| 296 | public boolean isVideoCallProviderChanged() { |
| 297 | return mIsVideoCallProviderChanged; |
| 298 | } |
| 299 | |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 300 | /** |
| 301 | * @return The time the call was created, in milliseconds since the epoch. |
| 302 | */ |
| 303 | public long getCreationTimeMillis() { |
| 304 | return mCreationTimeMillis; |
| 305 | } |
| 306 | |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 307 | /** Responsible for creating ParcelableCall objects for deserialized Parcels. */ |
Mathew Inwood | e5bfa3e | 2018-08-01 11:26:20 +0100 | [diff] [blame^] | 308 | @UnsupportedAppUsage |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 309 | public static final Parcelable.Creator<ParcelableCall> CREATOR = |
| 310 | new Parcelable.Creator<ParcelableCall> () { |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 311 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 312 | public ParcelableCall createFromParcel(Parcel source) { |
| 313 | ClassLoader classLoader = ParcelableCall.class.getClassLoader(); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 314 | String id = source.readString(); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 315 | int state = source.readInt(); |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 316 | DisconnectCause disconnectCause = source.readParcelable(classLoader); |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 317 | List<String> cannedSmsResponses = new ArrayList<>(); |
| 318 | source.readList(cannedSmsResponses, classLoader); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 319 | int capabilities = source.readInt(); |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 320 | int properties = source.readInt(); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 321 | long connectTimeMillis = source.readLong(); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 322 | Uri handle = source.readParcelable(classLoader); |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 323 | int handlePresentation = source.readInt(); |
| 324 | String callerDisplayName = source.readString(); |
| 325 | int callerDisplayNamePresentation = source.readInt(); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 326 | GatewayInfo gatewayInfo = source.readParcelable(classLoader); |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 327 | PhoneAccountHandle accountHandle = source.readParcelable(classLoader); |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 328 | boolean isVideoCallProviderChanged = source.readByte() == 1; |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 329 | IVideoProvider videoCallProvider = |
| 330 | IVideoProvider.Stub.asInterface(source.readStrongBinder()); |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 331 | String parentCallId = source.readString(); |
| 332 | List<String> childCallIds = new ArrayList<>(); |
| 333 | source.readList(childCallIds, classLoader); |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 334 | StatusHints statusHints = source.readParcelable(classLoader); |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 335 | int videoState = source.readInt(); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 336 | List<String> conferenceableCallIds = new ArrayList<>(); |
| 337 | source.readList(conferenceableCallIds, classLoader); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 338 | Bundle intentExtras = source.readBundle(classLoader); |
| 339 | Bundle extras = source.readBundle(classLoader); |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 340 | int supportedAudioRoutes = source.readInt(); |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 341 | boolean isRttCallChanged = source.readByte() == 1; |
| 342 | ParcelableRttCall rttCall = source.readParcelable(classLoader); |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 343 | long creationTimeMillis = source.readLong(); |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 344 | return new ParcelableCall( |
| 345 | id, |
| 346 | state, |
| 347 | disconnectCause, |
| 348 | cannedSmsResponses, |
| 349 | capabilities, |
| 350 | properties, |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 351 | supportedAudioRoutes, |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 352 | connectTimeMillis, |
| 353 | handle, |
| 354 | handlePresentation, |
| 355 | callerDisplayName, |
| 356 | callerDisplayNamePresentation, |
| 357 | gatewayInfo, |
| 358 | accountHandle, |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 359 | isVideoCallProviderChanged, |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 360 | videoCallProvider, |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 361 | isRttCallChanged, |
| 362 | rttCall, |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 363 | parentCallId, |
| 364 | childCallIds, |
| 365 | statusHints, |
| 366 | videoState, |
| 367 | conferenceableCallIds, |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 368 | intentExtras, |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 369 | extras, |
| 370 | creationTimeMillis); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 371 | } |
| 372 | |
| 373 | @Override |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 374 | public ParcelableCall[] newArray(int size) { |
| 375 | return new ParcelableCall[size]; |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 376 | } |
| 377 | }; |
| 378 | |
| 379 | /** {@inheritDoc} */ |
| 380 | @Override |
| 381 | public int describeContents() { |
| 382 | return 0; |
| 383 | } |
| 384 | |
Santos Cordon | 88b771d | 2014-07-19 13:10:40 -0700 | [diff] [blame] | 385 | /** Writes ParcelableCall object into a Parcel. */ |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 386 | @Override |
| 387 | public void writeToParcel(Parcel destination, int flags) { |
| 388 | destination.writeString(mId); |
Ihab Awad | b19a0bc | 2014-08-07 19:46:01 -0700 | [diff] [blame] | 389 | destination.writeInt(mState); |
Andrew Lee | 7f3d41f | 2014-09-11 17:33:16 -0700 | [diff] [blame] | 390 | destination.writeParcelable(mDisconnectCause, 0); |
Ihab Awad | c067754 | 2014-06-10 13:29:47 -0700 | [diff] [blame] | 391 | destination.writeList(mCannedSmsResponses); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 392 | destination.writeInt(mCapabilities); |
Andrew Lee | 223ad14 | 2014-08-27 16:33:08 -0700 | [diff] [blame] | 393 | destination.writeInt(mProperties); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 394 | destination.writeLong(mConnectTimeMillis); |
| 395 | destination.writeParcelable(mHandle, 0); |
Sailesh Nepal | 6120386 | 2014-07-11 14:50:13 -0700 | [diff] [blame] | 396 | destination.writeInt(mHandlePresentation); |
| 397 | destination.writeString(mCallerDisplayName); |
| 398 | destination.writeInt(mCallerDisplayNamePresentation); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 399 | destination.writeParcelable(mGatewayInfo, 0); |
Evan Charlton | 8c8a062 | 2014-07-20 12:31:00 -0700 | [diff] [blame] | 400 | destination.writeParcelable(mAccountHandle, 0); |
Tyler Gunn | 7595842 | 2015-04-15 14:23:42 -0700 | [diff] [blame] | 401 | destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0)); |
Tyler Gunn | 807de8a | 2014-06-30 14:22:57 -0700 | [diff] [blame] | 402 | destination.writeStrongBinder( |
Andrew Lee | 50aca23 | 2014-07-22 16:41:54 -0700 | [diff] [blame] | 403 | mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null); |
Santos Cordon | 980acb9 | 2014-05-31 10:31:19 -0700 | [diff] [blame] | 404 | destination.writeString(mParentCallId); |
| 405 | destination.writeList(mChildCallIds); |
Sailesh Nepal | e7ef59a | 2014-07-08 21:48:22 -0700 | [diff] [blame] | 406 | destination.writeParcelable(mStatusHints, 0); |
Andrew Lee | 85f5d42 | 2014-07-11 17:22:03 -0700 | [diff] [blame] | 407 | destination.writeInt(mVideoState); |
Santos Cordon | 7c7bc7f | 2014-07-28 18:15:48 -0700 | [diff] [blame] | 408 | destination.writeList(mConferenceableCallIds); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 409 | destination.writeBundle(mIntentExtras); |
| 410 | destination.writeBundle(mExtras); |
Christine Hallstrom | 2830ce9 | 2016-11-30 16:06:42 -0800 | [diff] [blame] | 411 | destination.writeInt(mSupportedAudioRoutes); |
Hall Liu | 95d5587 | 2017-01-25 17:12:49 -0800 | [diff] [blame] | 412 | destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0)); |
| 413 | destination.writeParcelable(mRttCall, 0); |
Tyler Gunn | c0bf6de | 2017-03-17 11:27:09 -0700 | [diff] [blame] | 414 | destination.writeLong(mCreationTimeMillis); |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 415 | } |
Santos Cordon | b693998 | 2014-06-04 20:20:58 -0700 | [diff] [blame] | 416 | |
| 417 | @Override |
| 418 | public String toString() { |
| 419 | return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds); |
| 420 | } |
Sailesh Nepal | 6043793 | 2014-04-05 16:44:55 -0700 | [diff] [blame] | 421 | } |