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