Bug 1069862 - Use serviceClass 0 to query callbarring option. r=hsinyi
--- a/dom/system/gonk/ril_worker.js
+++ b/dom/system/gonk/ril_worker.js
@@ -2720,16 +2720,23 @@ RilObject.prototype = {
* @param program
* One of CALL_BARRING_PROGRAM_* constants.
* @param serviceClass
* One of ICC_SERVICE_CLASS_* constants.
*/
queryCallBarringStatus: function(options) {
options.facility = CALL_BARRING_PROGRAM_TO_FACILITY[options.program];
options.password = ""; // For query no need to provide it.
+
+ // For some operators, querying specific serviceClass doesn't work. We use
+ // serviceClass 0 instead, and then process the response to extract the
+ // answer for queryServiceClass.
+ options.queryServiceClass = options.serviceClass;
+ options.serviceClass = 0;
+
this.queryICCFacilityLock(options);
},
/**
* Configures call barring rule.
*
* @param program
* One of CALL_BARRING_PROGRAM_* constants.
@@ -5925,30 +5932,33 @@ RilObject.prototype[REQUEST_DEACTIVATE_D
RilObject.prototype[REQUEST_QUERY_FACILITY_LOCK] = function REQUEST_QUERY_FACILITY_LOCK(length, options) {
options.success = (options.rilRequestError === 0);
if (!options.success) {
options.errorMsg = RIL_ERROR_TO_GECKO_ERROR[options.rilRequestError];
this.sendChromeMessage(options);
return;
}
- let services;
- if (length) {
- // Buf.readInt32List()[0] for Call Barring is a bit vector of services.
- services = this.context.Buf.readInt32List()[0];
- } else {
+ if (!length) {
options.success = false;
options.errorMsg = GECKO_ERROR_GENERIC_FAILURE;
this.sendChromeMessage(options);
return;
}
- options.enabled = services === 0 ? false : true;
-
- if (options.success && (options.rilMessageType === "sendMMI")) {
+ // Buf.readInt32List()[0] for Call Barring is a bit vector of services.
+ let services = this.context.Buf.readInt32List()[0];
+
+ if (options.queryServiceClass) {
+ options.enabled = (services & options.queryServiceClass) ? true : false;
+ } else {
+ options.enabled = services ? true : false;
+ }
+
+ if (options.rilMessageType === "sendMMI") {
if (!options.enabled) {
options.statusMessage = MMI_SM_KS_SERVICE_DISABLED;
} else {
options.statusMessage = MMI_SM_KS_SERVICE_ENABLED_FOR;
let serviceClass = [];
for (let serviceClassMask = 1;
serviceClassMask <= ICC_SERVICE_CLASS_MAX;
serviceClassMask <<= 1) {