mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-03 07:01:19 +00:00
Bug 900880 - Remove unused system messages, r=echou
This commit is contained in:
parent
452406ee5e
commit
135f478a83
@ -299,7 +299,6 @@ BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal)
|
||||
mA2dpConnected = true;
|
||||
mDeviceAddress = address;
|
||||
NotifyConnectionStatusChanged();
|
||||
DispatchConnectionStatusChanged();
|
||||
|
||||
OnConnect(EmptyString());
|
||||
break;
|
||||
@ -319,7 +318,6 @@ BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal)
|
||||
|
||||
mA2dpConnected = false;
|
||||
NotifyConnectionStatusChanged();
|
||||
DispatchConnectionStatusChanged();
|
||||
mDeviceAddress.Truncate();
|
||||
|
||||
// case 7 only
|
||||
@ -330,36 +328,11 @@ BluetoothA2dpManager::HandleSinkPropertyChanged(const BluetoothSignal& aSignal)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothA2dpManager::DispatchConnectionStatusChanged()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
DispatchStatusChangedEvent(
|
||||
NS_LITERAL_STRING(A2DP_STATUS_CHANGED_ID), mDeviceAddress, mA2dpConnected);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothA2dpManager::NotifyConnectionStatusChanged()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// Broadcast system message to Gaia
|
||||
NS_NAMED_LITERAL_STRING(type, BLUETOOTH_A2DP_STATUS_CHANGED_ID);
|
||||
InfallibleTArray<BluetoothNamedValue> parameters;
|
||||
|
||||
BluetoothValue v = mA2dpConnected;
|
||||
parameters.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("connected"), v));
|
||||
|
||||
v = mDeviceAddress;
|
||||
parameters.AppendElement(
|
||||
BluetoothNamedValue(NS_LITERAL_STRING("address"), v));
|
||||
|
||||
if (!BroadcastSystemMessage(type, parameters)) {
|
||||
NS_WARNING("Failed to broadcast system message to settings");
|
||||
}
|
||||
|
||||
// Notify Gecko observers
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
@ -370,6 +343,10 @@ BluetoothA2dpManager::NotifyConnectionStatusChanged()
|
||||
mDeviceAddress.get()))) {
|
||||
NS_WARNING("Failed to notify bluetooth-a2dp-status-changed observsers!");
|
||||
}
|
||||
|
||||
// Dispatch an event of status change
|
||||
DispatchStatusChangedEvent(
|
||||
NS_LITERAL_STRING(A2DP_STATUS_CHANGED_ID), mDeviceAddress, mA2dpConnected);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -71,8 +71,6 @@ private:
|
||||
bool Init();
|
||||
|
||||
void HandleShutdown();
|
||||
|
||||
void DispatchConnectionStatusChanged();
|
||||
void NotifyConnectionStatusChanged();
|
||||
|
||||
nsString mDeviceAddress;
|
||||
|
@ -442,50 +442,11 @@ BluetoothHfpManager::Get()
|
||||
return sBluetoothHfpManager;
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHfpManager::DispatchConnectionStatusChanged(const nsAString& aType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
bool status = false;
|
||||
if (aType.EqualsLiteral(HFP_STATUS_CHANGED_ID)) {
|
||||
status = IsConnected();
|
||||
} else if (aType.EqualsLiteral(SCO_STATUS_CHANGED_ID)) {
|
||||
status = IsScoConnected();
|
||||
} else {
|
||||
BT_WARNING("Wrong type for DispatchConnectionStatusChanged");
|
||||
return;
|
||||
}
|
||||
|
||||
DispatchStatusChangedEvent(aType, mDeviceAddress, status);
|
||||
}
|
||||
|
||||
void
|
||||
BluetoothHfpManager::NotifyConnectionStatusChanged(const nsAString& aType)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
BluetoothValue v;
|
||||
InfallibleTArray<BluetoothNamedValue> parameters;
|
||||
nsString name = NS_LITERAL_STRING("connected");
|
||||
if (aType.EqualsLiteral(BLUETOOTH_HFP_STATUS_CHANGED_ID)) {
|
||||
v = IsConnected();
|
||||
} else if (aType.EqualsLiteral(BLUETOOTH_SCO_STATUS_CHANGED_ID)) {
|
||||
v = IsScoConnected();
|
||||
} else {
|
||||
BT_WARNING("Wrong type for NotifyConnectionStatusChanged");
|
||||
return;
|
||||
}
|
||||
parameters.AppendElement(BluetoothNamedValue(name, v));
|
||||
|
||||
name.AssignLiteral("address");
|
||||
v = mDeviceAddress;
|
||||
parameters.AppendElement(BluetoothNamedValue(name, v));
|
||||
|
||||
if (!BroadcastSystemMessage(aType, parameters)) {
|
||||
NS_WARNING("Failed to broadcast system message to settings");
|
||||
}
|
||||
|
||||
// Notify Gecko observers
|
||||
nsCOMPtr<nsIObserverService> obs =
|
||||
do_GetService("@mozilla.org/observer-service;1");
|
||||
@ -495,6 +456,22 @@ BluetoothHfpManager::NotifyConnectionStatusChanged(const nsAString& aType)
|
||||
mDeviceAddress.get()))) {
|
||||
NS_WARNING("Failed to notify observsers!");
|
||||
}
|
||||
|
||||
// Dispatch an event of status change
|
||||
bool status;
|
||||
nsAutoString eventName;
|
||||
if (aType.EqualsLiteral(BLUETOOTH_HFP_STATUS_CHANGED_ID)) {
|
||||
status = IsConnected();
|
||||
eventName.AssignLiteral(HFP_STATUS_CHANGED_ID);
|
||||
} else if (aType.EqualsLiteral(BLUETOOTH_SCO_STATUS_CHANGED_ID)) {
|
||||
status = IsScoConnected();
|
||||
eventName.AssignLiteral(SCO_STATUS_CHANGED_ID);
|
||||
} else {
|
||||
MOZ_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
DispatchStatusChangedEvent(eventName, mDeviceAddress, status);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1481,8 +1458,8 @@ BluetoothHfpManager::OnSocketConnectSuccess(BluetoothSocket* aSocket)
|
||||
// Cache device path for NotifySettings() since we can't get socket address
|
||||
// when a headset disconnect with us
|
||||
mSocket->GetAddress(mDeviceAddress);
|
||||
NotifyConnectionStatusChanged(NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID));
|
||||
DispatchConnectionStatusChanged(NS_LITERAL_STRING(HFP_STATUS_CHANGED_ID));
|
||||
NotifyConnectionStatusChanged(
|
||||
NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID));
|
||||
|
||||
ListenSco();
|
||||
|
||||
@ -1522,8 +1499,8 @@ BluetoothHfpManager::OnSocketDisconnect(BluetoothSocket* aSocket)
|
||||
|
||||
DisconnectSco();
|
||||
|
||||
NotifyConnectionStatusChanged(NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID));
|
||||
DispatchConnectionStatusChanged(NS_LITERAL_STRING(HFP_STATUS_CHANGED_ID));
|
||||
NotifyConnectionStatusChanged(
|
||||
NS_LITERAL_STRING(BLUETOOTH_HFP_STATUS_CHANGED_ID));
|
||||
OnDisconnect(EmptyString());
|
||||
|
||||
Reset();
|
||||
@ -1592,8 +1569,8 @@ BluetoothHfpManager::OnScoConnectSuccess()
|
||||
mScoRunnable = nullptr;
|
||||
}
|
||||
|
||||
NotifyConnectionStatusChanged(NS_LITERAL_STRING(BLUETOOTH_SCO_STATUS_CHANGED_ID));
|
||||
DispatchConnectionStatusChanged(NS_LITERAL_STRING(SCO_STATUS_CHANGED_ID));
|
||||
NotifyConnectionStatusChanged(
|
||||
NS_LITERAL_STRING(BLUETOOTH_SCO_STATUS_CHANGED_ID));
|
||||
|
||||
mScoSocketStatus = mScoSocket->GetConnectionStatus();
|
||||
}
|
||||
@ -1616,8 +1593,8 @@ BluetoothHfpManager::OnScoDisconnect()
|
||||
{
|
||||
if (mScoSocketStatus == SocketConnectionStatus::SOCKET_CONNECTED) {
|
||||
ListenSco();
|
||||
NotifyConnectionStatusChanged(NS_LITERAL_STRING(BLUETOOTH_SCO_STATUS_CHANGED_ID));
|
||||
DispatchConnectionStatusChanged(NS_LITERAL_STRING(SCO_STATUS_CHANGED_ID));
|
||||
NotifyConnectionStatusChanged(
|
||||
NS_LITERAL_STRING(BLUETOOTH_SCO_STATUS_CHANGED_ID));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -121,9 +121,8 @@ private:
|
||||
uint32_t FindFirstCall(uint16_t aState);
|
||||
uint32_t GetNumberOfCalls(uint16_t aState);
|
||||
|
||||
void DispatchConnectionStatusChanged(const nsAString& aType);
|
||||
void NotifyDialer(const nsAString& aCommand);
|
||||
void NotifyConnectionStatusChanged(const nsAString& aType);
|
||||
void NotifyDialer(const nsAString& aCommand);
|
||||
|
||||
bool SendCommand(const char* aCommand, uint32_t aValue = 0);
|
||||
bool SendLine(const char* aMessage);
|
||||
|
@ -37,21 +37,9 @@ this.SystemMessagePermissionsTable = {
|
||||
"bluetooth-cancel": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-pairedstatuschanged": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-a2dp-status-changed": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-hfp-status-changed": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-hid-status-changed": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-sco-status-changed": {
|
||||
"bluetooth": []
|
||||
},
|
||||
"bluetooth-pairing-request": {
|
||||
"bluetooth": []
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user