[DO NOT MERGE] Do not allow Bluetooth enabling during device
shutting down Bug: 207521630 Test: reboot device in BLE_ON state, check log Change-Id: I5e68ecd7816a6e636ebb9cef070dd32fbd9bf3c4
This commit is contained in:
@@ -193,6 +193,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
// used inside handler thread
|
// used inside handler thread
|
||||||
private boolean mQuietEnable = false;
|
private boolean mQuietEnable = false;
|
||||||
private boolean mEnable;
|
private boolean mEnable;
|
||||||
|
private boolean mShutdownInProgress = false;
|
||||||
|
|
||||||
private static CharSequence timeToLog(long timestamp) {
|
private static CharSequence timeToLog(long timestamp) {
|
||||||
return android.text.format.DateFormat.format("MM-dd HH:mm:ss", timestamp);
|
return android.text.format.DateFormat.format("MM-dd HH:mm:ss", timestamp);
|
||||||
@@ -464,6 +465,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
}
|
}
|
||||||
} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
|
} else if (action.equals(Intent.ACTION_SHUTDOWN)) {
|
||||||
Slog.i(TAG, "Device is shutting down.");
|
Slog.i(TAG, "Device is shutting down.");
|
||||||
|
mShutdownInProgress = true;
|
||||||
mBluetoothLock.readLock().lock();
|
mBluetoothLock.readLock().lock();
|
||||||
try {
|
try {
|
||||||
mEnable = false;
|
mEnable = false;
|
||||||
@@ -1867,6 +1869,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
|
|||||||
case MESSAGE_ENABLE:
|
case MESSAGE_ENABLE:
|
||||||
int quietEnable = msg.arg1;
|
int quietEnable = msg.arg1;
|
||||||
int isBle = msg.arg2;
|
int isBle = msg.arg2;
|
||||||
|
if (mShutdownInProgress) {
|
||||||
|
Slog.i(TAG, "Skip Bluetooth Enable in device shutdown process");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED)
|
if (mHandler.hasMessages(MESSAGE_HANDLE_DISABLE_DELAYED)
|
||||||
|| mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) {
|
|| mHandler.hasMessages(MESSAGE_HANDLE_ENABLE_DELAYED)) {
|
||||||
// We are handling enable or disable right now, wait for it.
|
// We are handling enable or disable right now, wait for it.
|
||||||
|
|||||||
Reference in New Issue
Block a user