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

Commit a4d8b874 authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge "Convert leftover ALOGx macros in HFP JNI" into main

parents 69ff5ec1 7d005d32
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

#define LOG_TAG "BluetoothHeadsetServiceJni"

#include <bluetooth/log.h>

#include <mutex>
#include <shared_mutex>

@@ -24,7 +26,6 @@
#include "hardware/bluetooth_headset_callbacks.h"
#include "hardware/bluetooth_headset_interface.h"
#include "hardware/bt_hf.h"
#include "os/log.h"

namespace android {

@@ -948,22 +949,22 @@ static jboolean enableSwbNative(JNIEnv* env, jobject /* object */, jint swbCodec
                                jbyteArray address) {
  std::shared_lock<std::shared_timed_mutex> lock(interface_mutex);
  if (!sBluetoothHfpInterface) {
    ALOGW("%s: sBluetoothHfpInterface is null", __func__);
    log::warn("sBluetoothHfpInterface is null");
    return JNI_FALSE;
  }
  jbyte* addr = env->GetByteArrayElements(address, NULL);
  if (!addr) {
    ALOGE("%s: failed to get device address", __func__);
    log::error("failed to get device address");
    jniThrowIOException(env, EINVAL);
    return JNI_FALSE;
  }
  bt_status_t ret = sBluetoothHfpInterface->EnableSwb(
          (bluetooth::headset::bthf_swb_codec_t)swbCodec, (bool)enable, (RawAddress*)addr);
  if (ret != BT_STATUS_SUCCESS) {
    ALOGE("%s: Failed to %s", __func__, (enable ? "enable" : "disable"));
    log::error("Failed to {}", (enable ? "enable" : "disable"));
    return JNI_FALSE;
  }
  ALOGV("%s: Successfully %s", __func__, (enable ? "enabled" : "disabled"));
  log::verbose("Successfully {}", (enable ? "enabled" : "disabled"));
  return JNI_TRUE;
}