Ejemplo n.º 1
0
  @Override
  protected void onResume() {
    super.onResume();
    if (!isSimReady()) {
      log("Add NP lock fail : SIM not ready!");
      return;
    }

    // To get the MCC+MNC+GID1+GID2 from SIM card
    TelephonyManager telephonyManager = (TelephonyManager) getSystemService(TELEPHONY_SERVICE);
    if (!FeatureOption.MTK_GEMINI_SUPPORT) {
      mSimMccMnc = telephonyManager.getSimOperator();

      Phone phone = PhoneFactory.getDefaultPhone();
      IccFileHandler iccFh = ((PhoneProxy) phone).getIccFileHandler();
      iccFh.loadEFTransparent(IccConstants.EF_GID1, mHandler.obtainMessage(EVENT_GET_SIM_GID1));
      iccFh.loadEFTransparent(IccConstants.EF_GID2, mHandler.obtainMessage(EVENT_GET_SIM_GID2));
    } else {
      TelephonyManagerEx telephonyManagerEx = TelephonyManagerEx.getDefault();
      mSimMccMnc = telephonyManagerEx.getSimOperator(simNumber);

      GeminiPhone mGeminiPhone = (GeminiPhone) PhoneFactory.getDefaultPhone();
      IccFileHandler iccFh =
          ((PhoneProxy) (mGeminiPhone.getPhonebyId(simNumber))).getIccFileHandler();
      iccFh.loadEFTransparent(IccConstants.EF_GID1, mHandler.obtainMessage(EVENT_GET_SIM_GID1));
      iccFh.loadEFTransparent(IccConstants.EF_GID2, mHandler.obtainMessage(EVENT_GET_SIM_GID2));

      // To get the GID2 from SIM card //TEMP
      mSimGid2 = telephonyManagerEx.getSimOperatorName(simNumber);
      if (mSimGid2 == null) {
        log("Fail to read SIM GID2!");
      } else {
        log("[Gemini]Succeed to read SIM GID2. SIM GID2 is " + mSimGid2);
      }
    }

    if (mSimMccMnc == null) {
      log("Fail to read SIM MCC+MNC!");
    } else {
      log("Read SIM MCC+MNC: " + mSimMccMnc);
    }
  }
Ejemplo n.º 2
-1
 private String getImei() {
   String imei = null;
   String Imei1 = TelephonyManagerEx.getDefault().getDeviceId(0);
   String Imei2 = TelephonyManagerEx.getDefault().getDeviceId(1);
   imei = Imei1 + "\n" + Imei2;
   return imei;
 }