private void handleSmsReceived(Intent intent, int error) {
    SmsMessage[] msgs = Intents.getMessagesFromIntent(intent);
    String format = intent.getStringExtra("format");
    Uri messageUri = insertMessage(this, msgs, error, format);

    if (Log.isLoggable(LogTag.TRANSACTION, Log.VERBOSE) || LogTag.DEBUG_SEND) {
      SmsMessage sms = msgs[0];
      Log.v(
          TAG,
          "handleSmsReceived"
              + (sms.isReplace() ? "(replace)" : "")
              + " messageUri: "
              + messageUri
              + ", address: "
              + sms.getOriginatingAddress()
              + ", body: "
              + sms.getMessageBody());
    }

    if (messageUri != null) {
      long threadId = MessagingNotification.getSmsThreadId(this, messageUri);
      // Called off of the UI thread so ok to block.
      Log.d(TAG, "handleSmsReceived messageUri: " + messageUri + " threadId: " + threadId);
      MessagingNotification.blockingUpdateNewMessageIndicator(this, threadId, false);
    }
  }
  private void handleBootCompleted() {
    // Some messages may get stuck in the outbox. At this point, they're probably irrelevant
    // to the user, so mark them as failed and notify the user, who can then decide whether to
    // resend them manually.
    int numMoved = moveOutboxMessagesToFailedBox();
    if (numMoved > 0) {
      MessagingNotification.notifySendFailed(getApplicationContext(), true);
    }

    // Send any queued messages that were waiting from before the reboot.
    sendFirstQueuedMessage();

    // Called off of the UI thread so ok to block.
    MessagingNotification.blockingUpdateNewMessageIndicator(
        this, MessagingNotification.THREAD_ALL, false);
  }