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

Commit a7e6f39a authored by Amin Shaikh's avatar Amin Shaikh
Browse files

[PATCH] Fix SyetemUI can not get the new profile connect state after device reboot

Bluetooth will automatically open after device reboot.
SystemUI will construct LocalBluetoothManager, readPairedDevices will be called in the construction of LocalBluetoothmanager.
Since mLocalBluetoothManager.getEventManager.registerCallback is after the LocalBluetoothManager's construction.
SystemUI does not receive the message onDeviceAdded. As a result, CacheDevice.registerCallback cannot be registered later.
So the device cannot receive the OnDeviceAttributesChanged message when the device connects to the second profile.

Fixes: 136606985

Test: manual
1. Open BT, connect a bluetooth headset, a bluetooth mouse。
2. Reboot the device.
3. After the bluetooth headset auto connect, connect the bluetooth mouse again.
4. Check the status bar.

Change-Id: I460e632943f445a19f2273a5b1087ba1c27d841c
parent 8288111d
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -293,6 +293,18 @@ public class BluetoothControllerImpl implements BluetoothController, BluetoothCa
        mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED);
    }

    @Override
    public void onProfileConnectionStateChanged(CachedBluetoothDevice cachedDevice,
            int state, int bluetoothProfile) {
        if (DEBUG) {
            Log.d(TAG, "ProfileConnectionStateChanged=" + cachedDevice.getAddress() + " "
                    + stateToString(state) + " profileId=" + bluetoothProfile);
        }
        mCachedState.remove(cachedDevice);
        updateConnected();
        mHandler.sendEmptyMessage(H.MSG_STATE_CHANGED);
    }

    @Override
    public void onAclConnectionStateChanged(CachedBluetoothDevice cachedDevice, int state) {
        if (DEBUG) {