Merge lp:~mfrey/powerd/display-fix into lp:powerd

Proposed by Michael Frey
Status: Merged
Approved by: Bill Filler
Approved revision: 145
Merged at revision: 145
Proposed branch: lp:~mfrey/powerd/display-fix
Merge into: lp:powerd
Diff against target: 65 lines (+20/-10)
1 file modified
src/powerd.cpp (+20/-10)
To merge this branch: bzr merge lp:~mfrey/powerd/display-fix
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
Review via email: mp+239486@code.launchpad.net

Commit message

Do not turn on display if already on a call as well as turn on display after all calls end.

Description of the change

Do not turn on display if already on a call as well as turn on display after all calls end.

To post a comment you must log in.
Revision history for this message
Bill Filler (bfiller) wrote :

tested, works

review: Approve
lp:~mfrey/powerd/display-fix updated
146. By Michael Frey

Do not turn on display for SMS and USSD if on a call.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/powerd.cpp'
2--- src/powerd.cpp 2014-09-30 14:50:08 +0000
3+++ src/powerd.cpp 2014-10-25 19:22:09 +0000
4@@ -58,6 +58,8 @@
5
6 static int g_exit_code = 0;
7
8+static int call_added = 0;
9+
10 /* Used to track modem interfaces */
11 struct modem_data {
12 char *obj_name;
13@@ -251,13 +253,19 @@
14 GVariant *parameters,
15 gpointer user_data)
16 {
17- if (!strcmp(signal_name, "CallAdded")) {
18+ if (!strcmp(signal_name, "CallAdded") && call_added++ <= 0) {
19 turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
20
21 powerd_info("incoming call");
22
23 } else if (!strcmp(signal_name, "CallRemoved")) {
24- powerd_info("call removed");
25+ call_added--;
26+
27+ //Turn the display back on when all calls are over
28+ if (call_added == 0)
29+ turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
30+
31+ powerd_info("call removed");
32 }
33 }
34
35@@ -270,10 +278,11 @@
36 {
37 powerd_debug("we get signal from %s: %s", sender_name, signal_name);
38 /* from org.ofono.MessageManager */
39- if ((!strcmp(signal_name, "IncomingMessage")) ||
40- (!strcmp(signal_name, "ImmediateMessage"))) {
41- powerd_debug("Waking up the device - Incoming SMS");
42- turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
43+ if (((!strcmp(signal_name, "IncomingMessage")) ||
44+ (!strcmp(signal_name, "ImmediateMessage"))) &&
45+ (call_added == 0)) {
46+ powerd_debug("Waking up the device - Incoming SMS");
47+ turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
48 }
49 }
50
51@@ -285,10 +294,11 @@
52 {
53 powerd_debug("we get signal from %s: %s", sender_name, signal_name);
54 /* from org.ofono.MessageManager */
55- if ((!strcmp(signal_name, "NotificationReceived")) ||
56- (!strcmp(signal_name, "RequestReceived"))) {
57- powerd_debug("Waking up the device - Incoming USSD");
58- turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
59+ if (((!strcmp(signal_name, "NotificationReceived")) ||
60+ (!strcmp(signal_name, "RequestReceived"))) &&
61+ (call_added == 0)) {
62+ powerd_debug("Waking up the device - Incoming USSD");
63+ turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
64 }
65 }
66

Subscribers

People subscribed via source and target branches