| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.service.notification; |
| 18 |
|
| 19 |
import static java.lang.annotation.RetentionPolicy.SOURCE; |
| 20 |
|
| 21 |
import android.annotation.IntDef; |
| 22 |
import android.annotation.NonNull; |
| 23 |
import android.annotation.Nullable; |
| 24 |
import android.annotation.SdkConstant; |
| 25 |
import android.annotation.SystemApi; |
| 26 |
import android.app.Notification; |
| 27 |
import android.app.NotificationChannel; |
| 28 |
import android.app.NotificationManager; |
| 29 |
import android.app.admin.DevicePolicyManager; |
| 30 |
import android.content.ComponentName; |
| 31 |
import android.content.Context; |
| 32 |
import android.content.Intent; |
| 33 |
import android.os.Bundle; |
| 34 |
import android.os.Handler; |
| 35 |
import android.os.IBinder; |
| 36 |
import android.os.Looper; |
| 37 |
import android.os.Message; |
| 38 |
import android.os.RemoteException; |
| 39 |
import android.util.Log; |
| 40 |
|
| 41 |
import com.android.internal.os.SomeArgs; |
| 42 |
|
| 43 |
import java.lang.annotation.Retention; |
| 44 |
import java.util.List; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
@SystemApi |
| 69 |
public abstract class NotificationAssistantService extends NotificationListenerService { |
| 70 |
private static final String TAG = "NotificationAssistants"; |
| 71 |
|
| 72 |
|
| 73 |
@Retention(SOURCE) |
| 74 |
@IntDef({SOURCE_FROM_APP, SOURCE_FROM_ASSISTANT}) |
| 75 |
public @interface Source {} |
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
public static final int SOURCE_FROM_APP = 0; |
| 81 |
|
| 82 |
|
| 83 |
|
| 84 |
public static final int SOURCE_FROM_ASSISTANT = 1; |
| 85 |
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
@SdkConstant(SdkConstant.SdkConstantType.SERVICE_ACTION) |
| 90 |
public static final String SERVICE_INTERFACE |
| 91 |
= "android.service.notification.NotificationAssistantService"; |
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
|
| 99 |
|
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
@SdkConstant(SdkConstant.SdkConstantType.ACTIVITY_INTENT_ACTION) |
| 105 |
public static final String ACTION_NOTIFICATION_ASSISTANT_DETAIL_SETTINGS = |
| 106 |
"android.service.notification.action.NOTIFICATION_ASSISTANT_DETAIL_SETTINGS"; |
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
|
| 113 |
public static final String FEEDBACK_RATING = "feedback.rating"; |
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
protected Handler mHandler; |
| 119 |
|
| 120 |
@Override |
| 121 |
protected void attachBaseContext(Context base) { |
| 122 |
super.attachBaseContext(base); |
| 123 |
mHandler = new MyHandler(getContext().getMainLooper()); |
| 124 |
} |
| 125 |
|
| 126 |
@Override |
| 127 |
public final @NonNull IBinder onBind(@Nullable Intent intent) { |
| 128 |
if (mWrapper == null) { |
| 129 |
mWrapper = new NotificationAssistantServiceWrapper(); |
| 130 |
} |
| 131 |
return mWrapper; |
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
|
| 142 |
abstract public void onNotificationSnoozedUntilContext(@NonNull StatusBarNotification sbn, |
| 143 |
@NonNull String snoozeCriterionId); |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
|
| 150 |
|
| 151 |
|
| 152 |
|
| 153 |
|
| 154 |
|
| 155 |
abstract public @Nullable Adjustment onNotificationEnqueued(@NonNull StatusBarNotification sbn); |
| 156 |
|
| 157 |
|
| 158 |
|
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
|
| 164 |
|
| 165 |
|
| 166 |
|
| 167 |
public @Nullable Adjustment onNotificationEnqueued(@NonNull StatusBarNotification sbn, |
| 168 |
@NonNull NotificationChannel channel) { |
| 169 |
return onNotificationEnqueued(sbn); |
| 170 |
} |
| 171 |
|
| 172 |
|
| 173 |
|
| 174 |
|
| 175 |
|
| 176 |
|
| 177 |
|
| 178 |
|
| 179 |
|
| 180 |
|
| 181 |
public @Nullable Adjustment onNotificationEnqueued(@NonNull StatusBarNotification sbn, |
| 182 |
@NonNull NotificationChannel channel, @NonNull RankingMap rankingMap) { |
| 183 |
return onNotificationEnqueued(sbn, channel); |
| 184 |
} |
| 185 |
|
| 186 |
|
| 187 |
|
| 188 |
|
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
|
| 193 |
|
| 194 |
|
| 195 |
|
| 196 |
|
| 197 |
|
| 198 |
|
| 199 |
|
| 200 |
|
| 201 |
|
| 202 |
|
| 203 |
|
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
|
| 208 |
@Override |
| 209 |
public void onNotificationRemoved(@NonNull StatusBarNotification sbn, |
| 210 |
@NonNull RankingMap rankingMap, |
| 211 |
@NonNull NotificationStats stats, int reason) { |
| 212 |
onNotificationRemoved(sbn, rankingMap, reason); |
| 213 |
} |
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
public void onNotificationsSeen(@NonNull List<String> keys) { |
| 220 |
|
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
|
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
public void onPanelRevealed(int items) { |
| 229 |
|
| 230 |
} |
| 231 |
|
| 232 |
|
| 233 |
|
| 234 |
|
| 235 |
public void onPanelHidden() { |
| 236 |
|
| 237 |
} |
| 238 |
|
| 239 |
|
| 240 |
|
| 241 |
|
| 242 |
|
| 243 |
|
| 244 |
|
| 245 |
public void onNotificationVisibilityChanged(@NonNull String key, boolean isVisible) { |
| 246 |
|
| 247 |
} |
| 248 |
|
| 249 |
|
| 250 |
|
| 251 |
|
| 252 |
|
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
public void onNotificationExpansionChanged( |
| 257 |
@NonNull String key, boolean isUserAction, boolean isExpanded) {} |
| 258 |
|
| 259 |
|
| 260 |
|
| 261 |
|
| 262 |
|
| 263 |
public void onNotificationDirectReplied(@NonNull String key) {} |
| 264 |
|
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
public void onSuggestedReplySent(@NonNull String key, @NonNull CharSequence reply, |
| 272 |
@Source int source) { |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
public void onActionInvoked(@NonNull String key, @NonNull Notification.Action action, |
| 282 |
@Source int source) { |
| 283 |
} |
| 284 |
|
| 285 |
|
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
public void onNotificationClicked(@NonNull String key) { |
| 290 |
} |
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
public void onAllowedAdjustmentsChanged() { |
| 299 |
} |
| 300 |
|
| 301 |
|
| 302 |
|
| 303 |
|
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
|
| 308 |
public void onNotificationFeedbackReceived(@NonNull String key, @NonNull RankingMap rankingMap, |
| 309 |
@NonNull Bundle feedback) { |
| 310 |
} |
| 311 |
|
| 312 |
|
| 313 |
se |
| 314 |
|
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
|
| 319 |
public final void adjustNotification(@NonNull Adjustment adjustment) { |
| 320 |
if (!isBound()) return; |
| 321 |
try { |
| 322 |
setAdjustmentIssuer(adjustment); |
| 323 |
getNotificationInterface().applyEnqueuedAdjustmentFromAssistant(mWrapper, adjustment); |
| 324 |
} catch (android.os.RemoteException ex) { |
| 325 |
Log.v(TAG, "Unable to contact notification manager", ex); |
| 326 |
throw ex.rethrowFromSystemServer(); |
| 327 |
} |
| 328 |
} |
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
to |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
public final void adjustNotifications(@NonNull List<Adjustment> adjustments) { |
| 338 |
if (!isBound()) return; |
| 339 |
try { |
| 340 |
for (Adjustment adjustment : adjustments) { |
| 341 |
setAdjustmentIssuer(adjustment); |
| 342 |
} |
| 343 |
getNotificationInterface().applyAdjustmentsFromAssistant(mWrapper, adjustments); |
| 344 |
} catch (android.os.RemoteException ex) { |
| 345 |
Log.v(TAG, "Unable to contact notification manager", ex); |
| 346 |
throw ex.rethrowFromSystemServer(); |
| 347 |
} |
| 348 |
} |
| 349 |
|
| 350 |
|
| 351 |
|
| 352 |
|
| 353 |
|
| 354 |
|
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
|
| 359 |
public final void unsnoozeNotification(@NonNull String key) { |
| 360 |
if (!isBound()) return; |
| 361 |
try { |
| 362 |
getNotificationInterface().unsnoozeNotificationFromAssistant(mWrapper, key); |
| 363 |
} catch (android.os.RemoteException ex) { |
| 364 |
Log.v(TAG, "Unable to contact notification manager", ex); |
| 365 |
} |
| 366 |
} |
| 367 |
|
| 368 |
private class NotificationAssistantServiceWrapper extends NotificationListenerWrapper { |
| 369 |
@Override |
| 370 |
public void onNotificationEnqueuedWithChannel(IStatusBarNotificationHolder sbnHolder, |
| 371 |
NotificationChannel channel, NotificationRankingUpdate update) { |
| 372 |
StatusBarNotification sbn; |
| 373 |
try { |
| 374 |
sbn = sbnHolder.get(); |
| 375 |
} catch (RemoteException e) { |
| 376 |
Log.w(TAG, "onNotificationEnqueued: Error receiving StatusBarNotification", e); |
| 377 |
return; |
| 378 |
} |
| 379 |
if (sbn == null) { |
| 380 |
Log.w(TAG, "onNotificationEnqueuedWithChannel: " |
| 381 |
+ "Error receiving StatusBarNotification"); |
| 382 |
return; |
| 383 |
} |
| 384 |
|
| 385 |
applyUpdateLocked(update); |
| 386 |
SomeArgs args = SomeArgs.obtain(); |
| 387 |
args.arg1 = sbn; |
| 388 |
args.arg2 = channel; |
| 389 |
args.arg3 = getCurrentRanking(); |
| 390 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_ENQUEUED, |
| 391 |
args).sendToTarget(); |
| 392 |
} |
| 393 |
|
| 394 |
@Override |
| 395 |
public void onNotificationSnoozedUntilContext( |
| 396 |
IStatusBarNotificationHolder sbnHolder, String snoozeCriterionId) { |
| 397 |
StatusBarNotification sbn; |
| 398 |
try { |
| 399 |
sbn = sbnHolder.get(); |
| 400 |
} catch (RemoteException e) { |
| 401 |
Log.w(TAG, "onNotificationSnoozed: Error receiving StatusBarNotification", e); |
| 402 |
return; |
| 403 |
} |
| 404 |
if (sbn == null) { |
| 405 |
Log.w(TAG, "onNotificationSnoozed: Error receiving StatusBarNotification"); |
| 406 |
return; |
| 407 |
} |
| 408 |
|
| 409 |
SomeArgs args = SomeArgs.obtain(); |
| 410 |
args.arg1 = sbn; |
| 411 |
args.arg2 = snoozeCriterionId; |
| 412 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_SNOOZED, |
| 413 |
args).sendToTarget(); |
| 414 |
} |
| 415 |
|
| 416 |
@Override |
| 417 |
public void onNotificationsSeen(List<String> keys) { |
| 418 |
SomeArgs args = SomeArgs.obtain(); |
| 419 |
args.arg1 = keys; |
| 420 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATIONS_SEEN, |
| 421 |
args).sendToTarget(); |
| 422 |
} |
| 423 |
|
| 424 |
@Override |
| 425 |
public void onPanelRevealed(int items) { |
| 426 |
SomeArgs args = SomeArgs.obtain(); |
| 427 |
args.argi1 = items; |
| 428 |
mHandler.obtainMessage(MyHandler.MSG_ON_PANEL_REVEALED, |
| 429 |
args).sendToTarget(); |
| 430 |
} |
| 431 |
|
| 432 |
@Override |
| 433 |
public void onPanelHidden() { |
| 434 |
SomeArgs args = SomeArgs.obtain(); |
| 435 |
mHandler.obtainMessage(MyHandler.MSG_ON_PANEL_HIDDEN, |
| 436 |
args).sendToTarget(); |
| 437 |
} |
| 438 |
|
| 439 |
@Override |
| 440 |
public void onNotificationVisibilityChanged(String key, boolean isVisible) { |
| 441 |
SomeArgs args = SomeArgs.obtain(); |
| 442 |
args.arg1 = key; |
| 443 |
args.argi1 = isVisible ? 1 : 0; |
| 444 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_VISIBILITY_CHANGED, |
| 445 |
args).sendToTarget(); |
| 446 |
} |
| 447 |
|
| 448 |
@Override |
| 449 |
public void onNotificationExpansionChanged(String key, boolean isUserAction, |
| 450 |
boolean isExpanded) { |
| 451 |
SomeArgs args = SomeArgs.obtain(); |
| 452 |
args.arg1 = key; |
| 453 |
args.argi1 = isUserAction ? 1 : 0; |
| 454 |
args.argi2 = isExpanded ? 1 : 0; |
| 455 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_EXPANSION_CHANGED, args) |
| 456 |
.sendToTarget(); |
| 457 |
} |
| 458 |
|
| 459 |
@Override |
| 460 |
public void onNotificationDirectReply(String key) { |
| 461 |
SomeArgs args = SomeArgs.obtain(); |
| 462 |
args.arg1 = key; |
| 463 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT, args) |
| 464 |
.sendToTarget(); |
| 465 |
} |
| 466 |
|
| 467 |
@Override |
| 468 |
public void onSuggestedReplySent(String key, CharSequence reply, int source) { |
| 469 |
SomeArgs args = SomeArgs.obtain(); |
| 470 |
args.arg1 = key; |
| 471 |
args.arg2 = reply; |
| 472 |
args.argi2 = source; |
| 473 |
mHandler.obtainMessage(MyHandler.MSG_ON_SUGGESTED_REPLY_SENT, args).sendToTarget(); |
| 474 |
} |
| 475 |
|
| 476 |
@Override |
| 477 |
public void onActionClicked(String key, Notification.Action action, int source) { |
| 478 |
SomeArgs args = SomeArgs.obtain(); |
| 479 |
args.arg1 = key; |
| 480 |
args.arg2 = action; |
| 481 |
args.argi2 = source; |
| 482 |
mHandler.obtainMessage(MyHandler.MSG_ON_ACTION_INVOKED, args).sendToTarget(); |
| 483 |
} |
| 484 |
|
| 485 |
@Override |
| 486 |
public void onNotificationClicked(String key) { |
| 487 |
SomeArgs args = SomeArgs.obtain(); |
| 488 |
args.arg1 = key; |
| 489 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_CLICKED, args).sendToTarget(); |
| 490 |
} |
| 491 |
|
| 492 |
@Override |
| 493 |
public void onAllowedAdjustmentsChanged() { |
| 494 |
mHandler.obtainMessage(MyHandler.MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED).sendToTarget(); |
| 495 |
} |
| 496 |
|
| 497 |
@Override |
| 498 |
public void onNotificationFeedbackReceived(String key, NotificationRankingUpdate update, |
| 499 |
Bundle feedback) { |
| 500 |
applyUpdateLocked(update); |
| 501 |
SomeArgs args = SomeArgs.obtain(); |
| 502 |
args.arg1 = key; |
| 503 |
args.arg2 = getCurrentRanking(); |
| 504 |
args.arg3 = feedback; |
| 505 |
mHandler.obtainMessage(MyHandler.MSG_ON_NOTIFICATION_FEEDBACK_RECEIVED, |
| 506 |
args).sendToTarget(); |
| 507 |
} |
| 508 |
} |
| 509 |
|
| 510 |
private void setAdjustmentIssuer(@Nullable Adjustment adjustment) { |
| 511 |
if (adjustment != null) { |
| 512 |
adjustment.setIssuer(getOpPackageName() + "/" + getClass().getName()); |
| 513 |
} |
| 514 |
} |
| 515 |
|
| 516 |
private final class MyHandler extends Handler { |
| 517 |
public static final int MSG_ON_NOTIFICATION_ENQUEUED = 1; |
| 518 |
public static final int MSG_ON_NOTIFICATION_SNOOZED = 2; |
| 519 |
public static final int MSG_ON_NOTIFICATIONS_SEEN = 3; |
| 520 |
public static final int MSG_ON_NOTIFICATION_EXPANSION_CHANGED = 4; |
| 521 |
public static final int MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT = 5; |
| 522 |
public static final int MSG_ON_SUGGESTED_REPLY_SENT = 6; |
| 523 |
public static final int MSG_ON_ACTION_INVOKED = 7; |
| 524 |
public static final int MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED = 8; |
| 525 |
public static final int MSG_ON_PANEL_REVEALED = 9; |
| 526 |
public static final int MSG_ON_PANEL_HIDDEN = 10; |
| 527 |
public static final int MSG_ON_NOTIFICATION_VISIBILITY_CHANGED = 11; |
| 528 |
public static final int MSG_ON_NOTIFICATION_CLICKED = 12; |
| 529 |
public static final int MSG_ON_NOTIFICATION_FEEDBACK_RECEIVED = 13; |
| 530 |
|
| 531 |
public MyHandler(Looper looper) { |
| 532 |
super(looper, null, false); |
| 533 |
} |
| 534 |
|
| 535 |
@Override |
| 536 |
public void handleMessage(Message msg) { |
| 537 |
switch (msg.what) { |
| 538 |
case MSG_ON_NOTIFICATION_ENQUEUED: { |
| 539 |
SomeArgs args = (SomeArgs) msg.obj; |
| 540 |
StatusBarNotification sbn = (StatusBarNotification) args.arg1; |
| 541 |
NotificationChannel channel = (NotificationChannel) args.arg2; |
| 542 |
RankingMap ranking = (RankingMap) args.arg3; |
| 543 |
args.recycle(); |
| 544 |
Adjustment adjustment = onNotificationEnqueued(sbn, channel, ranking); |
| 545 |
setAdjustmentIssuer(adjustment); |
| 546 |
if (adjustment != null) { |
| 547 |
if (!isBound()) { |
| 548 |
Log.w(TAG, "MSG_ON_NOTIFICATION_ENQUEUED: service not bound, skip."); |
| 549 |
return; |
| 550 |
} |
| 551 |
try { |
| 552 |
getNotificationInterface().applyEnqueuedAdjustmentFromAssistant( |
| 553 |
mWrapper, adjustment); |
| 554 |
} catch (android.os.RemoteException ex) { |
| 555 |
Log.v(TAG, "Unable to contact notification manager", ex); |
| 556 |
throw ex.rethrowFromSystemServer(); |
| 557 |
} catch (SecurityException e) { |
| 558 |
|
| 559 |
Log.w(TAG, "Enqueue adjustment failed; no longer connected", e); |
| 560 |
} |
| 561 |
} |
| 562 |
break; |
| 563 |
} |
| 564 |
case MSG_ON_NOTIFICATION_SNOOZED: { |
| 565 |
SomeArgs args = (SomeArgs) msg.obj; |
| 566 |
StatusBarNotification sbn = (StatusBarNotification) args.arg1; |
| 567 |
String snoozeCriterionId = (String) args.arg2; |
| 568 |
args.recycle(); |
| 569 |
onNotificationSnoozedUntilContext(sbn, snoozeCriterionId); |
| 570 |
break; |
| 571 |
} |
| 572 |
case MSG_ON_NOTIFICATIONS_SEEN: { |
| 573 |
SomeArgs args = (SomeArgs) msg.obj; |
| 574 |
List<String> keys = (List<String>) args.arg1; |
| 575 |
args.recycle(); |
| 576 |
onNotificationsSeen(keys); |
| 577 |
break; |
| 578 |
} |
| 579 |
case MSG_ON_NOTIFICATION_EXPANSION_CHANGED: { |
| 580 |
SomeArgs args = (SomeArgs) msg.obj; |
| 581 |
String key = (String) args.arg1; |
| 582 |
boolean isUserAction = args.argi1 == 1; |
| 583 |
boolean isExpanded = args.argi2 == 1; |
| 584 |
args.recycle(); |
| 585 |
onNotificationExpansionChanged(key, isUserAction, isExpanded); |
| 586 |
break; |
| 587 |
} |
| 588 |
case MSG_ON_NOTIFICATION_DIRECT_REPLY_SENT: { |
| 589 |
SomeArgs args = (SomeArgs) msg.obj; |
| 590 |
String key = (String) args.arg1; |
| 591 |
args.recycle(); |
| 592 |
onNotificationDirectReplied(key); |
| 593 |
break; |
| 594 |
} |
| 595 |
case MSG_ON_SUGGESTED_REPLY_SENT: { |
| 596 |
SomeArgs args = (SomeArgs) msg.obj; |
| 597 |
String key = (String) args.arg1; |
| 598 |
CharSequence reply = (CharSequence) args.arg2; |
| 599 |
int source = args.argi2; |
| 600 |
args.recycle(); |
| 601 |
onSuggestedReplySent(key, reply, source); |
| 602 |
break; |
| 603 |
} |
| 604 |
case MSG_ON_ACTION_INVOKED: { |
| 605 |
SomeArgs args = (SomeArgs) msg.obj; |
| 606 |
String key = (String) args.arg1; |
| 607 |
Notification.Action action = (Notification.Action) args.arg2; |
| 608 |
int source = args.argi2; |
| 609 |
args.recycle(); |
| 610 |
onActionInvoked(key, action, source); |
| 611 |
break; |
| 612 |
} |
| 613 |
case MSG_ON_ALLOWED_ADJUSTMENTS_CHANGED: { |
| 614 |
onAllowedAdjustmentsChanged(); |
| 615 |
break; |
| 616 |
} |
| 617 |
case MSG_ON_PANEL_REVEALED: { |
| 618 |
SomeArgs args = (SomeArgs) msg.obj; |
| 619 |
int items = args.argi1; |
| 620 |
args.recycle(); |
| 621 |
onPanelRevealed(items); |
| 622 |
break; |
| 623 |
} |
| 624 |
case MSG_ON_PANEL_HIDDEN: { |
| 625 |
onPanelHidden(); |
| 626 |
break; |
| 627 |
} |
| 628 |
case MSG_ON_NOTIFICATION_VISIBILITY_CHANGED: { |
| 629 |
SomeArgs args = (SomeArgs) msg.obj; |
| 630 |
String key = (String) args.arg1; |
| 631 |
boolean isVisible = args.argi1 == 1; |
| 632 |
args.recycle(); |
| 633 |
onNotificationVisibilityChanged(key, isVisible); |
| 634 |
break; |
| 635 |
} |
| 636 |
case MSG_ON_NOTIFICATION_CLICKED: { |
| 637 |
SomeArgs args = (SomeArgs) msg.obj; |
| 638 |
String key = (String) args.arg1; |
| 639 |
args.recycle(); |
| 640 |
onNotificationClicked(key); |
| 641 |
break; |
| 642 |
} |
| 643 |
case MSG_ON_NOTIFICATION_FEEDBACK_RECEIVED: { |
| 644 |
SomeArgs args = (SomeArgs) msg.obj; |
| 645 |
String key = (String) args.arg1; |
| 646 |
RankingMap ranking = (RankingMap) args.arg2; |
| 647 |
Bundle feedback = (Bundle) args.arg3; |
| 648 |
args.recycle(); |
| 649 |
onNotificationFeedbackReceived(key, ranking, feedback); |
| 650 |
break; |
| 651 |
} |
| 652 |
} |
| 653 |
} |
| 654 |
} |
| 655 |
} |