summaryrefslogtreecommitdiff
path: root/tools/rootcanal
diff options
context:
space:
mode:
author Henri Chataing <henrichataing@google.com> 2024-03-25 15:47:07 +0000
committer Henri Chataing <henrichataing@google.com> 2024-03-27 07:52:36 -0700
commit11c6e082f521240f980084a043d51f644a0828e1 (patch)
tree492228f6d7320d248c53446402f56fe860933b40 /tools/rootcanal
parentdbfd8e4d5f4e30ad856c3a9bd9475e1d5ad999bd (diff)
system: Convert last remaining occurrences of GD logging
Test: m com.android.btservices Bug: 305066880 Flag: EXEMPT, mechanical refactor Change-Id: Iac3bd56aca234a2d33753a7d0467bfc736b38f54
Diffstat (limited to 'tools/rootcanal')
-rw-r--r--tools/rootcanal/hal/bluetooth_hci.cc57
-rw-r--r--tools/rootcanal/hal/bluetooth_hci.h1
-rw-r--r--tools/rootcanal/hal/service.cc5
-rw-r--r--tools/rootcanal/include/os/log.h33
4 files changed, 31 insertions, 65 deletions
diff --git a/tools/rootcanal/hal/bluetooth_hci.cc b/tools/rootcanal/hal/bluetooth_hci.cc
index 34cda65d7b..7cea46b097 100644
--- a/tools/rootcanal/hal/bluetooth_hci.cc
+++ b/tools/rootcanal/hal/bluetooth_hci.cc
@@ -19,6 +19,7 @@
#include "bluetooth_hci.h"
#include <cutils/properties.h>
+#include <log/log.h>
#include <netdb.h>
#include <netinet/in.h>
#include <string.h>
@@ -59,7 +60,7 @@ class BluetoothDeathRecipient : public hidl_death_recipient {
void serviceDied(
uint64_t /* cookie */,
const wp<::android::hidl::base::V1_0::IBase>& /* who */) override {
- LOG_ERROR("BluetoothDeathRecipient::serviceDied - Bluetooth service died");
+ ALOGE("BluetoothDeathRecipient::serviceDied - Bluetooth service died");
has_died_ = true;
mHci->close();
}
@@ -87,15 +88,15 @@ Return<void> BluetoothHci::initialize_1_1(
Return<void> BluetoothHci::initialize_impl(
const sp<V1_0::IBluetoothHciCallbacks>& cb,
const sp<V1_1::IBluetoothHciCallbacks>& cb_1_1) {
- LOG_INFO("%s", __func__);
+ ALOGI("%s", __func__);
if (cb == nullptr) {
- LOG_ERROR("cb == nullptr! -> Unable to call initializationComplete(ERR)");
+ ALOGE("cb == nullptr! -> Unable to call initializationComplete(ERR)");
return Void();
}
death_recipient_->setHasDied(false);
auto link_ret = cb->linkToDeath(death_recipient_, 0);
- ASSERT_LOG(link_ret.isOk(), "Error calling linkToDeath.");
+ ALOG_ASSERT(link_ret.isOk(), "Error calling linkToDeath.");
test_channel_transport_.RegisterCommandHandler(
[this](const std::string& name, const std::vector<std::string>& args) {
@@ -121,9 +122,9 @@ Return<void> BluetoothHci::initialize_impl(
hidl_vec<uint8_t> hci_event(packet->begin(), packet->end());
auto ret = cb->hciEventReceived(hci_event);
if (!ret.isOk()) {
- LOG_ERROR("Error sending event callback");
+ ALOGE("Error sending event callback");
if (!death_recipient_->getHasDied()) {
- LOG_ERROR("Closing");
+ ALOGE("Closing");
close();
}
}
@@ -134,9 +135,9 @@ Return<void> BluetoothHci::initialize_impl(
hidl_vec<uint8_t> acl_packet(packet->begin(), packet->end());
auto ret = cb->aclDataReceived(acl_packet);
if (!ret.isOk()) {
- LOG_ERROR("Error sending acl callback");
+ ALOGE("Error sending acl callback");
if (!death_recipient_->getHasDied()) {
- LOG_ERROR("Closing");
+ ALOGE("Closing");
close();
}
}
@@ -147,9 +148,9 @@ Return<void> BluetoothHci::initialize_impl(
hidl_vec<uint8_t> sco_packet(packet->begin(), packet->end());
auto ret = cb->scoDataReceived(sco_packet);
if (!ret.isOk()) {
- LOG_ERROR("Error sending sco callback");
+ ALOGE("Error sending sco callback");
if (!death_recipient_->getHasDied()) {
- LOG_ERROR("Closing");
+ ALOGE("Closing");
close();
}
}
@@ -161,9 +162,9 @@ Return<void> BluetoothHci::initialize_impl(
hidl_vec<uint8_t> iso_packet(packet->begin(), packet->end());
auto ret = cb_1_1->isoDataReceived(iso_packet);
if (!ret.isOk()) {
- LOG_ERROR("Error sending iso callback");
+ ALOGE("Error sending iso callback");
if (!death_recipient_->getHasDied()) {
- LOG_ERROR("Closing");
+ ALOGE("Closing");
close();
}
}
@@ -182,7 +183,7 @@ Return<void> BluetoothHci::initialize_impl(
// Send responses to logcat if the test channel is not configured.
test_channel_.RegisterSendResponse([](const std::string& response) {
- LOG_INFO("No test channel yet: %s", response.c_str());
+ ALOGI("No test channel yet: %s", response.c_str());
});
if (BtTestConsoleEnabled()) {
@@ -211,7 +212,7 @@ Return<void> BluetoothHci::initialize_impl(
});
} else {
// This should be configurable in the future.
- LOG_INFO("Adding Beacons so the scan list is not empty.");
+ ALOGI("Adding Beacons so the scan list is not empty.");
test_channel_.AddDevice({"beacon", "be:ac:10:00:00:01", "1000"});
test_model_.AddDeviceToPhy(controller_index + 1, low_energy_phy_index);
test_channel_.AddDevice({"beacon", "be:ac:10:00:00:02", "1000"});
@@ -224,28 +225,28 @@ Return<void> BluetoothHci::initialize_impl(
test_channel_.List({});
}
- unlink_cb_ = [this, cb](sp<BluetoothDeathRecipient>& death_recipient) {
+ unlink_cb_ = [cb](sp<BluetoothDeathRecipient>& death_recipient) {
if (death_recipient->getHasDied())
- LOG_INFO("Skipping unlink call, service died.");
+ ALOGI("Skipping unlink call, service died.");
else {
auto ret = cb->unlinkToDeath(death_recipient);
if (!ret.isOk()) {
- ASSERT_LOG(death_recipient_->getHasDied(),
- "Error calling unlink, but no death notification.");
+ ALOG_ASSERT(death_recipient_->getHasDied(),
+ "Error calling unlink, but no death notification.");
}
}
};
auto init_ret = cb->initializationComplete(V1_0::Status::SUCCESS);
if (!init_ret.isOk()) {
- ASSERT_LOG(death_recipient_->getHasDied(),
- "Error sending init callback, but no death notification.");
+ ALOG_ASSERT(death_recipient_->getHasDied(),
+ "Error sending init callback, but no death notification.");
}
return Void();
}
Return<void> BluetoothHci::close() {
- LOG_INFO("%s", __func__);
+ ALOGI("%s", __func__);
test_model_.Reset();
return Void();
}
@@ -296,11 +297,11 @@ Return<void> BluetoothHci::sendIsoData(const hidl_vec<uint8_t>& packet) {
void BluetoothHci::SetUpHciServer(ConnectCallback connection_callback) {
test_channel_.RegisterSendResponse([](const std::string& response) {
- LOG_INFO("No HCI Response channel: %s", response.c_str());
+ ALOGI("No HCI Response channel: %s", response.c_str());
});
if (!remote_hci_transport_.SetUp(hci_socket_server_, connection_callback)) {
- LOG_ERROR("Remote HCI channel SetUp failed.");
+ ALOGE("Remote HCI channel SetUp failed.");
return;
}
}
@@ -309,7 +310,7 @@ void BluetoothHci::SetUpLinkLayerServer(ConnectCallback connection_callback) {
remote_link_layer_transport_.SetUp(link_socket_server_, connection_callback);
test_channel_.RegisterSendResponse([](const std::string& response) {
- LOG_INFO("No LinkLayer Response channel: %s", response.c_str());
+ ALOGI("No LinkLayer Response channel: %s", response.c_str());
});
}
@@ -324,7 +325,7 @@ void BluetoothHci::SetUpTestChannel() {
bool transport_configured = test_channel_transport_.SetUp(
test_socket_server_, [this](std::shared_ptr<AsyncDataChannel> conn_fd,
AsyncDataChannelServer*) {
- LOG_INFO("Test channel connection accepted.");
+ ALOGI("Test channel connection accepted.");
test_channel_.RegisterSendResponse(
[this, conn_fd](const std::string& response) {
test_channel_transport_.SendResponse(conn_fd, response);
@@ -336,15 +337,15 @@ void BluetoothHci::SetUpTestChannel() {
return false;
});
test_channel_.RegisterSendResponse([](const std::string& response) {
- LOG_INFO("No test channel: %s", response.c_str());
+ ALOGI("No test channel: %s", response.c_str());
});
if (!transport_configured) {
- LOG_ERROR("Test channel SetUp failed.");
+ ALOGE("Test channel SetUp failed.");
return;
}
- LOG_INFO("Test channel SetUp() successful");
+ ALOGI("Test channel SetUp() successful");
}
/* Fallback to shared library if there is no service. */
diff --git a/tools/rootcanal/hal/bluetooth_hci.h b/tools/rootcanal/hal/bluetooth_hci.h
index 1bceda8812..374542177d 100644
--- a/tools/rootcanal/hal/bluetooth_hci.h
+++ b/tools/rootcanal/hal/bluetooth_hci.h
@@ -27,7 +27,6 @@
#include "model/setup/test_model.h"
#include "net/posix/posix_async_socket_connector.h"
#include "net/posix/posix_async_socket_server.h"
-#include "os/log.h"
namespace android {
namespace hardware {
diff --git a/tools/rootcanal/hal/service.cc b/tools/rootcanal/hal/service.cc
index 7856dcfa5b..cef8fe72de 100644
--- a/tools/rootcanal/hal/service.cc
+++ b/tools/rootcanal/hal/service.cc
@@ -16,11 +16,10 @@
#define LOG_TAG "android.hardware.bluetooth@1.1-service.sim"
-#include "os/log.h"
-
#include <android/hardware/bluetooth/1.1/IBluetoothHci.h>
#include <hidl/HidlSupport.h>
#include <hidl/HidlTransportSupport.h>
+#include <log/log.h>
#include "bluetooth_hci.h"
@@ -37,5 +36,5 @@ int main(int /* argc */, char** /* argv */) {
if (status == android::OK)
joinRpcThreadpool();
else
- LOG_ERROR("Could not register as a service!");
+ ALOGE("Could not register as a service!");
}
diff --git a/tools/rootcanal/include/os/log.h b/tools/rootcanal/include/os/log.h
deleted file mode 100644
index a1e46ddece..0000000000
--- a/tools/rootcanal/include/os/log.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2022 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-// This header is currently needed for hci_packets.h
-// FIXME: Change hci_packets.h to not depend on os/log.h
-// and remove this.
-#include "include/log.h"
-
-#define LOG_INFO(...) \
- rootcanal::log::Log(rootcanal::log::Verbosity::kInfo, __FILE__, __LINE__, \
- "{}", fmt::sprintf(__VA_ARGS__))
-#define LOG_WARN(...) \
- rootcanal::log::Log(rootcanal::log::Verbosity::kWarning, __FILE__, __LINE__, \
- "{}", fmt::sprintf(__VA_ARGS__))
-#define LOG_ERROR(...) \
- rootcanal::log::Log(rootcanal::log::Verbosity::kError, __FILE__, __LINE__, \
- "{}", fmt::sprintf(__VA_ARGS__))
-#define LOG_ALWAYS_FATAL(...) \
- rootcanal::log::Log(rootcanal::log::Verbosity::kFatal, __FILE__, __LINE__, \
- "{}", fmt::sprintf(__VA_ARGS__))