Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Bug 1207813 - locked-sim
Browse files Browse the repository at this point in the history
* Added icon on status bar for locked sim
* Displaying the strings for locked sim on Lock screen.
  • Loading branch information
Andrey.Smirnov authored and Andrey.Smirnov committed Dec 17, 2015
1 parent 217ee96 commit 90869ef
Show file tree
Hide file tree
Showing 9 changed files with 29 additions and 3 deletions.
14 changes: 14 additions & 0 deletions apps/sharedtest/test/unit/lockscreen_conn_info_manager_test.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,20 @@ suite('system/LockScreenConnInfoManager >', function() {
'emergencyCallsOnly-unknownSIMState');
});

test('pinRequired', function() {
mockMobileConnection.voice = {
connected: false,
emergencyCallsOnly: true,
isLocked: true
};
iccObj.cardState = 'pinRequired';

subject.updateConnStates();
assert.equal(domConnstateL1.dataset.l10nId, 'emergencyCallsOnly');
assert.equal(domConnstateL2.dataset.l10nId,
'emergencyCallsOnly-pinRequired');
});

test('other card state', function() {
mockMobileConnection.voice = {
connected: false,
Expand Down
7 changes: 5 additions & 2 deletions apps/system/js/signal_icon.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
_(this.element, 'statusbarSignalNoSimCard');
} else if (data && data.connected &&
data.type && data.type.startsWith('evdo')) {
this.element.classList.remove('sim-locked');
// "Carrier" / "Carrier (Roaming)" (EVDO)
// Show signal strength of data call as EVDO only supports data call.
this.debug('data connection, level=', data.relSignalStrength);
Expand All @@ -70,24 +71,26 @@
this.updateSignal(voice);
} else if (simslot.isLocked()) {
this.debug('locked simcard');
this.element.classList.add('sim-locked');
this.show();
// SIM locked
// We check if the sim card is locked after checking hasActiveCall
// because we still need to show the signal bars in the case of
// making emergency calls when the sim card is locked.
this.hide();
} else {
this.debug('emergency call only');
// emergencyCallsOnly is always true if voice.connected is false. Show
// searching icon if the device is searching. Or show the signal bars
// with a red "x", which stands for emergency calls only.
this.updateSignal(voice, true);
}

};
SignalIcon.prototype.updateSignal = function(connInfo, emergency) {
if (!this.element) {
return;
}

this.element.classList.remove('sim-locked');
this.show();
var _ = navigator.mozL10n.setAttributes, level;
var previousSearching = (this.element.dataset.searching === 'true');
Expand Down
Binary file modified apps/system/style/statusbar/images/icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/system/style/statusbar/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/system/style/statusbar/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/system/style/statusbar/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions apps/system/style/statusbar/statusbar.css
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ html[dir="rtl"] #statusbar-call-forwardings > * { float: right; }
background-position: -14rem -8rem;
position: relative;
}
.sb-icon-signal.sim-locked{
background-position: -30rem -4rem;
}

.sb-icon-network-activity {
width: 1.6rem;
Expand Down
2 changes: 1 addition & 1 deletion apps/system/test/unit/signal_icon_test.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ suite('system/SignalIcon', function() {

test('SIM card is locked', function() {
MockService.mockQueryWith('Radio.settingEnabled', true);
this.sinon.stub(subject, 'hide');
this.sinon.stub(subject, 'sim-locked');
this.sinon.stub(subject.manager, 'isLocked').returns(true);
subject.update();
assert.isTrue(subject.hide.called);
Expand Down
6 changes: 6 additions & 0 deletions shared/js/lockscreen_connection_info_manager.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,12 @@
} else if (SIMSlotManager.noSIMCardConnectedToNetwork()) {
if (index === 0) {
lineText(nextLine(), 'emergencyCallsOnly');

if(SIMSlotManager.getSlots()[index].isLocked()){
lineText(nextLine(), 'emergencyCallsOnly-pinRequired');
}
}

simIDLine.hidden = true;
return;
}
Expand Down Expand Up @@ -333,4 +338,5 @@

LockScreenConnInfoManager.prototype = LockScreenConnInfoManagerPrototype;
exports.LockScreenConnInfoManager = LockScreenConnInfoManager;

})(window);

0 comments on commit 90869ef

Please sign in to comment.