summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Eisenbach <eisenbach@google.com>2016-06-27 23:42:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-06-27 23:42:17 +0000
commit4d6be6b308e4e49b9496968811fbe0c21c623215 (patch)
tree8a53085c6dbf939014159b8cd2375c2cce79003d
parentf4806982981d528a9feabb1f0c0169d89920920a (diff)
parent414011116777e66bb3364fa86b856aa3574edbfa (diff)
downloadbase-4d6be6b308e4e49b9496968811fbe0c21c623215.tar.gz
Merge "Add extra waiting when switching users" into nyc-dev
-rw-r--r--services/core/java/com/android/server/BluetoothManagerService.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java
index 59e4f2849649..172025b38337 100644
--- a/services/core/java/com/android/server/BluetoothManagerService.java
+++ b/services/core/java/com/android/server/BluetoothManagerService.java
@@ -61,7 +61,7 @@ import java.util.Map;
class BluetoothManagerService extends IBluetoothManager.Stub {
private static final String TAG = "BluetoothManagerService";
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
private static final String BLUETOOTH_ADMIN_PERM = android.Manifest.permission.BLUETOOTH_ADMIN;
private static final String BLUETOOTH_PERM = android.Manifest.permission.BLUETOOTH;
@@ -1494,7 +1494,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
bluetoothStateChangeHandler(BluetoothAdapter.STATE_ON,
BluetoothAdapter.STATE_TURNING_OFF);
- waitForOnOff(false, true);
+ boolean didDisableTimeout = !waitForOnOff(false, true);
bluetoothStateChangeHandler(BluetoothAdapter.STATE_TURNING_OFF,
BluetoothAdapter.STATE_OFF);
@@ -1512,7 +1512,16 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
mBluetoothLock.writeLock().unlock();
}
- SystemClock.sleep(100);
+ //
+ // If disabling Bluetooth times out, wait for an
+ // additional amount of time to ensure the process is
+ // shut down completely before attempting to restart.
+ //
+ if (didDisableTimeout) {
+ SystemClock.sleep(3000);
+ } else {
+ SystemClock.sleep(100);
+ }
mHandler.removeMessages(MESSAGE_BLUETOOTH_STATE_CHANGE);
mState = BluetoothAdapter.STATE_OFF;