public void dismissChatNotification(long providerId, String username) {
    NotificationInfo info;
    boolean removed;
    synchronized (mNotificationInfos) {
      info = mNotificationInfos.get(providerId);
      if (info == null) {
        return;
      }
      removed = info.removeItem(username);
    }

    if (removed) {
      if (info.getMessage() == null) {
        if (DBG) log("dismissChatNotification: removed notification for " + providerId);
        mNotificationManager.cancel(info.computeNotificationId());
      } else {
        if (DBG) {
          log(
              "cancelNotify: new notification"
                  + " mTitle="
                  + info.getTitle()
                  + " mMessage="
                  + info.getMessage()
                  + " mIntent="
                  + info.getIntent());
        }
        mNotificationManager.notify(
            info.computeNotificationId(), info.createNotification("", true));
      }
    }
  }