Esempio n. 1
0
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:58:54.921 -0500",
      hash_original_method = "E50365918A8B4813331E3A24E11292EF",
      hash_generated_method = "3CBE59FC5B8ED7B8F451502F6184DC1C")
  @Override
  protected void onAllRecordsLoaded() {
    Log.d(LOG_TAG, "RuimRecords: record load complete");

    // Further records that can be inserted are Operator/OEM dependent

    String operator = getRUIMOperatorNumeric();
    SystemProperties.set(PROPERTY_ICC_OPERATOR_NUMERIC, operator);

    if (mImsi != null) {
      SystemProperties.set(
          PROPERTY_ICC_OPERATOR_ISO_COUNTRY,
          MccTable.countryCodeForMcc(Integer.parseInt(mImsi.substring(0, 3))));
    }
    recordsLoadedRegistrants.notifyRegistrants(new AsyncResult(null, null, null));
    phone.mIccCard.broadcastIccStateChangedIntent(RuimCard.INTENT_VALUE_ICC_LOADED, null);
  }
Esempio n. 2
0
  /**
   * Returns the 5 or 6 digit MCC/MNC of the operator that provided the RUIM card. Returns null of
   * RUIM is not yet ready
   */
  @DSSource({DSSourceKind.NETWORK})
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:58:54.910 -0500",
      hash_original_method = "1499AC64B3568BF128EFDB3C9845AC3C",
      hash_generated_method = "951A50BCD18A3DFD623BEB79035586BE")
  public String getRUIMOperatorNumeric() {
    if (mImsi == null) {
      return null;
    }

    if (mncLength != UNINITIALIZED && mncLength != UNKNOWN) {
      // Length = length of MCC + length of MNC
      // length of mcc = 3 (3GPP2 C.S0005 - Section 2.3)
      return mImsi.substring(0, 3 + mncLength);
    }

    // Guess the MNC length based on the MCC if we don't
    // have a valid value in ef[ad]

    int mcc = Integer.parseInt(mImsi.substring(0, 3));
    return mImsi.substring(0, 3 + MccTable.smallestDigitsMccForMnc(mcc));
  }
Esempio n. 3
0
  @DSSafe(DSCat.IPC_CALLBACK)
  @DSGenerator(
      tool_name = "Doppelganger",
      tool_version = "2.0",
      generated_on = "2013-12-30 12:58:54.915 -0500",
      hash_original_method = "584E0C361321C2DCD1B11D8CE97AF6DF",
      hash_generated_method = "CAF5DAE398870082803BAF9A29AA061A")
  @Override
  public void handleMessage(Message msg) {
    AsyncResult ar;

    byte data[];

    boolean isRecordLoadResponse = false;

    try {
      switch (msg.what) {
        case EVENT_RUIM_READY:
          onRuimReady();
          break;

        case EVENT_RADIO_OFF_OR_NOT_AVAILABLE:
          onRadioOffOrNotAvailable();
          break;

        case EVENT_GET_DEVICE_IDENTITY_DONE:
          Log.d(LOG_TAG, "Event EVENT_GET_DEVICE_IDENTITY_DONE Received");
          break;

          /* IO events */
        case EVENT_GET_IMSI_DONE:
          isRecordLoadResponse = true;

          ar = (AsyncResult) msg.obj;
          if (ar.exception != null) {
            Log.e(LOG_TAG, "Exception querying IMSI, Exception:" + ar.exception);
            break;
          }

          mImsi = (String) ar.result;

          // IMSI (MCC+MNC+MSIN) is at least 6 digits, but not more
          // than 15 (and usually 15).
          if (mImsi != null && (mImsi.length() < 6 || mImsi.length() > 15)) {
            Log.e(LOG_TAG, "invalid IMSI " + mImsi);
            mImsi = null;
          }

          Log.d(LOG_TAG, "IMSI: " + mImsi.substring(0, 6) + "xxxxxxxxx");

          String operatorNumeric = getRUIMOperatorNumeric();
          if (operatorNumeric != null) {
            if (operatorNumeric.length() <= 6) {
              MccTable.updateMccMncConfiguration(phone, operatorNumeric);
            }
          }
          break;

        case EVENT_GET_CDMA_SUBSCRIPTION_DONE:
          ar = (AsyncResult) msg.obj;
          String localTemp[] = (String[]) ar.result;
          if (ar.exception != null) {
            break;
          }

          mMyMobileNumber = localTemp[0];
          mMin2Min1 = localTemp[3];
          mPrlVersion = localTemp[4];

          Log.d(LOG_TAG, "MDN: " + mMyMobileNumber + " MIN: " + mMin2Min1);

          break;

        case EVENT_GET_ICCID_DONE:
          isRecordLoadResponse = true;

          ar = (AsyncResult) msg.obj;
          data = (byte[]) ar.result;

          if (ar.exception != null) {
            break;
          }

          iccid = IccUtils.bcdToString(data, 0, data.length);

          Log.d(LOG_TAG, "iccid: " + iccid);

          break;

        case EVENT_UPDATE_DONE:
          ar = (AsyncResult) msg.obj;
          if (ar.exception != null) {
            Log.i(LOG_TAG, "RuimRecords update failed", ar.exception);
          }
          break;

        case EVENT_GET_ALL_SMS_DONE:
        case EVENT_MARK_SMS_READ_DONE:
        case EVENT_SMS_ON_RUIM:
        case EVENT_GET_SMS_DONE:
          Log.w(LOG_TAG, "Event not supported: " + msg.what);
          break;

          // TODO: probably EF_CST should be read instead
        case EVENT_GET_SST_DONE:
          Log.d(LOG_TAG, "Event EVENT_GET_SST_DONE Received");
          break;

        case EVENT_RUIM_REFRESH:
          isRecordLoadResponse = false;
          ar = (AsyncResult) msg.obj;
          if (ar.exception == null) {
            handleRuimRefresh((int[]) (ar.result));
          }
          break;
      }
    } catch (RuntimeException exc) {
      // I don't want these exceptions to be fatal
      Log.w(LOG_TAG, "Exception parsing RUIM record", exc);
    } finally {
      // Count up record load responses even if they are fails
      if (isRecordLoadResponse) {
        onRecordLoaded();
      }
    }
  }