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

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

Merge "Add broadcast feature supported API" am: 754da27e am: 005953a2 am: 6deb66b2

Original change: https://android-review.googlesource.com/c/platform/packages/modules/Bluetooth/+/1952563

Change-Id: I234cf2b39a6fdd597bb33603a2021c3115176fae
parents ddff074b 6deb66b2
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -127,7 +127,9 @@ class AdapterProperties {
    private int mDynamicAudioBufferSizeSupportedCodecsGroup2;

    private boolean mIsLePeriodicAdvertisingSyncTransferSenderSupported;
    private boolean mIsLePeriodicAdvertisingSyncTransferRecipientSupported;
    private boolean mIsLeConnectedIsochronousStreamCentralSupported;
    private boolean mIsLeIsochronousBroadcasterSupported;

    private List<BufferConstraint> mBufferConstraintList;

@@ -513,6 +515,13 @@ class AdapterProperties {
        return mIsLePeriodicAdvertisingSyncTransferSenderSupported;
    }

    /**
     * @return the mIsLePeriodicAdvertisingSyncTransferRecipientSupported
     */
    boolean isLePeriodicAdvertisingSyncTransferRecipientSupported() {
        return mIsLePeriodicAdvertisingSyncTransferRecipientSupported;
    }

    /**
     * @return the mIsLeConnectedIsochronousStreamCentralSupported
     */
@@ -520,6 +529,13 @@ class AdapterProperties {
        return mIsLeConnectedIsochronousStreamCentralSupported;
    }

    /**
     * @return the mIsLeIsochronousBroadcasterSupported
     */
    boolean isLeIsochronousBroadcasterSupported() {
        return mIsLeIsochronousBroadcasterSupported;
    }

    /**
     * @return the getLeMaximumAdvertisingDataLength
     */
@@ -982,6 +998,8 @@ class AdapterProperties {
                ((0xFF & ((int) val[23])) << 8) + (0xFF & ((int) val[22]));
        mIsLePeriodicAdvertisingSyncTransferSenderSupported = ((0xFF & ((int) val[24])) != 0);
        mIsLeConnectedIsochronousStreamCentralSupported = ((0xFF & ((int) val[25])) != 0);
        mIsLeIsochronousBroadcasterSupported = ((0xFF & ((int) val[26])) != 0);
        mIsLePeriodicAdvertisingSyncTransferRecipientSupported = ((0xFF & ((int) val[27])) != 0);

        Log.d(TAG, "BT_PROPERTY_LOCAL_LE_FEATURES: update from BT controller"
                + " mNumOfAdvertisementInstancesSupported = "
@@ -1005,7 +1023,11 @@ class AdapterProperties {
                + " mIsLePeriodicAdvertisingSyncTransferSenderSupported = "
                + mIsLePeriodicAdvertisingSyncTransferSenderSupported
                + " mIsLeConnectedIsochronousStreamCentralSupported = "
                + mIsLeConnectedIsochronousStreamCentralSupported);
                + mIsLeConnectedIsochronousStreamCentralSupported
                + " mIsLeIsochronousBroadcasterSupported = "
                + mIsLeIsochronousBroadcasterSupported
                + " mIsLePeriodicAdvertisingSyncTransferRecipientSupported = "
                + mIsLePeriodicAdvertisingSyncTransferRecipientSupported);
        //invalidateIsOffloadedFilteringSupportedCache();
    }

+39 −8
Original line number Diff line number Diff line
@@ -2457,13 +2457,27 @@ public class AdapterService extends Service {
        }

        @Override
        public int isLePeriodicAdvertisingSyncTransferSenderSupported() {
        public int isLeAudioBroadcastSourceSupported() {
            AdapterService service = getService();
            if (service == null) {
                return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
            }

            if (service.mAdapterProperties.isLePeriodicAdvertisingSyncTransferSenderSupported()) {
            if (service.isLeAudioBroadcastSourceSupported()) {
                return BluetoothStatusCodes.SUCCESS;
            }

            return BluetoothStatusCodes.ERROR_FEATURE_NOT_SUPPORTED;
        }

        @Override
        public int isLeAudioBroadcastAssistantSupported() {
            AdapterService service = getService();
            if (service == null) {
                return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
            }

            if (service.isLeAudioBroadcastAssistantSupported()) {
                return BluetoothStatusCodes.SUCCESS;
            }

@@ -3474,16 +3488,33 @@ public class AdapterService extends Service {
        return mAdapterProperties.isLePeriodicAdvertisingSupported();
    }

    public int getLeMaximumAdvertisingDataLength() {
        return mAdapterProperties.getLeMaximumAdvertisingDataLength();
    /**
     * Check if the LE audio broadcast source feature is supported.
     *
     * @return true, if the LE audio broadcast source is supported
     */
    public boolean isLeAudioBroadcastSourceSupported() {
        //TODO: check the profile support status as well after we have the implementation
        return mAdapterProperties.isLePeriodicAdvertisingSupported()
                && mAdapterProperties.isLeExtendedAdvertisingSupported()
                && mAdapterProperties.isLeIsochronousBroadcasterSupported();
    }

    public boolean isLePeriodicAdvertisingSyncTransferSenderSupported() {
        return mAdapterProperties.isLePeriodicAdvertisingSyncTransferSenderSupported();
    /**
     * Check if the LE audio broadcast assistant feature is supported.
     *
     * @return true, if the LE audio broadcast assistant is supported
     */
    public boolean isLeAudioBroadcastAssistantSupported() {
        //TODO: check the profile support status as well after we have the implementation
        return mAdapterProperties.isLePeriodicAdvertisingSupported()
            && mAdapterProperties.isLeExtendedAdvertisingSupported()
            && (mAdapterProperties.isLePeriodicAdvertisingSyncTransferSenderSupported()
                || mAdapterProperties.isLePeriodicAdvertisingSyncTransferRecipientSupported());
    }

    public boolean isLeConnectedIsochronousStreamCentralSupported() {
        return mAdapterProperties.isLeConnectedIsochronousStreamCentralSupported();
    public int getLeMaximumAdvertisingDataLength() {
        return mAdapterProperties.getLeMaximumAdvertisingDataLength();
    }

    /**
+45 −19
Original line number Diff line number Diff line
@@ -2325,21 +2325,47 @@ public final class BluetoothAdapter {
    }

    /**
     * Returns {@link BluetoothStatusCodes#SUCCESS} if LE Periodic Advertising Sync Transfer Sender
     * feature is supported, returns {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the
     * feature is not supported or an error code
     * Returns {@link BluetoothStatusCodes#SUCCESS} if the LE audio broadcast source
     * feature is supported, {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the
     * feature is not supported, or an error code.
     *
     * @return whether the chipset supports the LE Periodic Advertising Sync Transfer Sender feature
     * @return whether the LE audio broadcast source is supported
     */
    @RequiresNoPermission
    public @LeFeatureReturnValues int isLePeriodicAdvertisingSyncTransferSenderSupported() {
    public @LeFeatureReturnValues int isLeAudioBroadcastSourceSupported() {
      if (!getLeAccess()) {
        return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
      }
      try {
        mServiceLock.readLock().lock();
        if (mService != null) {
                return mService.isLePeriodicAdvertisingSyncTransferSenderSupported();
          return mService.isLeAudioBroadcastSourceSupported();
        }
      } catch (RemoteException e) {
        e.rethrowFromSystemServer();
      } finally {
        mServiceLock.readLock().unlock();
      }

      return BluetoothStatusCodes.ERROR_UNKNOWN;
    }

    /**
     * Returns {@link BluetoothStatusCodes#SUCCESS} if the LE audio broadcast assistant
     * feature is supported, {@link BluetoothStatusCodes#ERROR_FEATURE_NOT_SUPPORTED} if the
     * feature is not supported, or an error code.
     *
     * @return whether the LE audio broadcast assistent is supported
     */
    @RequiresNoPermission
    public @LeFeatureReturnValues int isLeAudioBroadcastAssistantSupported() {
      if (!getLeAccess()) {
        return BluetoothStatusCodes.ERROR_BLUETOOTH_NOT_ENABLED;
      }
      try {
        mServiceLock.readLock().lock();
        if (mService != null) {
          return mService.isLeAudioBroadcastAssistantSupported();
        }
      } catch (RemoteException e) {
        e.rethrowFromSystemServer();
+3 −1
Original line number Diff line number Diff line
@@ -198,7 +198,9 @@ interface IBluetooth
    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    int isLeAudioSupported();
    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    int isLePeriodicAdvertisingSyncTransferSenderSupported();
    int isLeAudioBroadcastSourceSupported();
    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    int isLeAudioBroadcastAssistantSupported();
    @JavaPassthrough(annotation="@android.annotation.RequiresNoPermission")
    int getLeMaximumAdvertisingDataLength();

+5 −0
Original line number Diff line number Diff line
@@ -622,6 +622,11 @@ void btif_get_adapter_property(bt_property_type_t type) {
        controller->supports_ble_periodic_advertising_sync_transfer_sender();
    local_le_features.le_connected_isochronous_stream_central_supported =
        controller->supports_ble_connected_isochronous_stream_central();
    local_le_features.le_isochronous_broadcast_supported =
        controller->supports_ble_isochronous_broadcaster();
    local_le_features
        .le_periodic_advertising_sync_transfer_recipient_supported =
        controller->supports_ble_periodic_advertising_sync_transfer_recipient();
    memcpy(prop.val, &local_le_features, prop.len);
  } else if (prop.type == BT_PROPERTY_DYNAMIC_AUDIO_BUFFER) {
    tBTM_BLE_VSC_CB cmn_vsc_cb;
Loading