Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
64
gaia/apps/system/js/sim_settings_helper.js
Executable file
64
gaia/apps/system/js/sim_settings_helper.js
Executable file
|
|
@ -0,0 +1,64 @@
|
|||
/* exported SimSettingsHelper */
|
||||
/* global SIMSlotManager, SettingsListener */
|
||||
'use strict';
|
||||
|
||||
(function(exports) {
|
||||
// we have to make sure we are in DSDS
|
||||
if (!SIMSlotManager.isMultiSIM()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var SimSettingsHelper = {
|
||||
start: function ssh_init() {
|
||||
if (SIMSlotManager.ready) {
|
||||
this.simslotUpdatedHandler();
|
||||
} else {
|
||||
window.addEventListener('simslotready', this);
|
||||
}
|
||||
},
|
||||
handleEvent: function ssh_handleEvent(evt) {
|
||||
switch (evt.type) {
|
||||
case 'simslotready':
|
||||
this.simslotUpdatedHandler();
|
||||
break;
|
||||
}
|
||||
},
|
||||
overrideUserSimSettings: function() {
|
||||
var availableSIMIndex = SIMSlotManager.isSIMCardAbsent(0) ? 1 : 0;
|
||||
this.setServiceOnCard('outgoingCall', availableSIMIndex);
|
||||
this.setServiceOnCard('outgoingMessages', availableSIMIndex);
|
||||
this.setServiceOnCard('outgoingData', availableSIMIndex);
|
||||
},
|
||||
simslotUpdatedHandler: function() {
|
||||
if (SIMSlotManager.hasOnlyOneSIMCardDetected()) {
|
||||
this.overrideUserSimSettings();
|
||||
}
|
||||
},
|
||||
setServiceOnCard: function ssh_setServiceOnCard(serviceName, cardIndex) {
|
||||
var mozKeys = [];
|
||||
|
||||
switch (serviceName) {
|
||||
case 'outgoingCall':
|
||||
mozKeys.push('ril.telephony.defaultServiceId');
|
||||
mozKeys.push('ril.voicemail.defaultServiceId');
|
||||
break;
|
||||
|
||||
case 'outgoingMessages':
|
||||
mozKeys.push('ril.sms.defaultServiceId');
|
||||
break;
|
||||
|
||||
case 'outgoingData':
|
||||
mozKeys.push('ril.mms.defaultServiceId');
|
||||
mozKeys.push('ril.data.defaultServiceId');
|
||||
break;
|
||||
}
|
||||
|
||||
mozKeys.forEach(function(eachKey) {
|
||||
var setObj = {};
|
||||
setObj[eachKey] = cardIndex;
|
||||
SettingsListener.getSettingsLock().set(setObj);
|
||||
});
|
||||
}
|
||||
};
|
||||
exports.SimSettingsHelper = SimSettingsHelper;
|
||||
})(window);
|
||||
Loading…
Reference in a new issue