/** * Return true if time zone needs fixing. * * @param phoneBase * @param operatorNumeric * @param prevOperatorNumeric * @param needToFixTimeZone * @return true if time zone needs to be fixed */ protected boolean shouldFixTimeZoneNow( PhoneBase phoneBase, String operatorNumeric, String prevOperatorNumeric, boolean needToFixTimeZone) { // Return false if the mcc isn't valid as we don't know where we are. // Return true if we have an IccCard and the mcc changed or we // need to fix it because when the NITZ time came in we didn't // know the country code. // If mcc is invalid then we'll return false int mcc; try { mcc = Integer.parseInt(operatorNumeric.substring(0, 3)); } catch (Exception e) { if (DBG) { log("shouldFixTimeZoneNow: no mcc, operatorNumeric=" + operatorNumeric + " retVal=false"); } return false; } // If prevMcc is invalid will make it different from mcc // so we'll return true if the card exists. int prevMcc; try { prevMcc = Integer.parseInt(prevOperatorNumeric.substring(0, 3)); } catch (Exception e) { prevMcc = mcc + 1; } // Determine if the Icc card exists boolean iccCardExist = false; if (mUiccApplcation != null) { iccCardExist = mUiccApplcation.getState() != AppState.APPSTATE_UNKNOWN; } // Determine retVal boolean retVal = ((iccCardExist && (mcc != prevMcc)) || needToFixTimeZone); if (DBG) { long ctm = System.currentTimeMillis(); log( "shouldFixTimeZoneNow: retVal=" + retVal + " iccCardExist=" + iccCardExist + " operatorNumeric=" + operatorNumeric + " mcc=" + mcc + " prevOperatorNumeric=" + prevOperatorNumeric + " prevMcc=" + prevMcc + " needToFixTimeZone=" + needToFixTimeZone + " ltod=" + TimeUtils.logTimeOfDay(ctm)); } return retVal; }
/** Process a MMI PUK code */ void processCode() { try { if (isPinPukCommand()) { // TODO: This is the same as the code in GsmMmiCode.java, // MmiCode should be an abstract or base class and this and // other common variables and code should be promoted. // sia = old PIN or PUK // sib = new PIN // sic = new PIN String oldPinOrPuk = mSia; String newPinOrPuk = mSib; int pinLen = newPinOrPuk.length(); if (isRegister()) { if (!newPinOrPuk.equals(mSic)) { // password mismatch; return error handlePasswordError(com.android.internal.R.string.mismatchPin); } else if (pinLen < 4 || pinLen > 8) { // invalid length handlePasswordError(com.android.internal.R.string.invalidPin); } else if (mSc.equals(SC_PIN) && mUiccApplication != null && mUiccApplication.getState() == AppState.APPSTATE_PUK) { // Sim is puk-locked handlePasswordError(com.android.internal.R.string.needPuk); } else if (mUiccApplication != null) { Rlog.d(LOG_TAG, "process mmi service code using UiccApp sc=" + mSc); // We have an app and the pre-checks are OK if (mSc.equals(SC_PIN)) { mUiccApplication.changeIccLockPassword( oldPinOrPuk, newPinOrPuk, obtainMessage(EVENT_SET_COMPLETE, this)); } else if (mSc.equals(SC_PIN2)) { mUiccApplication.changeIccFdnPassword( oldPinOrPuk, newPinOrPuk, obtainMessage(EVENT_SET_COMPLETE, this)); } else if (mSc.equals(SC_PUK)) { mUiccApplication.supplyPuk( oldPinOrPuk, newPinOrPuk, obtainMessage(EVENT_SET_COMPLETE, this)); } else if (mSc.equals(SC_PUK2)) { mUiccApplication.supplyPuk2( oldPinOrPuk, newPinOrPuk, obtainMessage(EVENT_SET_COMPLETE, this)); } else { throw new RuntimeException("Unsupported service code=" + mSc); } } else { throw new RuntimeException("No application mUiccApplicaiton is null"); } } else { throw new RuntimeException("Ivalid register/action=" + mAction); } } } catch (RuntimeException exc) { mState = State.FAILED; mMessage = mContext.getText(com.android.internal.R.string.mmiError); mPhone.onMMIDone(this); } }