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

Commit

Permalink
Merge pull request #12740 from alivedise/bugzilla/915975/proximity-to…
Browse files Browse the repository at this point in the history
…ggle

Bug 915975 - Turn on screen whenever its turned off by proximity, r=timdream
  • Loading branch information
alivedise committed Oct 11, 2013
2 parents 5d259f7 + 8522431 commit 495912f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/system/js/screen_manager.js
Expand Up @@ -205,10 +205,14 @@ var ScreenManager = {
var telephony = window.navigator.mozTelephony;
if (Bluetooth.isProfileConnected(Bluetooth.Profiles.SCO) ||
telephony.speakerEnabled ||
StatusBar.headphonesActive)
StatusBar.headphonesActive) {
// XXX: Remove this hack in Bug 868348
// We shouldn't access headset status from statusbar.
if (this._screenOffBy == 'proximity') {
this.turnScreenOn();
}
break;
}

if (evt.near) {
this.turnScreenOff(true, 'proximity');
Expand Down
11 changes: 10 additions & 1 deletion apps/system/test/unit/screen_manager_test.js
Expand Up @@ -220,8 +220,9 @@ suite('system/ScreenManager', function() {
test('if Bluetooth SCO connected', function() {
stubBluetooth.Profiles = {};
this.sinon.stub(stubBluetooth, 'isProfileConnected').returns(true);
ScreenManager._screenOffBy = 'proximity';
ScreenManager.handleEvent({'type': 'userproximity'});
assert.isFalse(stubTurnOn.called);
assert.isTrue(stubTurnOn.called);
assert.isFalse(stubTurnOff.called);
});

Expand All @@ -243,6 +244,14 @@ suite('system/ScreenManager', function() {
assert.isFalse(stubTurnOn.called);
assert.isTrue(stubTurnOff.calledWith(true, 'proximity'));
});

test('if earphone is connected', function() {
stubBluetooth.Profiles = {};
stubStatusBar.headponesActive = true;
ScreenManager._screenOffBy = 'proximity';
ScreenManager.handleEvent({'type': 'userproximity'});
assert.isTrue(stubTurnOn.called);
});
});

suite('Testing callschanged event', function() {
Expand Down

0 comments on commit 495912f

Please sign in to comment.