/*
     * Use PIN or PUK to unlock SIM card
     *
     * If PUK is null, unlock SIM card with PIN
     *
     * If PUK is not null, unlock SIM card with PUK and set PIN code
     */
    synchronized boolean unlockSim(String puk, String pin) {

      while (mHandler == null) {
        try {
          wait();
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
        }
      }
      Message callback = Message.obtain(mHandler, SUPPLY_PIN_COMPLETE);

      if (puk == null) {
        mSimCard.supplyPin(pin, callback);
      } else {
        mSimCard.supplyPuk(puk, pin, callback);
      }

      while (!mDone) {
        try {
          Log.d(LOG_TAG, "wait for done");
          wait();
        } catch (InterruptedException e) {
          // Restore the interrupted status
          Thread.currentThread().interrupt();
        }
      }
      Log.d(LOG_TAG, "done");
      return mResult;
    }