/**
   * Asks the user want to interrupt the current MIDlet with a new MIDlet that has received network
   * data.
   *
   * @param connection connection to place in the permission question or null for alarm
   * @return true if the use wants interrupt the current MIDlet, else false
   */
  public boolean permissionToInterrupt(String connection) {
    String name;
    MIDletSuite current;
    String question;
    String currentName;

    if (pushInterruptSetting == Permissions.USER_DENIED
        || pushInterruptSetting == Permissions.NEVER) {
      return false;
    }

    // treat SESSION level the same as ONE_SHOT

    switch (pushInterruptSetting) {
      case Permissions.ALLOW:
      case Permissions.BLANKET_GRANTED:
        return true;
    }

    name = getSuiteNameForInterrupt();

    // The currently running suite controls what question to ask.
    current = Scheduler.getScheduler().getMIDletSuite();
    if (current instanceof MIDletSuiteImpl) {
      MIDletSuiteImpl temp = (MIDletSuiteImpl) current;
      if (connection == null) {
        question = temp.getAlarmInterruptQuestion();
      } else {
        question = temp.getPushInterruptQuestion();
      }

      currentName = temp.getSuiteNameForInterrupt();
    } else {
      // use the questions of this suite
      if (connection == null) {
        question = getAlarmInterruptQuestion();
      } else {
        question = getPushInterruptQuestion();
      }

      currentName = Resource.getString("The current application");
    }

    try {
      switch (SecurityToken.askUserForPermission(
          classSecurityToken,
          "Can %1 Interrupt?",
          question,
          name,
          currentName,
          null,
          Permissions.BLANKET,
          pushInterruptSetting)) {
        case Permissions.BLANKET:
          pushInterruptSetting = Permissions.BLANKET_GRANTED;
          return true;

        case Permissions.SESSION:
        case Permissions.ONE_SHOT:
          // treat one shot as session
          pushInterruptSetting = Permissions.SESSION;
          return true;

        case Permissions.DENY:
          pushInterruptSetting = Permissions.USER_DENIED;
          return false;
      }
    } catch (InterruptedException ie) {
      return false;
    }

    // default, is cancel, ask again next time
    pushInterruptSetting = Permissions.DENY_SESSION;
    return false;
  }