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

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

Merge "system: Migrate from {fmt} to std::format" into main

parents d7075ba6 b052e585
Loading
Loading
Loading
Loading
+14 −14
Original line number Diff line number Diff line
@@ -779,7 +779,7 @@ static jboolean sendPassThroughCommandNative(JNIEnv* env, jobject /* object */,
    return JNI_FALSE;
  }

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));

  log::info("key_code: {}, key_state: {}", key_code, key_state);

@@ -808,7 +808,7 @@ static jboolean sendGroupNavigationCommandNative(JNIEnv* env, jobject /* object
    return JNI_FALSE;
  }

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));

  log::info("key_code: {}, key_state: {}", key_code, key_state);

@@ -833,7 +833,7 @@ static jboolean sendGroupNavigationCommandNative(JNIEnv* env, jobject /* object
static void setPlayerApplicationSettingValuesNative(JNIEnv* env, jobject /* object */,
                                                    jbyteArray address, jbyte num_attrib,
                                                    jbyteArray attrib_ids, jbyteArray attrib_val) {
  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  if (!sBluetoothAvrcpInterface) {
    return;
  }
@@ -893,7 +893,7 @@ static void sendAbsVolRspNative(JNIEnv* env, jobject /* object */, jbyteArray ad
    return;
  }

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -916,7 +916,7 @@ static void sendRegisterAbsVolRspNative(JNIEnv* env, jobject /* object */, jbyte
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -939,7 +939,7 @@ static void getCurrentMetadataNative(JNIEnv* env, jobject /* object */, jbyteArr
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::verbose("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::verbose("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -961,7 +961,7 @@ static void getPlaybackStateNative(JNIEnv* env, jobject /* object */, jbyteArray
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::verbose("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::verbose("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -982,7 +982,7 @@ static void getNowPlayingListNative(JNIEnv* env, jobject /* object */, jbyteArra
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::verbose("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::verbose("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -1004,7 +1004,7 @@ static void getFolderListNative(JNIEnv* env, jobject /* object */, jbyteArray ad
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::verbose("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::verbose("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -1025,7 +1025,7 @@ static void getPlayerListNative(JNIEnv* env, jobject /* object */, jbyteArray ad
    jniThrowIOException(env, EINVAL);
    return;
  }
  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -1053,7 +1053,7 @@ static void changeFolderPathNative(JNIEnv* env, jobject /* object */, jbyteArray
  //  return;
  //}

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

@@ -1077,7 +1077,7 @@ static void setBrowsedPlayerNative(JNIEnv* env, jobject /* object */, jbyteArray
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  bt_status_t status = sBluetoothAvrcpInterface->set_browsed_player_cmd(rawAddress, (uint16_t)id);
  if (status != BT_STATUS_SUCCESS) {
    log::error("Failed sending setBrowsedPlayerNative command, status: {}", bt_status_text(status));
@@ -1098,7 +1098,7 @@ static void setAddressedPlayerNative(JNIEnv* env, jobject /* object */, jbyteArr
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  bt_status_t status = sBluetoothAvrcpInterface->set_addressed_player_cmd(rawAddress, (uint16_t)id);
  if (status != BT_STATUS_SUCCESS) {
    log::error("Failed sending setAddressedPlayerNative command, status: {}",
@@ -1126,7 +1126,7 @@ static void playItemNative(JNIEnv* env, jobject /* object */, jbyteArray address
  RawAddress rawAddress;
  rawAddress.FromOctets((uint8_t*)addr);

  log::info("sBluetoothAvrcpInterface: {}", fmt::ptr(sBluetoothAvrcpInterface));
  log::info("sBluetoothAvrcpInterface: {}", std::format_ptr(sBluetoothAvrcpInterface));
  bt_status_t status = sBluetoothAvrcpInterface->play_item_cmd(
          rawAddress, (uint8_t)scope, (uint8_t*)&uid, (uint16_t)uidCounter);
  if (status != BT_STATUS_SUCCESS) {
+3 −3
Original line number Diff line number Diff line
@@ -49,12 +49,12 @@
using bluetooth::Uuid;
extern bt_interface_t bluetoothInterface;

namespace fmt {
namespace std {
template <>
struct formatter<bt_state_t> : enum_formatter<bt_state_t> {};
template <>
struct formatter<bt_discovery_state_t> : enum_formatter<bt_discovery_state_t> {};
}  // namespace fmt
}  // namespace std

static Uuid from_java_uuid(jlong uuid_msb, jlong uuid_lsb) {
  std::array<uint8_t, Uuid::kNumBytes128> uu;
@@ -825,7 +825,7 @@ static void callback_thread_event(bt_cb_thread_evt event) {
    vm->AttachCurrentThread(&callbackEnv, &args);
    sHaveCallbackThread = true;
    sCallbackThread = pthread_self();
    log::verbose("Callback thread attached: {}", fmt::ptr(callbackEnv));
    log::verbose("Callback thread attached: {}", std::format_ptr(callbackEnv));
  } else if (event == DISASSOCIATE_JVM) {
    if (!isCallbackThread()) {
      log::error("Callback: '' is not called on the correct thread");
+2 −2
Original line number Diff line number Diff line
@@ -198,8 +198,8 @@ tA2DP_STATUS parse_a2dp_configuration(btav_a2dp_codec_index_t codec_index,
}  // namespace audio
}  // namespace bluetooth

namespace fmt {
namespace std {
template <>
struct formatter<::bluetooth::audio::a2dp::BluetoothAudioStatus>
    : enum_formatter<::bluetooth::audio::a2dp::BluetoothAudioStatus> {};
}  // namespace fmt
}  // namespace std
+2 −2
Original line number Diff line number Diff line
@@ -48,12 +48,12 @@ typedef enum {
  A2DP_CTRL_GET_PRESENTATION_POSITION,
} tA2DP_CTRL_CMD;

namespace fmt {
namespace std {
template <>
struct formatter<tUIPC_EVENT> : enum_formatter<tUIPC_EVENT> {};
template <>
struct formatter<tA2DP_CTRL_CMD> : enum_formatter<tA2DP_CTRL_CMD> {};
}  // namespace fmt
}  // namespace std

namespace {

+2 −2
Original line number Diff line number Diff line
@@ -40,14 +40,14 @@ typedef enum {
  A2DP_CTRL_GET_PRESENTATION_POSITION,
} tA2DP_CTRL_CMD;

namespace fmt {
namespace std {
template <>
struct formatter<tA2DP_CTRL_CMD> : enum_formatter<tA2DP_CTRL_CMD> {};
template <>
struct formatter<audio_usage_t> : enum_formatter<audio_usage_t> {};
template <>
struct formatter<audio_content_type_t> : enum_formatter<audio_content_type_t> {};
}  // namespace fmt
}  // namespace std

namespace bluetooth {
namespace audio {
Loading