예제 #1
0
  CheckCurAPN(Context c, String key) {
    super(c, key);

    setTitle(R.string.apn_check_title);

    if (key.equals(CheckItemKeySet.CI_CMWAP_CHECK_ONLY)) {
      setProperty(PROPERTY_AUTO_CHECK);
      checkAPN = "cmwap";
      setNote(R.string.apn_cmwap);
      StringBuilder apn_cmwap = new StringBuilder();
      apn_cmwap.append(getContext().getString(R.string.apn_cmwap));
      apn_cmwap.append("\n" + getContext().getString(R.string.internet_doc));

      setNote(apn_cmwap.toString());
    } else if (key.equals(CheckItemKeySet.CI_CMWAP_AUTO_CONFG)
        || key.equals(CheckItemKeySet.CI_CMWAP)) {
      setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG);
      checkAPN = "cmwap";
      StringBuilder apn_cmwap = new StringBuilder();
      apn_cmwap.append(getContext().getString(R.string.apn_cmwap));
      apn_cmwap.append("\n" + getContext().getString(R.string.internet_doc));

      setNote(apn_cmwap.toString());
    } else if (key.equals(CheckItemKeySet.CI_CMNET_CHECK_ONLY)) {
      setProperty(PROPERTY_AUTO_CHECK);
      checkAPN = "cmnet";
      StringBuilder apn_cmnet = new StringBuilder();
      apn_cmnet.append(getContext().getString(R.string.apn_cmnet));
      apn_cmnet.append("\n" + getContext().getString(R.string.streaming_doc));

      setNote(apn_cmnet.toString());
    } else {
      setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG);
      checkAPN = "cmnet";
      StringBuilder apn_cmnet = new StringBuilder();
      apn_cmnet.append(getContext().getString(R.string.apn_cmnet));
      apn_cmnet.append("\n" + getContext().getString(R.string.streaming_doc));

      setNote(apn_cmnet.toString());
    }

    mSimInfoList = SimInfoManager.getInsertedSimInfoList(c);

    if (mSimInfoList.isEmpty()) {
      setProperty(PROPERTY_AUTO_CHECK);
    }
  }
예제 #2
0
  CheckLabAPN(Context c, String key) {
    super(c, key);

    setTitle(R.string.apn_check_title);

    StringBuilder noteStr = new StringBuilder();
    noteStr.append(getContext().getString(R.string.apn_name) + "\n");
    noteStr.append(getContext().getString(R.string.apn_apn_lab) + "labwap3" + "\n");
    noteStr.append(getContext().getString(R.string.apn_proxy_lab) + "\n");
    noteStr.append(getContext().getString(R.string.apn_port_lab) + "\n");
    if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS)) {
      mCheckProperty = mCheckProperty | CHECK_MMS;
      noteStr.append(getContext().getString(R.string.apn_mms) + "\n");
      noteStr.append(getContext().getString(R.string.apn_mms_proxy) + "\n");
      noteStr.append(getContext().getString(R.string.apn_mms_port) + "\n");
    } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_TYPE)) {
      mCheckProperty = mCheckProperty | CHECK_TYPE;
      noteStr.append(getContext().getString(R.string.apn_type) + "\n");
    } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS_TYPE)) {
      mCheckProperty = mCheckProperty | CHECK_MMS;
      mCheckProperty = mCheckProperty | CHECK_TYPE;
      noteStr.append(getContext().getString(R.string.apn_mms) + "\n");
      noteStr.append(getContext().getString(R.string.apn_mms_proxy) + "\n");
      noteStr.append(getContext().getString(R.string.apn_mms_port) + "\n");
      noteStr.append(getContext().getString(R.string.apn_type) + "\n");
    } else {
      mCheckProperty = CHECK_BASE;
    }

    if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS)) {
      noteStr.append(getContext().getString(R.string.agps_doc) + "\n");
      noteStr.append(getContext().getString(R.string.card_doc));
    } else if (key.equals(CheckItemKeySet.CI_LABAPN_CHECK_MMS_TYPE)) {
      noteStr.append(getContext().getString(R.string.iot_doc));
    }

    setNote(noteStr.toString());
    setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG);
    mSimInfoList = SimInfoManager.getInsertedSimInfoList(c);

    if (mSimInfoList.isEmpty()) {
      setProperty(PROPERTY_AUTO_CHECK);
    }
  }
예제 #3
0
  public check_result getCheckResult() {

    if (!isCheckable()) {
      return super.getCheckResult();
    }

    if (mSimInfoList.isEmpty()) {
      setValue(R.string.string_sim);
      return check_result.UNKNOWN;
    }

    if (mSyncDone == false) {
      mResult = check_result.UNKNOWN;
      mNeedNotify = true;
      setValue(R.string.string_checking);
      return mResult;
    }

    mNeedNotify = false;
    return mResult;
  }
예제 #4
0
  CheckSMSC(Context c, String key) {
    super(c, key);

    setTitle(R.string.smsc_check_title);

    if (key.equals(CheckItemKeySet.CI_SMSC_CHECK_ONLY)) {
      setProperty(PROPERTY_AUTO_CHECK);
    } else {
      setProperty(PROPERTY_AUTO_CHECK | PROPERTY_AUTO_CONFG);
    }

    mSimInfoList = SimInfoManager.getInsertedSimInfoList(c);

    if (mSimInfoList.isEmpty()) {
      setProperty(PROPERTY_AUTO_CHECK);
    }

    StringBuilder smscNote = new StringBuilder();
    smscNote.append(getContext().getString(R.string.smsc_number));
    smscNote.append("\n" + getContext().getString(R.string.agps_doc));

    setNote(smscNote.toString());
  }
예제 #5
0
  public boolean onCheck() {
    if (mSimInfoList.isEmpty()) {
      setValue(R.string.string_sim);
      return false;
    }

    new Thread(
            new Runnable() {
              public void run() {
                TelephonyManagerEx telephonyMgr = TelephonyManagerEx.getDefault();

                if (FeatureOption.MTK_GEMINI_SUPPORT == true) {
                  Bundle bd = new Bundle();

                  for (SimInfoRecord simInfo : mSimInfoList) {
                    int slotId = simInfo.mSimSlotId;
                    String smscStr = telephonyMgr.getScAddress(slotId);
                    bd.putString("SMSC" + slotId, smscStr);

                    CTSCLog.v("CheckSMSC", "Get Result SMSC" + slotId + " " + smscStr);
                  }

                  mSMSCHandler.sendMessage(mSMSCHandler.obtainMessage(MSG_GET_SMSC_DONE, 0, 0, bd));
                } else {
                  String smscStr = telephonyMgr.getScAddress(0);
                  Bundle bd = new Bundle();
                  bd.putString("SMSC", smscStr);
                  mSMSCHandler.sendMessage(mSMSCHandler.obtainMessage(MSG_GET_SMSC_DONE, 0, 0, bd));
                }
              }
            })
        .start();
    mSyncDone = false;

    return super.onCheck();
  }
예제 #6
0
  public check_result getCheckResult() {
    if (!isCheckable()) {
      return super.getCheckResult();
    }

    if (mSimInfoList.isEmpty()) {
      setValue(R.string.string_sim);
      return check_result.UNKNOWN;
    }

    if (true == FeatureOption.MTK_GEMINI_SUPPORT) {
      StringBuilder valueStr = new StringBuilder();
      check_result result = check_result.RIGHT;

      for (SimInfoRecord simInfo : mSimInfoList) {
        int simNo = simInfo.mSimSlotId + 1;
        Cursor cursor_APN =
            getContext()
                .getContentResolver()
                .query(
                    Uri.parse("content://telephony/carriers_sim" + simNo + "/preferapn"),
                    null,
                    null,
                    null,
                    null);

        if (cursor_APN == null || !cursor_APN.moveToNext()) {
          if (cursor_APN != null) {
            cursor_APN.close();
          }

          if (valueStr.toString().length() != 0) {
            valueStr.append("\n");
          }
          valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_setted));
          result = check_result.WRONG;
          mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
        } else {
          String curAPN = cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.APN));

          cursor_APN.close();

          if (curAPN.equalsIgnoreCase(checkAPN)) {

          } else {
            result = check_result.WRONG;
            if (valueStr.toString().length() != 0) {
              valueStr.append("\n");
            }
            valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_correct));
            mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
          }
        }
      }

      setValue(valueStr.toString());
      return result;
    } else {
      Cursor cursor_APN =
          getContext()
              .getContentResolver()
              .query(Uri.parse("content://telephony/carriers/preferapn"), null, null, null, null);
      if (cursor_APN == null || !cursor_APN.moveToNext()) {
        if (cursor_APN != null) {
          cursor_APN.close();
        }

        setValue(R.string.apn_not_setted);
        return check_result.WRONG;
      } else {
        String curAPN = cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.APN));
        cursor_APN.close();

        if (curAPN.equalsIgnoreCase(checkAPN)) {
          setValue("");
          return check_result.RIGHT;
        } else {
          setValue(R.string.apn_not_correct);
          return check_result.WRONG;
        }
      }
    }
  }
예제 #7
0
  public check_result getCheckResult() {
    if (!isCheckable()) {
      return super.getCheckResult();
    }

    if (mSimInfoList.isEmpty()) {
      setValue(R.string.string_sim);
      return check_result.UNKNOWN;
    }

    if (true == FeatureOption.MTK_GEMINI_SUPPORT) {
      StringBuilder valueStr = new StringBuilder();
      check_result result = check_result.RIGHT;

      for (SimInfoRecord simInfo : mSimInfoList) {
        int simNo = simInfo.mSimSlotId + 1;
        Cursor cursor_APN =
            getContext()
                .getContentResolver()
                .query(
                    Uri.parse("content://telephony/carriers_sim" + simNo + "/preferapn"),
                    null,
                    null,
                    null,
                    null);

        if (cursor_APN == null || !cursor_APN.moveToNext()) {
          if (cursor_APN != null) {
            cursor_APN.close();
          }
          valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_setted));
          result = check_result.WRONG;
          mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
        } else {
          String curAPN = cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.APN));
          String curAPNProxy =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.PROXY));
          String curAPNPort =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.PORT));
          String curAPNMMS =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSC));
          String curAPNType =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.TYPE));
          String curAPNMMSProxy =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSPROXY));
          String curAPNMMSPort =
              cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSPORT));

          cursor_APN.close();

          if (curAPN.equalsIgnoreCase("labwap3")
              && curAPNProxy.equalsIgnoreCase("192.168.230.8")
              && curAPNPort.equalsIgnoreCase("9028")) {
            if ((mCheckProperty & CHECK_MMS) != 0) {
              if (false == curAPNMMS.equalsIgnoreCase("http://218.206.176.175:8181/was")
                  || false == curAPNMMSProxy.equalsIgnoreCase("192.168.230.8")
                  || false == curAPNMMSPort.equalsIgnoreCase("9028")) {
                result = check_result.WRONG;
                mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
                if (valueStr.toString().length() != 0) {
                  valueStr.append("\n");
                }
                valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_correct));
              }
            }

            if ((mCheckProperty & CHECK_TYPE) != 0) {
              if (null == curAPNType) {
                result = check_result.WRONG;
                mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
                if (valueStr.toString().length() != 0) {
                  valueStr.append("\n");
                }
                valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_correct));
              } else if (false == curAPNType.equals("default,mms,net")) {
                result = check_result.WRONG;
                mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
                if (valueStr.toString().length() != 0) {
                  valueStr.append("\n");
                }
                valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_correct));
              }
            }
          } else {
            result = check_result.WRONG;
            mSimNeedSetAPN.add(new Integer(simInfo.mSimSlotId));
            if (valueStr.toString().length() != 0) {
              valueStr.append("\n");
            }
            valueStr.append("Sim" + simNo + getContext().getString(R.string.apn_not_correct));
          }
        }
      }

      setValue(valueStr.toString());
      return result;
    } else {
      Cursor cursor_APN =
          getContext()
              .getContentResolver()
              .query(Uri.parse("content://telephony/carriers/preferapn"), null, null, null, null);
      if (cursor_APN == null || !cursor_APN.moveToNext()) {
        if (cursor_APN != null) {
          cursor_APN.close();
        }

        setValue(R.string.apn_not_setted);
        return check_result.WRONG;
      } else {
        String curAPN = cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.APN));
        String curAPNProxy =
            cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.PROXY));
        String curAPNPort =
            cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.PORT));
        String curAPNMMS = cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSC));
        String curAPNType =
            cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.TYPE));
        String curAPNMMSProxy =
            cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSPROXY));
        String curAPNMMSPort =
            cursor_APN.getString(cursor_APN.getColumnIndex(Telephony.Carriers.MMSPORT));

        cursor_APN.close();

        if (curAPN.equalsIgnoreCase("labwap3")
            && curAPNProxy.equalsIgnoreCase("192.168.230.8")
            && curAPNPort.equalsIgnoreCase("9028")) {
          if ((mCheckProperty & CHECK_MMS) != 0) {
            if (false == curAPNMMS.equalsIgnoreCase("http://218.206.176.175:8181/was")
                || false == curAPNMMSProxy.equalsIgnoreCase("192.168.230.8")
                || false == curAPNMMSPort.equalsIgnoreCase("9028")) {
              setValue(R.string.apn_not_correct);
              return check_result.WRONG;
            }
          }

          if ((mCheckProperty & CHECK_TYPE) != 0) {
            if (null == curAPNType) {
              setValue(R.string.apn_not_correct);
              return check_result.WRONG;
            } else if (false == curAPNType.equals("default,mms,net")) {
              setValue(R.string.apn_not_correct);
              return check_result.WRONG;
            }
          }

          setValue("");
          return check_result.RIGHT;
        } else {
          return check_result.WRONG;
        }
      }
    }
  }