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

Commit cacf18ae authored by Yun-Hao Chung's avatar Yun-Hao Chung Committed by Yun-hao Chung
Browse files

Floss: Initialize core profile after btif is ready

In btif_hh, it is expected to enable the service after btif
initialization completes. If we enable the HID profile before btif
initialized, libbluetooth would end up in a weird state and the L2CAP
PSM would never be registered.

This change fixes the problem by delaying the core profile
initialization to btif enabled callback.

Bug: 298038671
Test: mma -j32
Test: run bluetoothAdapterEPHealth
Test: test headset CUJ on zork/morphius with WH-1000XM4
Tag: #floss
Change-Id: Id0a45e29a6a714f2ff23121e5a0c3be55908f113
parent 5da20d02
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -395,7 +395,6 @@ fn main() -> Result<(), Box<dyn Error>> {

            let mut bluetooth = bluetooth.lock().unwrap();
            bluetooth.init(init_flags);
            bluetooth.init_profiles();
            bluetooth.enable();

            bluetooth_gatt.lock().unwrap().init_profiles(tx.clone(), adapter.clone());
+3 −0
Original line number Diff line number Diff line
@@ -1263,6 +1263,9 @@ impl BtifBluetoothCallbacks for Bluetooth {
                // Initialize media
                self.bluetooth_media.lock().unwrap().initialize();

                // Initialize core profiles
                self.init_profiles();

                // Trigger properties update
                self.intf.lock().unwrap().get_adapter_properties();