diff options
| author | 2018-01-19 04:58:29 +0000 | |
|---|---|---|
| committer | 2018-01-19 04:58:29 +0000 | |
| commit | a76a9d4cb83e7f26cf734f4d74af05a54b74cc80 (patch) | |
| tree | f8cb3dcb93f0a821a70c8f3e5533c5bd4142b738 | |
| parent | 98b6993af6ac09f8686adbc0c405350e36d68ff6 (diff) | |
| parent | 54f4413375e1ea7e231caf1f2bfcfbd838316c60 (diff) | |
Merge "resolve merge conflicts of f761f6371a0350bd8d62e97d14cce869a5039572 to master"
| -rw-r--r-- | core/res/res/values/config.xml | 2 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 | ||||
| -rw-r--r-- | services/core/java/com/android/server/BluetoothManagerService.java | 10 |
3 files changed, 14 insertions, 0 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 3b02a967a4b2..8de3a98a3585 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3252,4 +3252,6 @@ <!-- Package name that should be granted Notification Assistant access --> <string name="config_defaultAssistantAccessPackage" translatable="false">android.ext.services</string> + + <bool name="config_supportBluetoothPersistedState">true</bool> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 6e33648b6f14..90be99cd6157 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3219,4 +3219,6 @@ <java-symbol type="string" name="harmful_app_warning_title" /> <java-symbol type="string" name="config_defaultAssistantAccessPackage" /> + + <java-symbol type="bool" name="config_supportBluetoothPersistedState" /> </resources> diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 337406d58f9d..20777901a3aa 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -439,10 +439,17 @@ class BluetoothManagerService extends IBluetoothManager.Stub { Settings.Global.AIRPLANE_MODE_ON, 0) == 1; } + private boolean supportBluetoothPersistedState() { + return mContext.getResources().getBoolean(R.bool.config_supportBluetoothPersistedState); + } + /** * Returns true if the Bluetooth saved state is "on" */ private boolean isBluetoothPersistedStateOn() { + if (!supportBluetoothPersistedState()) { + return false; + } int state = Settings.Global.getInt(mContentResolver, Settings.Global.BLUETOOTH_ON, -1); if (DBG) { Slog.d(TAG, "Bluetooth persisted state: " + state); @@ -454,6 +461,9 @@ class BluetoothManagerService extends IBluetoothManager.Stub { * Returns true if the Bluetooth saved state is BLUETOOTH_ON_BLUETOOTH */ private boolean isBluetoothPersistedStateOnBluetooth() { + if (!supportBluetoothPersistedState()) { + return false; + } return Settings.Global.getInt(mContentResolver, Settings.Global.BLUETOOTH_ON, BLUETOOTH_ON_BLUETOOTH) == BLUETOOTH_ON_BLUETOOTH; } |