Beispiel #1
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   if (ChipSupport.MTK_6595_SUPPORT == ChipSupport.getChip()
       || ChipSupport.MTK_6795_SUPPORT == ChipSupport.getChip()) {
     mPortFile = FILE_PORT_MODE_2;
   }
   if (!new File(mPortFile).exists()) {
     Toast.makeText(this, R.string.uart_usb_switch_notsupport, Toast.LENGTH_SHORT).show();
     Xlog.w(TAG, "Port mode file not exist");
     finish();
     return;
   }
   setContentView(R.layout.uart_usb_switch);
   mTvCurrent = (TextView) findViewById(R.id.uart_usb_switch_current_mode);
   mRgMode = (RadioGroup) findViewById(R.id.uart_usb_switch_mode);
   mRbUsb = (RadioButton) findViewById(R.id.uart_usb_switch_mode_usb);
   mRbUart = (RadioButton) findViewById(R.id.uart_usb_switch_mode_uart);
   mWorkerThread = new HandlerThread(TAG);
   mWorkerThread.start();
   mWorkerHandler = new WorkerHandler(mWorkerThread.getLooper());
   showDialog(DIALOG_USB_WARNING);
 }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load preferences from xml.
    addPreferencesFromResource(FRAGMENT_RES[mXmlResId]);
    PreferenceScreen screen = getPreferenceScreen();

    if (!FeatureOption.MTK_DT_SUPPORT) {
      removePreference(screen, "dualtalk_network_info");
      removePreference(screen, "dualtalk_bandmode");
    }

    // Duplicate with Network Selecting, remove them
    removePreference(screen, "digital_standard");
    if (ModemCategory.getModemType() == ModemCategory.MODEM_TD) {
      removePreference(screen, "rat_mode");
    }

    if (!FeatureOption.MTK_DT_SUPPORT) {
      removePreference(screen, "dualtalk_network_select");
    } else {
      removePreference(screen, "network_select");
    }

    // if
    // (NfcAdapter.getDefaultAdapter(getActivity().getApplicationContext())
    // == null) {
    // removePreference(screen, "nfc");
    // }
    // it's ok
    int versionCode =
        Settings.Global.getInt(getActivity().getContentResolver(), "nfc_controller_code", -1);
    if (FRAGMENT_RES[mXmlResId] == R.xml.connectivity) {
      switch (versionCode) {
        case MTK_NFC_CHIP_TYPE_MSR3110:
          Xlog.i(TAG, "MSR3110 nfc chip, call nfc");
          removePreference(screen, "hqanfc");
          break;
        case MTK_NFC_CHIP_TYPE_MT6605:
          Xlog.i(TAG, "MT6605 nfc chip, call hqanfc");
          removePreference(screen, "nfc");
          break;
        default:
          Xlog.i(TAG, "no nfc chip support");
          removePreference(screen, "hqanfc");
          removePreference(screen, "nfc");
          break;
      }
    }
    if (!FeatureOption.MTK_NFC_SUPPORT) {
      removePreference(screen, "nfc_dta");
    }
    /*if (!FeatureOption.MTK_LOG2SERVER_APP) {
        removePreference(screen, "log2server");
    }*/

    if (FeatureOption.EVDO_DT_SUPPORT
        || !FeatureOption.MTK_DT_SUPPORT
        || SystemProperties.getInt("ril.external.md", 0) == 0) {
      removePreference(screen, "ext_md_logger");
    }

    if (!FeatureOption.MTK_SMSREG_APP) {
      removePreference(screen, "device_manager");
    }

    if (FeatureOption.MTK_BSP_PACKAGE) {
      removePreference(screen, "auto_answer");
    }

    if (ChipSupport.isFeatureSupported(ChipSupport.MTK_FM_SUPPORT)) {
      if (!ChipSupport.isFeatureSupported(ChipSupport.MTK_FM_TX_SUPPORT)) {
        removePreference(screen, "fm_transmitter");
      }
    } else {
      removePreference(screen, "fm_receiver");
      removePreference(screen, "fm_transmitter");
    }

    // AGPS is not ready if MTK_AGPS_APP isn't defined
    if (!ChipSupport.isFeatureSupported(ChipSupport.MTK_AGPS_APP)
        || !ChipSupport.isFeatureSupported(ChipSupport.MTK_GPS_SUPPORT)) {
      removePreference(screen, "location_basedservice");
    }

    if (!ChipSupport.isFeatureSupported(ChipSupport.MTK_GPS_SUPPORT)) {
      removePreference(screen, "ygps");
      removePreference(screen, "cw_test");
    }

    // MATV is not ready if HAVE_MATV_FEATURE isn't defined
    if (!ChipSupport.isFeatureSupported(ChipSupport.HAVE_MATV_FEATURE)) {
      removePreference(screen, "matv");
    }

    // BT is not ready if MTK_BT_SUPPORT isn't defined
    if (!ChipSupport.isFeatureSupported(ChipSupport.MTK_BT_SUPPORT)) {
      removePreference(screen, "bluetooth");
    }

    // wifi is not ready if MTK_WLAN_SUPPORT isn't defined
    if (!ChipSupport.isFeatureSupported(ChipSupport.MTK_WLAN_SUPPORT)) {
      removePreference(screen, "wifi");
    }

    if (!isVoiceCapable() || isWifiOnly()) {
      removePreference(screen, "auto_answer");
      removePreference(screen, "repeat_call_test");
      removePreference(screen, "video_telephony");
    }

    if (!FeatureOption.MTK_VT3G324M_SUPPORT) {
      removePreference(screen, "video_telephony");
    }

    if (isWifiOnly()) {
      removePreference(screen, "GPRS");
      removePreference(screen, "Modem");
      removePreference(screen, "NetworkInfo");
      removePreference(screen, "Baseband");
      removePreference(screen, "SIMMeLock");
      removePreference(screen, "BandMode");
      removePreference(screen, "RAT Mode");
      removePreference(screen, "SWLA");
      removePreference(screen, "ModemTest");
    }

    // if it single sim, then the flow is the same as before
    if (FeatureOption.MTK_GEMINI_SUPPORT) {
      /**
       * if it is Gemini, then the flow is : it start a TabActivity, then the TabActivity will start
       * sim1 or sim2 simLock activity Intent to launch SIM lock TabActivity
       */
      // intent.setComponent(new
      // ComponentName("com.android.simmelock","com.android.simmelock.TabLockList"));
      removePreference(screen, "simme_lock1");
    } else {
      // Intent to launch SIM lock settings
      // intent.setComponent(new
      // ComponentName("com.android.simmelock","com.android.simmelock.LockList"));
      removePreference(screen, "simme_lock2");
    }
    Xlog.i(TAG, "ChipSupport.getChip(): " + ChipSupport.getChip());
    if (ChipSupport.MTK_6589_SUPPORT > ChipSupport.getChip()) {
      removePreference(screen, "de_sense");
      removePreference(screen, "camera89");
    } else {
      removePreference(screen, "camera");
    }

    if (!FeatureOption.MTK_FD_SUPPORT) {
      removePreference(screen, "fast_dormancy");
    }

    File innerLoadIndicator = new File(INNER_LOAD_INDICATOR_FILE);
    if (!innerLoadIndicator.exists()) {
      removePreference(screen, "system_update");
    }
    if (!ChipSupport.isChipInSet(ChipSupport.CHIP_657X_SERIES_NEW)) {
      removePreference(screen, "deep_idle");
      removePreference(screen, "sleep_mode");
      removePreference(screen, "dcm");
      removePreference(screen, "pll_cg");
      removePreference(screen, "cpu_dvfs");
      removePreference(screen, "mcdi_setting");
    }

    if (!FeatureOption.MTK_CDS_EM_SUPPORT) {
      removePreference(screen, "cds_information");
    }

    Preference pref = (Preference) findPreference("cmas");
    if (pref != null && !isActivityAvailable(pref.getIntent())) {
      removePreference(screen, "cmas");
    }

    if (!FeatureOption.MTK_WORLD_PHONE) {
      removePreference(screen, "world_phone");
    }

    if (!FeatureOption.EVDO_DT_SUPPORT) {
      removePreference(screen, "saber");
    }

    String mOptr = SystemProperties.get("ro.operator.optr");
    if (!"OP01".equals(mOptr)) {
      removePreference(screen, "ConfigureCheck2_Send_Test");
      removePreference(screen, "ConfigureCheck2_Self_Test");
    }

    if ("OP09".equals(mOptr)) { // For CT
      removePreference(screen, "network_select");
      removePreference(screen, "dualtalk_network_select");
    } else {
      removePreference(screen, "cdma_network_select");
    }

    if (!FeatureOption.MTK_DEVREG_APP) {
      removePreference(screen, "device_register");
    }

    if (!FeatureOption.MTK_WFD_SUPPORT) {
      removePreference(screen, "wfd_settings");
    }

    if (!FeatureOption.MTK_LTE_DC_SUPPORT) {
      removePreference(screen, "lte_config");
    }
    if (!FeatureOption.MTK_LTE_SUPPORT) {
      removePreference(screen, "lte_network_info");
    }
    removePreference(screen, "lte_network_mode");

    if (!CipUtil.isCipSupported()) {
      removePreference(screen, "cip");
    }

    if (UserHandle.MU_ENABLED && UserManager.supportsMultipleUsers()) {
      // Remove all items used phone instance
      removePreference(screen, "bandmode");
      removePreference(screen, "te_dev_tool");
      removePreference(screen, "cds_information");
      removePreference(screen, "cfu");
      removePreference(screen, "fast_dormancy");
      removePreference(screen, "gprs");
      removePreference(screen, "hspa_info");
      removePreference(screen, "mobile_data_prefer");
      removePreference(screen, "modem_test");
      removePreference(screen, "modem_warning");
      removePreference(screen, "network_info");
      removePreference(screen, "dualtalk_network_info");
      removePreference(screen, "network_select");
      removePreference(screen, "cdma_network_select");
      removePreference(screen, "dualtalk_network_select");
      removePreference(screen, "rat_mode");
      removePreference(screen, "rf_desense_test");
      removePreference(screen, "swla");
      removePreference(screen, "simme_lock1");
      removePreference(screen, "simme_lock2");
      removePreference(screen, "world_phone");
      removePreference(screen, "lte_config");
      removePreference(screen, "lte_network_mode");
      removePreference(screen, "lte_network_info");
      removePreference(screen, "lte_tool");
    }

    if (!FeatureOption.MTK_DFO_RESOLUTION_SUPPORT) {
      removePreference(screen, "dfo");
    }
  }