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

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

Merge "leaudio: Add missing locks" am: 87c7ee85 am: d3bdf0f7 am: 932b7b7b

parents a7bef06a 932b7b7b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -392,6 +392,7 @@ static jboolean disconnectLeAudioNative(JNIEnv* env, jobject object,

static jboolean groupAddNodeNative(JNIEnv* env, jobject object, jint group_id,
                                   jbyteArray address) {
  std::shared_lock<std::shared_timed_mutex> lock(interface_mutex);
  jbyte* addr = env->GetByteArrayElements(address, nullptr);

  if (!sLeAudioClientInterface) {
@@ -413,6 +414,7 @@ static jboolean groupAddNodeNative(JNIEnv* env, jobject object, jint group_id,

static jboolean groupRemoveNodeNative(JNIEnv* env, jobject object,
                                      jint group_id, jbyteArray address) {
  std::shared_lock<std::shared_timed_mutex> lock(interface_mutex);
  if (!sLeAudioClientInterface) {
    LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface";
    return JNI_FALSE;
@@ -432,6 +434,7 @@ static jboolean groupRemoveNodeNative(JNIEnv* env, jobject object,

static void groupSetActiveNative(JNIEnv* env, jobject object, jint group_id) {
  LOG(INFO) << __func__;
  std::shared_lock<std::shared_timed_mutex> lock(interface_mutex);

  if (!sLeAudioClientInterface) {
    LOG(ERROR) << __func__ << ": Failed to get the Bluetooth LeAudio Interface";
@@ -445,6 +448,8 @@ static void setCodecConfigPreferenceNative(JNIEnv* env, jobject object,
                                           jint group_id,
                                           jobject inputCodecConfig,
                                           jobject outputCodecConfig) {
  std::shared_lock<std::shared_timed_mutex> lock(interface_mutex);

  if (!env->IsInstanceOf(inputCodecConfig,
                         android_bluetooth_BluetoothLeAudioCodecConfig.clazz) ||
      !env->IsInstanceOf(outputCodecConfig,