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

Commit 7d005d32 authored by Henri Chataing's avatar Henri Chataing
Browse files

Convert leftover ALOGx macros in HFP JNI

Bug: 331817295
Test: m com.android.btservices
Flag: EXEMPT, minor refactor
Change-Id: Ic7f3f17d2f8dbb9633579ddfddc6183ffa05c683
parent 2e689390
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;
}