diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 48287c9..fd67ee5 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -1014,7 +1014,7 @@
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
             <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
-                android:value="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment" />
+                android:value="com.android.settings.accessibility.CaptionPropertiesFragment" />
             <meta-data android:name="com.android.settings.TOP_LEVEL_HEADER_ID"
                 android:resource="@id/accessibility_settings" />
         </activity>
@@ -1359,13 +1359,6 @@
 
         <!-- Development settings -->
 
-        <activity android:name="DebugIntentSender" android:label="@string/debug_intent_sender_label">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.DEVELOPMENT_PREFERENCE" />
-            </intent-filter>
-        </activity>
-
         <!-- DeviceInfo adds the user's requested build to stats upload.  -->
         <receiver android:name=".DeviceInfo$StatsReportReceiver">
             <intent-filter>
diff --git a/res/layout/captioning_preview.xml b/res/layout/captioning_preview.xml
index 00d94a0..44563e4 100644
--- a/res/layout/captioning_preview.xml
+++ b/res/layout/captioning_preview.xml
@@ -40,9 +40,8 @@
             android:text="@string/captioning_preview_text" />
     </FrameLayout>
 
-    <fragment
+    <FrameLayout
         android:id="@+id/properties_fragment"
-        android:name="com.android.settings.accessibility.CaptionPropertiesFragment"
         android:layout_width="match_parent"
         android:layout_height="match_parent" />
 
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 586373c..22eb3e8 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1134,7 +1134,7 @@
     <!-- Bluetooth settings. Title of the advanced bluetooth settings screen [CHAR LIMIT=30]-->
     <string name="bluetooth_advanced_titlebar">Advanced Bluetooth</string>
     <!-- Bluetooth settings. Text displayed when Bluetooth is off and device list is empty [CHAR LIMIT=50]-->
-    <string name="bluetooth_empty_list_bluetooth_off">To see devices, turn Bluetooth on.</string>
+    <string name="bluetooth_empty_list_bluetooth_off">When Bluetooth is turned on, your device can communicate with other nearby Bluetooth devices.</string>
 
 
     <!-- Bluetooth settings.  The title of the screen to pick which profiles to connect to on the device.  For example, headphones may have both A2DP and headset, this allows the user to choose which one he wants to connect to. -->
@@ -2380,7 +2380,7 @@
     <!-- SMS Application [CHAR LIMIT=35]-->
     <string name="sms_application_title" translatable="true">Default SMS app</string>
     <string name="sms_change_default_dialog_title" translatable="true">Change SMS app?</string>
-    <string name="sms_change_default_dialog_text" translatable="true">Use <xliff:g id="new_app">%s</xliff:g> instead of <xliff:g id="current_app">%s</xliff:g> as your SMS app?</string>
+    <string name="sms_change_default_dialog_text" translatable="true">Use <xliff:g id="new_app">%1$s</xliff:g> instead of <xliff:g id="current_app">%2$s</xliff:g> as your SMS app?</string>
     <string name="sms_change_default_no_previous_dialog_text" translatable="true">Use <xliff:g id="new_app">%s</xliff:g> as your SMS app?</string>
 
     <!-- The SIM operator is not known [CHAR_ LIMIT=50]-->
@@ -3330,6 +3330,8 @@
     <string name="captioning_background_opacity">Background opacity</string>
     <!-- Title for the preference to change video caption text color. [CHAR LIMIT=35] -->
     <string name="captioning_foreground_color">Text color</string>
+    <!-- Title for the preference to change video caption text opacity. [CHAR LIMIT=35] -->
+    <string name="captioning_foreground_opacity">Text opacity</string>
     <!-- Title for the preference to change video caption edge color. [CHAR LIMIT=35] -->
     <string name="captioning_edge_color">Edge color</string>
     <!-- Title for the preference to change video caption edge type. [CHAR LIMIT=35] -->
@@ -4845,6 +4847,8 @@
     <string name="help_url_security" translatable="false"></string>
     <!-- Help URL, Tap & pay [DO NOT TRANSLATE] -->
     <string name="help_url_nfc_payment" translatable="false"></string>
+    <!-- Help URL, Remote display [DO NOT TRANSLATE] -->
+    <string name="help_url_remote_display" translatable="false"></string>
 
     <!-- User account title [CHAR LIMIT=30] -->
     <string name="user_account_title">Account for content</string>
diff --git a/res/xml/accessibility_settings.xml b/res/xml/accessibility_settings.xml
index 7b599b8..ee49bbd 100644
--- a/res/xml/accessibility_settings.xml
+++ b/res/xml/accessibility_settings.xml
@@ -28,7 +28,7 @@
             android:title="@string/accessibility_system_title">
 
         <PreferenceScreen
-            android:fragment="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment"
+            android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
             android:key="captioning_preference_screen"
             android:title="@string/accessibility_captioning_title" />
 
diff --git a/res/xml/captioning_settings.xml b/res/xml/captioning_settings.xml
index 9773943..d14d352 100644
--- a/res/xml/captioning_settings.xml
+++ b/res/xml/captioning_settings.xml
@@ -17,7 +17,7 @@
 
 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"
-    android:fragment="com.android.settings.accessibility.ToggleCaptioningPreferenceFragment"
+    android:fragment="com.android.settings.accessibility.CaptionPropertiesFragment"
     android:key="captioning_preference_screen"
     android:title="@string/accessibility_captioning_title" >
 
@@ -58,6 +58,10 @@
             android:key="captioning_foreground_color"
             android:persistent="false"
             android:title="@string/captioning_foreground_color" />
+        <com.android.settings.accessibility.ColorPreference
+            android:key="captioning_foreground_opacity"
+            android:persistent="false"
+            android:title="@string/captioning_foreground_opacity" />
 
         <com.android.settings.accessibility.EdgeTypePreference
             android:key="captioning_edge_type"
diff --git a/src/com/android/settings/DebugIntentSender.java b/src/com/android/settings/DebugIntentSender.java
deleted file mode 100644
index 9fed947..0000000
--- a/src/com/android/settings/DebugIntentSender.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings;
-
-import android.app.Activity;
-import android.widget.EditText;
-import android.widget.Button;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.text.TextUtils;
-import android.text.Spannable;
-import android.text.Selection;
-import android.net.Uri;
-
-/**
- * A simple activity that provides a UI for sending intents
- */
-public class DebugIntentSender extends Activity {
-    private EditText mIntentField;
-    private EditText mDataField;
-    private EditText mAccountField;
-    private EditText mResourceField;
-    private Button mSendBroadcastButton;
-    private Button mStartActivityButton;
-    private View.OnClickListener mClicked = new View.OnClickListener() {
-        public void onClick(View v) {
-            if ((v == mSendBroadcastButton) ||
-                       (v == mStartActivityButton)) {
-                String intentAction = mIntentField.getText().toString();
-                String intentData = mDataField.getText().toString();
-                String account = mAccountField.getText().toString();
-                String resource = mResourceField.getText().toString();
-
-                Intent intent = new Intent(intentAction);
-                if (!TextUtils.isEmpty(intentData)) {
-                    intent.setData(Uri.parse(intentData));
-                }
-                intent.putExtra("account", account);
-                intent.putExtra("resource", resource);
-                if (v == mSendBroadcastButton) {
-                    sendBroadcast(intent);
-                } else {
-                    startActivity(intent);
-                }
-
-                setResult(RESULT_OK);
-                finish();
-            }
-        }
-    };
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        setContentView(R.layout.intent_sender);
-
-        mIntentField = (EditText) findViewById(R.id.intent);
-        mIntentField.setText(Intent.ACTION_SYNC);
-        Selection.selectAll((Spannable) mIntentField.getText());
-
-        mDataField = (EditText) findViewById(R.id.data);
-        mDataField.setBackgroundResource(android.R.drawable.editbox_background);
-
-        mAccountField = (EditText) findViewById(R.id.account);
-        mResourceField = (EditText) findViewById(R.id.resource);
-
-        mSendBroadcastButton = (Button) findViewById(R.id.sendbroadcast);
-        mSendBroadcastButton.setOnClickListener(mClicked);
-
-        mStartActivityButton = (Button) findViewById(R.id.startactivity);
-        mStartActivityButton.setOnClickListener(mClicked);
-    }
-}
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
index db7eb2b..f6f49b8 100644
--- a/src/com/android/settings/Settings.java
+++ b/src/com/android/settings/Settings.java
@@ -61,8 +61,8 @@
 
 import com.android.internal.util.ArrayUtils;
 import com.android.settings.accessibility.AccessibilitySettings;
+import com.android.settings.accessibility.CaptionPropertiesFragment;
 import com.android.settings.accessibility.ToggleAccessibilityServicePreferenceFragment;
-import com.android.settings.accessibility.ToggleCaptioningPreferenceFragment;
 import com.android.settings.accounts.AccountSyncSettings;
 import com.android.settings.accounts.AuthenticatorHelper;
 import com.android.settings.accounts.ManageAccountsSettings;
@@ -326,13 +326,12 @@
         ManageApplications.class.getName(),
         ProcessStatsUi.class.getName(),
         NotificationStation.class.getName(),
-        AppOpsSummary.class.getName(),
         LocationSettings.class.getName(),
         SecuritySettings.class.getName(),
         PrivacySettings.class.getName(),
         DeviceAdminSettings.class.getName(),
         AccessibilitySettings.class.getName(),
-        ToggleCaptioningPreferenceFragment.class.getName(),
+        CaptionPropertiesFragment.class.getName(),
         TextToSpeechSettings.class.getName(),
         Memory.class.getName(),
         DevelopmentSettings.class.getName(),
@@ -1081,7 +1080,15 @@
     public static class DeviceInfoSettingsActivity extends Settings { /* empty */ }
     public static class ApplicationSettingsActivity extends Settings { /* empty */ }
     public static class ManageApplicationsActivity extends Settings { /* empty */ }
-    public static class AppOpsSummaryActivity extends Settings { /* empty */ }
+    public static class AppOpsSummaryActivity extends Settings {
+        @Override
+        public boolean isValidFragment(String className) {
+            if (AppOpsSummary.class.getName().equals(className)) {
+                return true;
+            }
+            return super.isValidFragment(className);
+        }
+    }
     public static class StorageUseActivity extends Settings { /* empty */ }
     public static class DevelopmentSettingsActivity extends Settings { /* empty */ }
     public static class AccessibilitySettingsActivity extends Settings { /* empty */ }
diff --git a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
index b010ca8..8a08d90 100644
--- a/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
+++ b/src/com/android/settings/accessibility/CaptionPropertiesFragment.java
@@ -16,6 +16,8 @@
 
 package com.android.settings.accessibility;
 
+import android.app.ActionBar;
+import android.app.Activity;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.res.Resources;
@@ -24,22 +26,46 @@
 import android.preference.ListPreference;
 import android.preference.Preference;
 import android.preference.PreferenceCategory;
+import android.preference.PreferenceFrameLayout;
 import android.preference.Preference.OnPreferenceChangeListener;
 import android.provider.Settings;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewGroup.LayoutParams;
 import android.view.accessibility.CaptioningManager;
 import android.view.accessibility.CaptioningManager.CaptionStyle;
 
+import com.android.internal.widget.SubtitleView;
 import com.android.settings.R;
 import com.android.settings.SettingsPreferenceFragment;
 import com.android.settings.accessibility.ListDialogPreference.OnValueChangedListener;
+import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeListener;
+
+import java.util.Locale;
 
 /**
  * Settings fragment containing captioning properties.
  */
 public class CaptionPropertiesFragment extends SettingsPreferenceFragment
         implements OnPreferenceChangeListener, OnValueChangedListener {
-    private ToggleCaptioningPreferenceFragment mParent;
+    private static final String PREF_BACKGROUND_COLOR = "captioning_background_color";
+    private static final String PREF_BACKGROUND_OPACITY = "captioning_background_opacity";
+    private static final String PREF_FOREGROUND_COLOR = "captioning_foreground_color";
+    private static final String PREF_FOREGROUND_OPACITY = "captioning_foreground_opacity";
+    private static final String PREF_EDGE_COLOR = "captioning_edge_color";
+    private static final String PREF_EDGE_TYPE = "captioning_edge_type";
+    private static final String PREF_FONT_SIZE = "captioning_font_size";
+    private static final String PREF_TYPEFACE = "captioning_typeface";
+    private static final String PREF_LOCALE = "captioning_locale";
+    private static final String PREF_PRESET = "captioning_preset";
+    private static final String PREF_CUSTOM = "custom";
+
+    private static final float DEFAULT_FONT_SIZE = 48f;
+
     private CaptioningManager mCaptioningManager;
+    private SubtitleView mPreviewText;
 
     // Standard options.
     private LocalePreference mLocale;
@@ -49,6 +75,7 @@
     // Custom options.
     private ListPreference mTypeface;
     private ColorPreference mForegroundColor;
+    private ColorPreference mForegroundOpacity;
     private EdgeTypePreference mEdgeType;
     private ColorPreference mEdgeColor;
     private ColorPreference mBackgroundColor;
@@ -70,35 +97,137 @@
         installUpdateListeners();
     }
 
-    /**
-     * Sets the parent fragment, which is used to update the live preview.
-     *
-     * @param parent the parent fragment
-     */
-    public void setParent(ToggleCaptioningPreferenceFragment parent) {
-        mParent = parent;
+    @Override
+    public View onCreateView(
+            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
+        final View rootView = inflater.inflate(R.layout.captioning_preview, container, false);
+
+        // We have to do this now because PreferenceFrameLayout looks at it
+        // only when the view is added.
+        if (container instanceof PreferenceFrameLayout) {
+            ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
+        }
+
+        final View content = super.onCreateView(inflater, container, savedInstanceState);
+        ((ViewGroup) rootView.findViewById(R.id.properties_fragment)).addView(
+                content, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
+
+        return rootView;
+    }
+
+    @Override
+    public void onViewCreated(View view, Bundle savedInstanceState) {
+        super.onViewCreated(view, savedInstanceState);
+
+        mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
+
+        installActionBarToggleSwitch();
+        refreshPreviewText();
+    }
+
+    private void refreshPreviewText() {
+        final Context context = getActivity();
+        if (context == null) {
+            // We've been destroyed, abort!
+            return;
+        }
+
+        final SubtitleView preview = mPreviewText;
+        if (preview != null) {
+            final int styleId = mCaptioningManager.getRawUserStyle();
+            applyCaptionProperties(mCaptioningManager, preview, styleId);
+
+            final Locale locale = mCaptioningManager.getLocale();
+            if (locale != null) {
+                final CharSequence localizedText = AccessibilityUtils.getTextForLocale(
+                        context, locale, R.string.captioning_preview_text);
+                preview.setText(localizedText);
+            } else {
+                preview.setText(R.string.captioning_preview_text);
+            }
+        }
+    }
+
+    public static void applyCaptionProperties(
+            CaptioningManager manager, SubtitleView previewText, int styleId) {
+        previewText.setStyle(styleId);
+
+        final Context context = previewText.getContext();
+        final ContentResolver cr = context.getContentResolver();
+        final float fontScale = manager.getFontScale();
+        previewText.setTextSize(fontScale * DEFAULT_FONT_SIZE);
+
+        final Locale locale = manager.getLocale();
+        if (locale != null) {
+            final CharSequence localizedText = AccessibilityUtils.getTextForLocale(
+                    context, locale, R.string.captioning_preview_characters);
+            previewText.setText(localizedText);
+        } else {
+            previewText.setText(R.string.captioning_preview_characters);
+        }
+    }
+
+    private void installActionBarToggleSwitch() {
+        final Activity activity = getActivity();
+        final ToggleSwitch toggleSwitch = new ToggleSwitch(activity);
+
+        final int padding = getResources().getDimensionPixelSize(
+                R.dimen.action_bar_switch_padding);
+        toggleSwitch.setPaddingRelative(0, 0, padding, 0);
+
+        final ActionBar actionBar = activity.getActionBar();
+        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
+
+        final ActionBar.LayoutParams params = new ActionBar.LayoutParams(
+                ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT,
+                        Gravity.CENTER_VERTICAL | Gravity.END);
+        actionBar.setCustomView(toggleSwitch, params);
+
+        final boolean enabled = mCaptioningManager.isEnabled();
+        getPreferenceScreen().setEnabled(enabled);
+        mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
+        toggleSwitch.setCheckedInternal(enabled);
+        toggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
+            @Override
+            public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
+                toggleSwitch.setCheckedInternal(checked);
+                Settings.Secure.putInt(getActivity().getContentResolver(),
+                        Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, checked ? 1 : 0);
+                getPreferenceScreen().setEnabled(checked);
+                mPreviewText.setVisibility(checked ? View.VISIBLE : View.INVISIBLE);
+                return false;
+            }
+        });
     }
 
     private void initializeAllPreferences() {
-        mLocale = (LocalePreference) findPreference("captioning_locale");
-        mFontSize = (ListPreference) findPreference("captioning_font_size");
+        mLocale = (LocalePreference) findPreference(PREF_LOCALE);
+        mFontSize = (ListPreference) findPreference(PREF_FONT_SIZE);
 
         final Resources res = getResources();
         final int[] presetValues = res.getIntArray(R.array.captioning_preset_selector_values);
         final String[] presetTitles = res.getStringArray(R.array.captioning_preset_selector_titles);
-        mPreset = (PresetPreference) findPreference("captioning_preset");
+        mPreset = (PresetPreference) findPreference(PREF_PRESET);
         mPreset.setValues(presetValues);
         mPreset.setTitles(presetTitles);
 
-        mCustom = (PreferenceCategory) findPreference("custom");
+        mCustom = (PreferenceCategory) findPreference(PREF_CUSTOM);
         mShowingCustom = true;
 
         final int[] colorValues = res.getIntArray(R.array.captioning_color_selector_values);
         final String[] colorTitles = res.getStringArray(R.array.captioning_color_selector_titles);
-        mForegroundColor = (ColorPreference) mCustom.findPreference("captioning_foreground_color");
+        mForegroundColor = (ColorPreference) mCustom.findPreference(PREF_FOREGROUND_COLOR);
         mForegroundColor.setTitles(colorTitles);
         mForegroundColor.setValues(colorValues);
-        mEdgeColor = (ColorPreference) mCustom.findPreference("captioning_edge_color");
+
+        final int[] opacityValues = res.getIntArray(R.array.captioning_opacity_selector_values);
+        final String[] opacityTitles = res.getStringArray(
+                R.array.captioning_opacity_selector_titles);
+        mForegroundOpacity = (ColorPreference) mCustom.findPreference(PREF_FOREGROUND_OPACITY);
+        mForegroundOpacity.setTitles(opacityTitles);
+        mForegroundOpacity.setValues(opacityValues);
+
+        mEdgeColor = (ColorPreference) mCustom.findPreference(PREF_EDGE_COLOR);
         mEdgeColor.setTitles(colorTitles);
         mEdgeColor.setValues(colorValues);
 
@@ -109,25 +238,22 @@
         System.arraycopy(colorTitles, 0, bgColorTitles, 1, colorTitles.length);
         bgColorValues[0] = Color.TRANSPARENT;
         bgColorTitles[0] = getString(R.string.color_none);
-        mBackgroundColor = (ColorPreference) mCustom.findPreference("captioning_background_color");
+        mBackgroundColor = (ColorPreference) mCustom.findPreference(PREF_BACKGROUND_COLOR);
         mBackgroundColor.setTitles(bgColorTitles);
         mBackgroundColor.setValues(bgColorValues);
 
-        final int[] opacityValues = res.getIntArray(R.array.captioning_opacity_selector_values);
-        final String[] opacityTitles = res.getStringArray(
-                R.array.captioning_opacity_selector_titles);
-        mBackgroundOpacity = (ColorPreference) mCustom.findPreference(
-                "captioning_background_opacity");
+        mBackgroundOpacity = (ColorPreference) mCustom.findPreference(PREF_BACKGROUND_OPACITY);
         mBackgroundOpacity.setTitles(opacityTitles);
         mBackgroundOpacity.setValues(opacityValues);
 
-        mEdgeType = (EdgeTypePreference) mCustom.findPreference("captioning_edge_type");
-        mTypeface = (ListPreference) mCustom.findPreference("captioning_typeface");
+        mEdgeType = (EdgeTypePreference) mCustom.findPreference(PREF_EDGE_TYPE);
+        mTypeface = (ListPreference) mCustom.findPreference(PREF_TYPEFACE);
     }
 
     private void installUpdateListeners() {
         mPreset.setOnValueChangedListener(this);
         mForegroundColor.setOnValueChangedListener(this);
+        mForegroundOpacity.setOnValueChangedListener(this);
         mEdgeColor.setOnValueChangedListener(this);
         mBackgroundColor.setOnValueChangedListener(this);
         mBackgroundOpacity.setOnValueChangedListener(this);
@@ -147,22 +273,11 @@
 
         final ContentResolver cr = getContentResolver();
         final CaptionStyle attrs = CaptionStyle.getCustomStyle(cr);
-        mForegroundColor.setValue(attrs.foregroundColor);
         mEdgeType.setValue(attrs.edgeType);
         mEdgeColor.setValue(attrs.edgeColor);
 
-        final int backgroundColor = attrs.backgroundColor;
-        final int bgColor;
-        final int bgAlpha;
-        if (Color.alpha(backgroundColor) == 0) {
-            bgColor = Color.TRANSPARENT;
-            bgAlpha = (backgroundColor & 0xFF) << 24;
-        } else {
-            bgColor = backgroundColor | 0xFF000000;
-            bgAlpha = backgroundColor & 0xFF000000;
-        }
-        mBackgroundColor.setValue(bgColor);
-        mBackgroundOpacity.setValue(bgAlpha | 0xFFFFFF);
+        parseColorOpacity(mForegroundColor, mForegroundOpacity, attrs.foregroundColor);
+        parseColorOpacity(mBackgroundColor, mBackgroundOpacity, attrs.backgroundColor);
 
         final String rawTypeface = attrs.mRawTypeface;
         mTypeface.setValue(rawTypeface == null ? "" : rawTypeface);
@@ -171,10 +286,30 @@
         mLocale.setValue(rawLocale == null ? "" : rawLocale);
     }
 
-    private void refreshPreviewText() {
-        if (mParent != null) {
-            mParent.refreshPreviewText();
+    private void parseColorOpacity(ColorPreference color, ColorPreference opacity, int value) {
+        final int colorValue;
+        final int opacityValue;
+        if (Color.alpha(value) == 0) {
+            colorValue = Color.TRANSPARENT;
+            opacityValue = (value & 0xFF) << 24;
+        } else {
+            colorValue = value | 0xFF000000;
+            opacityValue = value & 0xFF000000;
         }
+        color.setValue(colorValue);
+        opacity.setValue(opacityValue | 0xFFFFFF);
+    }
+
+    private int mergeColorOpacity(ColorPreference color, ColorPreference opacity) {
+        final int colorValue = color.getValue();
+        final int opacityValue = opacity.getValue();
+        final int value;
+        if (Color.alpha(colorValue) == 0) {
+            value = Color.alpha(opacityValue);
+        } else {
+            value = colorValue & 0x00FFFFFF | opacityValue & 0xFF000000;
+        }
+        return value;
     }
 
     private void refreshShowingCustom() {
@@ -191,20 +326,14 @@
     @Override
     public void onValueChanged(ListDialogPreference preference, int value) {
         final ContentResolver cr = getActivity().getContentResolver();
-        if (mForegroundColor == preference) {
+        if (mForegroundColor == preference || mForegroundOpacity == preference) {
+            final int merged = mergeColorOpacity(mForegroundColor, mForegroundOpacity);
             Settings.Secure.putInt(
-                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, value);
+                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_FOREGROUND_COLOR, merged);
         } else if (mBackgroundColor == preference || mBackgroundOpacity == preference) {
-            final int bgColor = mBackgroundColor.getValue();
-            final int bgAlpha = mBackgroundOpacity.getValue();
-            final int argb;
-            if (Color.alpha(bgColor) == 0) {
-                argb = Color.alpha(bgAlpha);
-            } else {
-                argb = bgColor & 0x00FFFFFF | bgAlpha & 0xFF000000;
-            }
+            final int merged = mergeColorOpacity(mBackgroundColor, mBackgroundOpacity);
             Settings.Secure.putInt(
-                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, argb);
+                    cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_BACKGROUND_COLOR, merged);
         } else if (mEdgeColor == preference) {
             Settings.Secure.putInt(cr, Settings.Secure.ACCESSIBILITY_CAPTIONING_EDGE_COLOR, value);
         } else if (mPreset == preference) {
diff --git a/src/com/android/settings/accessibility/PresetPreference.java b/src/com/android/settings/accessibility/PresetPreference.java
index c091f71..84aba6c 100644
--- a/src/com/android/settings/accessibility/PresetPreference.java
+++ b/src/com/android/settings/accessibility/PresetPreference.java
@@ -51,7 +51,7 @@
     protected void onBindListItem(View view, int index) {
         final SubtitleView previewText = (SubtitleView) view.findViewById(R.id.preview);
         final int value = getValueAt(index);
-        ToggleCaptioningPreferenceFragment.applyCaptionProperties(
+        CaptionPropertiesFragment.applyCaptionProperties(
                 mCaptioningManager, previewText, value);
 
         previewText.setTextSize(DEFAULT_FONT_SIZE);
diff --git a/src/com/android/settings/accessibility/ToggleCaptioningPreferenceFragment.java b/src/com/android/settings/accessibility/ToggleCaptioningPreferenceFragment.java
deleted file mode 100644
index f3c8b1c..0000000
--- a/src/com/android/settings/accessibility/ToggleCaptioningPreferenceFragment.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.settings.accessibility;
-
-import android.app.ActionBar;
-import android.app.Activity;
-import android.app.Fragment;
-import android.content.ContentResolver;
-import android.content.Context;
-import android.os.Bundle;
-import android.preference.PreferenceFrameLayout;
-import android.provider.Settings;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.accessibility.CaptioningManager;
-
-import com.android.internal.widget.SubtitleView;
-import com.android.settings.R;
-import com.android.settings.accessibility.ToggleSwitch.OnBeforeCheckedChangeListener;
-
-import java.util.Locale;
-
-public class ToggleCaptioningPreferenceFragment extends Fragment {
-    private static final float DEFAULT_FONT_SIZE = 48f;
-
-    private CaptionPropertiesFragment mPropsFragment;
-    private SubtitleView mPreviewText;
-    private CaptioningManager mCaptioningManager;
-
-    @Override
-    public void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        mCaptioningManager = (CaptioningManager) getActivity()
-                .getSystemService(Context.CAPTIONING_SERVICE);
-    }
-
-    @Override
-    public View onCreateView(
-            LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
-        final View rootView = inflater.inflate(R.layout.captioning_preview, container, false);
-
-        // We have to do this now because PreferenceFrameLayout looks at it
-        // only when the view is added.
-        if (container instanceof PreferenceFrameLayout) {
-            ((PreferenceFrameLayout.LayoutParams) rootView.getLayoutParams()).removeBorders = true;
-        }
-
-        return rootView;
-    }
-
-    @Override
-    public void onViewCreated(View view, Bundle savedInstanceState) {
-        super.onViewCreated(view, savedInstanceState);
-
-        mPropsFragment = ((CaptionPropertiesFragment) getFragmentManager()
-                .findFragmentById(R.id.properties_fragment));
-        mPropsFragment.setParent(this);
-
-        mPreviewText = (SubtitleView) view.findViewById(R.id.preview_text);
-
-        installActionBarToggleSwitch();
-        refreshPreviewText();
-    }
-
-    public void refreshPreviewText() {
-        final SubtitleView preview = mPreviewText;
-        if (preview != null) {
-            final Activity activity = getActivity();
-            final ContentResolver cr = activity.getContentResolver();
-            final int styleId = mCaptioningManager.getRawUserStyle();
-            applyCaptionProperties(mCaptioningManager, preview, styleId);
-
-            final Locale locale = mCaptioningManager.getLocale();
-            if (locale != null) {
-                final CharSequence localizedText = AccessibilityUtils.getTextForLocale(
-                        activity, locale, R.string.captioning_preview_text);
-                preview.setText(localizedText);
-            } else {
-                preview.setText(R.string.captioning_preview_text);
-            }
-        }
-    }
-
-    public static void applyCaptionProperties(
-            CaptioningManager manager, SubtitleView previewText, int styleId) {
-        previewText.setStyle(styleId);
-
-        final Context context = previewText.getContext();
-        final ContentResolver cr = context.getContentResolver();
-        final float fontScale = manager.getFontScale();
-        previewText.setTextSize(fontScale * DEFAULT_FONT_SIZE);
-
-        final Locale locale = manager.getLocale();
-        if (locale != null) {
-            final CharSequence localizedText = AccessibilityUtils.getTextForLocale(
-                    context, locale, R.string.captioning_preview_characters);
-            previewText.setText(localizedText);
-        } else {
-            previewText.setText(R.string.captioning_preview_characters);
-        }
-    }
-
-    private void installActionBarToggleSwitch() {
-        final Activity activity = getActivity();
-        final ToggleSwitch toggleSwitch = new ToggleSwitch(activity);
-
-        final int padding = getResources().getDimensionPixelSize(
-                R.dimen.action_bar_switch_padding);
-        toggleSwitch.setPaddingRelative(0, 0, padding, 0);
-
-        final ActionBar actionBar = activity.getActionBar();
-        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM, ActionBar.DISPLAY_SHOW_CUSTOM);
-
-        final ActionBar.LayoutParams params = new ActionBar.LayoutParams(
-                ActionBar.LayoutParams.WRAP_CONTENT, ActionBar.LayoutParams.WRAP_CONTENT,
-                        Gravity.CENTER_VERTICAL | Gravity.END);
-        actionBar.setCustomView(toggleSwitch, params);
-
-        final boolean enabled = mCaptioningManager.isEnabled();
-        mPropsFragment.getPreferenceScreen().setEnabled(enabled);
-        mPreviewText.setVisibility(enabled ? View.VISIBLE : View.INVISIBLE);
-        toggleSwitch.setCheckedInternal(enabled);
-        toggleSwitch.setOnBeforeCheckedChangeListener(new OnBeforeCheckedChangeListener() {
-            @Override
-            public boolean onBeforeCheckedChanged(ToggleSwitch toggleSwitch, boolean checked) {
-                toggleSwitch.setCheckedInternal(checked);
-                Settings.Secure.putInt(getActivity().getContentResolver(),
-                        Settings.Secure.ACCESSIBILITY_CAPTIONING_ENABLED, checked ? 1 : 0);
-                mPropsFragment.getPreferenceScreen().setEnabled(checked);
-                mPreviewText.setVisibility(checked ? View.VISIBLE : View.INVISIBLE);
-                return false;
-            }
-        });
-    }
-}
diff --git a/src/com/android/settings/wfd/WifiDisplaySettings.java b/src/com/android/settings/wfd/WifiDisplaySettings.java
index d04f6f2..d7f4708 100755
--- a/src/com/android/settings/wfd/WifiDisplaySettings.java
+++ b/src/com/android/settings/wfd/WifiDisplaySettings.java
@@ -137,6 +137,11 @@
     }
 
     @Override
+    protected int getHelpResource() {
+        return R.string.help_url_remote_display;
+    }
+
+    @Override
     public void onActivityCreated(Bundle savedInstanceState) {
         super.onActivityCreated(savedInstanceState);
 
