From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Oliver Scott Date: Fri, 2 Oct 2020 12:37:30 -0400 Subject: [PATCH] add bluetooth auto-turn-off setting --- res/values/arrays.xml | 44 +++++++ res/values/strings.xml | 19 +++ res/xml/connected_devices.xml | 8 ++ .../BluetoothTimeoutPreferenceController.java | 115 ++++++++++++++++++ 4 files changed, 186 insertions(+) create mode 100644 src/com/android/settings/bluetooth/BluetoothTimeoutPreferenceController.java diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 35e3247663..5adc98d256 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -39,6 +39,50 @@ All + + + @string/bluetooth_timeout_summary_never + @string/bluetooth_timeout_summary_15secs + @string/bluetooth_timeout_summary_30secs + @string/bluetooth_timeout_summary_1min + @string/bluetooth_timeout_summary_2mins + @string/bluetooth_timeout_summary_5mins + @string/bluetooth_timeout_summary_10mins + @string/bluetooth_timeout_summary_30mins + @string/bluetooth_timeout_summary_1hour + @string/bluetooth_timeout_summary_2hours + @string/bluetooth_timeout_summary_4hours + @string/bluetooth_timeout_summary_8hours + + + + + + 0 + + 15000 + + 30000 + + 60000 + + 120000 + + 300000 + + 600000 + + 1800000 + + 3600000 + + 7200000 + + 14400000 + + 28800000 + + 15 seconds diff --git a/res/values/strings.xml b/res/values/strings.xml index c1aaf40f96..7ea1708b72 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -27,6 +27,25 @@ Turn on + + Bluetooth timeout + + + Bluetooth will turn off after %1$s if no devices connected + Do not automatically turn off Bluetooth + Never + 15 seconds + 30 seconds + 1 minute + 2 minutes + 5 minutes + 10 minutes + 30 minutes + 1 hour + 2 hours + 4 hours + 8 hours + Unknown diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml index a0e0a1f26d..ded58ebd41 100644 --- a/res/xml/connected_devices.xml +++ b/res/xml/connected_devices.xml @@ -47,6 +47,14 @@ settings:useAdminDisabledSummary="true" settings:controller="com.android.settings.connecteddevice.AddDevicePreferenceController"/> + +