зеркало из https://github.com/mozilla/gecko-dev.git
Bug 945193 - Print function name in bluetooth logs, r=echou
This commit is contained in:
Родитель
7b39a77436
Коммит
c341c78824
|
@ -19,22 +19,25 @@ extern bool gBluetoothDebugFlag;
|
|||
#undef BT_LOG
|
||||
#if defined(MOZ_WIDGET_GONK)
|
||||
#include <android/log.h>
|
||||
|
||||
/**
|
||||
* Prints 'D'EBUG build logs, which show in DEBUG build only when
|
||||
* developer setting 'Bluetooth output in adb' is enabled.
|
||||
*/
|
||||
#define BT_LOGD(args...) \
|
||||
#define BT_LOGD(msg, ...) \
|
||||
do { \
|
||||
if (gBluetoothDebugFlag) { \
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoBluetooth", args); \
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoBluetooth", \
|
||||
"%s: " msg, __FUNCTION__, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
/**
|
||||
* Prints 'R'ELEASE build logs, which show in both RELEASE and DEBUG builds.
|
||||
*/
|
||||
#define BT_LOGR(args...) \
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoBluetooth", args) \
|
||||
#define BT_LOGR(msg, ...) \
|
||||
__android_log_print(ANDROID_LOG_INFO, "GeckoBluetooth", \
|
||||
"%s: " msg, __FUNCTION__, ##__VA_ARGS__) \
|
||||
|
||||
/**
|
||||
* Prints DEBUG build warnings, which show in DEBUG build only.
|
||||
|
@ -43,15 +46,15 @@ extern bool gBluetoothDebugFlag;
|
|||
NS_WARNING(nsPrintfCString(args).get()) \
|
||||
|
||||
#else
|
||||
#define BT_LOGD(args, ...) \
|
||||
#define BT_LOGD(msg, ...) \
|
||||
do { \
|
||||
if (gBluetoothDebugFlag) { \
|
||||
printf(args, ##__VA_ARGS__); \
|
||||
printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__); \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#define BT_LOGR(args, ...) printf(args, ##__VA_ARGS__)
|
||||
#define BT_WARNING(args, ...) printf(args, ##__VA_ARGS__)
|
||||
#define BT_LOGR(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
|
||||
#define BT_WARNING(msg, ...) printf("%s: " msg, __FUNCTION__, ##__VA_ARGS__))
|
||||
#endif
|
||||
|
||||
#define BEGIN_BLUETOOTH_NAMESPACE \
|
||||
|
|
|
@ -16,12 +16,11 @@
|
|||
|
||||
USING_BLUETOOTH_NAMESPACE
|
||||
|
||||
#define BT_LOGR_PROFILE(mgr, args...) \
|
||||
#define BT_LOGR_PROFILE(mgr, msg, ...) \
|
||||
do { \
|
||||
nsCString name; \
|
||||
mgr->GetName(name); \
|
||||
BT_LOGR("%s: [%s] %s", __FUNCTION__, name.get(), \
|
||||
nsPrintfCString(args).get()); \
|
||||
BT_LOGR("[%s] " msg, name.get(), ##__VA_ARGS__); \
|
||||
} while(0)
|
||||
|
||||
BluetoothProfileController::BluetoothProfileController(
|
||||
|
|
|
@ -379,8 +379,7 @@ BluetoothRilListener::ServiceChanged(uint32_t aClientId, bool aRegistered)
|
|||
// Restart listening
|
||||
ListenMobileConnAndIccInfo(true);
|
||||
|
||||
BT_LOGR("%s: %d client %d. new mClientId %d",
|
||||
__FUNCTION__, aRegistered, aClientId,
|
||||
BT_LOGR("%d client %d. new mClientId %d", aRegistered, aClientId,
|
||||
(mClientId < mMobileConnListeners.Length()) ? mClientId : -1);
|
||||
}
|
||||
|
||||
|
|
|
@ -518,7 +518,7 @@ void
|
|||
BluetoothHfpManager::ProcessConnectionState(bthf_connection_state_t aState,
|
||||
bt_bdaddr_t* aBdAddress)
|
||||
{
|
||||
BT_LOGR("%s: state %d", __FUNCTION__, aState);
|
||||
BT_LOGR("state %d", aState);
|
||||
|
||||
mConnectionState = aState;
|
||||
|
||||
|
@ -537,7 +537,7 @@ void
|
|||
BluetoothHfpManager::ProcessAudioState(bthf_audio_state_t aState,
|
||||
bt_bdaddr_t* aBdAddress)
|
||||
{
|
||||
BT_LOGR("%s: state %d", __FUNCTION__, aState);
|
||||
BT_LOGR("state %d", aState);
|
||||
|
||||
mAudioState = aState;
|
||||
|
||||
|
@ -702,7 +702,7 @@ BluetoothHfpManager::ProcessAtClcc()
|
|||
void
|
||||
BluetoothHfpManager::ProcessUnknownAt(char *aAtString)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, aAtString);
|
||||
BT_LOGR("[%s]", aAtString);
|
||||
|
||||
NS_ENSURE_TRUE_VOID(sBluetoothHfpInterface);
|
||||
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
|
||||
|
@ -967,8 +967,8 @@ BluetoothHfpManager::UpdatePhoneCIND(uint32_t aCallIndex, bool aSend)
|
|||
nsAutoCString number = NS_ConvertUTF16toUTF8(mCurrentCallArray[aCallIndex].mNumber);
|
||||
bthf_call_addrtype_t type = mCurrentCallArray[aCallIndex].mType;
|
||||
|
||||
BT_LOGR("%s: [%d] state %d => BTHF: active[%d] held[%d] state[%d]",
|
||||
__FUNCTION__, aCallIndex, callState, numActive, numHeld, bthfCallState);
|
||||
BT_LOGR("[%d] state %d => BTHF: active[%d] held[%d] state[%d]",
|
||||
aCallIndex, callState, numActive, numHeld, bthfCallState);
|
||||
|
||||
NS_ENSURE_TRUE_VOID(BT_STATUS_SUCCESS ==
|
||||
sBluetoothHfpInterface->phone_state_change(
|
||||
|
|
|
@ -383,7 +383,7 @@ BluetoothOppManager::DiscardBlobsToSend()
|
|||
while (length > mCurrentBlobIndex + 1) {
|
||||
mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex];
|
||||
|
||||
BT_LOGR("%s: idx %d", __FUNCTION__, mCurrentBlobIndex);
|
||||
BT_LOGR("idx %d", mCurrentBlobIndex);
|
||||
ExtractBlobHeaders();
|
||||
StartFileTransfer();
|
||||
FileTransferComplete();
|
||||
|
@ -400,7 +400,7 @@ BluetoothOppManager::ProcessNextBatch()
|
|||
if (mCurrentBlobIndex >= 0) {
|
||||
ClearQueue();
|
||||
mBatches.RemoveElementAt(0);
|
||||
BT_LOGR("%s: REMOVE. %d remaining", __FUNCTION__, mBatches.Length());
|
||||
BT_LOGR("REMOVE. %d remaining", mBatches.Length());
|
||||
}
|
||||
|
||||
// Process the next batch
|
||||
|
@ -758,7 +758,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
|||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
mPacketReceivedLength + dataLength > mPacketLength) {
|
||||
BT_LOGR("%s: Received packet size is unreasonable", __FUNCTION__);
|
||||
BT_LOGR("Received packet size is unreasonable");
|
||||
|
||||
ReplyToPut(mPutFinalFlag, false);
|
||||
DeleteReceivedFile();
|
||||
|
@ -1376,7 +1376,7 @@ BluetoothOppManager::NotifyAboutFileChange()
|
|||
void
|
||||
BluetoothOppManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer)? "server" : "client");
|
||||
BT_LOGR("[%s]", (mIsServer)? "server" : "client");
|
||||
MOZ_ASSERT(aSocket);
|
||||
|
||||
/**
|
||||
|
@ -1403,7 +1403,7 @@ BluetoothOppManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
|||
void
|
||||
BluetoothOppManager::OnSocketConnectError(BluetoothSocket* aSocket)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer)? "server" : "client");
|
||||
BT_LOGR("[%s]", (mIsServer)? "server" : "client");
|
||||
|
||||
mServerSocket = nullptr;
|
||||
mSocket = nullptr;
|
||||
|
@ -1427,7 +1427,7 @@ BluetoothOppManager::OnSocketDisconnect(BluetoothSocket* aSocket)
|
|||
// Do nothing when a listening server socket is closed.
|
||||
return;
|
||||
}
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer) ? "client" : "server");
|
||||
BT_LOGR("[%s]", (mIsServer) ? "client" : "server");
|
||||
|
||||
/**
|
||||
* It is valid for a bluetooth device which is transfering file via OPP
|
||||
|
|
|
@ -669,7 +669,7 @@ BluetoothSocket::ReceiveSocketInfo(nsAutoPtr<UnixSocketRawData>& aMessage)
|
|||
// 1st message: [channel:4]
|
||||
int32_t channel = ReadInt32(aMessage->mData, &offset);
|
||||
|
||||
BT_LOGR("%s: channel %d", __FUNCTION__, channel);
|
||||
BT_LOGR("channel %d", channel);
|
||||
} else if (mReceivedSocketInfoLength == TOTAL_SOCKET_INFO_LENGTH) {
|
||||
// 2nd message: [size:2][bd address:6][channel:4][connection status:4]
|
||||
int16_t size = ReadInt16(aMessage->mData, &offset);
|
||||
|
@ -677,7 +677,7 @@ BluetoothSocket::ReceiveSocketInfo(nsAutoPtr<UnixSocketRawData>& aMessage)
|
|||
int32_t channel = ReadInt32(aMessage->mData, &offset);
|
||||
int32_t connectionStatus = ReadInt32(aMessage->mData, &offset);
|
||||
|
||||
BT_LOGR("%s: size %d channel %d remote addr %s status %d", __FUNCTION__,
|
||||
BT_LOGR("size %d channel %d remote addr %s status %d",
|
||||
size, channel, NS_ConvertUTF16toUTF8(mDeviceAddress).get(), connectionStatus);
|
||||
|
||||
if (connectionStatus != 0) {
|
||||
|
|
|
@ -105,7 +105,7 @@ public:
|
|||
|
||||
int ret = sBtInterface->set_adapter_property(&prop);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BT_LOGR("%s: Fail to set: BT_SCAN_MODE_CONNECTABLE", __FUNCTION__);
|
||||
BT_LOGR("Fail to set: BT_SCAN_MODE_CONNECTABLE");
|
||||
}
|
||||
|
||||
// Try to fire event 'AdapterAdded' to fit the original behaviour when
|
||||
|
@ -119,7 +119,7 @@ public:
|
|||
// Trigger BluetoothOppManager to listen
|
||||
BluetoothOppManager* opp = BluetoothOppManager::Get();
|
||||
if (!opp || !opp->Listen()) {
|
||||
BT_LOGR("%s: Fail to start BluetoothOppManager listening", __FUNCTION__);
|
||||
BT_LOGR("Fail to start BluetoothOppManager listening");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -272,7 +272,7 @@ AdapterStateChangeCallback(bt_state_t aStatus)
|
|||
{
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
||||
BT_LOGR("%s, BT_STATE:%d", __FUNCTION__, aStatus);
|
||||
BT_LOGR("BT_STATE %d", aStatus);
|
||||
|
||||
sIsBtEnabled = (aStatus == BT_STATE_ON);
|
||||
|
||||
|
@ -673,7 +673,7 @@ EnsureBluetoothHalLoad()
|
|||
hw_device_t* device;
|
||||
int err = hw_get_module(BT_HARDWARE_MODULE_ID, (hw_module_t const**)&module);
|
||||
if (err != 0) {
|
||||
BT_LOGR("Error: %s ", strerror(err));
|
||||
BT_LOGR("Error: %s", strerror(err));
|
||||
return false;
|
||||
}
|
||||
module->methods->open(module, BT_HARDWARE_MODULE_ID, &device);
|
||||
|
@ -682,7 +682,7 @@ EnsureBluetoothHalLoad()
|
|||
|
||||
int ret = sBtInterface->init(&sBluetoothCallbacks);
|
||||
if (ret != BT_STATUS_SUCCESS) {
|
||||
BT_LOGR("Error while setting the callbacks %s", __FUNCTION__);
|
||||
BT_LOGR("Error while setting the callbacks");
|
||||
sBtInterface = nullptr;
|
||||
}
|
||||
|
||||
|
@ -712,7 +712,7 @@ ReplyStatusError(BluetoothReplyRunnable* aBluetoothReplyRunnable,
|
|||
{
|
||||
MOZ_ASSERT(aBluetoothReplyRunnable, "Reply runnable is nullptr");
|
||||
|
||||
BT_LOGR("%s: error code(%d)", __FUNCTION__, aStatusCode);
|
||||
BT_LOGR("error code(%d)", aStatusCode);
|
||||
|
||||
nsAutoString replyError;
|
||||
replyError.Assign(aCustomMsg);
|
||||
|
@ -743,7 +743,7 @@ BluetoothServiceBluedroid::BluetoothServiceBluedroid()
|
|||
sToggleBtMonitor = new Monitor("BluetoothService.sToggleBtMonitor");
|
||||
|
||||
if (!EnsureBluetoothHalLoad()) {
|
||||
BT_LOGR("Error! Failed to load bluedroid library.\n");
|
||||
BT_LOGR("Error! Failed to load bluedroid library.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ BluetoothServiceBluedroid::StartInternal()
|
|||
|
||||
nsresult ret = StartStopGonkBluetooth(true);
|
||||
if (NS_FAILED(ret)) {
|
||||
BT_LOGR("Error: %s", __FUNCTION__);
|
||||
BT_LOGR("Error");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -778,7 +778,7 @@ BluetoothServiceBluedroid::StopInternal()
|
|||
|
||||
nsresult ret = StartStopGonkBluetooth(false);
|
||||
if (NS_FAILED(ret)) {
|
||||
BT_LOGR("Error: %s", __FUNCTION__);
|
||||
BT_LOGR("Error");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -399,7 +399,7 @@ BluetoothOppManager::DiscardBlobsToSend()
|
|||
while (length > mCurrentBlobIndex + 1) {
|
||||
mBlob = mBatches[0].mBlobs[++mCurrentBlobIndex];
|
||||
|
||||
BT_LOGR("%s: idx %d", __FUNCTION__, mCurrentBlobIndex);
|
||||
BT_LOGR("idx %d", mCurrentBlobIndex);
|
||||
ExtractBlobHeaders();
|
||||
StartFileTransfer();
|
||||
FileTransferComplete();
|
||||
|
@ -416,7 +416,7 @@ BluetoothOppManager::ProcessNextBatch()
|
|||
if (mCurrentBlobIndex >= 0) {
|
||||
ClearQueue();
|
||||
mBatches.RemoveElementAt(0);
|
||||
BT_LOGR("%s: REMOVE. %d remaining", __FUNCTION__, mBatches.Length());
|
||||
BT_LOGR("REMOVE. %d remaining", mBatches.Length());
|
||||
}
|
||||
|
||||
// Process the next batch
|
||||
|
@ -774,7 +774,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
|||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
mPacketReceivedLength + dataLength > mPacketLength) {
|
||||
BT_LOGR("%s: Received packet size is unreasonable", __FUNCTION__);
|
||||
BT_LOGR("Received packet size is unreasonable");
|
||||
|
||||
ReplyToPut(mPutFinalFlag, false);
|
||||
DeleteReceivedFile();
|
||||
|
@ -1392,7 +1392,7 @@ BluetoothOppManager::NotifyAboutFileChange()
|
|||
void
|
||||
BluetoothOppManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer)? "server" : "client");
|
||||
BT_LOGR("[%s]", (mIsServer)? "server" : "client");
|
||||
MOZ_ASSERT(aSocket);
|
||||
|
||||
/**
|
||||
|
@ -1428,7 +1428,7 @@ BluetoothOppManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
|||
void
|
||||
BluetoothOppManager::OnSocketConnectError(BluetoothSocket* aSocket)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer)? "server" : "client");
|
||||
BT_LOGR("[%s]", (mIsServer)? "server" : "client");
|
||||
|
||||
mRfcommSocket = nullptr;
|
||||
mL2capSocket = nullptr;
|
||||
|
@ -1448,7 +1448,7 @@ BluetoothOppManager::OnSocketConnectError(BluetoothSocket* aSocket)
|
|||
void
|
||||
BluetoothOppManager::OnSocketDisconnect(BluetoothSocket* aSocket)
|
||||
{
|
||||
BT_LOGR("%s: [%s]", __FUNCTION__, (mIsServer)? "server" : "client");
|
||||
BT_LOGR("[%s]", (mIsServer)? "server" : "client");
|
||||
MOZ_ASSERT(aSocket);
|
||||
|
||||
if (aSocket != mSocket) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче