blob: ede05943772ec4074b5bc5ebb34dbd08deba7449 [file] [log] [blame]
Santos Cordon823fd3c2014-08-07 18:35:18 -07001/*
2 * Copyright 2014, The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Tyler Gunnef9f6f92014-09-12 22:16:17 -070017package android.telecom;
Santos Cordon823fd3c2014-08-07 18:35:18 -070018
Tyler Gunnac60f952019-05-31 07:23:16 -070019import android.net.Uri;
Santos Cordon6b7f9552015-05-27 17:21:45 -070020import android.os.Bundle;
Santos Cordon823fd3c2014-08-07 18:35:18 -070021import android.os.Parcel;
22import android.os.Parcelable;
23
24import java.util.ArrayList;
25import java.util.List;
26
Rekha Kumar07366812015-03-24 16:42:31 -070027import com.android.internal.telecom.IVideoProvider;
28
Santos Cordon823fd3c2014-08-07 18:35:18 -070029/**
30 * A parcelable representation of a conference connection.
31 * @hide
32 */
33public final class ParcelableConference implements Parcelable {
34
35 private PhoneAccountHandle mPhoneAccount;
36 private int mState;
Ihab Awad5c9c86e2014-11-12 13:41:16 -080037 private int mConnectionCapabilities;
Tyler Gunn720c6642016-03-22 09:02:47 -070038 private int mConnectionProperties;
Santos Cordon823fd3c2014-08-07 18:35:18 -070039 private List<String> mConnectionIds;
Andrew Leeedc625f2015-04-14 13:38:12 -070040 private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED;
Rekha Kumar07366812015-03-24 16:42:31 -070041 private final IVideoProvider mVideoProvider;
42 private final int mVideoState;
Andrew Leeedc625f2015-04-14 13:38:12 -070043 private StatusHints mStatusHints;
Santos Cordon6b7f9552015-05-27 17:21:45 -070044 private Bundle mExtras;
Tyler Gunnb2f875b2017-08-04 09:27:26 -070045 private long mConnectElapsedTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED;
Tyler Gunnac60f952019-05-31 07:23:16 -070046 private final Uri mAddress;
47 private final int mAddressPresentation;
48 private final String mCallerDisplayName;
49 private final int mCallerDisplayNamePresentation;
Tyler Gunncd5d33c2015-01-12 09:02:01 -080050
51 public ParcelableConference(
52 PhoneAccountHandle phoneAccount,
53 int state,
54 int connectionCapabilities,
Tyler Gunn720c6642016-03-22 09:02:47 -070055 int connectionProperties,
Tyler Gunncd5d33c2015-01-12 09:02:01 -080056 List<String> connectionIds,
Rekha Kumar07366812015-03-24 16:42:31 -070057 IVideoProvider videoProvider,
58 int videoState,
Andrew Leeedc625f2015-04-14 13:38:12 -070059 long connectTimeMillis,
Tyler Gunnb2f875b2017-08-04 09:27:26 -070060 long connectElapsedTimeMillis,
Santos Cordon6b7f9552015-05-27 17:21:45 -070061 StatusHints statusHints,
Tyler Gunnac60f952019-05-31 07:23:16 -070062 Bundle extras,
63 Uri address,
64 int addressPresentation,
65 String callerDisplayName,
66 int callerDisplayNamePresentation) {
Andrew Leeedc625f2015-04-14 13:38:12 -070067 mPhoneAccount = phoneAccount;
68 mState = state;
69 mConnectionCapabilities = connectionCapabilities;
Tyler Gunn720c6642016-03-22 09:02:47 -070070 mConnectionProperties = connectionProperties;
Andrew Leeedc625f2015-04-14 13:38:12 -070071 mConnectionIds = connectionIds;
Andrew Lee0f51da32015-04-16 13:11:55 -070072 mVideoProvider = videoProvider;
73 mVideoState = videoState;
Tyler Gunncd5d33c2015-01-12 09:02:01 -080074 mConnectTimeMillis = connectTimeMillis;
Andrew Leeedc625f2015-04-14 13:38:12 -070075 mStatusHints = statusHints;
Santos Cordon6b7f9552015-05-27 17:21:45 -070076 mExtras = extras;
Tyler Gunnb2f875b2017-08-04 09:27:26 -070077 mConnectElapsedTimeMillis = connectElapsedTimeMillis;
Tyler Gunnac60f952019-05-31 07:23:16 -070078 mAddress = address;
79 mAddressPresentation = addressPresentation;
80 mCallerDisplayName = callerDisplayName;
81 mCallerDisplayNamePresentation = callerDisplayNamePresentation;
Santos Cordon823fd3c2014-08-07 18:35:18 -070082 }
83
84 @Override
85 public String toString() {
86 return (new StringBuffer())
87 .append("account: ")
88 .append(mPhoneAccount)
89 .append(", state: ")
90 .append(Connection.stateToString(mState))
91 .append(", capabilities: ")
Ihab Awad5c9c86e2014-11-12 13:41:16 -080092 .append(Connection.capabilitiesToString(mConnectionCapabilities))
Tyler Gunn720c6642016-03-22 09:02:47 -070093 .append(", properties: ")
94 .append(Connection.propertiesToString(mConnectionProperties))
Tyler Gunncd5d33c2015-01-12 09:02:01 -080095 .append(", connectTime: ")
96 .append(mConnectTimeMillis)
Santos Cordon823fd3c2014-08-07 18:35:18 -070097 .append(", children: ")
98 .append(mConnectionIds)
Rekha Kumar07366812015-03-24 16:42:31 -070099 .append(", VideoState: ")
100 .append(mVideoState)
101 .append(", VideoProvider: ")
102 .append(mVideoProvider)
Santos Cordon823fd3c2014-08-07 18:35:18 -0700103 .toString();
104 }
105
106 public PhoneAccountHandle getPhoneAccount() {
107 return mPhoneAccount;
108 }
109
110 public int getState() {
111 return mState;
112 }
113
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800114 public int getConnectionCapabilities() {
115 return mConnectionCapabilities;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700116 }
117
Tyler Gunn720c6642016-03-22 09:02:47 -0700118 public int getConnectionProperties() {
119 return mConnectionProperties;
120 }
121
Santos Cordon823fd3c2014-08-07 18:35:18 -0700122 public List<String> getConnectionIds() {
123 return mConnectionIds;
124 }
125
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800126 public long getConnectTimeMillis() {
127 return mConnectTimeMillis;
128 }
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700129
130 public long getConnectElapsedTimeMillis() {
131 return mConnectElapsedTimeMillis;
132 }
133
Rekha Kumar07366812015-03-24 16:42:31 -0700134 public IVideoProvider getVideoProvider() {
135 return mVideoProvider;
136 }
137
138 public int getVideoState() {
139 return mVideoState;
140 }
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800141
Andrew Leeedc625f2015-04-14 13:38:12 -0700142 public StatusHints getStatusHints() {
143 return mStatusHints;
144 }
145
Santos Cordon6b7f9552015-05-27 17:21:45 -0700146 public Bundle getExtras() {
147 return mExtras;
148 }
149
Tyler Gunnac60f952019-05-31 07:23:16 -0700150 public Uri getHandle() {
151 return mAddress;
152 }
153
154 public int getHandlePresentation() {
155 return mAddressPresentation;
156 }
157
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700158 public static final @android.annotation.NonNull Parcelable.Creator<ParcelableConference> CREATOR =
Santos Cordon823fd3c2014-08-07 18:35:18 -0700159 new Parcelable.Creator<ParcelableConference> () {
160 @Override
161 public ParcelableConference createFromParcel(Parcel source) {
162 ClassLoader classLoader = ParcelableConference.class.getClassLoader();
163 PhoneAccountHandle phoneAccount = source.readParcelable(classLoader);
164 int state = source.readInt();
165 int capabilities = source.readInt();
166 List<String> connectionIds = new ArrayList<>(2);
167 source.readList(connectionIds, classLoader);
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800168 long connectTimeMillis = source.readLong();
Rekha Kumar07366812015-03-24 16:42:31 -0700169 IVideoProvider videoCallProvider =
170 IVideoProvider.Stub.asInterface(source.readStrongBinder());
171 int videoState = source.readInt();
Tyler Gunnd7017c42015-04-27 13:13:32 -0700172 StatusHints statusHints = source.readParcelable(classLoader);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700173 Bundle extras = source.readBundle(classLoader);
Tyler Gunn720c6642016-03-22 09:02:47 -0700174 int properties = source.readInt();
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700175 long connectElapsedTimeMillis = source.readLong();
Tyler Gunnac60f952019-05-31 07:23:16 -0700176 Uri address = source.readParcelable(classLoader);
177 int addressPresentation = source.readInt();
178 String callerDisplayName = source.readString();
179 int callerDisplayNamePresentation = source.readInt();
Rekha Kumar07366812015-03-24 16:42:31 -0700180
Tyler Gunn720c6642016-03-22 09:02:47 -0700181 return new ParcelableConference(phoneAccount, state, capabilities, properties,
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700182 connectionIds, videoCallProvider, videoState, connectTimeMillis,
Tyler Gunnac60f952019-05-31 07:23:16 -0700183 connectElapsedTimeMillis, statusHints, extras, address, addressPresentation,
184 callerDisplayName, callerDisplayNamePresentation);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700185 }
186
187 @Override
188 public ParcelableConference[] newArray(int size) {
189 return new ParcelableConference[size];
190 }
191 };
192
193 /** {@inheritDoc} */
194 @Override
195 public int describeContents() {
196 return 0;
197 }
198
199 /** Writes ParcelableConference object into a Parcel. */
200 @Override
201 public void writeToParcel(Parcel destination, int flags) {
202 destination.writeParcelable(mPhoneAccount, 0);
203 destination.writeInt(mState);
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800204 destination.writeInt(mConnectionCapabilities);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700205 destination.writeList(mConnectionIds);
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800206 destination.writeLong(mConnectTimeMillis);
Rekha Kumar07366812015-03-24 16:42:31 -0700207 destination.writeStrongBinder(
208 mVideoProvider != null ? mVideoProvider.asBinder() : null);
209 destination.writeInt(mVideoState);
Andrew Leeedc625f2015-04-14 13:38:12 -0700210 destination.writeParcelable(mStatusHints, 0);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700211 destination.writeBundle(mExtras);
Tyler Gunn720c6642016-03-22 09:02:47 -0700212 destination.writeInt(mConnectionProperties);
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700213 destination.writeLong(mConnectElapsedTimeMillis);
Tyler Gunnac60f952019-05-31 07:23:16 -0700214 destination.writeParcelable(mAddress, 0);
215 destination.writeInt(mAddressPresentation);
216 destination.writeString(mCallerDisplayName);
217 destination.writeInt(mCallerDisplayNamePresentation);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700218 }
219}