Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6979c8bb authored by Andre Eisenbach's avatar Andre Eisenbach Committed by Gerrit Code Review
Browse files

Merge "Add Developer menu entry to disable Bluetooth absolute volume"

parents 8cb4301b bbf4f661
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -3645,6 +3645,8 @@
    <string name="legacy_dhcp_client">Use legacy DHCP client</string>
    <!-- Setting Checkbox title whether to always keep cellular data active. [CHAR LIMIT=80] -->
    <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  -->
    <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>
    <!-- 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>
    <!-- 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] -->
    <string name="enforce_read_external_title" product="nosdcard">Protect USB storage</string>
+4 −0
Original line number Diff line number Diff line
@@ -156,6 +156,10 @@
            android:entries="@array/usb_configuration_titles"
            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 android:key="debug_input_category"
+20 −0
Original line number Diff line number Diff line
@@ -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 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 OPENGL_TRACES_KEY = "enable_opengl_traces";
@@ -227,6 +232,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
    private SwitchPreference mWifiAggressiveHandover;
    private SwitchPreference mLegacyDhcpClient;
    private SwitchPreference mMobileDataAlwaysOn;
    private SwitchPreference mBluetoothDisableAbsVolume;

    private SwitchPreference mWifiAllowScansWithTraffic;
    private SwitchPreference mStrictMode;
@@ -380,6 +386,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        mMobileDataAlwaysOn = findAndInitSwitchPref(MOBILE_DATA_ALWAYS_ON);
        mLogdSize = addListPreference(SELECT_LOGD_SIZE_KEY);
        mUsbConfiguration = addListPreference(USB_CONFIGURATION_KEY);
        mBluetoothDisableAbsVolume = findAndInitSwitchPref(BLUETOOTH_DISABLE_ABSOLUTE_VOLUME_KEY);

        mWindowAnimationScale = addListPreference(WINDOW_ANIMATION_SCALE_KEY);
        mTransitionAnimationScale = addListPreference(TRANSITION_ANIMATION_SCALE_KEY);
@@ -632,6 +639,7 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
        updateMobileDataAlwaysOnOptions();
        updateSimulateColorSpace();
        updateUSBAudioOptions();
        updateBluetoothDisableAbsVolumeOptions();
    }

    private void resetDangerousOptions() {
@@ -1252,6 +1260,16 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
                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() {
        updateSwitchPreference(mMobileDataAlwaysOn, Settings.Global.getInt(
                getActivity().getContentResolver(),
@@ -1750,6 +1768,8 @@ public class DevelopmentSettings extends SettingsPreferenceFragment
            writeUSBAudioOptions();
        } else if (INACTIVE_APPS_KEY.equals(preference.getKey())) {
            startInactiveAppsFragment();
        } else if (preference == mBluetoothDisableAbsVolume) {
            writeBluetoothDisableAbsVolumeOptions();
        } else {
            return super.onPreferenceTreeClick(preferenceScreen, preference);
        }