ParcelableCall.java revision 88b771d8cd3f1e5748078c02f3ab571831ace72f
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
176043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalpackage android.telecomm;
186043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
196043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.net.Uri;
206043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.os.Parcel;
216043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.os.Parcelable;
225dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Leeimport android.os.RemoteException;
236043793d3e8455bc8867baed39353f0350daa63fSailesh Nepalimport android.telephony.DisconnectCause;
246043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
255dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Leeimport com.android.internal.telecomm.ICallVideoProvider;
265dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
27980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordonimport java.util.ArrayList;
28980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordonimport java.util.List;
296043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
306043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal/**
316043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal * Information about a call that is used between InCallService and Telecomm.
3288b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon * @hide
336043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal */
3488b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordonpublic final class ParcelableCall implements Parcelable {
356043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final String mId;
366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final CallState mState;
37fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    private final int mDisconnectCauseCode;
38fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    private final String mDisconnectCauseMsg;
39c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    private final List<String> mCannedSmsResponses;
406043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final int mCapabilities;
416043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final long mConnectTimeMillis;
426043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final Uri mHandle;
43612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mHandlePresentation;
44612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final String mCallerDisplayName;
45612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    private final int mCallerDisplayNamePresentation;
466043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    private final GatewayInfo mGatewayInfo;
478c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    private final PhoneAccountHandle mAccountHandle;
485dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    private final ICallVideoProvider mCallVideoProvider;
495dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    private RemoteCallVideoProvider mRemoteCallVideoProvider;
50980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final String mParentCallId;
51980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    private final List<String> mChildCallIds;
52e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    private final StatusHints mStatusHints;
5385f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    private final int mVideoState;
546043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
556043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** @hide */
5688b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public ParcelableCall(
57980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String id,
58980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            CallState state,
59fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad            int disconnectCauseCode,
60fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad            String disconnectCauseMsg,
61c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses,
62980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            int capabilities,
63980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            long connectTimeMillis,
64980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            Uri handle,
65612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation,
66612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName,
67612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation,
68980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            GatewayInfo gatewayInfo,
698c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle,
705dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            ICallVideoProvider callVideoProvider,
71980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId,
728d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn            List<String> childCallIds,
7385f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            StatusHints statusHints,
7485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            int videoState) {
756043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mId = id;
766043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mState = state;
77fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        mDisconnectCauseCode = disconnectCauseCode;
78fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        mDisconnectCauseMsg = disconnectCauseMsg;
79c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        mCannedSmsResponses = cannedSmsResponses;
806043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mCapabilities = capabilities;
816043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mConnectTimeMillis = connectTimeMillis;
826043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mHandle = handle;
83612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mHandlePresentation = handlePresentation;
84612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayName = callerDisplayName;
85612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        mCallerDisplayNamePresentation = callerDisplayNamePresentation;
866043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        mGatewayInfo = gatewayInfo;
878c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        mAccountHandle = accountHandle;
885dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee        mCallVideoProvider = callVideoProvider;
89980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mParentCallId = parentCallId;
90980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        mChildCallIds = childCallIds;
91e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        mStatusHints = statusHints;
9285f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        mVideoState = videoState;
936043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
946043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
956043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The unique ID of the call. */
966043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public String getId() {
976043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mId;
986043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
996043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1006043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The current state of the call. */
1016043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public CallState getState() {
1026043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mState;
1036043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1046043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1056043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
1066043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal     * Reason for disconnection, values are defined in {@link DisconnectCause}. Valid when call
107c1a48ef7c37751b28ff5af3ff8b12e7ddec7eadbSailesh Nepal     * state is {@link CallState#DISCONNECTED}.
1086043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal     */
109fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    public int getDisconnectCauseCode() {
110fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        return mDisconnectCauseCode;
111fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    }
112fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad
113fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    /**
114fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad     * Further optional textual information about the reason for disconnection. Valid when call
115fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad     * state is {@link CallState#DISCONNECTED}.
116fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad     */
117fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad    public String getDisconnectCauseMsg() {
118fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        return mDisconnectCauseMsg;
1196043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1206043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
121c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    /**
122c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     * The set of possible text message responses when this call is incoming.
123c067754a85017ac16a9b438d807c6004f35c095fIhab Awad     */
124c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    public List<String> getCannedSmsResponses() {
125c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        return mCannedSmsResponses;
126c067754a85017ac16a9b438d807c6004f35c095fIhab Awad    }
127c067754a85017ac16a9b438d807c6004f35c095fIhab Awad
1286043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
1296043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int getCapabilities() {
1306043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mCapabilities;
1316043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1326043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1336043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The time that the call switched to the active state. */
1346043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public long getConnectTimeMillis() {
1356043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mConnectTimeMillis;
1366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1376043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1386043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** The endpoint to which the call is connected. */
1396043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public Uri getHandle() {
1406043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mHandle;
1416043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1426043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
143612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    /** The {@link CallPropertyPresentation} which controls how the handle is shown. */
144612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getHandlePresentation() {
145612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mHandlePresentation;
146612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
147612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
148612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    /** The endpoint to which the call is connected. */
149612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public String getCallerDisplayName() {
150612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayName;
151612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
152612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
153612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    /** The {@link CallPropertyPresentation} which controls how the caller display name is shown. */
154612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    public int getCallerDisplayNamePresentation() {
155612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        return mCallerDisplayNamePresentation;
156612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal    }
157612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal
1586043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** Gateway information for the call. */
1596043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public GatewayInfo getGatewayInfo() {
1606043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return mGatewayInfo;
1616043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
1626043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
1636eb262c3515c927df19340b3eee8c74bc9478d16Evan Charlton    /** PhoneAccountHandle information for the call. */
1648c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton    public PhoneAccountHandle getAccountHandle() {
1658c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        return mAccountHandle;
1665ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen    }
1675ffbfccea007e6aebc9ba53b3666664d08a666b4Nancy Chen
1686043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /**
1695dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee     * Returns an object for remotely communicating through the call video provider's binder.
1705dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee     * @return The call video provider.
1715dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee     */
1725dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    public RemoteCallVideoProvider getCallVideoProvider() throws RemoteException {
173807de8aa763a5ba459ab87b6e0b61c3a025c1ebeTyler Gunn        if (mRemoteCallVideoProvider == null && mCallVideoProvider != null) {
1745dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            try {
1755dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee                mRemoteCallVideoProvider = new RemoteCallVideoProvider(mCallVideoProvider);
1765dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            } catch (RemoteException ignored) {
1775dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee                // Ignore RemoteException.
1785dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            }
1795dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee        }
1805dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
1815dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee        return mRemoteCallVideoProvider;
1825dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    }
1835dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee
1845dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee    /**
185980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The conference call to which this call is conferenced. Null if not conferenced.
186980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * @hide
187980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
188980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public String getParentCallId() {
189980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mParentCallId;
190980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
191980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
192980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    /**
193980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * The child call-IDs if this call is a conference call. Returns an empty list if this is not
194980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * a conference call or if the conference call contains no children.
195980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     * @hide
196980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon     */
197980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    public List<String> getChildCallIds() {
198980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        return mChildCallIds;
199980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon    }
200980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon
2018d83fa9bbd2ad15299a4419241eb10404e7839beTyler Gunn    /**
202e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * The status label and icon.
203e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     *
204e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     * @return Status hints.
205e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal     */
206e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    public StatusHints getStatusHints() {
207e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        return mStatusHints;
208e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal    }
209e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal
21085f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    /**
21185f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * The video state.
21285f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     * @return The video state of the call.
21385f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee     */
21485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    public int getVideoState() {
21585f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        return mVideoState;
21685f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee    }
21785f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee
21888b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Responsible for creating ParcelableCall objects for deserialized Parcels. */
21988b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    public static final Parcelable.Creator<ParcelableCall> CREATOR =
22088b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            new Parcelable.Creator<ParcelableCall> () {
2216043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
22288b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall createFromParcel(Parcel source) {
22388b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            ClassLoader classLoader = ParcelableCall.class.getClassLoader();
2246043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            String id = source.readString();
2256043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            CallState state = CallState.valueOf(source.readString());
226fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad            int disconnectCauseCode = source.readInt();
227fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad            String disconnectCauseMsg = source.readString();
228c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            List<String> cannedSmsResponses = new ArrayList<>();
229c067754a85017ac16a9b438d807c6004f35c095fIhab Awad            source.readList(cannedSmsResponses, classLoader);
2306043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            int capabilities = source.readInt();
2316043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            long connectTimeMillis = source.readLong();
2326043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            Uri handle = source.readParcelable(classLoader);
233612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int handlePresentation = source.readInt();
234612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            String callerDisplayName = source.readString();
235612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal            int callerDisplayNamePresentation = source.readInt();
2366043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal            GatewayInfo gatewayInfo = source.readParcelable(classLoader);
2378c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton            PhoneAccountHandle accountHandle = source.readParcelable(classLoader);
2385dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee            ICallVideoProvider callVideoProvider =
2395dc3075cfca63aa1f9215e49156e2af12183d07dAndrew Lee                    ICallVideoProvider.Stub.asInterface(source.readStrongBinder());
240980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            String parentCallId = source.readString();
241980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            List<String> childCallIds = new ArrayList<>();
242980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon            source.readList(childCallIds, classLoader);
243e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal            StatusHints statusHints = source.readParcelable(classLoader);
24485f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee            int videoState = source.readInt();
24588b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            return new ParcelableCall(id, state, disconnectCauseCode, disconnectCauseMsg,
246612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal                    cannedSmsResponses, capabilities, connectTimeMillis, handle, handlePresentation,
247612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal                    callerDisplayName, callerDisplayNamePresentation, gatewayInfo,
2488c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton                    accountHandle, callVideoProvider, parentCallId, childCallIds, statusHints,
24985f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee                    videoState);
2506043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
2516043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
2526043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        @Override
25388b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon        public ParcelableCall[] newArray(int size) {
25488b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon            return new ParcelableCall[size];
2556043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        }
2566043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    };
2576043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
2586043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    /** {@inheritDoc} */
2596043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
2606043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public int describeContents() {
2616043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        return 0;
2626043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
2636043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal
26488b771d8cd3f1e5748078c02f3ab571831ace72fSantos Cordon    /** Writes ParcelableCall object into a Parcel. */
2656043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    @Override
2666043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    public void writeToParcel(Parcel destination, int flags) {
2676043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeString(mId);
2686043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeString(mState.name());
269fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        destination.writeInt(mDisconnectCauseCode);
270fbb092f26e796fe638fb8bb4a91de2d4525bcaccIhab Awad        destination.writeString(mDisconnectCauseMsg);
271c067754a85017ac16a9b438d807c6004f35c095fIhab Awad        destination.writeList(mCannedSmsResponses);
2726043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeInt(mCapabilities);
2736043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeLong(mConnectTimeMillis);
2746043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mHandle, 0);
275612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mHandlePresentation);
276612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeString(mCallerDisplayName);
277612038642fa9cf1545dbcc8274d313192ce928b5Sailesh Nepal        destination.writeInt(mCallerDisplayNamePresentation);
2786043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal        destination.writeParcelable(mGatewayInfo, 0);
2798c8a062f521d39ceecc99e8fc6cef9c60b773da5Evan Charlton        destination.writeParcelable(mAccountHandle, 0);
280807de8aa763a5ba459ab87b6e0b61c3a025c1ebeTyler Gunn        destination.writeStrongBinder(
281807de8aa763a5ba459ab87b6e0b61c3a025c1ebeTyler Gunn                mCallVideoProvider != null ? mCallVideoProvider.asBinder() : null);
282980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeString(mParentCallId);
283980acb9bd6984a9daad5f584bd35e8d503820200Santos Cordon        destination.writeList(mChildCallIds);
284e7ef59a77d55c9802cc7d919f7dd794bd5fea30eSailesh Nepal        destination.writeParcelable(mStatusHints, 0);
28585f5d4263dcc31a9d6da46d774081a639b34e553Andrew Lee        destination.writeInt(mVideoState);
2866043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal    }
287b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon
288b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    @Override
289b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    public String toString() {
290b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon        return String.format("[%s, parent:%s, children:%s]", mId, mParentCallId, mChildCallIds);
291b693998fdfdd4498a33c4c69405f2708e4840aa7Santos Cordon    }
2926043793d3e8455bc8867baed39353f0350daa63fSailesh Nepal}
293