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

Commit b294234d authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge changes I375cf663,I9012c3bb am: 45af1c9b

parents 648873cd 45af1c9b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1306,6 +1306,19 @@ static void btif_dm_search_devices_evt(tBTA_DM_SEARCH_EVT event,
            pairing_cb.eir_uuids[i] = uuid.To128BitBE();
            pairing_cb.num_eir_uuids++;
          }

#if TARGET_FLOSS
          // Floss expects that EIR uuids are immediately reported when the
          // device is found and doesn't wait for the pairing intent.
          //
          // If a subsequent SDP is completed, the new UUIDs should replace the
          // existing UUIDs.
          BTIF_STORAGE_FILL_PROPERTY(
              &properties[num_properties], BT_PROPERTY_UUIDS,
              pairing_cb.num_eir_uuids * Uuid::kNumBytes128,
              pairing_cb.eir_uuids);
          num_properties++;
#endif
        }

        status =
+3 −2
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ impl CommandHandler {
                        DisplayList(
                            uuids
                                .iter()
                                .map(|&x| UuidHelper::to_string(&x))
                                .map(|&x| uuid_helper.known_uuid_to_string(&x))
                                .collect::<Vec<String>>()
                        )
                    );
@@ -529,6 +529,7 @@ impl CommandHandler {
                        (name, alias, device_type, class, bonded, connected, uuids)
                    };

                    let uuid_helper = UuidHelper::new();
                    print_info!("Address: {}", &device.address);
                    print_info!("Name: {}", name);
                    print_info!("Alias: {}", alias);
@@ -541,7 +542,7 @@ impl CommandHandler {
                        DisplayList(
                            uuids
                                .iter()
                                .map(|&x| UuidHelper::to_string(&x))
                                .map(|&x| uuid_helper.known_uuid_to_string(&x))
                                .collect::<Vec<String>>()
                        )
                    );
+19 −0
Original line number Diff line number Diff line
@@ -81,6 +81,15 @@ impl<'a> Display for UuidWrapper<'a> {
    }
}

pub struct KnownUuidWrapper<'a>(pub &'a Uuid128Bit, pub &'a Profile);

impl<'a> Display for KnownUuidWrapper<'a> {
    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
        let _ = Uuid::format(&self.0, f);
        write!(f, ": {:?}", self.1)
    }
}

pub struct UuidHelper {
    /// A list of enabled profiles on the system. These may be modified by policy.
    pub enabled_profiles: HashSet<Profile>,
@@ -165,6 +174,16 @@ impl UuidHelper {
        UuidWrapper(&uuid).to_string()
    }

    /// If a uuid is known to be a certain service, convert it into a formatted
    /// string that shows the service name. Else just format the uuid.
    pub fn known_uuid_to_string(&self, uuid: &Uuid128Bit) -> String {
        if let Some(p) = self.is_known_profile(uuid) {
            return KnownUuidWrapper(&uuid, &p).to_string();
        }

        UuidHelper::to_string(uuid)
    }

    /// Converts a well-formatted UUID string to a UUID byte array.
    /// The UUID string should be in the format:
    /// 12345678-1234-1234-1234-1234567890