Backed out changeset c6fee4d37e2a (bug 1023141)

This commit is contained in:
Carsten "Tomcat" Book 2014-07-01 15:35:54 +02:00
parent 93c125d560
commit 348c271122
3 changed files with 80 additions and 86 deletions

View File

@ -1632,7 +1632,9 @@ WorkerMessenger.prototype = {
libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true",
dataRegistrationOnDemand: RILQUIRKS_DATA_REGISTRATION_ON_DEMAND,
subscriptionControl: RILQUIRKS_SUBSCRIPTION_CONTROL
}
},
rilEmergencyNumbers: libcutils.property_get("ril.ecclist") ||
libcutils.property_get("ro.ril.ecclist")
};
this.send(null, "setInitialOptions", options);

View File

@ -52,6 +52,9 @@ if (!this.debug) {
};
}
let RIL_EMERGENCY_NUMBERS;
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
// Timeout value for emergency callback mode.
const EMERGENCY_CB_MODE_TIMEOUT_MS = 300000; // 5 mins = 300000 ms.
@ -1552,7 +1555,7 @@ RilObject.prototype = {
cachedDialRequest : null,
/**
* Dial a non-emergency number.
* Dial the phone.
*
* @param number
* String containing the number to dial.
@ -1561,13 +1564,34 @@ RilObject.prototype = {
* @param uusInfo
* Integer doing something XXX TODO
*/
dialNonEmergencyNumber: function(options) {
dial: function(options) {
let onerror = (function onerror(options, errorMsg) {
options.success = false;
options.errorMsg = errorMsg;
this.sendChromeMessage(options);
}).bind(this, options);
if (this._isEmergencyNumber(options.number)) {
this.dialEmergencyNumber(options, onerror);
} else {
if (!this._isCdma) {
// TODO: Both dial() and sendMMI() functions should be unified at some
// point in the future. In the mean time we handle temporary CLIR MMI
// commands through the dial() function. Please see bug 889737.
let mmi = this._parseMMI(options.number);
if (mmi && this._isTemporaryModeCLIR(mmi)) {
options.number = mmi.dialNumber;
// In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI
// presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B.
options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ?
CLIR_SUPPRESSION : CLIR_INVOCATION;
}
}
this.dialNonEmergencyNumber(options, onerror);
}
},
dialNonEmergencyNumber: function(options, onerror) {
if (this.radioState == GECKO_RADIOSTATE_OFF) {
// Notify error in establishing the call without radio.
onerror(GECKO_ERROR_RADIO_NOT_AVAILABLE);
@ -1585,41 +1609,17 @@ RilObject.prototype = {
this.exitEmergencyCbMode();
}
if (!this._isCdma) {
// TODO: Both dial() and sendMMI() functions should be unified at some
// point in the future. In the mean time we handle temporary CLIR MMI
// commands through the dial() function. Please see bug 889737.
let mmi = this._parseMMI(options.number);
if (mmi && this._isTemporaryModeCLIR(mmi)) {
options.number = mmi.dialNumber;
// In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI
// presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B.
options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ?
CLIR_SUPPRESSION : CLIR_INVOCATION;
}
if (this._isCdma && Object.keys(this.currentCalls).length == 1) {
// Make a Cdma 3way call.
options.featureStr = options.number;
this.sendCdmaFlashCommand(options);
} else {
options.request = REQUEST_DIAL;
this.sendDialRequest(options);
}
options.request = REQUEST_DIAL;
this.sendDialRequest(options);
},
/**
* Dial an emergency number.
*
* @param number
* String containing the number to dial.
* @param clirMode
* Integer for showing/hidding the caller Id to the called party.
* @param uusInfo
* Integer doing something XXX TODO
*/
dialEmergencyNumber: function(options) {
let onerror = (function onerror(options, errorMsg) {
options.success = false;
options.errorMsg = errorMsg;
this.sendChromeMessage(options);
}).bind(this, options);
dialEmergencyNumber: function(options, onerror) {
options.request = RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL ?
REQUEST_DIAL_EMERGENCY_CALL : REQUEST_DIAL;
if (this.radioState == GECKO_RADIOSTATE_OFF) {
@ -1636,20 +1636,20 @@ RilObject.prototype = {
return;
}
this.sendDialRequest(options);
},
sendDialRequest: function(options) {
if (this._isCdma && Object.keys(this.currentCalls).length == 1) {
// Make a Cdma 3way call.
options.featureStr = options.number;
this.sendCdmaFlashCommand(options);
} else {
this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial,
options);
this.sendDialRequest(options);
}
},
sendDialRequest: function(options) {
this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial,
options);
},
sendRilRequestDial: function(options) {
let Buf = this.context.Buf;
Buf.newParcel(options.request, options);
@ -2417,8 +2417,9 @@ RilObject.prototype = {
return false;
}
// TODO: Should take care of checking if the string is an emergency number
// in Bug 889737. See Bug 1023141 for more background.
if (this._isEmergencyNumber(mmiString)) {
return false;
}
// In a call case.
if (Object.getOwnPropertyNames(this.currentCalls).length > 0) {
@ -3308,18 +3309,38 @@ RilObject.prototype = {
},
/**
* Checks whether to temporarily suppress caller id for the call.
* Check a given number against the list of emergency numbers provided by the RIL.
*
* @param mmi
* MMI full object.
* @param number
* The number to look up.
*/
_isTemporaryModeCLIR: function(mmi) {
return (mmi &&
mmi.serviceCode == MMI_SC_CLIR &&
mmi.dialNumber &&
(mmi.procedure == MMI_PROCEDURE_ACTIVATION ||
mmi.procedure == MMI_PROCEDURE_DEACTIVATION));
},
_isEmergencyNumber: function(number) {
// Check ril provided numbers first.
let numbers = RIL_EMERGENCY_NUMBERS;
if (numbers) {
numbers = numbers.split(",");
} else {
// No ecclist system property, so use our own list.
numbers = DEFAULT_EMERGENCY_NUMBERS;
}
return numbers.indexOf(number) != -1;
},
/**
* Checks whether to temporarily suppress caller id for the call.
*
* @param mmi
* MMI full object.
*/
_isTemporaryModeCLIR: function(mmi) {
return (mmi &&
mmi.serviceCode == MMI_SC_CLIR &&
mmi.dialNumber &&
(mmi.procedure == MMI_PROCEDURE_ACTIVATION ||
mmi.procedure == MMI_PROCEDURE_DEACTIVATION));
},
/**
* Report STK Service is running.
@ -4034,7 +4055,6 @@ RilObject.prototype = {
for (let i in newCalls) {
if (newCalls[i].state !== CALL_STATE_INCOMING) {
callIndex = newCalls[i].callIndex;
newCalls[i].isEmergency = options.isEmergency;
break;
}
}
@ -4085,9 +4105,9 @@ RilObject.prototype = {
newCall.isOutgoing = true;
}
if (newCall.isEmergency === undefined) {
newCall.isEmergency = false;
}
// Set flag for outgoing emergency call.
newCall.isEmergency = newCall.isOutgoing &&
this._isEmergencyNumber(newCall.number);
// Set flag for conference.
newCall.isConference = newCall.isMpty ? true : false;

View File

@ -10,7 +10,6 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/systemlibs.js");
XPCOMUtils.defineLazyGetter(this, "RIL", function () {
let obj = {};
@ -51,8 +50,6 @@ const AUDIO_STATE_NAME = [
"PHONE_STATE_IN_CALL"
];
const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"];
let DEBUG;
function debug(s) {
dump("TelephonyService: " + s + "\n");
@ -333,26 +330,6 @@ TelephonyService.prototype = {
}).bind(this));
},
/**
* Check a given number against the list of emergency numbers provided by the
* RIL.
*
* @param aNumber
* The number to look up.
*/
_isEmergencyNumber: function(aNumber) {
// Check ril provided numbers first.
let numbers = libcutils.property_get("ril.ecclist") ||
libcutils.property_get("ro.ril.ecclist");
if (numbers) {
numbers = numbers.split(",");
} else {
// No ecclist system property, so use our own list.
numbers = DEFAULT_EMERGENCY_NUMBERS;
}
return numbers.indexOf(aNumber) != -1;
},
/**
* nsITelephonyService interface.
*/
@ -500,14 +477,9 @@ TelephonyService.prototype = {
this.notifyCallStateChanged(aClientId, parentCall);
};
let isEmergencyNumber = this._isEmergencyNumber(aNumber);
let msg = isEmergencyNumber ?
"dialEmergencyNumber" :
"dialNonEmergencyNumber";
this.isDialing = true;
this._getClient(aClientId).sendWorkerMessage(msg, {
this._getClient(aClientId).sendWorkerMessage("dial", {
number: aNumber,
isEmergency: isEmergencyNumber,
isDialEmergency: aIsEmergency
}, (function(response) {
this.isDialing = false;