Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 1 | /* |
| 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 Gunn | ef9f6f9 | 2014-09-12 22:16:17 -0700 | [diff] [blame] | 17 | package android.telecom; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 18 | |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 19 | import android.net.Uri; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 20 | import android.os.Bundle; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 21 | import android.os.Parcel; |
| 22 | import android.os.Parcelable; |
| 23 | |
| 24 | import java.util.ArrayList; |
| 25 | import java.util.List; |
| 26 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 27 | import com.android.internal.telecom.IVideoProvider; |
| 28 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 29 | /** |
| 30 | * A parcelable representation of a conference connection. |
| 31 | * @hide |
| 32 | */ |
| 33 | public final class ParcelableConference implements Parcelable { |
| 34 | |
| 35 | private PhoneAccountHandle mPhoneAccount; |
| 36 | private int mState; |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 37 | private int mConnectionCapabilities; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 38 | private int mConnectionProperties; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 39 | private List<String> mConnectionIds; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 40 | private long mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 41 | private final IVideoProvider mVideoProvider; |
| 42 | private final int mVideoState; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 43 | private StatusHints mStatusHints; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 44 | private Bundle mExtras; |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 45 | private long mConnectElapsedTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 46 | private final Uri mAddress; |
| 47 | private final int mAddressPresentation; |
| 48 | private final String mCallerDisplayName; |
| 49 | private final int mCallerDisplayNamePresentation; |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 50 | |
| 51 | public ParcelableConference( |
| 52 | PhoneAccountHandle phoneAccount, |
| 53 | int state, |
| 54 | int connectionCapabilities, |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 55 | int connectionProperties, |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 56 | List<String> connectionIds, |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 57 | IVideoProvider videoProvider, |
| 58 | int videoState, |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 59 | long connectTimeMillis, |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 60 | long connectElapsedTimeMillis, |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 61 | StatusHints statusHints, |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 62 | Bundle extras, |
| 63 | Uri address, |
| 64 | int addressPresentation, |
| 65 | String callerDisplayName, |
| 66 | int callerDisplayNamePresentation) { |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 67 | mPhoneAccount = phoneAccount; |
| 68 | mState = state; |
| 69 | mConnectionCapabilities = connectionCapabilities; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 70 | mConnectionProperties = connectionProperties; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 71 | mConnectionIds = connectionIds; |
Andrew Lee | 0f51da3 | 2015-04-16 13:11:55 -0700 | [diff] [blame] | 72 | mVideoProvider = videoProvider; |
| 73 | mVideoState = videoState; |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 74 | mConnectTimeMillis = connectTimeMillis; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 75 | mStatusHints = statusHints; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 76 | mExtras = extras; |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 77 | mConnectElapsedTimeMillis = connectElapsedTimeMillis; |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 78 | mAddress = address; |
| 79 | mAddressPresentation = addressPresentation; |
| 80 | mCallerDisplayName = callerDisplayName; |
| 81 | mCallerDisplayNamePresentation = callerDisplayNamePresentation; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 82 | } |
| 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 Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 92 | .append(Connection.capabilitiesToString(mConnectionCapabilities)) |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 93 | .append(", properties: ") |
| 94 | .append(Connection.propertiesToString(mConnectionProperties)) |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 95 | .append(", connectTime: ") |
| 96 | .append(mConnectTimeMillis) |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 97 | .append(", children: ") |
| 98 | .append(mConnectionIds) |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 99 | .append(", VideoState: ") |
| 100 | .append(mVideoState) |
| 101 | .append(", VideoProvider: ") |
| 102 | .append(mVideoProvider) |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 103 | .toString(); |
| 104 | } |
| 105 | |
| 106 | public PhoneAccountHandle getPhoneAccount() { |
| 107 | return mPhoneAccount; |
| 108 | } |
| 109 | |
| 110 | public int getState() { |
| 111 | return mState; |
| 112 | } |
| 113 | |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 114 | public int getConnectionCapabilities() { |
| 115 | return mConnectionCapabilities; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 118 | public int getConnectionProperties() { |
| 119 | return mConnectionProperties; |
| 120 | } |
| 121 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 122 | public List<String> getConnectionIds() { |
| 123 | return mConnectionIds; |
| 124 | } |
| 125 | |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 126 | public long getConnectTimeMillis() { |
| 127 | return mConnectTimeMillis; |
| 128 | } |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 129 | |
| 130 | public long getConnectElapsedTimeMillis() { |
| 131 | return mConnectElapsedTimeMillis; |
| 132 | } |
| 133 | |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 134 | public IVideoProvider getVideoProvider() { |
| 135 | return mVideoProvider; |
| 136 | } |
| 137 | |
| 138 | public int getVideoState() { |
| 139 | return mVideoState; |
| 140 | } |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 141 | |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 142 | public StatusHints getStatusHints() { |
| 143 | return mStatusHints; |
| 144 | } |
| 145 | |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 146 | public Bundle getExtras() { |
| 147 | return mExtras; |
| 148 | } |
| 149 | |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 150 | public Uri getHandle() { |
| 151 | return mAddress; |
| 152 | } |
| 153 | |
| 154 | public int getHandlePresentation() { |
| 155 | return mAddressPresentation; |
| 156 | } |
| 157 | |
Jeff Sharkey | 9e8f83d | 2019-02-28 12:06:45 -0700 | [diff] [blame] | 158 | public static final @android.annotation.NonNull Parcelable.Creator<ParcelableConference> CREATOR = |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 159 | 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 Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 168 | long connectTimeMillis = source.readLong(); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 169 | IVideoProvider videoCallProvider = |
| 170 | IVideoProvider.Stub.asInterface(source.readStrongBinder()); |
| 171 | int videoState = source.readInt(); |
Tyler Gunn | d7017c4 | 2015-04-27 13:13:32 -0700 | [diff] [blame] | 172 | StatusHints statusHints = source.readParcelable(classLoader); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 173 | Bundle extras = source.readBundle(classLoader); |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 174 | int properties = source.readInt(); |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 175 | long connectElapsedTimeMillis = source.readLong(); |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 176 | Uri address = source.readParcelable(classLoader); |
| 177 | int addressPresentation = source.readInt(); |
| 178 | String callerDisplayName = source.readString(); |
| 179 | int callerDisplayNamePresentation = source.readInt(); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 180 | |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 181 | return new ParcelableConference(phoneAccount, state, capabilities, properties, |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 182 | connectionIds, videoCallProvider, videoState, connectTimeMillis, |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 183 | connectElapsedTimeMillis, statusHints, extras, address, addressPresentation, |
| 184 | callerDisplayName, callerDisplayNamePresentation); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 185 | } |
| 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 Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 204 | destination.writeInt(mConnectionCapabilities); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 205 | destination.writeList(mConnectionIds); |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 206 | destination.writeLong(mConnectTimeMillis); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 207 | destination.writeStrongBinder( |
| 208 | mVideoProvider != null ? mVideoProvider.asBinder() : null); |
| 209 | destination.writeInt(mVideoState); |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 210 | destination.writeParcelable(mStatusHints, 0); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 211 | destination.writeBundle(mExtras); |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 212 | destination.writeInt(mConnectionProperties); |
Tyler Gunn | b2f875b | 2017-08-04 09:27:26 -0700 | [diff] [blame] | 213 | destination.writeLong(mConnectElapsedTimeMillis); |
Tyler Gunn | ac60f95 | 2019-05-31 07:23:16 -0700 | [diff] [blame^] | 214 | destination.writeParcelable(mAddress, 0); |
| 215 | destination.writeInt(mAddressPresentation); |
| 216 | destination.writeString(mCallerDisplayName); |
| 217 | destination.writeInt(mCallerDisplayNamePresentation); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 218 | } |
| 219 | } |