private void setScreenState() {
   if (isAirplaneModeOn()) {
     mNetworkSetting.setEnabled(false);
     mCallSetting.setEnabled(false);
     mEnablerPreference.setEnabled(false);
     mCDMACheckbox.setChecked(false);
     mGSMCheckbox.setChecked(false);
   } else {
     mNetworkSetting.setEnabled(isSubActivated());
     mCallSetting.setEnabled(isSubActivated());
     mEnablerPreference.setEnabled(hasCard());
     mCDMACheckbox.setEnabled(mEnablerPreference.isCard1Active());
     mGSMCheckbox.setEnabled(mEnablerPreference.isCard1Active());
     for (int i = 0; i < MAX_SUBSCRIPTIONS; i++) {
       Subscription sub = mSubscriptionManager.getCurrentSubscription(i);
       Log.d(LOG_TAG, "kangta" + sub.toString());
       if (sub.subId == 0) {
         mCDMACheckbox.setChecked(
             ((sub.subStatus == Subscription.SubscriptionStatus.SUB_ACTIVATED && sub.slotId == 0)
                 ? true
                 : false));
       } else if (sub.subId == 1) {
         mGSMCheckbox.setChecked(
             ((sub.subStatus == Subscription.SubscriptionStatus.SUB_ACTIVATED && sub.slotId == 0)
                 ? true
                 : false));
       }
     }
   }
 }
  private void switchToGSMStep2() {
    mSubscriptionManager.registerForSetSubscriptionCompleted(
        mHandler, EVENT_SET_SUBSCRIPTION_DONE, null);

    for (int i = 0; i < MAX_SUBSCRIPTIONS; i++) {
      mUserSelSub.subscription[i].copyFrom(mSubscriptionManager.getCurrentSubscription(i));
    }

    for (int i = 0; i < MAX_SUBSCRIPTIONS; i++) {
      mUserSelSub.subscription[i].clear();
      mUserSelSub.subscription[i].subId = i;
      mUserSelSub.subscription[i].iccId = mIccId;
    }
    mUserSelSub.subscription[0].slotId = SUBSCRIPTION_INDEX_INVALID;
    mUserSelSub.subscription[0].m3gppIndex = SUBSCRIPTION_INDEX_INVALID;
    mUserSelSub.subscription[0].m3gpp2Index = SUBSCRIPTION_INDEX_INVALID;
    mUserSelSub.subscription[0].subStatus = Subscription.SubscriptionStatus.SUB_DEACTIVATE;
    mUserSelSub.subscription[0].appType = "RUIM";

    mUserSelSub.subscription[1].slotId = 0;
    mUserSelSub.subscription[1].m3gppIndex = 0;
    mUserSelSub.subscription[1].m3gpp2Index = -1;
    mUserSelSub.subscription[1].subStatus = Subscription.SubscriptionStatus.SUB_ACTIVATE;
    mUserSelSub.subscription[1].appType = "SIM";
    setSubscription();
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.multi_sim_configuration_dual_mode);

    mPrefScreen = getPreferenceScreen();

    Intent intent = getIntent();
    mSubscription = intent.getIntExtra(SUBSCRIPTION_KEY, CARD1);
    mSubscriptionManager = SubscriptionManager.getInstance();

    mNamePreference = (MultiSimNamePreference) findPreference(KEY_SIM_NAME);
    mNamePreference.setSubscription(mSubscription);

    mEnablerPreference = (MultiSimEnablerForDualMode) findPreference(KEY_SIM_ENABLER);
    mEnablerPreference.setSubscription(this, mSubscription);
    mNetworkSetting = (PreferenceScreen) findPreference(KEY_NETWORK_SETTING);
    mNetworkSetting
        .getIntent()
        .putExtra(
            MultiSimSettingsConstants.TARGET_PACKAGE, MultiSimSettingsConstants.NETWORK_PACKAGE)
        .putExtra(MultiSimSettingsConstants.TARGET_CLASS, MultiSimSettingsConstants.NETWORK_CLASS)
        .putExtra(SUBSCRIPTION_KEY, mSubscription);

    mCallSetting = (PreferenceScreen) findPreference(KEY_CALL_SETTING);
    mCallSetting
        .getIntent()
        .putExtra(MultiSimSettingsConstants.TARGET_PACKAGE, MultiSimSettingsConstants.CALL_PACKAGE)
        .putExtra(MultiSimSettingsConstants.TARGET_CLASS, MultiSimSettingsConstants.CALL_CLASS)
        .putExtra(SUBSCRIPTION_KEY, mSubscription);

    mIntentFilter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED);
    mCardSubscriptionManager = CardSubscriptionManager.getInstance();
    mCDMACheckbox = (CheckBoxPreference) findPreference(KEY_CDMA_CHECKBOX);
    mGSMCheckbox = (CheckBoxPreference) findPreference(KEY_GSM_CHECKBOX);
    mCDMACheckbox.setOnPreferenceChangeListener(this);
    mGSMCheckbox.setOnPreferenceChangeListener(this);
    mUserSelSub = new SubscriptionData(MAX_SUBSCRIPTIONS);
    mCardSubscrInfo = new SubscriptionData[MAX_SUBSCRIPTIONS];
    mCurrentSelSub = new SubscriptionData(MAX_SUBSCRIPTIONS);
    for (int i = 0; i < MAX_SUBSCRIPTIONS; i++) {
      mCardSubscrInfo[i] = mCardSubscriptionManager.getCardSubscriptions(i);
      if (mCardSubscrInfo[i] != null) {
        Log.d(LOG_TAG, mCardSubscrInfo[i].toString());
        if (i == CARD1) {
          mIccId = mCardSubscrInfo[CARD1].subscription[0].iccId;
        }
      }

      Subscription sub = mSubscriptionManager.getCurrentSubscription(i);
      mCurrentSelSub.subscription[i].copyFrom(sub);
    }
    mUserSelSub.copyFrom(mCurrentSelSub);
    Log.d(LOG_TAG, "Current sub start....");
    Log.d(LOG_TAG, mCurrentSelSub.toString());
    Log.d(LOG_TAG, "Current sub end....");

    if (mSubscriptionManager.isSetSubscriptionInProgress()) {
      Log.d(LOG_TAG, "onCreate: SetSubscription is in progress when started this activity");
      showDialog(DIALOG_SET_SUBSCRIPTION_IN_PROGRESS);
      mSubscriptionManager.registerForSetSubscriptionCompleted(
          mHandler, EVENT_SET_SUBSCRIPTION_DONE, null);
    }
    mstm = (MSimTelephonyManager) this.getSystemService(Context.MSIM_TELEPHONY_SERVICE);
  }