NotificationListenerService.java revision ce7d6d292b2309eff95d4206b09858f13fff5213
1/* 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 android.service.notification; 18 19import android.annotation.SystemApi; 20import android.annotation.SdkConstant; 21import android.app.INotificationManager; 22import android.app.Notification; 23import android.app.Notification.Builder; 24import android.app.Service; 25import android.content.ComponentName; 26import android.content.Context; 27import android.content.Intent; 28import android.content.pm.ParceledListSlice; 29import android.os.IBinder; 30import android.os.Parcel; 31import android.os.Parcelable; 32import android.os.RemoteException; 33import android.os.ServiceManager; 34import android.util.ArrayMap; 35import android.util.ArraySet; 36import android.util.Log; 37 38import java.util.Collections; 39import java.util.List; 40 41/** 42 * A service that receives calls from the system when new notifications are 43 * posted or removed, or their ranking changed. 44 * <p>To extend this class, you must declare the service in your manifest file with 45 * the {@link android.Manifest.permission#BIND_NOTIFICATION_LISTENER_SERVICE} permission 46 * and include an intent filter with the {@link #SERVICE_INTERFACE} action. For example:</p> 47 * <pre> 48 * <service android:name=".NotificationListener" 49 * android:label="@string/service_name" 50 * android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"> 51 * <intent-filter> 52 * <action android:name="android.service.notification.NotificationListenerService" /> 53 * </intent-filter> 54 * </service></pre> 55 */ 56public abstract class NotificationListenerService extends Service { 57 // TAG = "NotificationListenerService[MySubclass]" 58 private final String TAG = NotificationListenerService.class.getSimpleName() 59 + "[" + getClass().getSimpleName() + "]"; 60 61 /** {@link #getCurrentListenerHints() Listener hints} constant - default state. */ 62 public static final int HINTS_NONE = 0; 63 64 /** Bitmask range for {@link #getCurrentListenerHints() Listener hints} host interruption level 65 * constants. */ 66 public static final int HOST_INTERRUPTION_LEVEL_MASK = 0x3; 67 68 /** {@link #getCurrentListenerHints() Listener hints} constant - Normal interruption level. */ 69 public static final int HINT_HOST_INTERRUPTION_LEVEL_ALL = 1; 70 71 /** {@link #getCurrentListenerHints() Listener hints} constant - Priority interruption level. */ 72 public static final int HINT_HOST_INTERRUPTION_LEVEL_PRIORITY = 2; 73 74 /** {@link #getCurrentListenerHints() Listener hints} constant - No interruptions level. */ 75 public static final int HINT_HOST_INTERRUPTION_LEVEL_NONE = 3; 76 77 /** {@link #getCurrentListenerHints() Listener hints} constant - the primary device UI 78 * should disable notification sound, vibrating and other visual or aural effects. 79 * This does not change the interruption level, only the effects. **/ 80 public static final int HINT_HOST_DISABLE_EFFECTS = 1 << 2; 81 82 private INotificationListenerWrapper mWrapper = null; 83 private RankingMap mRankingMap; 84 85 private INotificationManager mNoMan; 86 87 /** Only valid after a successful call to (@link registerAsService}. */ 88 private int mCurrentUser; 89 90 91 // This context is required for system services since NotificationListenerService isn't 92 // started as a real Service and hence no context is available. 93 private Context mSystemContext; 94 95 /** 96 * The {@link Intent} that must be declared as handled by the service. 97 */ 98 @SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) 99 public static final String SERVICE_INTERFACE 100 = "android.service.notification.NotificationListenerService"; 101 102 /** 103 * Implement this method to learn about new notifications as they are posted by apps. 104 * 105 * @param sbn A data structure encapsulating the original {@link android.app.Notification} 106 * object as well as its identifying information (tag and id) and source 107 * (package name). 108 */ 109 public void onNotificationPosted(StatusBarNotification sbn) { 110 // optional 111 } 112 113 /** 114 * Implement this method to learn about new notifications as they are posted by apps. 115 * 116 * @param sbn A data structure encapsulating the original {@link android.app.Notification} 117 * object as well as its identifying information (tag and id) and source 118 * (package name). 119 * @param rankingMap The current ranking map that can be used to retrieve ranking information 120 * for active notifications, including the newly posted one. 121 */ 122 public void onNotificationPosted(StatusBarNotification sbn, RankingMap rankingMap) { 123 onNotificationPosted(sbn); 124 } 125 126 /** 127 * Implement this method to learn when notifications are removed. 128 * <P> 129 * This might occur because the user has dismissed the notification using system UI (or another 130 * notification listener) or because the app has withdrawn the notification. 131 * <P> 132 * NOTE: The {@link StatusBarNotification} object you receive will be "light"; that is, the 133 * result from {@link StatusBarNotification#getNotification} may be missing some heavyweight 134 * fields such as {@link android.app.Notification#contentView} and 135 * {@link android.app.Notification#largeIcon}. However, all other fields on 136 * {@link StatusBarNotification}, sufficient to match this call with a prior call to 137 * {@link #onNotificationPosted(StatusBarNotification)}, will be intact. 138 * 139 * @param sbn A data structure encapsulating at least the original information (tag and id) 140 * and source (package name) used to post the {@link android.app.Notification} that 141 * was just removed. 142 */ 143 public void onNotificationRemoved(StatusBarNotification sbn) { 144 // optional 145 } 146 147 /** 148 * Implement this method to learn when notifications are removed. 149 * <P> 150 * This might occur because the user has dismissed the notification using system UI (or another 151 * notification listener) or because the app has withdrawn the notification. 152 * <P> 153 * NOTE: The {@link StatusBarNotification} object you receive will be "light"; that is, the 154 * result from {@link StatusBarNotification#getNotification} may be missing some heavyweight 155 * fields such as {@link android.app.Notification#contentView} and 156 * {@link android.app.Notification#largeIcon}. However, all other fields on 157 * {@link StatusBarNotification}, sufficient to match this call with a prior call to 158 * {@link #onNotificationPosted(StatusBarNotification)}, will be intact. 159 * 160 * @param sbn A data structure encapsulating at least the original information (tag and id) 161 * and source (package name) used to post the {@link android.app.Notification} that 162 * was just removed. 163 * @param rankingMap The current ranking map that can be used to retrieve ranking information 164 * for active notifications. 165 * 166 */ 167 public void onNotificationRemoved(StatusBarNotification sbn, RankingMap rankingMap) { 168 onNotificationRemoved(sbn); 169 } 170 171 /** 172 * Implement this method to learn about when the listener is enabled and connected to 173 * the notification manager. You are safe to call {@link #getActiveNotifications()} 174 * at this time. 175 */ 176 public void onListenerConnected() { 177 // optional 178 } 179 180 /** 181 * Implement this method to be notified when the notification ranking changes. 182 * 183 * @param rankingMap The current ranking map that can be used to retrieve ranking information 184 * for active notifications. 185 */ 186 public void onNotificationRankingUpdate(RankingMap rankingMap) { 187 // optional 188 } 189 190 /** 191 * Implement this method to be notified when the 192 * {@link #getCurrentListenerHints() Listener hints} change. 193 * 194 * @param hints The current {@link #getCurrentListenerHints() listener hints}. 195 */ 196 public void onListenerHintsChanged(int hints) { 197 // optional 198 } 199 200 private final INotificationManager getNotificationInterface() { 201 if (mNoMan == null) { 202 mNoMan = INotificationManager.Stub.asInterface( 203 ServiceManager.getService(Context.NOTIFICATION_SERVICE)); 204 } 205 return mNoMan; 206 } 207 208 /** 209 * Inform the notification manager about dismissal of a single notification. 210 * <p> 211 * Use this if your listener has a user interface that allows the user to dismiss individual 212 * notifications, similar to the behavior of Android's status bar and notification panel. 213 * It should be called after the user dismisses a single notification using your UI; 214 * upon being informed, the notification manager will actually remove the notification 215 * and you will get an {@link #onNotificationRemoved(StatusBarNotification)} callback. 216 * <P> 217 * <b>Note:</b> If your listener allows the user to fire a notification's 218 * {@link android.app.Notification#contentIntent} by tapping/clicking/etc., you should call 219 * this method at that time <i>if</i> the Notification in question has the 220 * {@link android.app.Notification#FLAG_AUTO_CANCEL} flag set. 221 * 222 * @param pkg Package of the notifying app. 223 * @param tag Tag of the notification as specified by the notifying app in 224 * {@link android.app.NotificationManager#notify(String, int, android.app.Notification)}. 225 * @param id ID of the notification as specified by the notifying app in 226 * {@link android.app.NotificationManager#notify(String, int, android.app.Notification)}. 227 * <p> 228 * @deprecated Use {@link #cancelNotification(String key)} 229 * instead. Beginning with {@link android.os.Build.VERSION_CODES#L} this method will no longer 230 * cancel the notification. It will continue to cancel the notification for applications 231 * whose {@code targetSdkVersion} is earlier than {@link android.os.Build.VERSION_CODES#L}. 232 */ 233 public final void cancelNotification(String pkg, String tag, int id) { 234 if (!isBound()) return; 235 try { 236 getNotificationInterface().cancelNotificationFromListener( 237 mWrapper, pkg, tag, id); 238 } catch (android.os.RemoteException ex) { 239 Log.v(TAG, "Unable to contact notification manager", ex); 240 } 241 } 242 243 /** 244 * Inform the notification manager about dismissal of a single notification. 245 * <p> 246 * Use this if your listener has a user interface that allows the user to dismiss individual 247 * notifications, similar to the behavior of Android's status bar and notification panel. 248 * It should be called after the user dismisses a single notification using your UI; 249 * upon being informed, the notification manager will actually remove the notification 250 * and you will get an {@link #onNotificationRemoved(StatusBarNotification)} callback. 251 * <P> 252 * <b>Note:</b> If your listener allows the user to fire a notification's 253 * {@link android.app.Notification#contentIntent} by tapping/clicking/etc., you should call 254 * this method at that time <i>if</i> the Notification in question has the 255 * {@link android.app.Notification#FLAG_AUTO_CANCEL} flag set. 256 * <p> 257 * @param key Notification to dismiss from {@link StatusBarNotification#getKey()}. 258 */ 259 public final void cancelNotification(String key) { 260 if (!isBound()) return; 261 try { 262 getNotificationInterface().cancelNotificationsFromListener(mWrapper, 263 new String[] {key}); 264 } catch (android.os.RemoteException ex) { 265 Log.v(TAG, "Unable to contact notification manager", ex); 266 } 267 } 268 269 /** 270 * Inform the notification manager about dismissal of all notifications. 271 * <p> 272 * Use this if your listener has a user interface that allows the user to dismiss all 273 * notifications, similar to the behavior of Android's status bar and notification panel. 274 * It should be called after the user invokes the "dismiss all" function of your UI; 275 * upon being informed, the notification manager will actually remove all active notifications 276 * and you will get multiple {@link #onNotificationRemoved(StatusBarNotification)} callbacks. 277 * 278 * {@see #cancelNotification(String, String, int)} 279 */ 280 public final void cancelAllNotifications() { 281 cancelNotifications(null /*all*/); 282 } 283 284 /** 285 * Inform the notification manager about dismissal of specific notifications. 286 * <p> 287 * Use this if your listener has a user interface that allows the user to dismiss 288 * multiple notifications at once. 289 * 290 * @param keys Notifications to dismiss, or {@code null} to dismiss all. 291 * 292 * {@see #cancelNotification(String, String, int)} 293 */ 294 public final void cancelNotifications(String[] keys) { 295 if (!isBound()) return; 296 try { 297 getNotificationInterface().cancelNotificationsFromListener(mWrapper, keys); 298 } catch (android.os.RemoteException ex) { 299 Log.v(TAG, "Unable to contact notification manager", ex); 300 } 301 } 302 303 /** 304 * Request the list of outstanding notifications (that is, those that are visible to the 305 * current user). Useful when you don't know what's already been posted. 306 * 307 * @return An array of active notifications, sorted in natural order. 308 */ 309 public StatusBarNotification[] getActiveNotifications() { 310 return getActiveNotifications(null); 311 } 312 313 /** 314 * Request one or more notifications by key. Useful if you have been keeping track of 315 * notifications but didn't want to retain the bits, and now need to go back and extract 316 * more data out of those notifications. 317 * 318 * @return An array of notifications corresponding to the requested keys, in the 319 * same order as the key list. 320 */ 321 public StatusBarNotification[] getActiveNotifications(String[] keys) { 322 if (!isBound()) return null; 323 try { 324 ParceledListSlice<StatusBarNotification> parceledList = 325 getNotificationInterface().getActiveNotificationsFromListener(mWrapper, keys); 326 List<StatusBarNotification> list = parceledList.getList(); 327 328 int N = list.size(); 329 for (int i = 0; i < N; i++) { 330 Notification notification = list.get(i).getNotification(); 331 Builder.rebuild(getContext(), notification); 332 } 333 return list.toArray(new StatusBarNotification[N]); 334 } catch (android.os.RemoteException ex) { 335 Log.v(TAG, "Unable to contact notification manager", ex); 336 } 337 return null; 338 } 339 340 /** 341 * Gets the set of hints representing current state. 342 * 343 * <p> 344 * The current state may differ from the requested state if the hint represents state 345 * shared across all listeners or a feature the notification host does not support or refuses 346 * to grant. 347 * 348 * @return One or more of the HINT_ constants. 349 */ 350 public final int getCurrentListenerHints() { 351 if (!isBound()) return HINTS_NONE; 352 try { 353 return getNotificationInterface().getHintsFromListener(mWrapper); 354 } catch (android.os.RemoteException ex) { 355 Log.v(TAG, "Unable to contact notification manager", ex); 356 return HINTS_NONE; 357 } 358 } 359 360 /** 361 * Sets the desired {@link #getCurrentListenerHints() listener hints}. 362 * 363 * <p> 364 * This is merely a request, the host may or not choose to take action depending 365 * on other listener requests or other global state. 366 * <p> 367 * Listen for updates using {@link #onListenerHintsChanged(int)}. 368 * 369 * @param hints One or more of the HINT_ constants. 370 */ 371 public final void requestListenerHints(int hints) { 372 if (!isBound()) return; 373 try { 374 getNotificationInterface().requestHintsFromListener(mWrapper, hints); 375 } catch (android.os.RemoteException ex) { 376 Log.v(TAG, "Unable to contact notification manager", ex); 377 } 378 } 379 380 /** 381 * Returns current ranking information. 382 * 383 * <p> 384 * The returned object represents the current ranking snapshot and only 385 * applies for currently active notifications. 386 * <p> 387 * Generally you should use the RankingMap that is passed with events such 388 * as {@link #onNotificationPosted(StatusBarNotification, RankingMap)}, 389 * {@link #onNotificationRemoved(StatusBarNotification, RankingMap)}, and 390 * so on. This method should only be used when needing access outside of 391 * such events, for example to retrieve the RankingMap right after 392 * initialization. 393 * 394 * @return A {@link RankingMap} object providing access to ranking information 395 */ 396 public RankingMap getCurrentRanking() { 397 return mRankingMap; 398 } 399 400 @Override 401 public IBinder onBind(Intent intent) { 402 if (mWrapper == null) { 403 mWrapper = new INotificationListenerWrapper(); 404 } 405 return mWrapper; 406 } 407 408 private boolean isBound() { 409 if (mWrapper == null) { 410 Log.w(TAG, "Notification listener service not yet bound."); 411 return false; 412 } 413 return true; 414 } 415 416 /** 417 * Directly register this service with the Notification Manager. 418 * 419 * <p>Only system services may use this call. It will fail for non-system callers. 420 * Apps should ask the user to add their listener in Settings. 421 * 422 * @param context Context required for accessing resources. Since this service isn't 423 * launched as a real Service when using this method, a context has to be passed in. 424 * @param componentName the component that will consume the notification information 425 * @param currentUser the user to use as the stream filter 426 * @hide 427 */ 428 @SystemApi 429 public void registerAsSystemService(Context context, ComponentName componentName, 430 int currentUser) throws RemoteException { 431 mSystemContext = context; 432 if (mWrapper == null) { 433 mWrapper = new INotificationListenerWrapper(); 434 } 435 INotificationManager noMan = getNotificationInterface(); 436 noMan.registerListener(mWrapper, componentName, currentUser); 437 mCurrentUser = currentUser; 438 } 439 440 /** 441 * Directly unregister this service from the Notification Manager. 442 * 443 * <P>This method will fail for listeners that were not registered 444 * with (@link registerAsService). 445 * @hide 446 */ 447 @SystemApi 448 public void unregisterAsSystemService() throws RemoteException { 449 if (mWrapper != null) { 450 INotificationManager noMan = getNotificationInterface(); 451 noMan.unregisterListener(mWrapper, mCurrentUser); 452 } 453 } 454 455 private class INotificationListenerWrapper extends INotificationListener.Stub { 456 @Override 457 public void onNotificationPosted(StatusBarNotification sbn, 458 NotificationRankingUpdate update) { 459 Notification.Builder.rebuild(getContext(), sbn.getNotification()); 460 461 // protect subclass from concurrent modifications of (@link mNotificationKeys}. 462 synchronized (mWrapper) { 463 applyUpdate(update); 464 try { 465 NotificationListenerService.this.onNotificationPosted(sbn, mRankingMap); 466 } catch (Throwable t) { 467 Log.w(TAG, "Error running onNotificationPosted", t); 468 } 469 } 470 } 471 @Override 472 public void onNotificationRemoved(StatusBarNotification sbn, 473 NotificationRankingUpdate update) { 474 // protect subclass from concurrent modifications of (@link mNotificationKeys}. 475 synchronized (mWrapper) { 476 applyUpdate(update); 477 try { 478 NotificationListenerService.this.onNotificationRemoved(sbn, mRankingMap); 479 } catch (Throwable t) { 480 Log.w(TAG, "Error running onNotificationRemoved", t); 481 } 482 } 483 } 484 @Override 485 public void onListenerConnected(NotificationRankingUpdate update) { 486 // protect subclass from concurrent modifications of (@link mNotificationKeys}. 487 synchronized (mWrapper) { 488 applyUpdate(update); 489 try { 490 NotificationListenerService.this.onListenerConnected(); 491 } catch (Throwable t) { 492 Log.w(TAG, "Error running onListenerConnected", t); 493 } 494 } 495 } 496 @Override 497 public void onNotificationRankingUpdate(NotificationRankingUpdate update) 498 throws RemoteException { 499 // protect subclass from concurrent modifications of (@link mNotificationKeys}. 500 synchronized (mWrapper) { 501 applyUpdate(update); 502 try { 503 NotificationListenerService.this.onNotificationRankingUpdate(mRankingMap); 504 } catch (Throwable t) { 505 Log.w(TAG, "Error running onNotificationRankingUpdate", t); 506 } 507 } 508 } 509 @Override 510 public void onListenerHintsChanged(int hints) throws RemoteException { 511 try { 512 NotificationListenerService.this.onListenerHintsChanged(hints); 513 } catch (Throwable t) { 514 Log.w(TAG, "Error running onListenerHintsChanged", t); 515 } 516 } 517 } 518 519 private void applyUpdate(NotificationRankingUpdate update) { 520 mRankingMap = new RankingMap(update); 521 } 522 523 private Context getContext() { 524 if (mSystemContext != null) { 525 return mSystemContext; 526 } 527 return this; 528 } 529 530 /** 531 * Stores ranking related information on a currently active notification. 532 * 533 * <p> 534 * Ranking objects aren't automatically updated as notification events 535 * occur. Instead, ranking information has to be retrieved again via the 536 * current {@link RankingMap}. 537 */ 538 public static class Ranking { 539 private String mKey; 540 private int mRank = -1; 541 private boolean mIsAmbient; 542 private boolean mMatchesInterruptionFilter; 543 544 public Ranking() {} 545 546 /** 547 * Returns the key of the notification this Ranking applies to. 548 */ 549 public String getKey() { 550 return mKey; 551 } 552 553 /** 554 * Returns the rank of the notification. 555 * 556 * @return the rank of the notification, that is the 0-based index in 557 * the list of active notifications. 558 */ 559 public int getRank() { 560 return mRank; 561 } 562 563 /** 564 * Returns whether the notification is an ambient notification, that is 565 * a notification that doesn't require the user's immediate attention. 566 */ 567 public boolean isAmbient() { 568 return mIsAmbient; 569 } 570 571 /** 572 * Returns whether the notification meets the user's interruption 573 * filter. 574 * 575 * @removed 576 */ 577 public boolean meetsInterruptionFilter() { 578 return mMatchesInterruptionFilter; 579 } 580 581 /** 582 * Returns whether the notification matches the user's interruption 583 * filter. 584 */ 585 public boolean matchesInterruptionFilter() { 586 return mMatchesInterruptionFilter; 587 } 588 589 private void populate(String key, int rank, boolean isAmbient, 590 boolean matchesInterruptionFilter) { 591 mKey = key; 592 mRank = rank; 593 mIsAmbient = isAmbient; 594 mMatchesInterruptionFilter = matchesInterruptionFilter; 595 } 596 } 597 598 /** 599 * Provides access to ranking information on currently active 600 * notifications. 601 * 602 * <p> 603 * Note that this object represents a ranking snapshot that only applies to 604 * notifications active at the time of retrieval. 605 */ 606 public static class RankingMap implements Parcelable { 607 private final NotificationRankingUpdate mRankingUpdate; 608 private ArrayMap<String,Integer> mRanks; 609 private ArraySet<Object> mIntercepted; 610 611 private RankingMap(NotificationRankingUpdate rankingUpdate) { 612 mRankingUpdate = rankingUpdate; 613 } 614 615 /** 616 * Request the list of notification keys in their current ranking 617 * order. 618 * 619 * @return An array of active notification keys, in their ranking order. 620 */ 621 public String[] getOrderedKeys() { 622 return mRankingUpdate.getOrderedKeys(); 623 } 624 625 /** 626 * Populates outRanking with ranking information for the notification 627 * with the given key. 628 * 629 * @return true if a valid key has been passed and outRanking has 630 * been populated; false otherwise 631 */ 632 public boolean getRanking(String key, Ranking outRanking) { 633 int rank = getRank(key); 634 outRanking.populate(key, rank, isAmbient(key), !isIntercepted(key)); 635 return rank >= 0; 636 } 637 638 private int getRank(String key) { 639 synchronized (this) { 640 if (mRanks == null) { 641 buildRanksLocked(); 642 } 643 } 644 Integer rank = mRanks.get(key); 645 return rank != null ? rank : -1; 646 } 647 648 private boolean isAmbient(String key) { 649 int firstAmbientIndex = mRankingUpdate.getFirstAmbientIndex(); 650 if (firstAmbientIndex < 0) { 651 return false; 652 } 653 int rank = getRank(key); 654 return rank >= 0 && rank >= firstAmbientIndex; 655 } 656 657 private boolean isIntercepted(String key) { 658 synchronized (this) { 659 if (mIntercepted == null) { 660 buildInterceptedSetLocked(); 661 } 662 } 663 return mIntercepted.contains(key); 664 } 665 666 // Locked by 'this' 667 private void buildRanksLocked() { 668 String[] orderedKeys = mRankingUpdate.getOrderedKeys(); 669 mRanks = new ArrayMap<>(orderedKeys.length); 670 for (int i = 0; i < orderedKeys.length; i++) { 671 String key = orderedKeys[i]; 672 mRanks.put(key, i); 673 } 674 } 675 676 // Locked by 'this' 677 private void buildInterceptedSetLocked() { 678 String[] dndInterceptedKeys = mRankingUpdate.getInterceptedKeys(); 679 mIntercepted = new ArraySet<>(dndInterceptedKeys.length); 680 Collections.addAll(mIntercepted, dndInterceptedKeys); 681 } 682 683 // ----------- Parcelable 684 685 @Override 686 public int describeContents() { 687 return 0; 688 } 689 690 @Override 691 public void writeToParcel(Parcel dest, int flags) { 692 dest.writeParcelable(mRankingUpdate, flags); 693 } 694 695 public static final Creator<RankingMap> CREATOR = new Creator<RankingMap>() { 696 @Override 697 public RankingMap createFromParcel(Parcel source) { 698 NotificationRankingUpdate rankingUpdate = source.readParcelable(null); 699 return new RankingMap(rankingUpdate); 700 } 701 702 @Override 703 public RankingMap[] newArray(int size) { 704 return new RankingMap[size]; 705 } 706 }; 707 } 708} 709