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;
426043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final long mConnectTimeMillis;
436043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final Uri mHandle;
44612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mHandlePresentation;
45612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final String mCallerDisplayName;
46612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mCallerDisplayNamePresentation;
476043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final GatewayInfo mGatewayInfo;
488c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    private final PhoneAccountHandle mAccountHandle;
49b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad    private final IVideoProvider mVideoCallProvider;
5050aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee    private InCallService.VideoCall mVideoCall;
51980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final String mParentCallId;
52980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final List<String> mChildCallIds;
53e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    private final StatusHints mStatusHints;
5485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    private final int mVideoState;
557c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    private final List<String> mConferenceableCallIds;
5610798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    private final Bundle mExtras;
576043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
5888b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public ParcelableCall(
59980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String id,
60b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            int state,
617f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            DisconnectCause disconnectCause,
62c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses,
63980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            int capabilities,
64223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee            int properties,
65980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            long connectTimeMillis,
66980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            Uri handle,
67612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation,
68612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName,
69612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation,
70980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            GatewayInfo gatewayInfo,
718c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle,
72b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            IVideoProvider videoCallProvider,
73980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId,
748d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn            List<String> childCallIds,
7585f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            StatusHints statusHints,
767c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            int videoState,
7710798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen            List<String> conferenceableCallIds,
7810798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen            Bundle extras) {
796043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mId = id;
806043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mState = state;
817f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        mDisconnectCause = disconnectCause;
82c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        mCannedSmsResponses = cannedSmsResponses;
836043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mCapabilities = capabilities;
84223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee        mProperties = properties;
856043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mConnectTimeMillis = connectTimeMillis;
866043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mHandle = handle;
87612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mHandlePresentation = handlePresentation;
88612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayName = callerDisplayName;
89612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayNamePresentation = callerDisplayNamePresentation;
906043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mGatewayInfo = gatewayInfo;
918c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        mAccountHandle = accountHandle;
9250aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        mVideoCallProvider = videoCallProvider;
93980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mParentCallId = parentCallId;
94980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mChildCallIds = childCallIds;
95e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        mStatusHints = statusHints;
9685f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        mVideoState = videoState;
977c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        mConferenceableCallIds = Collections.unmodifiableList(conferenceableCallIds);
9810798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen        mExtras = extras;
996043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1006043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1016043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The unique ID of the call. */
1026043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public String getId() {
1036043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mId;
1046043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1056043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1066043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The current state of the call. */
107b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad    public int getState() {
1086043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mState;
1096043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1106043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1116043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
1127f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee     * Reason for disconnection, as described by {@link android.telecomm.DisconnectCause}. Valid
1137f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee     * when call state is {@link CallState#DISCONNECTED}.
1146043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal     */
1157f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee    public DisconnectCause getDisconnectCause() {
1167f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        return mDisconnectCause;
1176043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1186043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
119c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    /**
120c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     * The set of possible text message responses when this call is incoming.
121c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     */
122c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    public List<String> getCannedSmsResponses() {
123c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        return mCannedSmsResponses;
124c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    }
125c067754a85017ac16a9b438d807c6004f35c095fIhab Awad
1266043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
1276043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int getCapabilities() {
1286043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mCapabilities;
1296043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1306043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
131223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee    /** Bitmask of properties of the call. */
132223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee    public int getProperties() { return mProperties; }
133223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee
1346043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The time that the call switched to the active state. */
1356043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public long getConnectTimeMillis() {
1366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mConnectTimeMillis;
1376043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1386043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1396043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The endpoint to which the call is connected. */
1406043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public Uri getHandle() {
1416043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mHandle;
1426043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1436043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1449d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen    /**
145ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn     * The presentation requirements for the handle. See {@link TelecomManager} for valid values.
1469d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     */
147612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getHandlePresentation() {
148612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mHandlePresentation;
149612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
150612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
151612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    /** The endpoint to which the call is connected. */
152612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public String getCallerDisplayName() {
153612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayName;
154612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
155612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
1569d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen    /**
1579d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     * The presentation requirements for the caller display name.
158ef9f6f957d897ea0ed82114185b8fa3fefd4917bTyler Gunn     * See {@link TelecomManager} for valid values.
1599d568c01db1f90fbe9cbff1d9385e7e7b809e066Nancy Chen     */
160612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getCallerDisplayNamePresentation() {
161612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayNamePresentation;
162612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
163612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
1646043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** Gateway information for the call. */
1656043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public GatewayInfo getGatewayInfo() {
1666043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mGatewayInfo;
1676043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1686043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1696eb262c3515c927df19340b3eee8c74bc9478d16Evan Charlton    /** PhoneAccountHandle information for the call. */
1708c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    public PhoneAccountHandle getAccountHandle() {
1718c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        return mAccountHandle;
1725ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen    }
1735ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen
1746043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
17550aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee     * Returns an object for remotely communicating through the video call provider's binder.
17650aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee     * @return The video call.
1775dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee     */
17850aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee    public InCallService.VideoCall getVideoCall() {
17950aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        if (mVideoCall == null && mVideoCallProvider != null) {
1805dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            try {
18150aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee                mVideoCall = new VideoCallImpl(mVideoCallProvider);
1825dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            } catch (RemoteException ignored) {
1835dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee                // Ignore RemoteException.
1845dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            }
1855dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee        }
1865dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
18750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee        return mVideoCall;
1885dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    }
1895dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
1905dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    /**
191980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The conference call to which this call is conferenced. Null if not conferenced.
192980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
193980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public String getParentCallId() {
194980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mParentCallId;
195980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
196980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
197980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    /**
198980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The child call-IDs if this call is a conference call. Returns an empty list if this is not
199980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * a conference call or if the conference call contains no children.
200980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
201980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public List<String> getChildCallIds() {
202980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mChildCallIds;
203980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
204980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
2057c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    public List<String> getConferenceableCallIds() {
2067c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        return mConferenceableCallIds;
2077c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon    }
2087c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon
2098d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn    /**
210e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * The status label and icon.
211e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     *
212e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * @return Status hints.
213e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     */
214e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    public StatusHints getStatusHints() {
215e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        return mStatusHints;
216e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    }
217e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal
21885f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    /**
21985f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * The video state.
22085f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * @return The video state of the call.
22185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     */
22285f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    public int getVideoState() {
22385f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        return mVideoState;
22485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    }
22585f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee
22610798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    /**
22710798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     * Any extras to pass with the call
22810798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     *
22910798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     * @return a bundle of extras
23010798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen     */
23110798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    public Bundle getExtras() {
23210798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen        return mExtras;
23310798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen    }
23410798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen
23588b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
23688b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public static final Parcelable.Creator<ParcelableCall> CREATOR =
23788b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            new Parcelable.Creator<ParcelableCall> () {
2386043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
23988b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall createFromParcel(Parcel source) {
24088b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            ClassLoader classLoader = ParcelableCall.class.getClassLoader();
2416043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            String id = source.readString();
242b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            int state = source.readInt();
2437f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            DisconnectCause disconnectCause = source.readParcelable(classLoader);
244c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses = new ArrayList<>();
245c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            source.readList(cannedSmsResponses, classLoader);
2466043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            int capabilities = source.readInt();
247223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee            int properties = source.readInt();
2486043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            long connectTimeMillis = source.readLong();
2496043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            Uri handle = source.readParcelable(classLoader);
250612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation = source.readInt();
251612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName = source.readString();
252612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation = source.readInt();
2536043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            GatewayInfo gatewayInfo = source.readParcelable(classLoader);
2548c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
255b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad            IVideoProvider videoCallProvider =
256b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad                    IVideoProvider.Stub.asInterface(source.readStrongBinder());
257980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId = source.readString();
258980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            List<String> childCallIds = new ArrayList<>();
259980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            source.readList(childCallIds, classLoader);
260e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal            StatusHints statusHints = source.readParcelable(classLoader);
26185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            int videoState = source.readInt();
2627c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            List<String> conferenceableCallIds = new ArrayList<>();
2637c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon            source.readList(conferenceableCallIds, classLoader);
26410798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen            Bundle extras = source.readParcelable(classLoader);
2657f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee            return new ParcelableCall(
2667f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    id,
2677f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    state,
2687f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    disconnectCause,
2697f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    cannedSmsResponses,
2707f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    capabilities,
2717f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    properties,
2727f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    connectTimeMillis,
2737f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    handle,
2747f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    handlePresentation,
2757f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    callerDisplayName,
2767f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    callerDisplayNamePresentation,
2777f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    gatewayInfo,
2787f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    accountHandle,
2797f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    videoCallProvider,
2807f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    parentCallId,
2817f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    childCallIds,
2827f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    statusHints,
2837f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    videoState,
2847f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    conferenceableCallIds,
2857f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee                    extras);
2866043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
2876043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
2886043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
28988b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall[] newArray(int size) {
29088b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            return new ParcelableCall[size];
2916043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
2926043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    };
2936043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
2946043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** {@inheritDoc} */
2956043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
2966043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int describeContents() {
2976043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return 0;
2986043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
2996043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
30088b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Writes ParcelableCall object into a Parcel. */
3016043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
3026043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public void writeToParcel(Parcel destination, int flags) {
3036043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeString(mId);
304b19a0bcdd8a5020c61a0d697f600fdc943c86f59Ihab Awad        destination.writeInt(mState);
3057f3d41fd124dd7c4a8b72c1d48df08a8ee7209ecAndrew Lee        destination.writeParcelable(mDisconnectCause, 0);
306c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        destination.writeList(mCannedSmsResponses);
3076043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeInt(mCapabilities);
308223ad1455ada00feee1ca89ccd7bad5afd8c680aAndrew Lee        destination.writeInt(mProperties);
3096043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeLong(mConnectTimeMillis);
3106043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mHandle, 0);
311612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mHandlePresentation);
312612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeString(mCallerDisplayName);
313612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mCallerDisplayNamePresentation);
3146043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mGatewayInfo, 0);
3158c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        destination.writeParcelable(mAccountHandle, 0);
316807de8aa763a5ba459ab87b6e0b61c3a025c1ebeTyler Gunn        destination.writeStrongBinder(
31750aca23bd7f51a3cf32a1f7e32238cc1e26ca1a0Andrew Lee                mVideoCallProvider != null ? mVideoCallProvider.asBinder() : null);
318980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeString(mParentCallId);
319980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeList(mChildCallIds);
320e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        destination.writeParcelable(mStatusHints, 0);
32185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        destination.writeInt(mVideoState);
3227c7bc7f6917484250974c5da00af9ef756844b0aSantos Cordon        destination.writeList(mConferenceableCallIds);
32310798dcaff8ac060af5956906602c2c24f11aa09Nancy Chen        destination.writeParcelable(mExtras, 0);
3246043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
325b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon
326b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    @Override
327b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    public String toString() {
328b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon        return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds);
329b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    }
3306043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal}
331