blob: 489c208a0d46630f9c98dc503226fcf926b06df2 [file] [log] [blame]
Wink Savillef8458ff2014-06-25 16:08:02 -07001/*
2 * Copyright (c) 2013 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
17package com.android.ims;
18
19import android.os.Bundle;
20import android.os.Parcel;
21import android.os.Parcelable;
Tyler Gunnc4fd93e2017-09-12 13:39:38 -070022import android.os.PersistableBundle;
Tyler Gunnef9f6f92014-09-12 22:16:17 -070023import android.telecom.VideoProfile;
Tyler Gunnc4fd93e2017-09-12 13:39:38 -070024import android.util.Log;
Wink Savillef8458ff2014-06-25 16:08:02 -070025
Jing Zhaoe647a012014-08-19 12:41:23 -050026import com.android.internal.telephony.PhoneConstants;
27
Wink Savillef8458ff2014-06-25 16:08:02 -070028/**
29 * Parcelable object to handle IMS call profile.
30 * It is created from GSMA IR.92/IR.94, 3GPP TS 24.229/TS 26.114/TS26.111.
31 * It provides the service and call type, the additional information related to the call.
32 *
33 * @hide
34 */
35public class ImsCallProfile implements Parcelable {
36 private static final String TAG = "ImsCallProfile";
37
38 /**
39 * Service types
40 */
41 /**
42 * It is for a special case. It helps that the application can make a call
43 * without IMS connection (not registered).
44 * In the moment of the call initiation, the device try to connect to the IMS network
45 * and initiates the call.
46 */
47 public static final int SERVICE_TYPE_NONE = 0;
48 /**
49 * It is a default type and can be selected when the device is connected to the IMS network.
50 */
51 public static final int SERVICE_TYPE_NORMAL = 1;
52 /**
53 * It is for an emergency call.
54 */
55 public static final int SERVICE_TYPE_EMERGENCY = 2;
56
57 /**
58 * Call types
59 */
60 /**
61 * IMSPhone to support IR.92 & IR.94 (voice + video upgrade/downgrade)
62 */
63 public static final int CALL_TYPE_VOICE_N_VIDEO = 1;
64 /**
65 * IR.92 (Voice only)
66 */
67 public static final int CALL_TYPE_VOICE = 2;
68 /**
69 * VT to support IR.92 & IR.94 (voice + video upgrade/downgrade)
70 */
71 public static final int CALL_TYPE_VIDEO_N_VOICE = 3;
72 /**
73 * Video Telephony (audio / video two way)
74 */
75 public static final int CALL_TYPE_VT = 4;
76 /**
77 * Video Telephony (audio two way / video TX one way)
78 */
79 public static final int CALL_TYPE_VT_TX = 5;
80 /**
81 * Video Telephony (audio two way / video RX one way)
82 */
83 public static final int CALL_TYPE_VT_RX = 6;
84 /**
85 * Video Telephony (audio two way / video inactive)
86 */
87 public static final int CALL_TYPE_VT_NODIR = 7;
88 /**
89 * VideoShare (video two way)
90 */
91 public static final int CALL_TYPE_VS = 8;
92 /**
93 * VideoShare (video TX one way)
94 */
95 public static final int CALL_TYPE_VS_TX = 9;
96 /**
97 * VideoShare (video RX one way)
98 */
99 public static final int CALL_TYPE_VS_RX = 10;
100
101 /**
102 * Extra properties for IMS call.
103 */
104 /**
105 * Boolean extra properties - "true" / "false"
106 * conference : Indicates if the session is for the conference call or not.
107 * e_call : Indicates if the session is for the emergency call or not.
108 * vms : Indicates if the session is connected to the voice mail system or not.
109 * call_mode_changeable : Indicates if the session is able to upgrade/downgrade
110 * the video during voice call.
111 * conference_avail : Indicates if the session can be extended to the conference.
112 */
113 public static final String EXTRA_CONFERENCE = "conference";
114 public static final String EXTRA_E_CALL = "e_call";
115 public static final String EXTRA_VMS = "vms";
116 public static final String EXTRA_CALL_MODE_CHANGEABLE = "call_mode_changeable";
117 public static final String EXTRA_CONFERENCE_AVAIL = "conference_avail";
118
Shriram Ganesh482e6da2014-10-13 11:31:50 -0700119 // Extra string for internal use only. OEMs should not use
120 // this for packing extras.
121 public static final String EXTRA_OEM_EXTRAS = "OemCallExtras";
122
Wink Savillef8458ff2014-06-25 16:08:02 -0700123 /**
124 * Integer extra properties
125 * oir : Rule for originating identity (number) presentation, MO/MT.
126 * {@link ImsCallProfile#OIR_DEFAULT}
127 * {@link ImsCallProfile#OIR_PRESENTATION_RESTRICTED}
128 * {@link ImsCallProfile#OIR_PRESENTATION_NOT_RESTRICTED}
129 * cnap : Rule for calling name presentation
130 * {@link ImsCallProfile#OIR_DEFAULT}
131 * {@link ImsCallProfile#OIR_PRESENTATION_RESTRICTED}
132 * {@link ImsCallProfile#OIR_PRESENTATION_NOT_RESTRICTED}
133 * dialstring : To identify the Ims call type, MO
134 * {@link ImsCallProfile#DIALSTRING_NORMAL_CALL}
135 * {@link ImsCallProfile#DIALSTRING_SS_CONF}
136 * {@link ImsCallProfile#DIALSTRING_USSD}
137 */
138 public static final String EXTRA_OIR = "oir";
139 public static final String EXTRA_CNAP = "cnap";
140 public static final String EXTRA_DIALSTRING = "dialstring";
141
142 /**
143 * Values for EXTRA_OIR / EXTRA_CNAP
144 */
145 public static final int OIR_DEFAULT = 0; // "user subscription default value"
146 public static final int OIR_PRESENTATION_RESTRICTED = 1;
147 public static final int OIR_PRESENTATION_NOT_RESTRICTED = 2;
Shriram Ganeshef0cde82015-03-05 16:43:03 +0530148 public static final int OIR_PRESENTATION_UNKNOWN = 3;
149 public static final int OIR_PRESENTATION_PAYPHONE = 4;
Wink Savillef8458ff2014-06-25 16:08:02 -0700150
151 /**
152 * Values for EXTRA_DIALSTRING
153 */
154 // default (normal call)
155 public static final int DIALSTRING_NORMAL = 0;
156 // Call for SIP-based user configuration
157 public static final int DIALSTRING_SS_CONF = 1;
158 // Call for USSD message
159 public static final int DIALSTRING_USSD = 2;
160
161 /**
Shriram Ganesh482e6da2014-10-13 11:31:50 -0700162 * Values for causes that restrict call types
163 */
164 // Default cause not restricted at peer and HD is supported
165 public static final int CALL_RESTRICT_CAUSE_NONE = 0;
166 // Service not supported by RAT at peer
167 public static final int CALL_RESTRICT_CAUSE_RAT = 1;
168 // Service Disabled at peer
169 public static final int CALL_RESTRICT_CAUSE_DISABLED = 2;
170 // HD is not supported
171 public static final int CALL_RESTRICT_CAUSE_HD = 3;
172
173 /**
Wink Savillef8458ff2014-06-25 16:08:02 -0700174 * String extra properties
175 * oi : Originating identity (number), MT only
176 * cna : Calling name
177 * ussd : For network-initiated USSD, MT only
178 * remote_uri : Connected user identity (it can be used for the conference)
Shriram Ganeshddf570e2015-05-31 09:18:48 -0700179 * ChildNum: Child number info.
180 * Codec: Codec info.
181 * DisplayText: Display text for the call.
182 * AdditionalCallInfo: Additional call info.
Omkar Kolangade99eb21d2016-02-26 09:45:04 -0800183 * CallPull: Boolean value specifying if the call is a pulled call.
Wink Savillef8458ff2014-06-25 16:08:02 -0700184 */
185 public static final String EXTRA_OI = "oi";
186 public static final String EXTRA_CNA = "cna";
187 public static final String EXTRA_USSD = "ussd";
188 public static final String EXTRA_REMOTE_URI = "remote_uri";
Shriram Ganeshddf570e2015-05-31 09:18:48 -0700189 public static final String EXTRA_CHILD_NUMBER = "ChildNum";
190 public static final String EXTRA_CODEC = "Codec";
191 public static final String EXTRA_DISPLAY_TEXT = "DisplayText";
192 public static final String EXTRA_ADDITIONAL_CALL_INFO = "AdditionalCallInfo";
Omkar Kolangade99eb21d2016-02-26 09:45:04 -0800193 public static final String EXTRA_IS_CALL_PULL = "CallPull";
Tyler Gunn3ffb08a2015-11-02 11:24:57 -0800194
195 /**
196 * Extra key which the RIL can use to indicate the radio technology used for a call.
197 * Valid values are:
198 * {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_LTE},
199 * {@link android.telephony.ServiceState#RIL_RADIO_TECHNOLOGY_IWLAN}, and the other defined
200 * {@code RIL_RADIO_TECHNOLOGY_*} constants.
201 * Note: Despite the fact the {@link android.telephony.ServiceState} values are integer
202 * constants, the values passed for the {@link #EXTRA_CALL_RAT_TYPE} should be strings (e.g.
203 * "14" vs (int) 14).
204 * Note: This is used by {@link com.android.internal.telephony.imsphone.ImsPhoneConnection#
205 * updateWifiStateFromExtras(Bundle)} to determine whether to set the
Tyler Gunn720c6642016-03-22 09:02:47 -0700206 * {@link android.telecom.Connection#PROPERTY_WIFI} property on a connection.
Tyler Gunn3ffb08a2015-11-02 11:24:57 -0800207 */
Omkar Kolangade3b0437e2015-10-29 15:06:27 -0700208 public static final String EXTRA_CALL_RAT_TYPE = "CallRadioTech";
Wink Savillef8458ff2014-06-25 16:08:02 -0700209
Tyler Gunn853d8f62016-07-13 17:25:37 -0700210 /**
211 * Similar to {@link #EXTRA_CALL_RAT_TYPE}, except with a lowercase 'c'. Used to ensure
212 * compatibility with modems that are non-compliant with the {@link #EXTRA_CALL_RAT_TYPE}
213 * extra key. Should be removed when the non-compliant modems are fixed.
214 * @hide
215 */
216 public static final String EXTRA_CALL_RAT_TYPE_ALT = "callRadioTech";
217
Wink Savillef8458ff2014-06-25 16:08:02 -0700218 public int mServiceType;
219 public int mCallType;
Shriram Ganesh482e6da2014-10-13 11:31:50 -0700220 public int mRestrictCause = CALL_RESTRICT_CAUSE_NONE;
Tyler Gunnc4fd93e2017-09-12 13:39:38 -0700221
222 /**
223 * Extras associated with this {@link ImsCallProfile}.
224 * <p>
225 * Valid data types include:
226 * <ul>
227 * <li>{@link Integer} (and int)</li>
228 * <li>{@link Long} (and long)</li>
229 * <li>{@link Double} (and double)</li>
230 * <li>{@link String}</li>
231 * <li>{@code int[]}</li>
232 * <li>{@code long[]}</li>
233 * <li>{@code double[]}</li>
234 * <li>{@code String[]}</li>
235 * <li>{@link PersistableBundle}</li>
236 * <li>{@link Boolean} (and boolean)</li>
237 * <li>{@code boolean[]}</li>
238 * <li>Other {@link Parcelable} classes in the {@code android.*} namespace.</li>
239 * </ul>
240 * <p>
241 * Invalid types will be removed when the {@link ImsCallProfile} is parceled for transmit across
242 * a {@link android.os.Binder}.
243 */
Wink Savillef8458ff2014-06-25 16:08:02 -0700244 public Bundle mCallExtras;
245 public ImsStreamMediaProfile mMediaProfile;
246
Wink Savillef8458ff2014-06-25 16:08:02 -0700247 public ImsCallProfile(Parcel in) {
248 readFromParcel(in);
249 }
250
251 public ImsCallProfile() {
252 mServiceType = SERVICE_TYPE_NORMAL;
253 mCallType = CALL_TYPE_VOICE_N_VIDEO;
254 mCallExtras = new Bundle();
255 mMediaProfile = new ImsStreamMediaProfile();
256 }
257
258 public ImsCallProfile(int serviceType, int callType) {
259 mServiceType = serviceType;
260 mCallType = callType;
261 mCallExtras = new Bundle();
262 mMediaProfile = new ImsStreamMediaProfile();
263 }
264
265 public String getCallExtra(String name) {
266 return getCallExtra(name, "");
267 }
268
269 public String getCallExtra(String name, String defaultValue) {
270 if (mCallExtras == null) {
271 return defaultValue;
272 }
273
274 return mCallExtras.getString(name, defaultValue);
275 }
276
277 public boolean getCallExtraBoolean(String name) {
278 return getCallExtraBoolean(name, false);
279 }
280
281 public boolean getCallExtraBoolean(String name, boolean defaultValue) {
282 if (mCallExtras == null) {
283 return defaultValue;
284 }
285
286 return mCallExtras.getBoolean(name, defaultValue);
287 }
288
289 public int getCallExtraInt(String name) {
290 return getCallExtraInt(name, -1);
291 }
292
293 public int getCallExtraInt(String name, int defaultValue) {
294 if (mCallExtras == null) {
295 return defaultValue;
296 }
297
298 return mCallExtras.getInt(name, defaultValue);
299 }
300
301 public void setCallExtra(String name, String value) {
302 if (mCallExtras != null) {
303 mCallExtras.putString(name, value);
304 }
305 }
306
307 public void setCallExtraBoolean(String name, boolean value) {
308 if (mCallExtras != null) {
309 mCallExtras.putBoolean(name, value);
310 }
311 }
312
313 public void setCallExtraInt(String name, int value) {
314 if (mCallExtras != null) {
315 mCallExtras.putInt(name, value);
316 }
317 }
318
319 public void updateCallType(ImsCallProfile profile) {
320 mCallType = profile.mCallType;
321 }
322
323 public void updateCallExtras(ImsCallProfile profile) {
324 mCallExtras.clear();
325 mCallExtras = (Bundle) profile.mCallExtras.clone();
326 }
327
328 @Override
329 public String toString() {
330 return "{ serviceType=" + mServiceType +
331 ", callType=" + mCallType +
Etan Cohendb45a012014-12-10 10:08:20 -0800332 ", restrictCause=" + mRestrictCause +
Wink Savillef8458ff2014-06-25 16:08:02 -0700333 ", mediaProfile=" + mMediaProfile.toString() + " }";
334 }
335
336 @Override
337 public int describeContents() {
338 return 0;
339 }
340
341 @Override
342 public void writeToParcel(Parcel out, int flags) {
Tyler Gunnc4fd93e2017-09-12 13:39:38 -0700343 Bundle filteredExtras = maybeCleanseExtras(mCallExtras);
Wink Savillef8458ff2014-06-25 16:08:02 -0700344 out.writeInt(mServiceType);
345 out.writeInt(mCallType);
Tyler Gunnc4fd93e2017-09-12 13:39:38 -0700346 out.writeBundle(filteredExtras);
Wink Savillef8458ff2014-06-25 16:08:02 -0700347 out.writeParcelable(mMediaProfile, 0);
348 }
349
350 private void readFromParcel(Parcel in) {
351 mServiceType = in.readInt();
352 mCallType = in.readInt();
Tyler Gunnc4fd93e2017-09-12 13:39:38 -0700353 mCallExtras = in.readBundle();
Wink Savillef8458ff2014-06-25 16:08:02 -0700354 mMediaProfile = in.readParcelable(null);
355 }
356
357 public static final Creator<ImsCallProfile> CREATOR = new Creator<ImsCallProfile>() {
358 @Override
359 public ImsCallProfile createFromParcel(Parcel in) {
360 return new ImsCallProfile(in);
361 }
362
363 @Override
364 public ImsCallProfile[] newArray(int size) {
365 return new ImsCallProfile[size];
366 }
367 };
Tyler Gunnaa07df82014-07-17 07:50:22 -0700368
369 /**
370 * Converts from the call types defined in {@link com.android.ims.ImsCallProfile} to the
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700371 * video state values defined in {@link VideoProfile}.
Tyler Gunnaa07df82014-07-17 07:50:22 -0700372 *
Tyler Gunn9eb78512016-04-12 16:13:44 -0700373 * @param callProfile The call profile.
Tyler Gunnaa07df82014-07-17 07:50:22 -0700374 * @return The video state.
375 */
Rekha Kumar07366812015-03-24 16:42:31 -0700376 public static int getVideoStateFromImsCallProfile(ImsCallProfile callProfile) {
Tyler Gunn9eb78512016-04-12 16:13:44 -0700377 int videostate = getVideoStateFromCallType(callProfile.mCallType);
378 if (callProfile.isVideoPaused() && !VideoProfile.isAudioOnly(videostate)) {
379 videostate |= VideoProfile.STATE_PAUSED;
380 } else {
381 videostate &= ~VideoProfile.STATE_PAUSED;
382 }
383 return videostate;
384 }
385
386 /**
387 * Translates a {@link ImsCallProfile} {@code CALL_TYPE_*} constant into a video state.
388 * @param callType The call type.
389 * @return The video state.
390 */
391 public static int getVideoStateFromCallType(int callType) {
Tyler Gunn87b73f32015-06-03 10:09:59 -0700392 int videostate = VideoProfile.STATE_AUDIO_ONLY;
Tyler Gunn9eb78512016-04-12 16:13:44 -0700393 switch (callType) {
Tyler Gunnaa07df82014-07-17 07:50:22 -0700394 case CALL_TYPE_VT_TX:
Tyler Gunn87b73f32015-06-03 10:09:59 -0700395 videostate = VideoProfile.STATE_TX_ENABLED;
Rekha Kumar07366812015-03-24 16:42:31 -0700396 break;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700397 case CALL_TYPE_VT_RX:
Tyler Gunn87b73f32015-06-03 10:09:59 -0700398 videostate = VideoProfile.STATE_RX_ENABLED;
Rekha Kumar07366812015-03-24 16:42:31 -0700399 break;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700400 case CALL_TYPE_VT:
Tyler Gunn87b73f32015-06-03 10:09:59 -0700401 videostate = VideoProfile.STATE_BIDIRECTIONAL;
Rekha Kumar07366812015-03-24 16:42:31 -0700402 break;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700403 case CALL_TYPE_VOICE:
Tyler Gunn87b73f32015-06-03 10:09:59 -0700404 videostate = VideoProfile.STATE_AUDIO_ONLY;
Rekha Kumar07366812015-03-24 16:42:31 -0700405 break;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700406 default:
Tyler Gunn87b73f32015-06-03 10:09:59 -0700407 videostate = VideoProfile.STATE_AUDIO_ONLY;
Rekha Kumar07366812015-03-24 16:42:31 -0700408 break;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700409 }
Rekha Kumar07366812015-03-24 16:42:31 -0700410 return videostate;
Tyler Gunnaa07df82014-07-17 07:50:22 -0700411 }
412
413 /**
Ihab Awadb19a0bc2014-08-07 19:46:01 -0700414 * Converts from the video state values defined in {@link VideoProfile}
Tyler Gunnaa07df82014-07-17 07:50:22 -0700415 * to the call types defined in {@link ImsCallProfile}.
416 *
417 * @param videoState The video state.
418 * @return The call type.
419 */
420 public static int getCallTypeFromVideoState(int videoState) {
Tyler Gunn87b73f32015-06-03 10:09:59 -0700421 boolean videoTx = isVideoStateSet(videoState, VideoProfile.STATE_TX_ENABLED);
422 boolean videoRx = isVideoStateSet(videoState, VideoProfile.STATE_RX_ENABLED);
423 boolean isPaused = isVideoStateSet(videoState, VideoProfile.STATE_PAUSED);
Tyler Gunnaa07df82014-07-17 07:50:22 -0700424 if (isPaused) {
425 return ImsCallProfile.CALL_TYPE_VT_NODIR;
426 } else if (videoTx && !videoRx) {
427 return ImsCallProfile.CALL_TYPE_VT_TX;
428 } else if (!videoTx && videoRx) {
429 return ImsCallProfile.CALL_TYPE_VT_RX;
430 } else if (videoTx && videoRx) {
431 return ImsCallProfile.CALL_TYPE_VT;
432 }
433 return ImsCallProfile.CALL_TYPE_VOICE;
434 }
435
436 /**
Jing Zhaoe647a012014-08-19 12:41:23 -0500437 * Translate presentation value to OIR value
438 * @param presentation
439 * @return OIR valuse
440 */
441 public static int presentationToOIR(int presentation) {
442 switch (presentation) {
443 case PhoneConstants.PRESENTATION_RESTRICTED:
444 return ImsCallProfile.OIR_PRESENTATION_RESTRICTED;
445 case PhoneConstants.PRESENTATION_ALLOWED:
446 return ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED;
Shriram Ganeshef0cde82015-03-05 16:43:03 +0530447 case PhoneConstants.PRESENTATION_PAYPHONE:
448 return ImsCallProfile.OIR_PRESENTATION_PAYPHONE;
449 case PhoneConstants.PRESENTATION_UNKNOWN:
450 return ImsCallProfile.OIR_PRESENTATION_UNKNOWN;
Jing Zhaoe647a012014-08-19 12:41:23 -0500451 default:
452 return ImsCallProfile.OIR_DEFAULT;
453 }
454 }
455
456 /**
457 * Translate OIR value to presentation value
458 * @param oir value
459 * @return presentation value
460 */
461 public static int OIRToPresentation(int oir) {
462 switch(oir) {
463 case ImsCallProfile.OIR_PRESENTATION_RESTRICTED:
464 return PhoneConstants.PRESENTATION_RESTRICTED;
465 case ImsCallProfile.OIR_PRESENTATION_NOT_RESTRICTED:
466 return PhoneConstants.PRESENTATION_ALLOWED;
Shriram Ganeshef0cde82015-03-05 16:43:03 +0530467 case ImsCallProfile.OIR_PRESENTATION_PAYPHONE:
468 return PhoneConstants.PRESENTATION_PAYPHONE;
469 case ImsCallProfile.OIR_PRESENTATION_UNKNOWN:
470 return PhoneConstants.PRESENTATION_UNKNOWN;
Jing Zhaoe647a012014-08-19 12:41:23 -0500471 default:
472 return PhoneConstants.PRESENTATION_UNKNOWN;
473 }
474 }
475
476 /**
Rekha Kumar07366812015-03-24 16:42:31 -0700477 * Checks if video call is paused
478 * @return true if call is video paused
479 */
480 public boolean isVideoPaused() {
481 return mMediaProfile.mVideoDirection == ImsStreamMediaProfile.DIRECTION_INACTIVE;
482 }
483
484 /**
Tyler Gunn4b6614e2016-06-22 10:35:13 -0700485 * Determines if the {@link ImsCallProfile} represents a video call.
486 *
487 * @return {@code true} if the profile is for a video call, {@code false} otherwise.
488 */
489 public boolean isVideoCall() {
490 return VideoProfile.isVideo(getVideoStateFromCallType(mCallType));
491 }
492
493 /**
Tyler Gunnc4fd93e2017-09-12 13:39:38 -0700494 * Cleanses a {@link Bundle} to ensure that it contains only data of type:
495 * 1. Primitive data types (e.g. int, bool, and other values determined by
496 * {@link android.os.PersistableBundle#isValidType(Object)}).
497 * 2. Other Bundles.
498 * 3. {@link Parcelable} objects in the {@code android.*} namespace.
499 * @param extras the source {@link Bundle}
500 * @return where all elements are valid types the source {@link Bundle} is returned unmodified,
501 * otherwise a copy of the {@link Bundle} with the invalid elements is returned.
502 */
503 private Bundle maybeCleanseExtras(Bundle extras) {
504 if (extras == null) {
505 return null;
506 }
507
508 int startSize = extras.size();
509 Bundle filtered = extras.filterValues();
510 int endSize = filtered.size();
511 if (startSize != endSize) {
512 Log.i(TAG, "maybeCleanseExtras: " + (startSize - endSize) + " extra values were "
513 + "removed - only primitive types and system parcelables are permitted.");
514 }
515 return filtered;
516 }
517
518 /**
Tyler Gunnaa07df82014-07-17 07:50:22 -0700519 * Determines if a video state is set in a video state bit-mask.
520 *
521 * @param videoState The video state bit mask.
522 * @param videoStateToCheck The particular video state to check.
523 * @return True if the video state is set in the bit-mask.
524 */
525 private static boolean isVideoStateSet(int videoState, int videoStateToCheck) {
526 return (videoState & videoStateToCheck) == videoStateToCheck;
527 }
Wink Savillef8458ff2014-06-25 16:08:02 -0700528}