Add setting to disable automatic USB audio routing

Bug: 16381952
Change-Id: I7335ed4c3ec8d5f9cb9a9bd2a9d2f9e0f3a63c43
This commit is contained in:
Glenn Kasten
2014-07-22 09:14:08 -07:00
parent aea9ae0004
commit ca54234efc
3 changed files with 27 additions and 0 deletions

View File

@@ -4767,6 +4767,11 @@
<!-- UI debug setting: force use of NuPlayer summary [CHAR LIMIT=50] --> <!-- UI debug setting: force use of NuPlayer summary [CHAR LIMIT=50] -->
<string name="use_nuplayer_summary">Use NuPlayer instead of AwesomePlayer</string> <string name="use_nuplayer_summary">Use NuPlayer instead of AwesomePlayer</string>
<!-- UI debug setting: disable USB audio routing title [CHAR LIMIT=25] -->
<string name="usb_audio_disable_routing">Disable USB audio routing</string>
<!-- UI debug setting: disable USB audio routing summary [CHAR LIMIT=50] -->
<string name="usb_audio_disable_routing_summary">Disable automatic routing to USB audio peripherals</string>
<!-- UI debug setting: show layout bounds information [CHAR LIMIT=25] --> <!-- UI debug setting: show layout bounds information [CHAR LIMIT=25] -->
<string name="debug_layout">Show layout bounds</string> <string name="debug_layout">Show layout bounds</string>
<!-- UI debug setting: show layout bounds information summary [CHAR LIMIT=50] --> <!-- UI debug setting: show layout bounds information summary [CHAR LIMIT=50] -->

View File

@@ -251,6 +251,11 @@
android:title="@string/use_nuplayer" android:title="@string/use_nuplayer"
android:summary="@string/use_nuplayer_summary"/> android:summary="@string/use_nuplayer_summary"/>
<CheckBoxPreference
android:key="usb_audio"
android:title="@string/usb_audio_disable_routing"
android:summary="@string/usb_audio_disable_routing_summary" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:key="debug_monitoring_category" <PreferenceCategory android:key="debug_monitoring_category"

View File

@@ -117,6 +117,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String DISABLE_OVERLAYS_KEY = "disable_overlays"; private static final String DISABLE_OVERLAYS_KEY = "disable_overlays";
private static final String SIMULATE_COLOR_SPACE = "simulate_color_space"; private static final String SIMULATE_COLOR_SPACE = "simulate_color_space";
private static final String USE_NUPLAYER_KEY = "use_nuplayer"; private static final String USE_NUPLAYER_KEY = "use_nuplayer";
private static final String USB_AUDIO_KEY = "usb_audio";
private static final String USE_AWESOMEPLAYER_PROPERTY = "persist.sys.media.use-awesome"; private static final String USE_AWESOMEPLAYER_PROPERTY = "persist.sys.media.use-awesome";
private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage"; private static final String SHOW_CPU_USAGE_KEY = "show_cpu_usage";
private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui"; private static final String FORCE_HARDWARE_UI_KEY = "force_hw_ui";
@@ -222,6 +223,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private ListPreference mSimulateColorSpace; private ListPreference mSimulateColorSpace;
private CheckBoxPreference mUseNuplayer; private CheckBoxPreference mUseNuplayer;
private CheckBoxPreference mUSBAudio;
private CheckBoxPreference mImmediatelyDestroyActivities; private CheckBoxPreference mImmediatelyDestroyActivities;
private ListPreference mAppProcessLimit; private ListPreference mAppProcessLimit;
@@ -343,6 +345,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY); mOpenGLTraces = addListPreference(OPENGL_TRACES_KEY);
mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE); mSimulateColorSpace = addListPreference(SIMULATE_COLOR_SPACE);
mUseNuplayer = findAndInitCheckboxPref(USE_NUPLAYER_KEY); mUseNuplayer = findAndInitCheckboxPref(USE_NUPLAYER_KEY);
mUSBAudio = findAndInitCheckboxPref(USB_AUDIO_KEY);
mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference( mImmediatelyDestroyActivities = (CheckBoxPreference) findPreference(
IMMEDIATELY_DESTROY_ACTIVITIES_KEY); IMMEDIATELY_DESTROY_ACTIVITIES_KEY);
@@ -549,6 +552,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
updateWifiAllowScansWithTrafficOptions(); updateWifiAllowScansWithTrafficOptions();
updateSimulateColorSpace(); updateSimulateColorSpace();
updateUseNuplayerOptions(); updateUseNuplayerOptions();
updateUSBAudioOptions();
} }
private void resetDangerousOptions() { private void resetDangerousOptions() {
@@ -1013,6 +1017,17 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
pokeSystemProperties(); pokeSystemProperties();
} }
private void updateUSBAudioOptions() {
updateCheckBox(mUSBAudio, Settings.Secure.getInt(getContentResolver(),
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED, 0) != 0);
}
private void writeUSBAudioOptions() {
Settings.Secure.putInt(getContentResolver(),
Settings.Secure.USB_AUDIO_AUTOMATIC_ROUTING_DISABLED,
mUSBAudio.isChecked() ? 1 : 0);
}
private void updateForceRtlOptions() { private void updateForceRtlOptions() {
updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(), updateCheckBox(mForceRtlLayout, Settings.Global.getInt(getActivity().getContentResolver(),
Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0); Settings.Global.DEVELOPMENT_FORCE_RTL, 0) != 0);
@@ -1417,6 +1432,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
writeWifiAllowScansWithTrafficOptions(); writeWifiAllowScansWithTrafficOptions();
} else if (preference == mUseNuplayer) { } else if (preference == mUseNuplayer) {
writeUseNuplayerOptions(); writeUseNuplayerOptions();
} else if (preference == mUSBAudio) {
writeUSBAudioOptions();
} else { } else {
return super.onPreferenceTreeClick(preferenceScreen, preference); return super.onPreferenceTreeClick(preferenceScreen, preference);
} }