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

Proposed by Alexandros Frantzis
Status: Merged
Approved by: Alexandros Frantzis
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
Ubuntu Phablet Team 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.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
180. By Alexandros Frantzis

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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
181. By Alexandros Frantzis

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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
182. By Alexandros Frantzis

Update debian/changelog

Revision history for this message
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
=== modified file 'debian/changelog'
--- debian/changelog 2015-08-31 13:55:58 +0000
+++ debian/changelog 2015-09-29 14:02:55 +0000
@@ -1,3 +1,13 @@
1powerd (0.16+15.10.20150929-0ubuntu1) UNRELEASED; urgency=medium
2
3 * Improve proximity and screen blanking handling for voice calls
4 by using proper reasons for turning the screen on when a calls
5 arrives and finish (LP: #1291455)
6 * Emit the current state of the proximity sensors when a client
7 requests proximity handling, even when it's already enabled.
8
9 -- Alexandros Frantzis <alexandros.frantzis@canonical.com> Mon, 29 Sep 2015 17:01:11 +0300
10
1powerd (0.16+15.10.20150831.1-0ubuntu1) wily; urgency=medium11powerd (0.16+15.10.20150831.1-0ubuntu1) wily; urgency=medium
212
3 [ Alexandros Frantzis ]13 [ Alexandros Frantzis ]
414
=== modified file 'src/powerd-internal.h'
--- src/powerd-internal.h 2015-07-20 14:53:30 +0000
+++ src/powerd-internal.h 2015-09-29 14:02:55 +0000
@@ -38,6 +38,8 @@
38 UNITY_SCREEN_REASON_NORMAL = 0,38 UNITY_SCREEN_REASON_NORMAL = 0,
39 UNITY_SCREEN_REASON_PROXIMITY = 3,39 UNITY_SCREEN_REASON_PROXIMITY = 3,
40 UNITY_SCREEN_REASON_NOTIFICATION = 4,40 UNITY_SCREEN_REASON_NOTIFICATION = 4,
41 UNITY_SCREEN_REASON_SNAP_DECISION = 5,
42 UNITY_SCREEN_REASON_CALL_DONE = 6,
41};43};
4244
43struct DbusNameWatch {45struct DbusNameWatch {
@@ -166,6 +168,7 @@
166/* Sensor functions */168/* Sensor functions */
167void powerd_sensors_proximity_enable(void);169void powerd_sensors_proximity_enable(void);
168void powerd_sensors_proximity_disable(void);170void powerd_sensors_proximity_disable(void);
171void powerd_sensors_proximity_emit(void);
169void powerd_sensors_als_enable(void);172void powerd_sensors_als_enable(void);
170void powerd_sensors_als_disable(void);173void powerd_sensors_als_disable(void);
171174
172175
=== modified file 'src/powerd-proximity.cpp'
--- src/powerd-proximity.cpp 2014-10-01 07:48:37 +0000
+++ src/powerd-proximity.cpp 2015-09-29 14:02:55 +0000
@@ -31,6 +31,9 @@
31{31{
32 if (active_proximity_users.empty())32 if (active_proximity_users.empty())
33 powerd_sensors_proximity_enable();33 powerd_sensors_proximity_enable();
34 else
35 powerd_sensors_proximity_emit();
36
34 active_proximity_users.insert(name);37 active_proximity_users.insert(name);
3538
36 g_dbus_method_invocation_return_value(invocation, NULL);39 g_dbus_method_invocation_return_value(invocation, NULL);
3740
=== modified file 'src/powerd-sensors.cpp'
--- src/powerd-sensors.cpp 2015-08-28 14:48:28 +0000
+++ src/powerd-sensors.cpp 2015-09-29 14:02:55 +0000
@@ -27,15 +27,29 @@
27#include <ubuntu/application/sensors/light.h>27#include <ubuntu/application/sensors/light.h>
28#include <ubuntu/application/sensors/proximity.h>28#include <ubuntu/application/sensors/proximity.h>
2929
30namespace
31{
32
30UASensorsProximity* prox_sensor;33UASensorsProximity* prox_sensor;
31UASensorsLight* light_sensor;34UASensorsLight* light_sensor;
32GMainLoop* main_loop = NULL;35GMainLoop* main_loop = NULL;
33std::atomic<bool> allow_synthetic{false};36std::atomic<bool> allow_synthetic{false};
37enum class Proximity { unknown, near, far };
38std::atomic<Proximity> current_proximity{Proximity::unknown};
39
40void update_and_emit_proximity(Proximity proximity)
41{
42 current_proximity = proximity;
43 if (proximity == Proximity::near)
44 powerd_proximity_event(TRUE);
45 else if (proximity == Proximity::far)
46 powerd_proximity_event(FALSE);
47}
3448
35gboolean emit_synthetic_proximity_far(void *context)49gboolean emit_synthetic_proximity_far(void *context)
36{50{
37 if (allow_synthetic)51 if (allow_synthetic)
38 powerd_proximity_event(FALSE);52 update_and_emit_proximity(Proximity::far);
3953
40 return FALSE;54 return FALSE;
41}55}
@@ -47,17 +61,19 @@
47 {61 {
48 case U_PROXIMITY_NEAR:62 case U_PROXIMITY_NEAR:
49 {63 {
50 powerd_proximity_event(TRUE);64 update_and_emit_proximity(Proximity::near);
51 break;65 break;
52 }66 }
53 case U_PROXIMITY_FAR:67 case U_PROXIMITY_FAR:
54 {68 {
55 powerd_proximity_event(FALSE);69 update_and_emit_proximity(Proximity::far);
56 break;70 break;
57 }71 }
58 }72 }
59}73}
6074
75}
76
61void powerd_sensors_proximity_enable(void)77void powerd_sensors_proximity_enable(void)
62{78{
63 //FIXME: Some proximity sensors do not79 //FIXME: Some proximity sensors do not
@@ -66,6 +82,7 @@
66 //far event in case no event has been emitted 500ms82 //far event in case no event has been emitted 500ms
67 //after enabling the proximity sensor83 //after enabling the proximity sensor
68 allow_synthetic = true;84 allow_synthetic = true;
85 current_proximity = Proximity::unknown;
69 g_timeout_add(500, emit_synthetic_proximity_far, NULL);86 g_timeout_add(500, emit_synthetic_proximity_far, NULL);
7087
71 ua_sensors_proximity_enable(prox_sensor);88 ua_sensors_proximity_enable(prox_sensor);
@@ -75,6 +92,12 @@
75{92{
76 allow_synthetic = false;93 allow_synthetic = false;
77 ua_sensors_proximity_disable(prox_sensor);94 ua_sensors_proximity_disable(prox_sensor);
95 current_proximity = Proximity::unknown;
96}
97
98void powerd_sensors_proximity_emit(void)
99{
100 update_and_emit_proximity(current_proximity);
78}101}
79102
80void on_new_als_event(UASLightEvent *event, void *context)103void on_new_als_event(UASLightEvent *event, void *context)
81104
=== modified file 'src/powerd-sensors.h'
--- src/powerd-sensors.h 2015-08-28 14:48:28 +0000
+++ src/powerd-sensors.h 2015-09-29 14:02:55 +0000
@@ -27,5 +27,6 @@
27void powerd_sensors_init(GMainLoop* main_loop);27void powerd_sensors_init(GMainLoop* main_loop);
28void powerd_sensors_proximity_enable(void);28void powerd_sensors_proximity_enable(void);
29void powerd_sensors_proximity_disable(void);29void powerd_sensors_proximity_disable(void);
30void powerd_sensors_proximity_emit(void);
3031
31#endif /* __POWERD_SENSORS_H */32#endif /* __POWERD_SENSORS_H */
3233
=== modified file 'src/powerd.cpp'
--- src/powerd.cpp 2015-08-28 14:48:28 +0000
+++ src/powerd.cpp 2015-09-29 14:02:55 +0000
@@ -256,7 +256,7 @@
256 gpointer user_data)256 gpointer user_data)
257{257{
258 if (!strcmp(signal_name, "CallAdded") && call_added++ <= 0) {258 if (!strcmp(signal_name, "CallAdded") && call_added++ <= 0) {
259 turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);259 turn_display_on(TRUE, UNITY_SCREEN_REASON_SNAP_DECISION);
260260
261 powerd_info("incoming call");261 powerd_info("incoming call");
262262
@@ -265,7 +265,7 @@
265265
266 //Turn the display back on when all calls are over266 //Turn the display back on when all calls are over
267 if (call_added == 0)267 if (call_added == 0)
268 turn_display_on(TRUE, UNITY_SCREEN_REASON_NORMAL);268 turn_display_on(TRUE, UNITY_SCREEN_REASON_CALL_DONE);
269269
270 powerd_info("call removed"); 270 powerd_info("call removed");
271 }271 }

Subscribers

People subscribed via source and target branches