Bug 1031239 - Part 2: Select clientId for emergency call. r=hsinyi

This commit is contained in:
Szu-Yu Chen [:aknow] 2014-07-02 03:47:00 -04:00
parent 8dbc759b37
commit 0ec9c34bf0
3 changed files with 27 additions and 1 deletions

View File

@ -1576,6 +1576,15 @@ RadioInterfaceLayer.prototype = {
return this.radioInterfaces[clientId];
},
getClientIdForEmergencyCall: function() {
for (let cid = 0; cid < this.numRadioInterfaces; ++cid) {
if (gRadioEnabledController._isRadioAbleToEnableAtClient(cid)) {
return cid;
}
}
return -1;
},
setMicrophoneMuted: function(muted) {
for (let clientId = 0; clientId < this.numRadioInterfaces; clientId++) {
let radioInterface = this.radioInterfaces[clientId];

View File

@ -93,12 +93,19 @@ interface nsIRadioInterface : nsISupports
void getNeighboringCellIds(in nsINeighboringCellIdsCallback callback);
};
[scriptable, uuid(d035c32e-b491-11e3-9f9d-c716fab88bd6)]
[scriptable, uuid(78b65e8c-68e7-4510-9a05-65bba12b283e)]
interface nsIRadioInterfaceLayer : nsISupports
{
readonly attribute unsigned long numRadioInterfaces;
nsIRadioInterface getRadioInterface(in unsigned long clientId);
/**
* Select a proper client for dialing emergency call.
*
* @return clientId or -1 if none of the clients are avaialble.
*/
unsigned long getClientIdForEmergencyCall();
void setMicrophoneMuted(in boolean muted);
};

View File

@ -413,6 +413,16 @@ TelephonyService.prototype = {
return;
}
// Select a proper clientId for dialEmergency.
if (aIsEmergency) {
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;
if (aClientId === -1) {
if (DEBUG) debug("Error: No client is avaialble for emergency call.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
}
// For DSDS, if there is aleady a call on SIM 'aClientId', we cannot place
// any new call on other SIM.
if (this._hasCallsOnOtherClient(aClientId)) {