Permalink
Browse files

Bug 815595 - Show carrier name (SPN and/or network) according to SIM …

…display conditions
  • Loading branch information...
1 parent e9b9271 commit 4d84c0b2ec35b61fa6c9428b572a659a771e1a1d @timdream timdream committed Dec 4, 2012
Showing with 26 additions and 0 deletions.
  1. +11 −0 apps/system/js/lockscreen.js
  2. +15 −0 apps/system/js/statusbar.js
@@ -140,6 +140,7 @@ var LockScreen = {
if (conn && conn.voice) {
conn.addEventListener('voicechange', this);
conn.addEventListener('cardstatechange', this);
+ conn.addEventListener('iccinfochange', this);
this.updateConnState();
this.connstate.hidden = false;
}
@@ -245,6 +246,7 @@ var LockScreen = {
break;
case 'voicechange':
case 'cardstatechange':
+ case 'iccinfochange':
this.updateConnState();
case 'click':
@@ -724,6 +726,7 @@ var LockScreen = {
return;
var voice = conn.voice;
+ var iccInfo = conn.iccInfo;
var connstateLine1 = this.connstate.firstElementChild;
var connstateLine2 = this.connstate.lastElementChild;
var _ = navigator.mozL10n.get;
@@ -810,6 +813,14 @@ var LockScreen = {
var carrierName = voice.network.shortName || voice.network.longName;
+ if (iccInfo.isDisplaySpnRequired && iccInfo.spn) {
+ if (iccInfo.isDisplayNetworkNameRequired) {
+ carrierName = carrierName + ' ' + iccInfo.spn;
+ } else {
+ carrierName = iccInfo.spn;
+ }
+ }
+
if (voice.roaming) {
var l10nArgs = { operator: carrierName };
connstateLine1.dataset.l10nId = 'roaming';
@@ -130,6 +130,10 @@ var StatusBar = {
this.update.label.call(this);
break;
+ case 'iccinfochange':
+ this.update.label.call(this);
+ break;
+
case 'datachange':
this.update.data.call(this);
break;
@@ -189,6 +193,7 @@ var StatusBar = {
var conn = window.navigator.mozMobileConnection;
if (conn) {
conn.addEventListener('voicechange', this);
+ conn.addEventListener('iccinfochange', this);
conn.addEventListener('datachange', this);
this.update.signal.call(this);
this.update.data.call(this);
@@ -216,6 +221,7 @@ var StatusBar = {
var conn = window.navigator.mozMobileConnection;
if (conn) {
conn.removeEventListener('voicechange', this);
+ conn.removeEventListener('iccinfochange', this);
conn.removeEventListener('datachange', this);
}
@@ -242,9 +248,18 @@ var StatusBar = {
}
var voice = conn.voice;
+ var iccInfo = conn.iccInfo;
var network = voice.network;
l10nArgs.operator = network.shortName || network.longName;
+ if (iccInfo.isDisplaySpnRequired && iccInfo.spn) {
+ if (iccInfo.isDisplayNetworkNameRequired) {
+ l10nArgs.operator = l10nArgs.operator + ' ' + iccInfo.spn;
+ } else {
+ l10nArgs.operator = iccInfo.spn;
+ }
+ }
+
if (network.mcc == 724 &&
voice.cell && voice.cell.gsmLocationAreaCode) {
// We are in Brazil, It is legally required to show local region name

0 comments on commit 4d84c0b

Please sign in to comment.