Bug 921326 - Part 1: Support to Set Search List for Each SIM. r=htsai
--- a/dom/system/gonk/RadioInterfaceLayer.js
+++ b/dom/system/gonk/RadioInterfaceLayer.js
@@ -1810,18 +1810,30 @@ function RadioInterface(aClientId, aWork
lock.get(kSettingsTimezoneAutoUpdateEnabled, this);
// Set "time.clock.automatic-update.available" to false when starting up.
this.setClockAutoUpdateAvailable(false);
// Set "time.timezone.automatic-update.available" to false when starting up.
this.setTimezoneAutoUpdateAvailable(false);
- // Read the Cell Broadcast Search List setting, string of integers or integer
- // ranges separated by comma, to set listening channels.
+ /**
+ * Read the Cell Broadcast Search List setting to set listening channels:
+ *
+ * Simple Format:
+ * String of integers or integer ranges separated by comma.
+ * For example, "1, 2, 4-6"
+ * Enhanced Format:
+ * Array of Objects with search lists specified in gsm/cdma network.
+ * For example, [{'gsm' : "1, 2, 4-6", 'cdma' : "1, 50, 99"},
+ * {'cdma' : "3, 6, 8-9"}]
+ * This provides the possibility to
+ * 1. set gsm/cdma search list individually for CDMA+LTE device.
+ * 2. set search list per RadioInterface.
+ */
lock.get(kSettingsCellBroadcastSearchList, this);
Services.obs.addObserver(this, kMozSettingsChangedObserverTopic, false);
Services.obs.addObserver(this, kSysClockChangeObserverTopic, false);
Services.obs.addObserver(this, kScreenStateChangedTopic, false);
Services.obs.addObserver(this, kNetworkConnStateChangedTopic, false);
Services.obs.addObserver(this, kNetworkActiveChangedTopic, false);
@@ -2488,33 +2500,40 @@ RadioInterface.prototype = {
this._selectingNetwork = null;
target.sendAsyncMessage("RIL:SelectNetworkAuto", {
clientId: this.clientId,
data: response
});
}).bind(this));
},
- setCellBroadcastSearchList: function(newSearchList) {
- if ((newSearchList == this._cellBroadcastSearchList) ||
- (newSearchList && this._cellBroadcastSearchList &&
- newSearchList.gsm == this._cellBroadcastSearchList.gsm &&
- newSearchList.cdma == this._cellBroadcastSearchList.cdma)) {
+ setCellBroadcastSearchList: function(settings) {
+ let newSearchList =
+ Array.isArray(settings) ? settings[this.clientId] : settings;
+ let oldSearchList =
+ Array.isArray(this._cellBroadcastSearchList) ?
+ this._cellBroadcastSearchList[this.clientId] :
+ this._cellBroadcastSearchList;
+
+ if ((newSearchList == oldSearchList) ||
+ (newSearchList && oldSearchList &&
+ newSearchList.gsm == oldSearchList.gsm &&
+ newSearchList.cdma == oldSearchList.cdma)) {
return;
}
this.workerMessenger.send("setCellBroadcastSearchList",
{ searchList: newSearchList },
(function callback(response) {
if (!response.success) {
let lock = gSettingsService.createLock();
lock.set(kSettingsCellBroadcastSearchList,
this._cellBroadcastSearchList, null);
} else {
- this._cellBroadcastSearchList = response.searchList;
+ this._cellBroadcastSearchList = settings;
}
return false;
}).bind(this));
},
/**
* Handle signal strength changes.
@@ -3470,19 +3489,18 @@ RadioInterface.prototype = {
}
}
break;
case kSettingsCellBroadcastSearchList:
if (DEBUG) {
this.debug("'" + kSettingsCellBroadcastSearchList +
"' is now " + JSON.stringify(aResult));
}
- // TODO: Set searchlist for Multi-SIM. See Bug 921326.
- let result = Array.isArray(aResult) ? aResult[0] : aResult;
- this.setCellBroadcastSearchList(result);
+
+ this.setCellBroadcastSearchList(aResult);
break;
}
},
handleError: function(aErrorMessage) {
if (DEBUG) {
this.debug("There was an error while reading RIL settings.");
}