Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Bug 823650 - showing Cellbroadcast information #7207

Merged
merged 1 commit into from

2 participants

@yurenju
Owner

No description provided.

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.cellbroadcast = msg.body;
@timdream Owner

cellbroadcastLabel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
apps/system/js/lockscreen.js
@@ -770,7 +782,9 @@ var LockScreen = {
return;
}
var operatorInfos = MobileOperator.userFacingInfo(conn);
- if (operatorInfos.carrier) {
+ if (this.cellbroadcast) {
@timdream Owner

cellbroadcastLabel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@yurenju yurenju merged commit 655b8a8 into mozilla-b2g:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
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;
Something went wrong with that request. Please try again.