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

Commit 3ae7159c authored by Chienyuan Huang's avatar Chienyuan Huang
Browse files

CS: Check CS supported and set event mask

Bug: 324185011
Bug: 345799932
Test: m com.android.btservices
Change-Id: I5f604213cd5676bb477dfc844f12eb7e48d5847f
parent 1077361f
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -148,6 +148,7 @@ class AdapterProperties {
    private boolean mIsLePeriodicAdvertisingSyncTransferRecipientSupported;
    private boolean mIsLeConnectedIsochronousStreamCentralSupported;
    private boolean mIsLeIsochronousBroadcasterSupported;
    private boolean mIsLeChannelSoundingSupported;

    private boolean mReceiverRegistered;
    private Handler mHandler;
@@ -535,6 +536,13 @@ class AdapterProperties {
        return mIsLeIsochronousBroadcasterSupported;
    }

    /**
     * @return the mIsLeChannelSoundingSupported
     */
    boolean isLeChannelSoundingSupported() {
        return mIsLeChannelSoundingSupported;
    }

    /**
     * @return the getLeMaximumAdvertisingDataLength
     */
@@ -1129,6 +1137,7 @@ class AdapterProperties {
        mIsLeIsochronousBroadcasterSupported = ((0xFF & ((int) val[26])) != 0);
        mIsLePeriodicAdvertisingSyncTransferRecipientSupported = ((0xFF & ((int) val[27])) != 0);
        mIsOffloadedTransportDiscoveryDataScanSupported = ((0x01 & ((int) val[28])) != 0);
        mIsLeChannelSoundingSupported = ((0xFF & ((int) val[30])) != 0);

        Log.d(
                TAG,
@@ -1176,7 +1185,9 @@ class AdapterProperties {
                        + " mIsLePeriodicAdvertisingSyncTransferRecipientSupported = "
                        + mIsLePeriodicAdvertisingSyncTransferRecipientSupported
                        + " mIsOffloadedTransportDiscoveryDataScanSupported = "
                        + mIsOffloadedTransportDiscoveryDataScanSupported);
                        + mIsOffloadedTransportDiscoveryDataScanSupported
                        + " mIsLeChannelSoundingSupported = "
                        + mIsLeChannelSoundingSupported);
        invalidateIsOffloadedFilteringSupportedCache();
    }

+9 −0
Original line number Diff line number Diff line
@@ -5764,6 +5764,15 @@ public class AdapterService extends Service {
                                .isLePeriodicAdvertisingSyncTransferRecipientSupported());
    }

    /**
     * Check if the LE channel sounding feature is supported.
     *
     * @return true, if the LE channel sounding is supported
     */
    public boolean isLeChannelSoundingSupported() {
        return mAdapterProperties.isLeChannelSoundingSupported();
    }

    public long getSupportedProfilesBitMask() {
        return Config.getSupportedProfilesBitMask();
    }
+12 −4
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ import android.util.Log;
import com.android.bluetooth.btservice.AdapterService;
import com.android.internal.annotations.VisibleForTesting;

import java.util.ArrayList;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
@@ -71,12 +72,19 @@ public class DistanceMeasurementManager {
    }

    DistanceMeasurementMethod[] getSupportedDistanceMeasurementMethods() {
        DistanceMeasurementMethod rssi =
        ArrayList<DistanceMeasurementMethod> methods = new ArrayList<DistanceMeasurementMethod>();
        methods.add(
                new DistanceMeasurementMethod.Builder(
                                DistanceMeasurementMethod.DISTANCE_MEASUREMENT_METHOD_RSSI)
                        .build();
        DistanceMeasurementMethod[] methods = {rssi};
        return methods;
                        .build());
        if (mAdapterService.isLeChannelSoundingSupported()) {
            methods.add(
                    new DistanceMeasurementMethod.Builder(
                                    DistanceMeasurementMethod
                                            .DISTANCE_MEASUREMENT_METHOD_CHANNEL_SOUNDING)
                            .build());
        }
        return methods.toArray(new DistanceMeasurementMethod[methods.size()]);
    }

    void startDistanceMeasurement(
+2 −0
Original line number Diff line number Diff line
@@ -522,6 +522,8 @@ void btif_get_adapter_property(bt_property_type_t type) {
        controller->SupportsBlePeriodicAdvertisingSyncTransferRecipient();
    local_le_features.adv_filter_extended_features_mask =
        cmn_vsc_cb.adv_filter_extended_features_mask;
    local_le_features.le_channel_sounding_supported =
        controller->SupportsBleChannelSounding();

    memcpy(prop.val, &local_le_features, prop.len);
  } else if (prop.type == BT_PROPERTY_DYNAMIC_AUDIO_BUFFER) {
+4 −2
Original line number Diff line number Diff line
@@ -152,7 +152,8 @@ std::string bt_property_text(const bt_property_t& property) {
          " le_connected_isochronous_stream_central_supported:%d "
          "le_isochronous_broadcast_supported:%d"
          " le_periodic_advertising_sync_transfer_recipient_supported:%d "
          "adv_filter_extended_features_mask:%d",
          "adv_filter_extended_features_mask:%d"
          "le_channel_sounding_supported:%d ",
          bt_property_type_text(property.type).c_str(),
          ((bt_local_le_features_t*)property.val)->version_supported,
          ((bt_local_le_features_t*)property.val)->local_privacy_enabled,
@@ -178,7 +179,8 @@ std::string bt_property_text(const bt_property_t& property) {
          ((bt_local_le_features_t*)property.val)->le_isochronous_broadcast_supported,
          ((bt_local_le_features_t*)property.val)
              ->le_periodic_advertising_sync_transfer_recipient_supported,
          ((bt_local_le_features_t*)property.val)->adv_filter_extended_features_mask);
          ((bt_local_le_features_t*)property.val)->adv_filter_extended_features_mask,
          ((bt_local_le_features_t*)property.val)->le_channel_sounding_supported);

    case BT_PROPERTY_RESERVED_0E:
      return base::StringPrintf("type:%s", bt_property_type_text(property.type).c_str());
Loading