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 5813bb18dbb..40d01907a43 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 8f4a3c61157..ef517e8503c 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -25,6 +25,25 @@ Deny + + 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 da55fe33f4f..d0f9dcc507e 100644 --- a/res/xml/connected_devices.xml +++ b/res/xml/connected_devices.xml @@ -52,6 +52,14 @@ settings:useAdminDisabledSummary="true" settings:controller="com.android.settings.connecteddevice.AddDevicePreferenceController"/> + +