From 03f2f52e6f7d659742d1c539a9afbfd8dcf79c61 Mon Sep 17 00:00:00 2001 From: Oliver Scott Date: Fri, 2 Oct 2020 12:37:30 -0400 Subject: [PATCH] Bluetooth timeout feature * Now use AOSP settings storage instead of LineageSettings. This is so the Bluetooth APEX module can access the setting. Also includes squashed change: Author: Tommy Webb Date: Thu May 18 13:49:24 2023 -0400 fixup! Bluetooth timeout feature Only allow admin users to adjust the Bluetooth timeout. Issue: calyxos#1633 Change-Id: I8b3ae8f0faffde194ee417548e7d200842000fb6 Issue: calyxos#124 Change-Id: I4f4646139cd42b7ad20b486ed77dd00499aa3c6e Signed-off-by: Pranav Vashi --- AndroidManifest.xml | 7 + res/values/evolution_arrays.xml | 31 +++++ res/values/evolution_strings.xml | 20 +++ res/xml/connected_devices.xml | 8 ++ .../BluetoothTimeoutPreferenceController.java | 121 ++++++++++++++++++ 5 files changed, 187 insertions(+) create mode 100644 src/com/android/settings/bluetooth/BluetoothTimeoutPreferenceController.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 3ed7e42fc4e..8390bbcd81b 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -4249,6 +4249,13 @@ + + + + + + diff --git a/res/values/evolution_arrays.xml b/res/values/evolution_arrays.xml index 3a3dba52000..9b3731d455e 100644 --- a/res/values/evolution_arrays.xml +++ b/res/values/evolution_arrays.xml @@ -17,4 +17,35 @@ 1 0 + + + + @string/custom_timeout_summary_never + @string/custom_timeout_summary_15secs + @string/custom_timeout_summary_30secs + @string/custom_timeout_summary_1min + @string/custom_timeout_summary_2mins + @string/custom_timeout_summary_5mins + @string/custom_timeout_summary_10mins + @string/custom_timeout_summary_30mins + @string/custom_timeout_summary_1hour + @string/custom_timeout_summary_2hours + @string/custom_timeout_summary_4hours + @string/custom_timeout_summary_8hours + + + + 0 + 15000 + 30000 + 60000 + 120000 + 300000 + 600000 + 1800000 + 3600000 + 7200000 + 14400000 + 28800000 + diff --git a/res/values/evolution_strings.xml b/res/values/evolution_strings.xml index 0d311d5a26f..b50422155ae 100644 --- a/res/values/evolution_strings.xml +++ b/res/values/evolution_strings.xml @@ -87,4 +87,24 @@ Market Name SoC Model Total RAM + + + Bluetooth timeout + Do not automatically turn off Bluetooth + Bluetooth will turn off after %1$s if no devices connected + Never + 5 seconds + 10 seconds + 15 seconds + 30 seconds + 1 minute + 2 minutes + 5 minutes + 10 minutes + 20 minutes + 30 minutes + 1 hour + 2 hours + 4 hours + 8 hours diff --git a/res/xml/connected_devices.xml b/res/xml/connected_devices.xml index 06fb5a7941d..31d6a7024e8 100644 --- a/res/xml/connected_devices.xml +++ b/res/xml/connected_devices.xml @@ -61,6 +61,14 @@ settings:useAdminDisabledSummary="true" settings:userRestriction="no_config_bluetooth" /> + +