diff options
| -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 e18265ba20df..0c2824b7305b 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3104,4 +3104,6 @@ <!-- Decide whether to display 'No service' on status bar instead of 'Emergency calls only' when SIM is unready. --> <bool name="config_display_no_service_when_sim_unready">false</bool> + + <bool name="config_supportBluetoothPersistedState">true</bool> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index f1070de93e37..ac93361ad9d2 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3082,4 +3082,6 @@ <java-symbol type="integer" name="config_stableDeviceDisplayWidth" /> <java-symbol type="integer" name="config_stableDeviceDisplayHeight" /> <java-symbol type="bool" name="config_display_no_service_when_sim_unready" /> + + <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; } |