blob: 636e4b2ba96e86a5f1c472d2cc1c385fd2f67aff [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
Santos Cordon6b7f9552015-05-27 17:21:45 -070019import android.os.Bundle;
Santos Cordon823fd3c2014-08-07 18:35:18 -070020import android.os.Parcel;
21import android.os.Parcelable;
22
23import java.util.ArrayList;
24import java.util.List;
25
Rekha Kumar07366812015-03-24 16:42:31 -070026import com.android.internal.telecom.IVideoProvider;
27
Santos Cordon823fd3c2014-08-07 18:35:18 -070028/**
29 * A parcelable representation of a conference connection.
30 * @hide
31 */
32public final class ParcelableConference implements Parcelable {
33
34 private PhoneAccountHandle mPhoneAccount;
35 private int mState;
Ihab Awad5c9c86e2014-11-12 13:41:16 -080036 private int mConnectionCapabilities;
Tyler Gunn720c6642016-03-22 09:02:47 -070037 private int mConnectionProperties;
Santos Cordon823fd3c2014-08-07 18:35:18 -070038 private List<String> mConnectionIds;
Andrew Leeedc625f2015-04-14 13:38:12 -070039 private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED;
Rekha Kumar07366812015-03-24 16:42:31 -070040 private final IVideoProvider mVideoProvider;
41 private final int mVideoState;
Andrew Leeedc625f2015-04-14 13:38:12 -070042 private StatusHints mStatusHints;
Santos Cordon6b7f9552015-05-27 17:21:45 -070043 private Bundle mExtras;
Tyler Gunnb2f875b2017-08-04 09:27:26 -070044 private long mConnectElapsedTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED;
Tyler Gunncd5d33c2015-01-12 09:02:01 -080045
46 public ParcelableConference(
47 PhoneAccountHandle phoneAccount,
48 int state,
49 int connectionCapabilities,
Tyler Gunn720c6642016-03-22 09:02:47 -070050 int connectionProperties,
Tyler Gunncd5d33c2015-01-12 09:02:01 -080051 List<String> connectionIds,
Rekha Kumar07366812015-03-24 16:42:31 -070052 IVideoProvider videoProvider,
53 int videoState,
Andrew Leeedc625f2015-04-14 13:38:12 -070054 long connectTimeMillis,
Tyler Gunnb2f875b2017-08-04 09:27:26 -070055 long connectElapsedTimeMillis,
Santos Cordon6b7f9552015-05-27 17:21:45 -070056 StatusHints statusHints,
57 Bundle extras) {
Andrew Leeedc625f2015-04-14 13:38:12 -070058 mPhoneAccount = phoneAccount;
59 mState = state;
60 mConnectionCapabilities = connectionCapabilities;
Tyler Gunn720c6642016-03-22 09:02:47 -070061 mConnectionProperties = connectionProperties;
Andrew Leeedc625f2015-04-14 13:38:12 -070062 mConnectionIds = connectionIds;
Andrew Lee0f51da32015-04-16 13:11:55 -070063 mVideoProvider = videoProvider;
64 mVideoState = videoState;
Tyler Gunncd5d33c2015-01-12 09:02:01 -080065 mConnectTimeMillis = connectTimeMillis;
Andrew Leeedc625f2015-04-14 13:38:12 -070066 mStatusHints = statusHints;
Santos Cordon6b7f9552015-05-27 17:21:45 -070067 mExtras = extras;
Tyler Gunnb2f875b2017-08-04 09:27:26 -070068 mConnectElapsedTimeMillis = connectElapsedTimeMillis;
Santos Cordon823fd3c2014-08-07 18:35:18 -070069 }
70
71 @Override
72 public String toString() {
73 return (new StringBuffer())
74 .append("account: ")
75 .append(mPhoneAccount)
76 .append(", state: ")
77 .append(Connection.stateToString(mState))
78 .append(", capabilities: ")
Ihab Awad5c9c86e2014-11-12 13:41:16 -080079 .append(Connection.capabilitiesToString(mConnectionCapabilities))
Tyler Gunn720c6642016-03-22 09:02:47 -070080 .append(", properties: ")
81 .append(Connection.propertiesToString(mConnectionProperties))
Tyler Gunncd5d33c2015-01-12 09:02:01 -080082 .append(", connectTime: ")
83 .append(mConnectTimeMillis)
Santos Cordon823fd3c2014-08-07 18:35:18 -070084 .append(", children: ")
85 .append(mConnectionIds)
Rekha Kumar07366812015-03-24 16:42:31 -070086 .append(", VideoState: ")
87 .append(mVideoState)
88 .append(", VideoProvider: ")
89 .append(mVideoProvider)
Santos Cordon823fd3c2014-08-07 18:35:18 -070090 .toString();
91 }
92
93 public PhoneAccountHandle getPhoneAccount() {
94 return mPhoneAccount;
95 }
96
97 public int getState() {
98 return mState;
99 }
100
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800101 public int getConnectionCapabilities() {
102 return mConnectionCapabilities;
Santos Cordon823fd3c2014-08-07 18:35:18 -0700103 }
104
Tyler Gunn720c6642016-03-22 09:02:47 -0700105 public int getConnectionProperties() {
106 return mConnectionProperties;
107 }
108
Santos Cordon823fd3c2014-08-07 18:35:18 -0700109 public List<String> getConnectionIds() {
110 return mConnectionIds;
111 }
112
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800113 public long getConnectTimeMillis() {
114 return mConnectTimeMillis;
115 }
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700116
117 public long getConnectElapsedTimeMillis() {
118 return mConnectElapsedTimeMillis;
119 }
120
Rekha Kumar07366812015-03-24 16:42:31 -0700121 public IVideoProvider getVideoProvider() {
122 return mVideoProvider;
123 }
124
125 public int getVideoState() {
126 return mVideoState;
127 }
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800128
Andrew Leeedc625f2015-04-14 13:38:12 -0700129 public StatusHints getStatusHints() {
130 return mStatusHints;
131 }
132
Santos Cordon6b7f9552015-05-27 17:21:45 -0700133 public Bundle getExtras() {
134 return mExtras;
135 }
136
Jeff Sharkey9e8f83d2019-02-28 12:06:45 -0700137 public static final @android.annotation.NonNull Parcelable.Creator<ParcelableConference> CREATOR =
Santos Cordon823fd3c2014-08-07 18:35:18 -0700138 new Parcelable.Creator<ParcelableConference> () {
139 @Override
140 public ParcelableConference createFromParcel(Parcel source) {
141 ClassLoader classLoader = ParcelableConference.class.getClassLoader();
142 PhoneAccountHandle phoneAccount = source.readParcelable(classLoader);
143 int state = source.readInt();
144 int capabilities = source.readInt();
145 List<String> connectionIds = new ArrayList<>(2);
146 source.readList(connectionIds, classLoader);
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800147 long connectTimeMillis = source.readLong();
Rekha Kumar07366812015-03-24 16:42:31 -0700148 IVideoProvider videoCallProvider =
149 IVideoProvider.Stub.asInterface(source.readStrongBinder());
150 int videoState = source.readInt();
Tyler Gunnd7017c42015-04-27 13:13:32 -0700151 StatusHints statusHints = source.readParcelable(classLoader);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700152 Bundle extras = source.readBundle(classLoader);
Tyler Gunn720c6642016-03-22 09:02:47 -0700153 int properties = source.readInt();
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700154 long connectElapsedTimeMillis = source.readLong();
Rekha Kumar07366812015-03-24 16:42:31 -0700155
Tyler Gunn720c6642016-03-22 09:02:47 -0700156 return new ParcelableConference(phoneAccount, state, capabilities, properties,
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700157 connectionIds, videoCallProvider, videoState, connectTimeMillis,
158 connectElapsedTimeMillis, statusHints, extras);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700159 }
160
161 @Override
162 public ParcelableConference[] newArray(int size) {
163 return new ParcelableConference[size];
164 }
165 };
166
167 /** {@inheritDoc} */
168 @Override
169 public int describeContents() {
170 return 0;
171 }
172
173 /** Writes ParcelableConference object into a Parcel. */
174 @Override
175 public void writeToParcel(Parcel destination, int flags) {
176 destination.writeParcelable(mPhoneAccount, 0);
177 destination.writeInt(mState);
Ihab Awad5c9c86e2014-11-12 13:41:16 -0800178 destination.writeInt(mConnectionCapabilities);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700179 destination.writeList(mConnectionIds);
Tyler Gunncd5d33c2015-01-12 09:02:01 -0800180 destination.writeLong(mConnectTimeMillis);
Rekha Kumar07366812015-03-24 16:42:31 -0700181 destination.writeStrongBinder(
182 mVideoProvider != null ? mVideoProvider.asBinder() : null);
183 destination.writeInt(mVideoState);
Andrew Leeedc625f2015-04-14 13:38:12 -0700184 destination.writeParcelable(mStatusHints, 0);
Santos Cordon6b7f9552015-05-27 17:21:45 -0700185 destination.writeBundle(mExtras);
Tyler Gunn720c6642016-03-22 09:02:47 -0700186 destination.writeInt(mConnectionProperties);
Tyler Gunnb2f875b2017-08-04 09:27:26 -0700187 destination.writeLong(mConnectElapsedTimeMillis);
Santos Cordon823fd3c2014-08-07 18:35:18 -0700188 }
189}