batch of updates
[webos-internals:skurriers-modifications.git] / sounds-and-alerts / sounds-and-alerts-really-silent-ringer-switch-mute.patch
1 diff --git a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
2 index a4a150e..e16ff4b 100644
3 --- a/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
4 +++ b/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
5 @@ -57,7 +57,7 @@ var BarAssistant = Class.create({
6                         this.initOnServerStart("com.palm.wifi", this.wifiInit.bind(this), this.wifiDeInit.bind(this));
7                 
8                 // Initialize and Subscribe for audio Status Notification
9 -               //this.initOnServerStart("com.palm.audio", this.audioInit.bind(this));
10 +               this.initOnServerStart("com.palm.audio", this.muteControl.bind(this));
11                                 
12                 // Initialize and Subscribe for Update Notification
13                 this.initOnServerStart("com.palm.update", this.updateInit.bind(this));
14 @@ -2993,6 +2993,44 @@ audioInit: function() {
15                 onSuccess: this.handleVoiceDialingAudioNotifications.bind(this)});
16  },
17  
18 +muteControl: function() {
19 +       this.controller.serviceRequest('palm://com.palm.audio/media', {
20 +               method:'status',
21 +               parameters: {"subscribe":true},
22 +               onSuccess: function(response) {
23 +                       this.setMutedSystem(!response['ringer switch']);
24 +                       this.setMutedRingtone(!response['ringer switch']);
25 +                       this.setMutedMedia(!response['ringer switch']
26 +                                       && (response.scenario=="media_back_speaker"));
27 +               }.bind(this)
28 +       });
29 +},
30 +
31 +setMutedSystem: function(mute) {
32 +       this.controller.serviceRequest('palm://com.palm.audio/system', {
33 +               method:'setMuted',
34 +               parameters:{muted:mute}
35 +       });
36 +},
37 +
38 +setMutedRingtone: function(mute) {
39 +       this.controller.serviceRequest('palm://com.palm.audio/ringtone', {
40 +               method:'setMuted',
41 +               parameters:{muted:mute}
42 +       });
43 +},
44 +
45 +setMutedMedia: function(mute) {
46 +       var value = "up";
47 +       if(mute) {
48 +               value = "down";
49 +       }
50 +       this.controller.serviceRequest('palm://com.palm.audio/media', {
51 +               method:'ramp',
52 +               parameters:{command:value}
53 +       });
54 +},
55 +
56  handlePhoneAudioNotifications: function(payload) {
57         
58         if(!payload)