Add Developer menu entry to disable Bluetooth absolute volume

Bug: 27078729
Change-Id: I8a029baeb25b449446ae9bcc8cb220d5ec8e44a9
This commit is contained in:
Andre Eisenbach
2016-02-08 15:40:23 -08:00
parent 8cb4301b59
commit bbf4f66143
3 changed files with 28 additions and 0 deletions

View File

@@ -3645,6 +3645,8 @@
<string name="legacy_dhcp_client">Use legacy DHCP client</string> <string name="legacy_dhcp_client">Use legacy DHCP client</string>
<!-- Setting Checkbox title whether to always keep cellular data active. [CHAR LIMIT=80] --> <!-- Setting Checkbox title whether to always keep cellular data active. [CHAR LIMIT=80] -->
<string name="mobile_data_always_on">Cellular data always active</string> <string name="mobile_data_always_on">Cellular data always active</string>
<!-- Setting Checkbox title for disabling Bluetooth absolute volume -->
<string name="bluetooth_disable_absolute_volume">Disable absolute volume</string>
<!-- setting Checkbox summary whether to show options for wireless display certification --> <!-- setting Checkbox summary whether to show options for wireless display certification -->
<string name="wifi_display_certification_summary">Show options for wireless display certification</string> <string name="wifi_display_certification_summary">Show options for wireless display certification</string>
@@ -3685,6 +3687,8 @@
<string name="verify_apps_over_usb_title">Verify apps over USB</string> <string name="verify_apps_over_usb_title">Verify apps over USB</string>
<!-- Summary of checkbox setting to perform package verification on apps installed over USB/ADT/ADB [CHAR LIMIT=NONE] --> <!-- Summary of checkbox setting to perform package verification on apps installed over USB/ADT/ADB [CHAR LIMIT=NONE] -->
<string name="verify_apps_over_usb_summary">Check apps installed via ADB/ADT for harmful behavior.</string> <string name="verify_apps_over_usb_summary">Check apps installed via ADB/ADT for harmful behavior.</string>
<!-- Summary of checkbox for disabling Bluetooth absolute volume -->
<string name="bluetooth_disable_absolute_volume_summary">Disables the Bluetooth absolute volume feature in case of volume issues with remote devices such as unacceptably loud volume or lack of control.</string>
<!-- Title of checkbox setting that protects external storage. [CHAR LIMIT=32] --> <!-- Title of checkbox setting that protects external storage. [CHAR LIMIT=32] -->
<string name="enforce_read_external_title" product="nosdcard">Protect USB storage</string> <string name="enforce_read_external_title" product="nosdcard">Protect USB storage</string>

View File

@@ -156,6 +156,10 @@
android:entries="@array/usb_configuration_titles" android:entries="@array/usb_configuration_titles"
android:entryValues="@array/usb_configuration_values" /> android:entryValues="@array/usb_configuration_values" />
<SwitchPreference
android:key="bluetooth_disable_absolute_volume"
android:title="@string/bluetooth_disable_absolute_volume"
android:summary="@string/bluetooth_disable_absolute_volume_summary"/>
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory android:key="debug_input_category" <PreferenceCategory android:key="debug_input_category"

View File

@@ -168,6 +168,11 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on"; private static final String MOBILE_DATA_ALWAYS_ON = "mobile_data_always_on";
private static final String KEY_COLOR_MODE = "color_mode"; private static final String KEY_COLOR_MODE = "color_mode";
private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY =
"bluetooth_disable_absolute_volume";
private static final String BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY =
"persist.bluetooth.disableabsvol";
private static final String INACTIVE_APPS_KEY = "inactive_apps"; private static final String INACTIVE_APPS_KEY = "inactive_apps";
private static final String OPENGL_TRACES_KEY = "enable_opengl_traces"; private static final String OPENGL_TRACES_KEY = "enable_opengl_traces";
@@ -227,6 +232,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
private SwitchPreference mWifiAggressiveHandover; private SwitchPreference mWifiAggressiveHandover;
private SwitchPreference mLegacyDhcpClient; private SwitchPreference mLegacyDhcpClient;
private SwitchPreference mMobileDataAlwaysOn; private SwitchPreference mMobileDataAlwaysOn;
private SwitchPreference mBluetoothDisableAbsVolume;
private SwitchPreference mWifiAllowScansWithTraffic; private SwitchPreference mWifiAllowScansWithTraffic;
private SwitchPreference mStrictMode; private SwitchPreference mStrictMode;
@@ -380,6 +386,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON); mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY); mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY); mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);
mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY); mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY); mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -632,6 +639,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
updateMobileDataAlwaysOnOptions(); updateMobileDataAlwaysOnOptions();
updateSimulateColorSpace(); updateSimulateColorSpace();
updateUSBAudioOptions(); updateUSBAudioOptions();
updateBluetoothDisableAbsVolumeOptions();
} }
private void resetDangerousOptions() { private void resetDangerousOptions() {
@@ -1252,6 +1260,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
mLegacyDhcpClient.isChecked() ? 1 : 0); mLegacyDhcpClient.isChecked() ? 1 : 0);
} }
private void updateBluetoothDisableAbsVolumeOptions() {
updateSwitchPreference(mBluetoothDisableAbsVolume,
SystemProperties.getBoolean(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY, false));
}
private void writeBluetoothDisableAbsVolumeOptions() {
SystemProperties.set(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_PROPERTY,
mBluetoothDisableAbsVolume.isChecked() ? "true" : "false");
}
private void updateMobileDataAlwaysOnOptions() { private void updateMobileDataAlwaysOnOptions() {
updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt( updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
getActivity().getContentResolver(), getActivity().getContentResolver(),
@@ -1750,6 +1768,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
writeUSBAudioOptions(); writeUSBAudioOptions();
} else if (INACTIVE_APPS_KEY.equals(preference.getKey())) { } else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
startInactiveAppsFragment(); startInactiveAppsFragment();
} else if (preference == mBluetoothDisableAbsVolume) {
writeBluetoothDisableAbsVolumeOptions();
} else { } else {
return super.onPreferenceTreeClick(preferenceScreen, preference); return super.onPreferenceTreeClick(preferenceScreen, preference);
} }