diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 09f1072..ec6ea2b 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -398,7 +398,8 @@
             cdmaOptions.setIntent(mSubscriptionInfoHelper.getIntent(CdmaCallOptions.class));
             gsmOptions.setIntent(mSubscriptionInfoHelper.getIntent(GsmUmtsCallOptions.class));
         } else {
-            prefSet.removePreference(cdmaOptions);
+            // Remove GSM options and repopulate the preferences in this Activity if phone type is
+            // GSM.
             prefSet.removePreference(gsmOptions);
 
             int phoneType = mPhone.getPhoneType();
@@ -406,12 +407,16 @@
                 prefSet.removePreference(fdnButton);
             } else {
                 if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
+                    // For now, just keep CdmaCallOptions as one entity. Eventually CDMA should
+                    // follow the same pattern as GSM below, where VP and Call forwarding are
+                    // populated here and Call waiting is populated in another "Additional Settings"
+                    // submenu for CDMA.
                     prefSet.removePreference(fdnButton);
-                    addPreferencesFromResource(R.xml.cdma_call_privacy);
-                    CdmaVoicePrivacySwitchPreference buttonVoicePrivacy =
-                            (CdmaVoicePrivacySwitchPreference) findPreference(BUTTON_VP_KEY);
-                    buttonVoicePrivacy.setPhone(mPhone);
+                    cdmaOptions.setSummary(null);
+                    cdmaOptions.setTitle(R.string.additional_gsm_call_settings);
+                    cdmaOptions.setIntent(mSubscriptionInfoHelper.getIntent(CdmaCallOptions.class));
                 } else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+                    prefSet.removePreference(cdmaOptions);
                     if (mPhone.getIccCard() == null || !mPhone.getIccCard().getIccFdnAvailable()) {
                         prefSet.removePreference(fdnButton);
                     }
diff --git a/src/com/android/phone/CdmaCallOptions.java b/src/com/android/phone/CdmaCallOptions.java
index 2e310aa..40e3517 100644
--- a/src/com/android/phone/CdmaCallOptions.java
+++ b/src/com/android/phone/CdmaCallOptions.java
@@ -32,7 +32,6 @@
     private static final String BUTTON_VP_KEY = "button_voice_privacy_key";
     private static final String CALL_FORWARDING_KEY = "call_forwarding_key";
     private static final String CALL_WAITING_KEY = "call_waiting_key";
-    private CdmaVoicePrivacySwitchPreference mButtonVoicePrivacy;
 
     @Override
     protected void onCreate(Bundle icicle) {
@@ -44,8 +43,9 @@
         subInfoHelper.setActionBarTitle(
                 getActionBar(), getResources(), R.string.labelCdmaMore_with_label);
 
-        mButtonVoicePrivacy = (CdmaVoicePrivacySwitchPreference) findPreference(BUTTON_VP_KEY);
-        mButtonVoicePrivacy.setPhone(subInfoHelper.getPhone());
+        CdmaVoicePrivacySwitchPreference buttonVoicePrivacy =
+                (CdmaVoicePrivacySwitchPreference) findPreference(BUTTON_VP_KEY);
+        buttonVoicePrivacy.setPhone(subInfoHelper.getPhone());
         PersistableBundle carrierConfig;
         if (subInfoHelper.hasSubId()) {
             carrierConfig = PhoneGlobals.getInstance().getCarrierConfigForSubId(
@@ -55,16 +55,26 @@
         }
         if (subInfoHelper.getPhone().getPhoneType() != PhoneConstants.PHONE_TYPE_CDMA
                 || carrierConfig.getBoolean(CarrierConfigManager.KEY_VOICE_PRIVACY_DISABLE_UI_BOOL)) {
-            // disable the entire screen
-            mButtonVoicePrivacy.setEnabled(false);
+            buttonVoicePrivacy.setEnabled(false);
         }
 
         Preference callForwardingPref = getPreferenceScreen().findPreference(CALL_FORWARDING_KEY);
-        callForwardingPref.setIntent(subInfoHelper.getIntent(CdmaCallForwardOptions.class));
+        if (carrierConfig != null && carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_CALL_FORWARDING_VISIBILITY_BOOL)) {
+            callForwardingPref.setIntent(
+                    subInfoHelper.getIntent(CdmaCallForwardOptions.class));
+        } else {
+            getPreferenceScreen().removePreference(callForwardingPref);
+        }
 
         CdmaCallWaitingPreference callWaitingPref = (CdmaCallWaitingPreference)getPreferenceScreen()
                                                      .findPreference(CALL_WAITING_KEY);
-        callWaitingPref.init(this, subInfoHelper.getPhone());
+        if (carrierConfig != null && carrierConfig.getBoolean(
+                CarrierConfigManager.KEY_ADDITIONAL_SETTINGS_CALL_WAITING_VISIBILITY_BOOL)) {
+            callWaitingPref.init(this, subInfoHelper.getPhone());
+        } else {
+            getPreferenceScreen().removePreference(callWaitingPref);
+        }
     }
 
     @Override
