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 9caf926229..d40e65e536 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 b9f886d492..e925a30b3e 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 644ce03299..039f253f9e 100644 --- a/res/xml/connected_devices.xml +++ b/res/xml/connected_devices.xml @@ -53,6 +53,14 @@ settings:useAdminDisabledSummary="true" settings:controller="com.android.settings.connecteddevice.AddDevicePreferenceController"/> + +