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

Commit 8b6d7103 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11504324 from 703a5c47 to 24Q2-release

Change-Id: Ica6510d0bb8973be3d86e6dabafc5b093a494914
parents 97e1c484 703a5c47
Loading
Loading
Loading
Loading
+15 −13
Original line number Diff line number Diff line
@@ -604,8 +604,11 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
            }
        }

        if (!mCallbackExecutorMap.isEmpty()) {
            return;
        }

        // If the callback map is empty, we unregister the service-to-app callback
        if (mCallbackExecutorMap.isEmpty()) {
        try {
            final IBluetoothVolumeControl service = getService();
            if (service != null) {
@@ -620,7 +623,6 @@ public final class BluetoothVolumeControl implements BluetoothProfile, AutoClose
            Log.e(TAG, e.toString() + "\n" + Log.getStackTraceString(new Throwable()));
        }
    }
    }

    /**
     * Tells the remote device to set a volume offset to the absolute volume.
+0 −45
Original line number Diff line number Diff line
@@ -40,8 +40,6 @@ static const std::string kDefaultAudioProviderFactoryInterface =
std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr =
    std::make_unique<HalVersionManager>();

#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

std::string toString(BluetoothAudioHalTransport transport) {
  switch (transport) {
    case BluetoothAudioHalTransport::UNKNOWN:
@@ -104,49 +102,6 @@ BluetoothAudioHalTransport HalVersionManager::GetHalTransport() {
  return instance_ptr->hal_version_.getTransport();
}

#else  // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

BluetoothAudioHalTransport HalVersionManager::GetHalTransport() {
  return instance_ptr->hal_transport_;
}

BluetoothAudioHalVersion GetAidlInterfaceVersion() {
  int aidl_version = 0;

  auto provider_factory = IBluetoothAudioProviderFactory::fromBinder(
      ::ndk::SpAIBinder(AServiceManager_waitForService(
          kDefaultAudioProviderFactoryInterface.c_str())));

  if (provider_factory == nullptr) {
    LOG_ERROR("Can't get aidl version from unknown factory");
    return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
  }

  auto aidl_retval = provider_factory->getInterfaceVersion(&aidl_version);
  if (!aidl_retval.isOk()) {
    LOG_ERROR("BluetoothAudioHal::getInterfaceVersion failure: %s",
              aidl_retval.getDescription().c_str());
    return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
  }

  switch (aidl_version) {
    case 1:
      return BluetoothAudioHalVersion::VERSION_AIDL_V1;
    case 2:
      return BluetoothAudioHalVersion::VERSION_AIDL_V2;
    case 3:
      return BluetoothAudioHalVersion::VERSION_AIDL_V3;
    case 4:
      return BluetoothAudioHalVersion::VERSION_AIDL_V4;
    default:
      LOG_ERROR("Unknown AIDL version %d", aidl_version);
      return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
  }
  return BluetoothAudioHalVersion::VERSION_UNAVAILABLE;
}

#endif  // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

BluetoothAudioHalVersion HalVersionManager::GetHalVersion() {
  std::lock_guard<std::mutex> guard(instance_ptr->mutex_);
  return instance_ptr->hal_version_;
+0 −22
Original line number Diff line number Diff line
@@ -35,7 +35,6 @@ constexpr char kFullyQualifiedInterfaceName_2_0[] =
constexpr char kFullyQualifiedInterfaceName_2_1[] =
    "android.hardware.bluetooth.audio@2.1::IBluetoothAudioProvidersFactory";

#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS
/**
 * The type of HAL transport, it's important to have
 * BluetoothAudioHalTransport::HIDL value defined smaller than
@@ -115,27 +114,6 @@ class BluetoothAudioHalVersion {
  uint16_t mMinor = 0;
};

#else  // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

enum class BluetoothAudioHalVersion : uint8_t {
  VERSION_UNAVAILABLE = 0,
  VERSION_2_0,
  VERSION_2_1,
  VERSION_AIDL_V1,
  VERSION_AIDL_V2,
  VERSION_AIDL_V3,
  VERSION_AIDL_V4,
};

enum class BluetoothAudioHalTransport : uint8_t {
  // Uninit, default value
  UNKNOWN,
  AIDL,
  HIDL,
};

#endif  // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

class HalVersionManager {
 public:
  static BluetoothAudioHalVersion GetHalVersion();
+0 −4
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@
namespace bluetooth {
namespace audio {

#if COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_UNAVAILABLE =
    BluetoothAudioHalVersion();
const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_2_0 =
@@ -36,8 +34,6 @@ const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_AIDL_V3 =
const BluetoothAudioHalVersion BluetoothAudioHalVersion::VERSION_AIDL_V4 =
    BluetoothAudioHalVersion(BluetoothAudioHalTransport::AIDL, 4, 0);

#endif  // COM_ANDROID_BLUETOOTH_FLAGS_AUDIO_HAL_VERSION_CLASS

std::unique_ptr<HalVersionManager> HalVersionManager::instance_ptr = nullptr;

BluetoothAudioHalVersion HalVersionManager::GetHalVersion() {
+22 −0
Original line number Diff line number Diff line
@@ -325,6 +325,28 @@ void LeAudioClientInterface::Sink::CancelStreamingRequest() {
        break;
    }
  }

  auto aidl_instance = get_aidl_transport_instance(is_broadcaster_);
  auto start_request_state = aidl_instance->GetStartRequestState();
  switch (start_request_state) {
    case StartRequestState::IDLE:
      LOG_WARN(", no pending start stream request");
      return;
    case StartRequestState::PENDING_BEFORE_RESUME:
      LOG_INFO("Response before sending PENDING to audio HAL");
      aidl_instance->SetStartRequestState(StartRequestState::CANCELED);
      return;
    case StartRequestState::PENDING_AFTER_RESUME:
      LOG_INFO("Response after sending PENDING to audio HAL");
      aidl_instance->ClearStartRequestState();
      get_aidl_client_interface(is_broadcaster_)
          ->StreamStarted(aidl::BluetoothAudioCtrlAck::FAILURE);
      return;
    case StartRequestState::CONFIRMED:
    case StartRequestState::CANCELED:
      LOG_ERROR("Invalid state, start stream already confirmed");
      break;
  }
}

void LeAudioClientInterface::Sink::CancelStreamingRequestV2() {
Loading