Merge lp:~afrantzis/powerd/unity-screen-reason-call into lp:powerd

Proposed by Alexandros Frantzis on 2015-09-11
Status: Merged
Approved by: Alexandros Frantzis on 2015-10-01
Approved revision: 182
Merged at revision: 179
Proposed branch: lp:~afrantzis/powerd/unity-screen-reason-call
Merge into: lp:powerd
Diff against target: 163 lines (+45/-5)
6 files modified
debian/changelog (+10/-0)
src/powerd-internal.h (+3/-0)
src/powerd-proximity.cpp (+3/-0)
src/powerd-sensors.cpp (+26/-3)
src/powerd-sensors.h (+1/-0)
src/powerd.cpp (+2/-2)
To merge this branch: bzr merge lp:~afrantzis/powerd/unity-screen-reason-call
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-09-29
Ubuntu Phablet Team 2015-09-11 Pending
Review via email: mp+270802@code.launchpad.net

Commit message

Turn the screen on using reason call/call_done when a voice call is received/finishes respectively

Description of the change

Turn the screen on using reason call/call_done when a voice call is received/finishes respectively

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
180. By Alexandros Frantzis on 2015-09-24

Rename reason "call" to "snap_decision" to match USC terminology

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
181. By Alexandros Frantzis on 2015-09-25

Emit the current state of the proximity sensor whenever a new client requests proximity handling

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
182. By Alexandros Frantzis on 2015-09-29

Update debian/changelog

PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2015-08-31 13:55:58 +0000
3+++ debian/changelog 2015-09-29 14:02:55 +0000
4@@ -1,3 +1,13 @@
5+powerd (0.16+15.10.20150929-0ubuntu1) UNRELEASED; urgency=medium
6+
7+ * Improve proximity and screen blanking handling for voice calls
8+ by using proper reasons for turning the screen on when a calls
9+ arrives and finish (LP: #1291455)
10+ * Emit the current state of the proximity sensors when a client
11+ requests proximity handling, even when it's already enabled.
12+
13+ -- Alexandros Frantzis <alexandros.frantzis@canonical.com> Mon, 29 Sep 2015 17:01:11 +0300
14+
15 powerd (0.16+15.10.20150831.1-0ubuntu1) wily; urgency=medium
16
17 [ Alexandros Frantzis ]
18
19=== modified file 'src/powerd-internal.h'
20--- src/powerd-internal.h 2015-07-20 14:53:30 +0000
21+++ src/powerd-internal.h 2015-09-29 14:02:55 +0000
22@@ -38,6 +38,8 @@
23 UNITY_SCREEN_REASON_NORMAL = 0,
24 UNITY_SCREEN_REASON_PROXIMITY = 3,
25 UNITY_SCREEN_REASON_NOTIFICATION = 4,
26+ UNITY_SCREEN_REASON_SNAP_DECISION = 5,
27+ UNITY_SCREEN_REASON_CALL_DONE = 6,
28 };
29
30 struct DbusNameWatch {
31@@ -166,6 +168,7 @@
32 /* Sensor functions */
33 void powerd_sensors_proximity_enable(void);
34 void powerd_sensors_proximity_disable(void);
35+void powerd_sensors_proximity_emit(void);
36 void powerd_sensors_als_enable(void);
37 void powerd_sensors_als_disable(void);
38
39
40=== modified file 'src/powerd-proximity.cpp'
41--- src/powerd-proximity.cpp 2014-10-01 07:48:37 +0000
42+++ src/powerd-proximity.cpp 2015-09-29 14:02:55 +0000
43@@ -31,6 +31,9 @@
44 {
45 if (active_proximity_users.empty())
46 powerd_sensors_proximity_enable();
47+ else
48+ powerd_sensors_proximity_emit();
49+
50 active_proximity_users.insert(name);
51
52 g_dbus_method_invocation_return_value(invocation, NULL);
53
54=== modified file 'src/powerd-sensors.cpp'
55--- src/powerd-sensors.cpp 2015-08-28 14:48:28 +0000
56+++ src/powerd-sensors.cpp 2015-09-29 14:02:55 +0000
57@@ -27,15 +27,29 @@
58 #include <ubuntu/application/sensors/light.h>
59 #include <ubuntu/application/sensors/proximity.h>
60
61+namespace
62+{
63+
64 UASensorsProximity* prox_sensor;
65 UASensorsLight* light_sensor;
66 GMainLoop* main_loop = NULL;
67 std::atomic<bool> allow_synthetic{false};
68+enum class Proximity { unknown, near, far };
69+std::atomic<Proximity> current_proximity{Proximity::unknown};
70+
71+void update_and_emit_proximity(Proximity proximity)
72+{
73+ current_proximity = proximity;
74+ if (proximity == Proximity::near)
75+ powerd_proximity_event(TRUE);
76+ else if (proximity == Proximity::far)
77+ powerd_proximity_event(FALSE);
78+}
79
80 gboolean emit_synthetic_proximity_far(void *context)
81 {
82 if (allow_synthetic)
83- powerd_proximity_event(FALSE);
84+ update_and_emit_proximity(Proximity::far);
85
86 return FALSE;
87 }
88@@ -47,17 +61,19 @@
89 {
90 case U_PROXIMITY_NEAR:
91 {
92- powerd_proximity_event(TRUE);
93+ update_and_emit_proximity(Proximity::near);
94 break;
95 }
96 case U_PROXIMITY_FAR:
97 {
98- powerd_proximity_event(FALSE);
99+ update_and_emit_proximity(Proximity::far);
100 break;
101 }
102 }
103 }
104
105+}
106+
107 void powerd_sensors_proximity_enable(void)
108 {
109 //FIXME: Some proximity sensors do not
110@@ -66,6 +82,7 @@
111 //far event in case no event has been emitted 500ms
112 //after enabling the proximity sensor
113 allow_synthetic = true;
114+ current_proximity = Proximity::unknown;
115 g_timeout_add(500, emit_synthetic_proximity_far, NULL);
116
117 ua_sensors_proximity_enable(prox_sensor);
118@@ -75,6 +92,12 @@
119 {
120 allow_synthetic = false;
121 ua_sensors_proximity_disable(prox_sensor);
122+ current_proximity = Proximity::unknown;
123+}
124+
125+void powerd_sensors_proximity_emit(void)
126+{
127+ update_and_emit_proximity(current_proximity);
128 }
129
130 void on_new_als_event(UASLightEvent *event, void *context)
131
132=== modified file 'src/powerd-sensors.h'
133--- src/powerd-sensors.h 2015-08-28 14:48:28 +0000
134+++ src/powerd-sensors.h 2015-09-29 14:02:55 +0000
135@@ -27,5 +27,6 @@
136 void powerd_sensors_init(GMainLoop* main_loop);
137 void powerd_sensors_proximity_enable(void);
138 void powerd_sensors_proximity_disable(void);
139+void powerd_sensors_proximity_emit(void);
140
141 #endif /* __POWERD_SENSORS_H */
142
143=== modified file 'src/powerd.cpp'
144--- src/powerd.cpp 2015-08-28 14:48:28 +0000
145+++ src/powerd.cpp 2015-09-29 14:02:55 +0000
146@@ -256,7 +256,7 @@
147 gpointer user_data)
148 {
149 if (!strcmp(signal_name, "CallAdded") && call_added++ <= 0) {
150- turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
151+ turn_display_on(TRUE, UNITY_SCREEN_REASON_SNAP_DECISION);
152
153 powerd_info("incoming call");
154
155@@ -265,7 +265,7 @@
156
157 //Turn the display back on when all calls are over
158 if (call_added == 0)
159- turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);
160+ turn_display_on(TRUE, UNITY_SCREEN_REASON_CALL_DONE);
161
162 powerd_info("call removed");
163 }

Subscribers

People subscribed via source and target branches