Source:
private void handleCellBroadcastIntent(Intent intent) { Bundle extras = intent.getExtras(); if (extras == null) { Log.e(TAG, "received SMS_CB_RECEIVED_ACTION with no extras!"); return; } SmsCbMessage message = (SmsCbMessage) extras.get("message"); if (message == null) { Log.e(TAG, "received SMS_CB_RECEIVED_ACTION with no message extra"); return; } final CellBroadcastMessage cbm = new CellBroadcastMessage(message); if (!isMessageEnabledByUser(cbm)) { Log.d(TAG, "ignoring alert of type " + cbm.getServiceCategory() + " by user preference"); return; } MessageServiceCategoryAndScope newMessageServiceCategory = new MessageServiceCategoryAndScope(message.getServiceCategory(), message.getSerialNumber(), message.getLocation()); if (sCmasIdList.size() < MAX_MESSAGE_ID_SIZE) { sCmasIdList.add(newMessageServiceCategory); } else { MessageServiceCategoryAndScope oldestMessageServiceCategory = sCmasIdList.get(sCmasIdListIndex); sCmasIdList.set(sCmasIdListIndex, newMessageServiceCategory); Log.d(TAG, "message ID limit reached, removing oldest message ID " + oldestMessageServiceCategory); sCmasIdSet.remove(oldestMessageServiceCategory); if (++sCmasIdListIndex >= MAX_MESSAGE_ID_SIZE) { sCmasIdListIndex = 0; } } if (!sCmasIdSet.add(newMessageServiceCategory)) { Log.d(TAG, "ignoring duplicate alert with " + newMessageServiceCategory); return; } final Intent alertIntent = new Intent(SHOW_NEW_ALERT_ACTION); alertIntent.setClass(this, CellBroadcastAlertService.class); alertIntent.putExtra("message", cbm); new CellBroadcastContentProvider.AsyncCellBroadcastTask(getContentResolver()) .execute(new CellBroadcastContentProvider.CellBroadcastOperation() { @Override public boolean execute(CellBroadcastContentProvider provider) { if (provider.insertNewBroadcast(cbm)) { startService(alertIntent); return true; } else { return false; } } }); }

Target:
private void handleCellBroadcastIntent(Intent intent) { Bundle extras = intent.getExtras(); if (extras == null) { Log.e(TAG, "received SMS_CB_RECEIVED_ACTION with no extras!"); return; } SmsCbMessage message = (SmsCbMessage) extras.get("message"); if (message == null) { Log.e(TAG, "received SMS_CB_RECEIVED_ACTION with no message extra"); return; } final CellBroadcastMessage cbm = new CellBroadcastMessage(message); if (!isMessageEnabledByUser(cbm)) { Log.d(TAG, "ignoring alert of type " + cbm.getServiceCategory() + " by user preference"); return; } MessageServiceCategoryAndScope newCmasId = new MessageServiceCategoryAndScope( message.getServiceCategory(), message.getSerialNumber(), message.getLocation()); if (sCmasIdList.size() < MAX_MESSAGE_ID_SIZE) { sCmasIdList.add(newCmasId); } else { MessageServiceCategoryAndScope oldestCmasId = sCmasIdList.get(sCmasIdListIndex); sCmasIdList.set(sCmasIdListIndex, newCmasId); Log.d(TAG, "message ID limit reached, removing oldest message ID " + oldestCmasId); sCmasIdSet.remove(oldestCmasId); if (++sCmasIdListIndex >= MAX_MESSAGE_ID_SIZE) { sCmasIdListIndex = 0; } } if (!sCmasIdSet.add(newCmasId)) { Log.d(TAG, "ignoring duplicate alert with " + newCmasId); return; } final Intent alertIntent = new Intent(SHOW_NEW_ALERT_ACTION); alertIntent.setClass(this, CellBroadcastAlertService.class); alertIntent.putExtra("message", cbm); new CellBroadcastContentProvider.AsyncCellBroadcastTask(getContentResolver()) .execute(new CellBroadcastContentProvider.CellBroadcastOperation() { @Override public boolean execute(CellBroadcastContentProvider provider) { if (provider.insertNewBroadcast(cbm)) { startService(alertIntent); return true; } else { return false; } } }); }