Bug 804474 - Null address value in system message of "bluetooth-hfp-status-changed". r=qdot, a=blocking-basecamp

This commit is contained in:
Gina Yeh 2012-10-26 17:21:32 +08:00
Родитель 7d56a60b2a
Коммит b8a22bfb53
2 изменённых файлов: 13 добавлений и 8 удалений

Просмотреть файл

@ -321,14 +321,16 @@ BluetoothHfpManager::NotifySettings()
type.AssignLiteral("bluetooth-hfp-status-changed"); type.AssignLiteral("bluetooth-hfp-status-changed");
name.AssignLiteral("connected"); name.AssignLiteral("connected");
uint32_t status = GetConnectionStatus(); if (GetConnectionStatus() == SocketConnectionStatus::SOCKET_CONNECTED) {
v = status; v = true;
} else {
v = false;
}
parameters.AppendElement(BluetoothNamedValue(name, v)); parameters.AppendElement(BluetoothNamedValue(name, v));
name.AssignLiteral("address"); name.AssignLiteral("address");
nsString address; GetSocketAddr(mDevicePath);
GetSocketAddr(address); v = mDevicePath;
v = address;
parameters.AppendElement(BluetoothNamedValue(name, v)); parameters.AppendElement(BluetoothNamedValue(name, v));
if (!BroadcastSystemMessage(type, parameters)) { if (!BroadcastSystemMessage(type, parameters)) {
@ -835,12 +837,14 @@ BluetoothHfpManager::CallStateChanged(int aCallIndex, int aCallState,
void void
BluetoothHfpManager::OnConnectSuccess() BluetoothHfpManager::OnConnectSuccess()
{ {
// Cache device path for NotifySettings() since we can't get socket address
// when a headset disconnect with us
GetSocketAddr(mDevicePath);
if (mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED || if (mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED ||
mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING || mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING ||
mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_ALERTING) { mCurrentCallState == nsIRadioInterfaceLayer::CALL_STATE_ALERTING) {
nsString address; OpenScoSocket(mDevicePath);
GetSocketAddr(address);
OpenScoSocket(address);
} }
NotifySettings(); NotifySettings();

Просмотреть файл

@ -54,6 +54,7 @@ private:
int mCurrentCallIndex; int mCurrentCallIndex;
int mCurrentCallState; int mCurrentCallState;
bool mReceiveVgsFlag; bool mReceiveVgsFlag;
nsString mDevicePath;
nsAutoPtr<BluetoothRilListener> mListener; nsAutoPtr<BluetoothRilListener> mListener;
}; };