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 | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 44 | |
| 45 | public ParcelableConference( |
| 46 | PhoneAccountHandle phoneAccount, |
| 47 | int state, |
| 48 | int connectionCapabilities, |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 49 | int connectionProperties, |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 50 | List<String> connectionIds, |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 51 | IVideoProvider videoProvider, |
| 52 | int videoState, |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 53 | long connectTimeMillis, |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 54 | StatusHints statusHints, |
| 55 | Bundle extras) { |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 56 | mPhoneAccount = phoneAccount; |
| 57 | mState = state; |
| 58 | mConnectionCapabilities = connectionCapabilities; |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 59 | mConnectionProperties = connectionProperties; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 60 | mConnectionIds = connectionIds; |
Andrew Lee | 0f51da3 | 2015-04-16 13:11:55 -0700 | [diff] [blame] | 61 | mConnectTimeMillis = Conference.CONNECT_TIME_NOT_SPECIFIED; |
| 62 | mVideoProvider = videoProvider; |
| 63 | mVideoState = videoState; |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 64 | mConnectTimeMillis = connectTimeMillis; |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 65 | mStatusHints = statusHints; |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 66 | mExtras = extras; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 67 | } |
| 68 | |
| 69 | @Override |
| 70 | public String toString() { |
| 71 | return (new StringBuffer()) |
| 72 | .append("account: ") |
| 73 | .append(mPhoneAccount) |
| 74 | .append(", state: ") |
| 75 | .append(Connection.stateToString(mState)) |
| 76 | .append(", capabilities: ") |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 77 | .append(Connection.capabilitiesToString(mConnectionCapabilities)) |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 78 | .append(", properties: ") |
| 79 | .append(Connection.propertiesToString(mConnectionProperties)) |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 80 | .append(", connectTime: ") |
| 81 | .append(mConnectTimeMillis) |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 82 | .append(", children: ") |
| 83 | .append(mConnectionIds) |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 84 | .append(", VideoState: ") |
| 85 | .append(mVideoState) |
| 86 | .append(", VideoProvider: ") |
| 87 | .append(mVideoProvider) |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 88 | .toString(); |
| 89 | } |
| 90 | |
| 91 | public PhoneAccountHandle getPhoneAccount() { |
| 92 | return mPhoneAccount; |
| 93 | } |
| 94 | |
| 95 | public int getState() { |
| 96 | return mState; |
| 97 | } |
| 98 | |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 99 | public int getConnectionCapabilities() { |
| 100 | return mConnectionCapabilities; |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 101 | } |
| 102 | |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 103 | public int getConnectionProperties() { |
| 104 | return mConnectionProperties; |
| 105 | } |
| 106 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 107 | public List<String> getConnectionIds() { |
| 108 | return mConnectionIds; |
| 109 | } |
| 110 | |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 111 | public long getConnectTimeMillis() { |
| 112 | return mConnectTimeMillis; |
| 113 | } |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 114 | public IVideoProvider getVideoProvider() { |
| 115 | return mVideoProvider; |
| 116 | } |
| 117 | |
| 118 | public int getVideoState() { |
| 119 | return mVideoState; |
| 120 | } |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 121 | |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 122 | public StatusHints getStatusHints() { |
| 123 | return mStatusHints; |
| 124 | } |
| 125 | |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 126 | public Bundle getExtras() { |
| 127 | return mExtras; |
| 128 | } |
| 129 | |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 130 | public static final Parcelable.Creator<ParcelableConference> CREATOR = |
| 131 | new Parcelable.Creator<ParcelableConference> () { |
| 132 | @Override |
| 133 | public ParcelableConference createFromParcel(Parcel source) { |
| 134 | ClassLoader classLoader = ParcelableConference.class.getClassLoader(); |
| 135 | PhoneAccountHandle phoneAccount = source.readParcelable(classLoader); |
| 136 | int state = source.readInt(); |
| 137 | int capabilities = source.readInt(); |
| 138 | List<String> connectionIds = new ArrayList<>(2); |
| 139 | source.readList(connectionIds, classLoader); |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 140 | long connectTimeMillis = source.readLong(); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 141 | IVideoProvider videoCallProvider = |
| 142 | IVideoProvider.Stub.asInterface(source.readStrongBinder()); |
| 143 | int videoState = source.readInt(); |
Tyler Gunn | d7017c4 | 2015-04-27 13:13:32 -0700 | [diff] [blame] | 144 | StatusHints statusHints = source.readParcelable(classLoader); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 145 | Bundle extras = source.readBundle(classLoader); |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 146 | int properties = source.readInt(); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 147 | |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 148 | return new ParcelableConference(phoneAccount, state, capabilities, properties, |
| 149 | connectionIds, videoCallProvider, videoState, connectTimeMillis, statusHints, |
| 150 | extras); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public ParcelableConference[] newArray(int size) { |
| 155 | return new ParcelableConference[size]; |
| 156 | } |
| 157 | }; |
| 158 | |
| 159 | /** {@inheritDoc} */ |
| 160 | @Override |
| 161 | public int describeContents() { |
| 162 | return 0; |
| 163 | } |
| 164 | |
| 165 | /** Writes ParcelableConference object into a Parcel. */ |
| 166 | @Override |
| 167 | public void writeToParcel(Parcel destination, int flags) { |
| 168 | destination.writeParcelable(mPhoneAccount, 0); |
| 169 | destination.writeInt(mState); |
Ihab Awad | 5c9c86e | 2014-11-12 13:41:16 -0800 | [diff] [blame] | 170 | destination.writeInt(mConnectionCapabilities); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 171 | destination.writeList(mConnectionIds); |
Tyler Gunn | cd5d33c | 2015-01-12 09:02:01 -0800 | [diff] [blame] | 172 | destination.writeLong(mConnectTimeMillis); |
Rekha Kumar | 0736681 | 2015-03-24 16:42:31 -0700 | [diff] [blame] | 173 | destination.writeStrongBinder( |
| 174 | mVideoProvider != null ? mVideoProvider.asBinder() : null); |
| 175 | destination.writeInt(mVideoState); |
Andrew Lee | edc625f | 2015-04-14 13:38:12 -0700 | [diff] [blame] | 176 | destination.writeParcelable(mStatusHints, 0); |
Santos Cordon | 6b7f955 | 2015-05-27 17:21:45 -0700 | [diff] [blame] | 177 | destination.writeBundle(mExtras); |
Tyler Gunn | 720c664 | 2016-03-22 09:02:47 -0700 | [diff] [blame] | 178 | destination.writeInt(mConnectionProperties); |
Santos Cordon | 823fd3c | 2014-08-07 18:35:18 -0700 | [diff] [blame] | 179 | } |
| 180 | } |