Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 396b4c2c authored by Gurpreet Ghai's avatar Gurpreet Ghai Committed by Steve Kondik
Browse files

BT: Set persiste Bluetooth State during enable timeout case

Use case: When enable timeout occurs during S&S testing and
Bluetooth state is moved from Turning On to Off.

Steps: Changes related to enable timeout case, to test the
changes, S&S testing can be done.

Failure: Changes done to handle Bluetooth enable timeout
case when Bluetooth state changes from Turning On to Off.

Root cause: Setting Bluetooth Persist state to handle the
enable timeout case so that Bluetooth doesnot self enable
after enable timeout case is handled.

Fix: Setting the Bluetooth Persist State to Off when enable
timeout occurs.

Change-Id: I17b3b05020eb7469666e6d8c88c86df7764b4024
CRs-Fixed: 1006444
parent 34040d04
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -2067,13 +2067,14 @@ public final class BluetoothAdapter {
            }

            public void onBluetoothServiceDown() {
                if (VDBG) Log.d(TAG, "onBluetoothServiceDown: " + mService);
                Log.d(TAG, "onBluetoothServiceDown: " + mService);
                synchronized (mManagerCallback) {
                    mService = null;
                    if (mLeScanClients != null) mLeScanClients.clear();
                    if (sBluetoothLeAdvertiser != null) sBluetoothLeAdvertiser.cleanup();
                    if (sBluetoothLeScanner != null) sBluetoothLeScanner.cleanup();
                    synchronized (mProxyServiceStateCallbacks) {
                        Log.d(TAG, "onBluetoothServiceDown: Sending callbacks to " + mProxyServiceStateCallbacks.size() + " clients");
                        for (IBluetoothManagerCallback cb : mProxyServiceStateCallbacks ){
                            try {
                                if (cb != null) {
@@ -2085,6 +2086,7 @@ public final class BluetoothAdapter {
                        }
                    }
                }
                Log.d(TAG, "onBluetoothServiceDown: Finished sending callbacks to registered clients");
            }

            public void onBrEdrDown() {
+9 −2
Original line number Diff line number Diff line
@@ -763,6 +763,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                    }  catch (RemoteException e) {
                        Log.e(TAG, "Unable to call onBluetoothServiceUp() on callback #" + i, e);
                    }
                    Log.d(TAG, "Broadcasted onBluetoothServiceUp() to " + mCallbacks.getBroadcastItem(i));
                }
            } finally {
                mCallbacks.finishBroadcast();
@@ -784,6 +785,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                    }  catch (RemoteException e) {
                        Log.e(TAG, "Unable to call onBluetoothServiceDown() on callback #" + i, e);
                    }
                    Log.d(TAG, "Broadcasted onBluetoothServiceDown() to " + mCallbacks.getBroadcastItem(i));
                }
            } finally {
                mCallbacks.finishBroadcast();
@@ -1144,6 +1146,11 @@ class BluetoothManagerService extends IBluetoothManager.Stub {
                        (mBluetooth != null) && mEnable) {
                        recoverBluetoothServiceFromError();
                    }
                    if ((prevState == BluetoothAdapter.STATE_TURNING_ON) &&
                            (newState == BluetoothAdapter.STATE_OFF) &&
                            (mBluetooth != null) && mEnable) {
                        persistBluetoothSetting(BLUETOOTH_OFF);
                    }
                    if ((prevState == BluetoothAdapter.STATE_TURNING_ON) &&
                            (newState == BluetoothAdapter.STATE_BLE_ON) &&
                            (mBluetooth != null) && mEnable) {