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

Commit 88079387 authored by Katherine Lai's avatar Katherine Lai
Browse files

floss: Prevent register scanner when adapter is off

Prevent libbluetooth crash from registering scanner when adapter
is disabled.

Bug: 298884688
Tag: #floss
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT, floss change for ChromeOS only.
Change-Id: I9de2614092da062c8c0fbda20749ddc09e1432e9
parent bbaba687
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1982,6 +1982,10 @@ impl IBluetoothGatt for BluetoothGatt {
    }

    fn register_scanner(&mut self, callback_id: u32) -> Uuid128Bit {
        if !self.enabled {
            return Uuid::empty().uu;
        }

        let mut bytes: [u8; 16] = [0; 16];
        self.small_rng.fill_bytes(&mut bytes);
        let uuid = Uuid::from(bytes);
+4 −0
Original line number Diff line number Diff line
@@ -466,6 +466,10 @@ impl Uuid {
            uuid[8], uuid[9],
            uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15])
    }

    pub fn empty() -> Uuid {
        unsafe { bindings::bluetooth::Uuid_kEmpty }
    }
}

impl Display for Uuid {