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

Commit

Permalink
Bug 1102814 - Use the `notification' channel to play keypad touch ton…
Browse files Browse the repository at this point in the history
…es r=thills
  • Loading branch information
gabrielesvelto committed Feb 6, 2015
1 parent f6b7948 commit cbc34ea
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 25 deletions.
11 changes: 5 additions & 6 deletions apps/communications/contacts/js/contacts.js
Expand Up @@ -263,12 +263,11 @@ var Contacts = (function() {

window.addEventListener('listRendered', loadDeferredActions);

/* XXX: Don't specify a default volume control channel as we want to stick
* with the default one as a workaround for bug 1092346. Once that bug is
* fixed please add back the following line:
*
* navigator.mozAudioChannelManager.volumeControlChannel = 'notification';
*/
/* Tell the audio channel manager that we want to adjust the "notification"
* channel when the user presses the volumeup/volumedown buttons. */
if (navigator.mozAudioChannelManager) {
navigator.mozAudioChannelManager.volumeControlChannel = 'notification';
}
};

var initContactsList = function initContactsList() {
Expand Down
11 changes: 5 additions & 6 deletions apps/communications/dialer/js/index.js
Expand Up @@ -10,12 +10,11 @@ function onLoadDialer() {

window.removeEventListener('load', onLoadDialer);

/* XXX: Don't specify a default volume control channel as we want to stick
* with the default one as a workaround for bug 1092346. Once that bug is
* fixed please add back the following line:
*
* navigator.mozAudioChannelManager.volumeControlChannel = 'notification';
*/
/* Tell the audio channel manager that we want to adjust the "notification"
* channel when the user presses the volumeup/volumedown buttons. */
if (navigator.mozAudioChannelManager) {
navigator.mozAudioChannelManager.volumeControlChannel = 'notification';
}

KeypadManager.init(/* oncall */ false);
// Keypad (app core content) is now bound
Expand Down
4 changes: 2 additions & 2 deletions apps/communications/dialer/test/unit/keypad_test.js
Expand Up @@ -107,13 +107,13 @@ suite('dialer/keypad', function() {
});

suite('Keypad Manager', function() {
test('initializates the TonePlayer to use the default audio channel',
test('initializates the TonePlayer to use the notification audio channel',
function() {
this.sinon.spy(MockTonePlayer, 'init');
KeypadManager.init(/* oncall */ false);

sinon.assert.calledOnce(MockTonePlayer.init);
sinon.assert.calledWithExactly(MockTonePlayer.init, null);
sinon.assert.calledWithExactly(MockTonePlayer.init, 'notification');
});

test('sanitizePhoneNumber', function(done) {
Expand Down
2 changes: 1 addition & 1 deletion apps/communications/manifest.webapp
Expand Up @@ -78,7 +78,7 @@
"desktop-notification":{},
"alarms": {},
"systemXHR": {},
"audio-channel-content":{},
"audio-channel-notification":{},
"idle":{},
"storage": {},
"device-storage:sdcard": { "access": "readcreate" },
Expand Down
5 changes: 1 addition & 4 deletions shared/js/dialer/keypad.js
Expand Up @@ -198,10 +198,7 @@ var KeypadManager = {
this.hangUpCallFromKeypad);
}

/* XXX: We should be using the `notification' channel here but we can't due
* to bug 1092346 and pass `null' instead, forcing the use of the default
* audio channel. */
TonePlayer.init(this._onCall ? 'telephony' : null);
TonePlayer.init(this._onCall ? 'telephony' : 'notification');

this.render();
LazyLoader.load(['/shared/style/action_menu.css',
Expand Down
7 changes: 1 addition & 6 deletions shared/js/dialer/tone_player.js
Expand Up @@ -82,12 +82,7 @@ var TonePlayer = {
return;
}

if (this._channel) {
this._audioContext = new AudioContext(this._channel);
} else {
// If no channel was specified stick with the default one.
this._audioContext = new AudioContext();
}
this._audioContext = new AudioContext(this._channel);
},

_trashAudio: function tp_trashAudio() {
Expand Down

0 comments on commit cbc34ea

Please sign in to comment.