16043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal/*
26043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * Copyright 2014, The Android Open Source Project
36043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal *
46043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * Licensed under the Apache License, Version 2.0 (the "License");
56043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * you may not use this file except in compliance with the License.
66043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * You may obtain a copy of the License at
76043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal *
86043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal *     http://www.apache.org/licenses/LICENSE-2.0
96043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal *
106043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * Unless required by applicable law or agreed to in writing, software
116043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * distributed under the License is distributed on an "AS IS" BASIS,
126043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * See the License for the specific language governing permissions and
146043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * limitations under the License.
156043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal */
166043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
17ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnpackage android.telecom;
186043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
196043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.net.Uri;
2010798dcaff8ac060af5956906602c2c24f11aa09Nancy Chenimport android.os.Bundle;
216043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.os.Parcel;
226043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.os.Parcelable;
235dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Leeimport android.os.RemoteException;
246043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
25980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordonimport java.util.ArrayList;
267c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordonimport java.util.Collections;
27980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordonimport java.util.List;
286043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
29ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunnimport com.android.internal.telecom.IVideoProvider;
30b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad
316043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal/**
32ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn * Information about a call that is used between InCallService and Telecom.
3388b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon * @hide
346043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal */
3588b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordonpublic final class ParcelableCall implements Parcelable {
366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final String mId;
37b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad    private final int mState;
387f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee    private final DisconnectCause mDisconnectCause;
39c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    private final List<String> mCannedSmsResponses;
406043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final int mCapabilities;
41223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee    private final int mProperties;
422830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom    private final int mSupportedAudioRoutes;
436043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final long mConnectTimeMillis;
446043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final Uri mHandle;
45612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mHandlePresentation;
46612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final String mCallerDisplayName;
47612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mCallerDisplayNamePresentation;
486043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final GatewayInfo mGatewayInfo;
498c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    private final PhoneAccountHandle mAccountHandle;
5075958420f2d294ceda517c2782b294002dc2969fTyler Gunn    private final boolean mIsVideoCallProviderChanged;
51b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad    private final IVideoProvider mVideoCallProvider;
52584ba6c1d156af1a1295fb101cd085577ac82eceTyler Gunn    private VideoCallImpl mVideoCall;
5395d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    private final boolean mIsRttCallChanged;
5495d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    private final ParcelableRttCall mRttCall;
55980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final String mParentCallId;
56980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final List<String> mChildCallIds;
57e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    private final StatusHints mStatusHints;
5885f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    private final int mVideoState;
597c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    private final List<String> mConferenceableCallIds;
606b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon    private final Bundle mIntentExtras;
6110798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    private final Bundle mExtras;
623251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn    private final long mCreationTimeMillis;
636043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
6488b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public ParcelableCall(
65980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String id,
66b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            int state,
677f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            DisconnectCause disconnectCause,
68c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses,
69980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            int capabilities,
70223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee            int properties,
712830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom            int supportedAudioRoutes,
72980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            long connectTimeMillis,
73980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            Uri handle,
74612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation,
75612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName,
76612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation,
77980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            GatewayInfo gatewayInfo,
788c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle,
7975958420f2d294ceda517c2782b294002dc2969fTyler Gunn            boolean isVideoCallProviderChanged,
80b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            IVideoProvider videoCallProvider,
8195d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu            boolean isRttCallChanged,
8295d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu            ParcelableRttCall rttCall,
83980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId,
848d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn            List<String> childCallIds,
8585f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            StatusHints statusHints,
867c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            int videoState,
8710798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen            List<String> conferenceableCallIds,
886b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon            Bundle intentExtras,
893251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn            Bundle extras,
903251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn            long creationTimeMillis) {
916043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mId = id;
926043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mState = state;
937f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        mDisconnectCause = disconnectCause;
94c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        mCannedSmsResponses = cannedSmsResponses;
956043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mCapabilities = capabilities;
96223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee        mProperties = properties;
972830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom        mSupportedAudioRoutes = supportedAudioRoutes;
986043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mConnectTimeMillis = connectTimeMillis;
996043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mHandle = handle;
100612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mHandlePresentation = handlePresentation;
101612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayName = callerDisplayName;
102612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayNamePresentation = callerDisplayNamePresentation;
1036043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mGatewayInfo = gatewayInfo;
1048c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        mAccountHandle = accountHandle;
10575958420f2d294ceda517c2782b294002dc2969fTyler Gunn        mIsVideoCallProviderChanged = isVideoCallProviderChanged;
10650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        mVideoCallProvider = videoCallProvider;
10795d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        mIsRttCallChanged = isRttCallChanged;
10895d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        mRttCall = rttCall;
109980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mParentCallId = parentCallId;
110980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mChildCallIds = childCallIds;
111e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        mStatusHints = statusHints;
11285f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        mVideoState = videoState;
1137c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
1146b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon        mIntentExtras = intentExtras;
11510798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen        mExtras = extras;
1163251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn        mCreationTimeMillis = creationTimeMillis;
1176043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1186043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1196043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The unique ID of the call. */
1206043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public String getId() {
1216043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mId;
1226043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1236043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1246043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The current state of the call. */
125b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad    public int getState() {
1266043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mState;
1276043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1286043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1296043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
1307f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee     * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid
1317f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee     * when call state is {@link CallState#DISCONNECTED}.
1326043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal     */
1337f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee    public DisconnectCause getDisconnectCause() {
1347f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        return mDisconnectCause;
1356043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
137c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    /**
138c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     * The set of possible text message responses when this call is incoming.
139c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     */
140c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    public List<String> getCannedSmsResponses() {
141c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        return mCannedSmsResponses;
142c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    }
143c067754a85017ac16a9b438d807c6004f35c095fIhab Awad
1446043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
1456043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int getCapabilities() {
1466043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mCapabilities;
1476043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1486043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
149223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee    /** Bitmask of properties of the call. */
150223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee    public int getProperties() { return mProperties; }
151223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee
1522830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom    /** Bitmask of supported routes of the call */
1532830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom    public int getSupportedAudioRoutes() {
1542830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom        return mSupportedAudioRoutes;
1552830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom    }
1562830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom
1576043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The time that the call switched to the active state. */
1586043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public long getConnectTimeMillis() {
1596043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mConnectTimeMillis;
1606043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1616043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1626043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The endpoint to which the call is connected. */
1636043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public Uri getHandle() {
1646043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mHandle;
1656043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1666043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1679d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen    /**
168ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn     * The presentation requirements for the handle. See {@link TelecomManager} for valid values.
1699d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     */
170612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getHandlePresentation() {
171612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mHandlePresentation;
172612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
173612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
174612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    /** The endpoint to which the call is connected. */
175612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public String getCallerDisplayName() {
176612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayName;
177612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
178612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
1799d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen    /**
1809d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     * The presentation requirements for the caller display name.
181ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn     * See {@link TelecomManager} for valid values.
1829d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     */
183612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getCallerDisplayNamePresentation() {
184612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayNamePresentation;
185612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
186612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
1876043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** Gateway information for the call. */
1886043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public GatewayInfo getGatewayInfo() {
1896043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mGatewayInfo;
1906043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1916043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1926eb262c3515c927df19340b3eee8c74bc9478d16Evan Charlton    /** PhoneAccountHandle information for the call. */
1938c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    public PhoneAccountHandle getAccountHandle() {
1948c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        return mAccountHandle;
1955ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen    }
1965ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen
1976043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
19850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee     * Returns an object for remotely communicating through the video call provider's binder.
199159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn     *
200159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn     * @param callingPackageName the package name of the calling InCallService.
201159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn     * @param targetSdkVersion the target SDK version of the calling InCallService.
20250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee     * @return The video call.
2035dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee     */
204159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn    public VideoCallImpl getVideoCallImpl(String callingPackageName, int targetSdkVersion) {
20550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        if (mVideoCall == null && mVideoCallProvider != null) {
2065dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            try {
207159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn                mVideoCall = new VideoCallImpl(mVideoCallProvider, callingPackageName,
208159f35c8e4a2d5902cbbeb8d3b9a80bddf247de3Tyler Gunn                        targetSdkVersion);
2095dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            } catch (RemoteException ignored) {
2105dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee                // Ignore RemoteException.
2115dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            }
2125dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee        }
2135dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
21450aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        return mVideoCall;
2155dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    }
2165dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
21795d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    public boolean getIsRttCallChanged() {
21895d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        return mIsRttCallChanged;
21995d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    }
22095d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu
22195d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    /**
22295d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu     * RTT communication channel information
22395d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu     * @return The ParcelableRttCall
22495d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu     */
22595d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    public ParcelableRttCall getParcelableRttCall() {
22695d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        return mRttCall;
22795d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu    }
22895d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu
2295dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    /**
230980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The conference call to which this call is conferenced. Null if not conferenced.
231980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
232980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public String getParentCallId() {
233980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mParentCallId;
234980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
235980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
236980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    /**
237980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The child call-IDs if this call is a conference call. Returns an empty list if this is not
238980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * a conference call or if the conference call contains no children.
239980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
240980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public List<String> getChildCallIds() {
241980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mChildCallIds;
242980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
243980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
2447c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    public List<String> getConferenceableCallIds() {
2457c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        return mConferenceableCallIds;
2467c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    }
2477c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon
2488d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn    /**
249e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * The status label and icon.
250e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     *
251e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * @return Status hints.
252e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     */
253e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    public StatusHints getStatusHints() {
254e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        return mStatusHints;
255e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    }
256e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal
25785f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    /**
25885f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * The video state.
25985f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * @return The video state of the call.
26085f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     */
26185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    public int getVideoState() {
26285f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        return mVideoState;
26385f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    }
26485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee
26510798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    /**
2666b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon     * Any extras associated with this call.
26710798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     *
26810798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     * @return a bundle of extras
26910798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     */
27010798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    public Bundle getExtras() {
27110798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen        return mExtras;
27210798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    }
27310798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen
27407366813cdf3768dcd69a1f744023747564d654aRekha Kumar    /**
2756b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon     * Extras passed in as part of the original call intent.
2766b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon     *
2776b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon     * @return The intent extras.
2786b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon     */
2796b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon    public Bundle getIntentExtras() {
2806b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon        return mIntentExtras;
2816b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon    }
2826b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon
2836b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon    /**
28475958420f2d294ceda517c2782b294002dc2969fTyler Gunn     * Indicates to the receiver of the {@link ParcelableCall} whether a change has occurred in the
28575958420f2d294ceda517c2782b294002dc2969fTyler Gunn     * {@link android.telecom.InCallService.VideoCall} associated with this call.  Since
28675958420f2d294ceda517c2782b294002dc2969fTyler Gunn     * {@link #getVideoCall()} creates a new {@link VideoCallImpl}, it is useful to know whether
28775958420f2d294ceda517c2782b294002dc2969fTyler Gunn     * the provider has changed (which can influence whether it is accessed).
28875958420f2d294ceda517c2782b294002dc2969fTyler Gunn     *
28975958420f2d294ceda517c2782b294002dc2969fTyler Gunn     * @return {@code true} if the video call changed, {@code false} otherwise.
29075958420f2d294ceda517c2782b294002dc2969fTyler Gunn     */
29175958420f2d294ceda517c2782b294002dc2969fTyler Gunn    public boolean isVideoCallProviderChanged() {
29275958420f2d294ceda517c2782b294002dc2969fTyler Gunn        return mIsVideoCallProviderChanged;
29375958420f2d294ceda517c2782b294002dc2969fTyler Gunn    }
29475958420f2d294ceda517c2782b294002dc2969fTyler Gunn
2953251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn    /**
2963251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn     * @return The time the call was created, in milliseconds since the epoch.
2973251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn     */
2983251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn    public long getCreationTimeMillis() {
2993251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn        return mCreationTimeMillis;
3003251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn    }
3013251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn
30288b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
30388b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public static final Parcelable.Creator<ParcelableCall> CREATOR =
30488b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            new Parcelable.Creator<ParcelableCall> () {
3056043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
30688b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall createFromParcel(Parcel source) {
30788b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            ClassLoader classLoader = ParcelableCall.class.getClassLoader();
3086043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            String id = source.readString();
309b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            int state = source.readInt();
3107f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            DisconnectCause disconnectCause = source.readParcelable(classLoader);
311c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses = new ArrayList<>();
312c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            source.readList(cannedSmsResponses, classLoader);
3136043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            int capabilities = source.readInt();
314223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee            int properties = source.readInt();
3156043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            long connectTimeMillis = source.readLong();
3166043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            Uri handle = source.readParcelable(classLoader);
317612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation = source.readInt();
318612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName = source.readString();
319612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation = source.readInt();
3206043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            GatewayInfo gatewayInfo = source.readParcelable(classLoader);
3218c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
32275958420f2d294ceda517c2782b294002dc2969fTyler Gunn            boolean isVideoCallProviderChanged = source.readByte() == 1;
323b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            IVideoProvider videoCallProvider =
324b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad                    IVideoProvider.Stub.asInterface(source.readStrongBinder());
325980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId = source.readString();
326980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            List<String> childCallIds = new ArrayList<>();
327980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            source.readList(childCallIds, classLoader);
328e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal            StatusHints statusHints = source.readParcelable(classLoader);
32985f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            int videoState = source.readInt();
3307c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            List<String> conferenceableCallIds = new ArrayList<>();
3317c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            source.readList(conferenceableCallIds, classLoader);
3326b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon            Bundle intentExtras = source.readBundle(classLoader);
3336b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon            Bundle extras = source.readBundle(classLoader);
3342830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom            int supportedAudioRoutes = source.readInt();
33595d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu            boolean isRttCallChanged = source.readByte() == 1;
33695d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu            ParcelableRttCall rttCall = source.readParcelable(classLoader);
3373251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn            long creationTimeMillis = source.readLong();
3387f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            return new ParcelableCall(
3397f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    id,
3407f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    state,
3417f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    disconnectCause,
3427f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    cannedSmsResponses,
3437f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    capabilities,
3447f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    properties,
3452830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom                    supportedAudioRoutes,
3467f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    connectTimeMillis,
3477f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    handle,
3487f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    handlePresentation,
3497f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    callerDisplayName,
3507f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    callerDisplayNamePresentation,
3517f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    gatewayInfo,
3527f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    accountHandle,
35375958420f2d294ceda517c2782b294002dc2969fTyler Gunn                    isVideoCallProviderChanged,
3547f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    videoCallProvider,
35595d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu                    isRttCallChanged,
35695d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu                    rttCall,
3577f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    parentCallId,
3587f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    childCallIds,
3597f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    statusHints,
3607f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    videoState,
3617f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    conferenceableCallIds,
3626b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon                    intentExtras,
3633251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn                    extras,
3643251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn                    creationTimeMillis);
3656043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
3666043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
3676043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
36888b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall[] newArray(int size) {
36988b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            return new ParcelableCall[size];
3706043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
3716043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    };
3726043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
3736043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** {@inheritDoc} */
3746043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
3756043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int describeContents() {
3766043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return 0;
3776043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
3786043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
37988b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Writes ParcelableCall object into a Parcel. */
3806043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
3816043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public void writeToParcel(Parcel destination, int flags) {
3826043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeString(mId);
383b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad        destination.writeInt(mState);
3847f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        destination.writeParcelable(mDisconnectCause, 0);
385c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        destination.writeList(mCannedSmsResponses);
3866043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeInt(mCapabilities);
387223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee        destination.writeInt(mProperties);
3886043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeLong(mConnectTimeMillis);
3896043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mHandle, 0);
390612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mHandlePresentation);
391612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeString(mCallerDisplayName);
392612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mCallerDisplayNamePresentation);
3936043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mGatewayInfo, 0);
3948c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        destination.writeParcelable(mAccountHandle, 0);
39575958420f2d294ceda517c2782b294002dc2969fTyler Gunn        destination.writeByte((byte) (mIsVideoCallProviderChanged ? 1 : 0));
396807de8aa763a5ba459ab87b6e0b61c3a025c1ebeTyler Gunn        destination.writeStrongBinder(
39750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee                mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
398980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeString(mParentCallId);
399980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeList(mChildCallIds);
400e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        destination.writeParcelable(mStatusHints, 0);
40185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        destination.writeInt(mVideoState);
4027c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        destination.writeList(mConferenceableCallIds);
4036b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon        destination.writeBundle(mIntentExtras);
4046b7f955c2d9b231660b8c54f8ef8e8e6ad802625Santos Cordon        destination.writeBundle(mExtras);
4052830ce9a096301acac8cc3dadeb2bf9a03edc4e3Christine Hallstrom        destination.writeInt(mSupportedAudioRoutes);
40695d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        destination.writeByte((byte) (mIsRttCallChanged ? 1 : 0));
40795d5587d0aad9dfd49f798408f4212f95ce68fc7Hall Liu        destination.writeParcelable(mRttCall, 0);
4083251a5571db7f355c92b354d65ce8b1c218c5abaTyler Gunn        destination.writeLong(mCreationTimeMillis);
4096043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
410b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon
411b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    @Override
412b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    public String toString() {
413b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon        return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds);
414b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    }
4156043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal}
416