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

Commit 0ee75a87 authored by Antoine Soulier's avatar Antoine Soulier Committed by Gerrit Code Review
Browse files

Merge "Reduce the AOSP reserved range for vendor-specific events The code 0x51...

Merge "Reduce the AOSP reserved range for vendor-specific events The code 0x51 conflicts with this range (already reserved by partner)." into main
parents beacb06c f8653faf
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4179,7 +4179,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
@@ -5830,8 +5830,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
@@ -5851,7 +5851,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;