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

Commit f8653faf authored by Antoine SOULIER's avatar Antoine SOULIER
Browse files

Reduce the AOSP reserved range for vendor-specific events

The code 0x51 conflicts with this range (already reserved by partner).

Bug: 360924438
Bug: 360925496
Test: mma -j32
Flag: com.android.bluetooth.flags.hci_vendor_specific_extension
Change-Id: I542e000c08bf32f654c5afb9f1602cf41fac9c0f
parent c1563865
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4180,7 +4180,7 @@ public class AdapterService extends Service {
            Set<Integer> eventCodesSet =
                    Arrays.stream(eventCodes).boxed().collect(Collectors.toSet());
            if (eventCodesSet.stream()
                    .anyMatch((n) -> (n < 0) || (n >= 0x50 && n < 0x60) || (n > 0xff))) {
                    .anyMatch((n) -> (n < 0) || (n >= 0x52 && n < 0x60) || (n > 0xff))) {
                throw new IllegalArgumentException("invalid vendor-specific event code");
            }

+3 −3
Original line number Diff line number Diff line
@@ -5839,8 +5839,8 @@ public final class BluetoothAdapter {
     * Register an {@link BluetoothHciVendorCallback} to listen for HCI vendor responses and events
     *
     * @param eventCodeSet Set of vendor-specific event codes to listen for updates. Each
     *     vendor-specific event code must be in the range 0x00 to 0x4f or 0x60 to 0xff.
     *     The inclusive range 0x50-0x5f is reserved by the system.
     *     vendor-specific event code must be in the range 0x00 to 0x4f or 0x60 to 0xff. The
     *     inclusive range 0x52-0x5f is reserved by the system.
     * @param executor an {@link Executor} to execute given callback
     * @param callback user implementation of the {@link BluetoothHciVendorCallback}
     * @throws IllegalArgumentException if the callback is already registered, or event codes not in
@@ -5860,7 +5860,7 @@ public final class BluetoothAdapter {
        requireNonNull(executor);
        requireNonNull(callback);
        if (eventCodeSet.stream()
                .anyMatch((n) -> (n < 0) || (n >= 0x50 && n < 0x60) || (n > 0xff))) {
                .anyMatch((n) -> (n < 0) || (n >= 0x52 && n < 0x60) || (n > 0xff))) {
            throw new IllegalArgumentException("Event code not in valid range");
        }

+1 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ static void CommandStatusOrCompleteCallback(BluetoothHciVendorSpecificCallbacks*

static void EventCallback(BluetoothHciVendorSpecificCallbacks* callbacks,
                          VendorSpecificEventView view) {
  const uint8_t aosp_reserved_codes_range[] = {0x50, 0x60};
  const uint8_t aosp_reserved_codes_range[] = {0x52, 0x60};
  auto code = static_cast<uint8_t>(view.GetSubeventCode());
  if (code >= aosp_reserved_codes_range[0] && code < aosp_reserved_codes_range[1]) {
    return;