10 New, 4 Modified patches for 1.3.5
[webos-internals:modifications.git] / sounds-and-alerts / sounds-and-alerts-really-silent-ringer-switch-mute.patch
1 Name: Really Silent Ringer Switch Mute
2 Version: 1.3.5.1-1
3 Author: Jason Robitaille
4 Description: Flicking the ringer switch to off will mute every aspect of the webOS, music and games included. Will not mute alarms nor the phone speaker (though will mute ringtone). If a wired or wireless headset/headphones are connected, mute will be cancelled.  (MIT license)
5
6 --- .orig/usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
7 +++ /usr/lib/luna/system/luna-systemui/app/controllers/bar-assistant.js
8 @@ -2891,6 +2891,41 @@
9                 method: 'status',
10                 parameters: {"subscribe":true},
11                 onSuccess: this.handleVoiceDialingAudioNotifications.bind(this)});
12 +               
13 +       this.controller.serviceRequest('palm://com.palm.audio/media', {
14 +               method:'status',
15 +               parameters: {subscribe:true},
16 +               onSuccess: function(response) {
17 +                       this.setMutedSystem(!response['ringer switch']);
18 +                       this.setMutedRingtone(!response['ringer switch']);
19 +                       this.setMutedMedia(!response['ringer switch'] && (response.scenario=="media_back_speaker"));
20 +               }.bind(this)
21 +       });
22 +},
23 +
24 +setMutedSystem: function(mute) {
25 +       this.controller.serviceRequest('palm://com.palm.audio/system', {
26 +               method:'setMuted',
27 +               parameters:{muted:mute}
28 +       });
29 +},
30 +
31 +setMutedRingtone: function(mute) {
32 +       this.controller.serviceRequest('palm://com.palm.audio/ringtone', {
33 +               method:'setMuted',
34 +               parameters:{muted:mute}
35 +       });
36 +},
37 +
38 +setMutedMedia: function(mute) {
39 +       var value = "up";
40 +       if(mute) {
41 +               value = "down";
42 +       }
43 +       this.controller.serviceRequest('palm://com.palm.audio/media', {
44 +               method:'ramp',
45 +               parameters:{command:value}
46 +       });
47  },
48  
49  handlePhoneAudioNotifications: function(payload) {