/**
  * Removes the given MMI from the pending list and notifies registrants that it is complete.
  *
  * @param mmi MMI that is done
  */
 /*package*/ void onMMIDone(GsmMmiCode mmi) {
   /* Only notify complete if it's on the pending list.
    * Otherwise, it's already been handled (eg, previously canceled).
    * The exception is cancellation of an incoming USSD-REQUEST, which is
    * not on the list.
    */
   if (mPendingMMIs.remove(mmi) || mmi.isUssdRequest()) {
     mMmiCompleteRegistrants.notifyRegistrants(new AsyncResult(null, mmi, null));
   }
 }
  static GsmMmiCode newNetworkInitiatedUssd(
      String ussdMessage, boolean isUssdRequest, GSMPhone phone, UiccCardApplication app) {
    GsmMmiCode ret;

    ret = new GsmMmiCode(phone, app);

    ret.message = ussdMessage;
    ret.isUssdRequest = isUssdRequest;

    // If it's a request, set to PENDING so that it's cancelable.
    if (isUssdRequest) {
      ret.isPendingUSSD = true;
      ret.state = State.PENDING;
    } else {
      ret.state = State.COMPLETE;
    }

    return ret;
  }