Merge lp:~mterry/unity8/auto-brightness into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Michael Terry
Approved revision: 785
Merged at revision: 801
Proposed branch: lp:~mterry/unity8/auto-brightness
Merge into: lp:unity8
Diff against target: 109 lines (+31/-1)
5 files modified
build (+1/-0)
debian/control (+2/-1)
plugins/Powerd/CMakeLists.txt (+8/-0)
plugins/Powerd/Powerd.cpp (+17/-0)
plugins/Powerd/Powerd.h (+3/-0)
To merge this branch: bzr merge lp:~mterry/unity8/auto-brightness
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+212914@code.launchpad.net

Commit message

Pass user's preference for auto-brightness on to powerd.

Description of the change

Pass user's preference for auto-brightness on to powerd.

This is just step one to avoid regressions. Step two+ is to move this logic to USC so we can properly handle multiple unity8 sessions all trying to manage this value.

You can test with commands like the following:
sudo -u phablet -i gsettings set com.ubuntu.touch.system auto-brightness false
sudo -u phablet -i gsettings set com.ubuntu.touch.system auto-brightness true

== Checklist ==

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 - No

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 - Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 - N/A

 * If you changed the UI, has there been a design review?
 - N/A

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:785
http://jenkins.qa.ubuntu.com/job/unity8-ci/2643/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4279
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3864
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-phablet-qmluitests-trusty/1513
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-amd64-ci/1164
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1168
        deb: http://jenkins.qa.ubuntu.com/job/unity8-trusty-armhf-ci/1168/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity8-trusty-i386-ci/1164
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3705
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4364
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4364/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3866
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3866/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6145
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5238

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity8-ci/2643/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

Tested with powerd available in silo 7 (https://launchpad.net/~ci-train-ppa-service/+archive/landing-007/), and worked as expected.

Thanks!

review: Approve
lp:~mterry/unity8/auto-brightness updated
786. By Michael Terry

Depend on schemas

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build'
2--- build 2014-01-29 19:12:48 +0000
3+++ build 2014-03-27 15:49:21 +0000
4@@ -41,6 +41,7 @@
5 sudo apt-get install devscripts \
6 equivs \
7 gsettings-desktop-schemas \
8+ gsettings-ubuntu-schemas \
9 qmenumodel-qml \
10 qtdeclarative5-dee-plugin \
11 qtdeclarative5-gsettings1.0 \
12
13=== modified file 'debian/control'
14--- debian/control 2014-03-24 11:49:06 +0000
15+++ debian/control 2014-03-27 15:49:21 +0000
16@@ -143,7 +143,8 @@
17 Architecture: any
18 Multi-Arch: same
19 Pre-Depends: ${misc:Pre-Depends},
20-Depends: ${misc:Depends},
21+Depends: gsettings-ubuntu-schemas,
22+ ${misc:Depends},
23 ${shlibs:Depends},
24 Provides: unity-launcher-impl,
25 unity-launcher-impl-3,
26
27=== modified file 'plugins/Powerd/CMakeLists.txt'
28--- plugins/Powerd/CMakeLists.txt 2013-08-02 16:18:28 +0000
29+++ plugins/Powerd/CMakeLists.txt 2014-03-27 15:49:21 +0000
30@@ -1,4 +1,11 @@
31 include(Plugins)
32+include(FindPkgConfig)
33+
34+pkg_search_module(GIO REQUIRED gio-2.0)
35+
36+include_directories(
37+ ${GIO_INCLUDE_DIRS}
38+)
39
40 add_definitions(-DSM_BUSNAME=systemBus)
41
42@@ -8,6 +15,7 @@
43 )
44
45 qt5_use_modules(Powerd-qml DBus Qml)
46+target_link_libraries(Powerd-qml ${GIO_LDFLAGS})
47
48 export_qmlfiles(Powerd Powerd)
49 export_qmlplugin(Powerd 0.1 Powerd TARGETS Powerd-qml)
50
51=== modified file 'plugins/Powerd/Powerd.cpp'
52--- plugins/Powerd/Powerd.cpp 2013-08-20 21:04:22 +0000
53+++ plugins/Powerd/Powerd.cpp 2014-03-27 15:49:21 +0000
54@@ -17,6 +17,13 @@
55 */
56
57 #include "Powerd.h"
58+#include <QDBusPendingCall>
59+
60+void autoBrightnessChanged(GSettings *settings, const gchar *key, QDBusInterface *powerd)
61+{
62+ bool value = g_settings_get_boolean(settings, key);
63+ powerd->asyncCall("userAutobrightnessEnable", QVariant(value));
64+}
65
66 Powerd::Powerd(QObject* parent)
67 : QObject(parent),
68@@ -33,4 +40,14 @@
69 "DisplayPowerStateChange",
70 this,
71 SIGNAL(displayPowerStateChange(int, unsigned int)));
72+
73+ systemSettings = g_settings_new("com.ubuntu.touch.system");
74+ g_signal_connect(systemSettings, "changed::auto-brightness", G_CALLBACK(autoBrightnessChanged), powerd);
75+ autoBrightnessChanged(systemSettings, "auto-brightness", powerd);
76+}
77+
78+Powerd::~Powerd()
79+{
80+ g_signal_handlers_disconnect_by_data(systemSettings, powerd);
81+ g_object_unref(systemSettings);
82 }
83
84=== modified file 'plugins/Powerd/Powerd.h'
85--- plugins/Powerd/Powerd.h 2013-08-21 20:04:24 +0000
86+++ plugins/Powerd/Powerd.h 2014-03-27 15:49:21 +0000
87@@ -20,6 +20,7 @@
88 #ifndef UNITY_POWERD_H
89 #define UNITY_POWERD_H
90
91+#include <gio/gio.h>
92 #include <QtCore/QObject>
93 #include <QtDBus/QDBusInterface>
94
95@@ -43,12 +44,14 @@
96 };
97
98 explicit Powerd(QObject *parent = 0);
99+ ~Powerd();
100
101 Q_SIGNALS:
102 void displayPowerStateChange(int status, unsigned int flags);
103
104 private:
105 QDBusInterface *powerd;
106+ GSettings *systemSettings;
107 };
108
109 #endif

Subscribers

People subscribed via source and target branches