Skip to content
Browse files

Bug 823650 - showing Cellbroadcast information. r=timdream

  • Loading branch information...
1 parent 92f991b commit a09c96d78fe28df10b3034b99b97e1a9279a4d7f @yurenju yurenju committed Dec 27, 2012
View
16 apps/system/js/lockscreen.js
@@ -132,6 +132,18 @@ var LockScreen = {
this.updateConnState();
this.connstate.hidden = false;
}
+ if (navigator && navigator.mozCellBroadcast) {
+ var self = this;
+ navigator.mozCellBroadcast.onreceived = function onReceived(event) {
+ var msg = event.message;
+ if (conn &&
+ conn.voice.network.mcc === MobileOperator.BRAZIL_MCC &&
+ msg.messageId === MobileOperator.BRAZIL_CELLBROADCAST_CHANNEL) {
+ self.cellbroadcastLabel = msg.body;
+ self.updateConnState();
+ }
+ };
+ }
var self = this;
SettingsListener.observe('lockscreen.enabled', true, function(value) {
@@ -770,7 +782,9 @@ var LockScreen = {
return;
}
var operatorInfos = MobileOperator.userFacingInfo(conn);
- if (operatorInfos.carrier) {
+ if (this.cellbroadcastLabel) {
+ connstateLine2.textContent = this.cellbroadcastLabel;
+ } else if (operatorInfos.carrier) {
connstateLine2.textContent = operatorInfos.carrier + ' ' +
operatorInfos.region;
}
View
3 apps/system/manifest.webapp
@@ -33,7 +33,8 @@
"background-sensors":{},
"permissions":{},
"audio-channel-publicnotification":{},
- "audio-channel-notification":{}
+ "audio-channel-notification":{},
+ "cellbroadcast":{}
},
"locales": {
"ar": {
View
14 apps/system/test/unit/mobile_operator_test.js
@@ -2,8 +2,6 @@
'use strict';
-requireApp('system/test/unit/mock_moz_mobile_connection.js');
-
requireApp('system/shared/js/mobile_operator.js');
suite('shared/MobileOperator', function() {
@@ -12,7 +10,17 @@ suite('shared/MobileOperator', function() {
setup(function() {
- MockMobileConnection = new MockMozMobileConnection();
+ MockMobileConnection = {
+ voice: {
+ network: {
+ shortName: 'Fake short',
+ longName: 'Fake long',
+ mnc: '6'
+ },
+ cell: { gsmLocationAreaCode: 71 }
+ },
+ iccInfo: { spn: 'Fake SPN' }
+ };
});
suite('Worldwide connection', function() {
View
1 shared/js/mobile_operator.js
@@ -2,6 +2,7 @@
var MobileOperator = {
BRAZIL_MCC: 724,
+ BRAZIL_CELLBROADCAST_CHANNEL: 50,
userFacingInfo: function mo_userFacingInfo(mobileConnection) {
var network = mobileConnection.voice.network;

0 comments on commit a09c96d

Please sign in to comment.
Something went wrong with that request. Please try again.