Merge lp:~mterry/unity8/fix-wakelocks into lp:unity8

Proposed by Michael Terry on 2015-12-03
Status: Superseded
Proposed branch: lp:~mterry/unity8/fix-wakelocks
Merge into: lp:unity8
Diff against target: 245 lines (+54/-24)
10 files modified
CMakeLists.txt (+1/-1)
debian/control (+3/-3)
qml/Stages/PhoneStage.qml (+6/-4)
qml/Stages/TabletStage.qml (+6/-4)
tests/mocks/Unity/Application/ApplicationInfo.cpp (+16/-0)
tests/mocks/Unity/Application/ApplicationInfo.h (+4/-0)
tests/mocks/Unity/Application/ApplicationManager.cpp (+2/-0)
tests/mocks/Unity/Application/ApplicationManager.h (+1/-1)
tests/plugins/Unity/Launcher/launchermodeltest.cpp (+2/-0)
tests/qmltests/tst_Shell.qml (+13/-11)
To merge this branch: bzr merge lp:~mterry/unity8/fix-wakelocks
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing on 2015-12-03
Unity Team 2015-12-03 Pending
Review via email: mp+279489@code.launchpad.net

This proposal has been superseded by a proposal from 2015-12-03.

Commit Message

Let qtmir know which apps are exempt from the lifecycle management.
This way, it can manage its own wakelocks better and stop preventing the system from deep sleeping.

Description of the Change

Let qtmir know which apps are exempt from the lifecycle management, so it can manage its own wakelocks better (and stop preventing the system from deep sleeping).

 * Are there any related MPs required for this MP to build/function as expected? Please list.
 https://code.launchpad.net/~mterry/unity-api/fix-wakelocks/+merge/279476
 https://code.launchpad.net/~mterry/qtmir/fix-wakelocks/+merge/279481

 * Did you perform an exploratory manual test run of your code change and any related functionality?
 Working on it

 * Did you make sure that your branch does not contain spurious tags?
 Yes

 * If you changed the packaging (debian), did you subscribe the ubuntu-unity team to this MP?
 I'm on that team

 * If you changed the UI, has there been a design review?
 NA

To post a comment you must log in.
lp:~mterry/unity8/fix-wakelocks updated on 2015-12-03
2079. By Michael Terry on 2015-12-03

Merge from surfaceItemFillMode

lp:~mterry/unity8/fix-wakelocks updated on 2015-12-03
2080. By Michael Terry on 2015-12-03

Add more comments and sanity checking to the exempt tests

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2015-11-26 13:51:24 +0000
3+++ CMakeLists.txt 2015-12-03 18:14:47 +0000
4@@ -57,7 +57,7 @@
5 find_package(Qt5Concurrent 5.4 REQUIRED)
6 find_package(Qt5Sql 5.4 REQUIRED)
7
8-pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=11)
9+pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=12)
10
11 # Standard install paths
12 include(GNUInstallDirs)
13
14=== modified file 'debian/control'
15--- debian/control 2015-11-26 13:51:24 +0000
16+++ debian/control 2015-12-03 18:14:47 +0000
17@@ -29,7 +29,7 @@
18 libqt5xmlpatterns5-dev,
19 libsystemsettings-dev,
20 libudev-dev,
21- libunity-api-dev (>= 7.103),
22+ libunity-api-dev (>= 7.104),
23 libusermetricsoutput1-dev,
24 libxcb1-dev,
25 pkg-config,
26@@ -128,7 +128,7 @@
27 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3.1627) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3.1627),
28 qtdeclarative5-unity-notifications-plugin (>= 0.1.2) | unity-notifications-impl,
29 ubuntu-thumbnailer-impl-0,
30- unity-application-impl-11,
31+ unity-application-impl-12,
32 unity-notifications-impl-3,
33 unity-plugin-scopes | unity-scopes-impl,
34 unity-scopes-impl-7,
35@@ -174,7 +174,7 @@
36 Depends: ${misc:Depends},
37 ${shlibs:Depends},
38 Provides: unity-application-impl,
39- unity-application-impl-11,
40+ unity-application-impl-12,
41 Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
42 Description: Fake environment for running Unity 8 shell
43 Provides fake implementations of some QML modules used by Unity 8 shell
44
45=== modified file 'qml/Stages/PhoneStage.qml'
46--- qml/Stages/PhoneStage.qml 2015-11-04 14:58:05 +0000
47+++ qml/Stages/PhoneStage.qml 2015-12-03 18:14:47 +0000
48@@ -426,14 +426,16 @@
49
50 readonly property bool isDash: model.appId == "unity8-dash"
51
52- readonly property bool canSuspend: model.isTouchApp
53- && !isExemptFromLifecycle(model.appId)
54+ Binding {
55+ target: appDelegate.application
56+ property: "exemptFromLifecycle"
57+ value: !model.isTouchApp || isExemptFromLifecycle(model.appId)
58+ }
59
60 Binding {
61 target: appDelegate.application
62 property: "requestedState"
63- value: !canSuspend
64- || (isDash && root.keepDashRunning)
65+ value: (isDash && root.keepDashRunning)
66 || (!root.suspended && appDelegate.focus)
67 ? ApplicationInfoInterface.RequestedRunning
68 : ApplicationInfoInterface.RequestedSuspended
69
70=== modified file 'qml/Stages/TabletStage.qml'
71--- qml/Stages/TabletStage.qml 2015-11-04 14:58:05 +0000
72+++ qml/Stages/TabletStage.qml 2015-12-03 18:14:47 +0000
73@@ -612,14 +612,16 @@
74
75 readonly property bool isDash: model.appId == "unity8-dash"
76
77- readonly property bool canSuspend: model.isTouchApp
78- && !isExemptFromLifecycle(model.appId)
79+ Binding {
80+ target: spreadTile.application
81+ property: "exemptFromLifecycle"
82+ value: !model.isTouchApp || isExemptFromLifecycle(model.appId)
83+ }
84
85 Binding {
86 target: spreadTile.application
87 property: "requestedState"
88- value: !canSuspend
89- || (isDash && root.keepDashRunning)
90+ value: (isDash && root.keepDashRunning)
91 || (!root.suspended && (model.appId == priv.mainStageAppId
92 || model.appId == priv.sideStageAppId))
93 ? ApplicationInfoInterface.RequestedRunning
94
95=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.cpp'
96--- tests/mocks/Unity/Application/ApplicationInfo.cpp 2015-11-06 09:11:53 +0000
97+++ tests/mocks/Unity/Application/ApplicationInfo.cpp 2015-12-03 18:14:47 +0000
98@@ -42,6 +42,7 @@
99 , m_rotatesWindowContents(false)
100 , m_requestedState(RequestedRunning)
101 , m_isTouchApp(true)
102+ , m_exemptFromLifecycle(false)
103 , m_manualSurfaceCreation(false)
104 {
105 }
106@@ -60,6 +61,7 @@
107 , m_rotatesWindowContents(false)
108 , m_requestedState(RequestedRunning)
109 , m_isTouchApp(true)
110+ , m_exemptFromLifecycle(false)
111 , m_manualSurfaceCreation(false)
112 {
113 }
114@@ -253,6 +255,20 @@
115 m_isTouchApp = isTouchApp;
116 }
117
118+bool ApplicationInfo::exemptFromLifecycle() const
119+{
120+ return m_exemptFromLifecycle;
121+}
122+
123+void ApplicationInfo::setExemptFromLifecycle(bool exemptFromLifecycle)
124+{
125+ if (m_exemptFromLifecycle != exemptFromLifecycle)
126+ {
127+ m_exemptFromLifecycle = exemptFromLifecycle;
128+ Q_EMIT exemptFromLifecycleChanged(m_exemptFromLifecycle);
129+ }
130+}
131+
132 void ApplicationInfo::onSessionSurfaceChanged(MirSurface* surface)
133 {
134 if (surface != nullptr && m_state == Starting) {
135
136=== modified file 'tests/mocks/Unity/Application/ApplicationInfo.h'
137--- tests/mocks/Unity/Application/ApplicationInfo.h 2015-10-01 17:43:10 +0000
138+++ tests/mocks/Unity/Application/ApplicationInfo.h 2015-12-03 18:14:47 +0000
139@@ -92,6 +92,9 @@
140 bool isTouchApp() const override;
141 void setIsTouchApp(bool isTouchApp); // only in mock
142
143+ bool exemptFromLifecycle() const override;
144+ void setExemptFromLifecycle(bool) override;
145+
146 public:
147 void setSession(Session* session);
148 Session* session() const { return m_session; }
149@@ -125,6 +128,7 @@
150 bool m_rotatesWindowContents;
151 RequestedState m_requestedState;
152 bool m_isTouchApp;
153+ bool m_exemptFromLifecycle;
154
155 bool m_manualSurfaceCreation;
156 };
157
158=== modified file 'tests/mocks/Unity/Application/ApplicationManager.cpp'
159--- tests/mocks/Unity/Application/ApplicationManager.cpp 2015-11-05 14:04:32 +0000
160+++ tests/mocks/Unity/Application/ApplicationManager.cpp 2015-12-03 18:14:47 +0000
161@@ -107,6 +107,8 @@
162 return app->focused();
163 case RoleIsTouchApp:
164 return app->isTouchApp();
165+ case RoleExemptFromLifecycle:
166+ return app->exemptFromLifecycle();
167 case RoleSession:
168 return QVariant::fromValue(app->session());
169 case RoleFullscreen:
170
171=== modified file 'tests/mocks/Unity/Application/ApplicationManager.h'
172--- tests/mocks/Unity/Application/ApplicationManager.h 2015-10-01 17:43:10 +0000
173+++ tests/mocks/Unity/Application/ApplicationManager.h 2015-12-03 18:14:47 +0000
174@@ -43,7 +43,7 @@
175 static ApplicationManager *singleton();
176
177 enum MoreRoles {
178- RoleSession = RoleIsTouchApp+1,
179+ RoleSession = RoleExemptFromLifecycle+1,
180 RoleFullscreen,
181 };
182 enum Flag {
183
184=== modified file 'tests/plugins/Unity/Launcher/launchermodeltest.cpp'
185--- tests/plugins/Unity/Launcher/launchermodeltest.cpp 2015-11-06 13:27:15 +0000
186+++ tests/plugins/Unity/Launcher/launchermodeltest.cpp 2015-12-03 18:14:47 +0000
187@@ -59,6 +59,8 @@
188 Qt::ScreenOrientations supportedOrientations() const override { return Qt::PortraitOrientation; }
189 bool rotatesWindowContents() const override { return false; }
190 bool isTouchApp() const override { return true; }
191+ bool exemptFromLifecycle() const override { return false; }
192+ void setExemptFromLifecycle(bool) override {}
193
194 // Methods used for mocking (not in the interface)
195 void setFocused(bool focused) { m_focused = focused; Q_EMIT focusedChanged(focused); }
196
197=== modified file 'tests/qmltests/tst_Shell.qml'
198--- tests/qmltests/tst_Shell.qml 2015-11-24 17:44:18 +0000
199+++ tests/qmltests/tst_Shell.qml 2015-12-03 18:14:47 +0000
200@@ -1859,19 +1859,20 @@
201
202 var app1 = ApplicationManager.startApplication("libreoffice");
203 waitUntilAppWindowIsFullyLoaded(app1);
204- var app2 = ApplicationManager.startApplication("dialer-app");
205+ var app2 = ApplicationManager.startApplication("gallery-app");
206 waitUntilAppWindowIsFullyLoaded(app2);
207
208- // Make sure app1 is unfocused but still running
209- compare(app1.session.surface.activeFocus, false);
210- compare(app1.isTouchApp, false); // sanity check our mock, which sets this for us
211- compare(app1.requestedState, ApplicationInfoInterface.RequestedRunning);
212+ // Make sure app1 is exempt with a requested suspend
213+ verify(app1.exemptFromLifecycle);
214+ verify(!app1.isTouchApp); // sanity check our mock, which sets this for us
215+ verify(!app1.session.surface.activeFocus);
216+ compare(app1.requestedState, ApplicationInfoInterface.RequestedSuspended);
217 }
218
219 function test_lifecyclePolicyExemption_data() {
220 return [
221- {tag: "phone", formFactor: "phone", usageScenario: "phone", suspendsApps: true},
222- {tag: "tablet", formFactor: "tablet", usageScenario: "tablet", suspendsApps: true}
223+ {tag: "phone", formFactor: "phone", usageScenario: "phone"},
224+ {tag: "tablet", formFactor: "tablet", usageScenario: "tablet"}
225 ]
226 }
227
228@@ -1883,12 +1884,13 @@
229
230 var app1 = ApplicationManager.startApplication("webbrowser-app");
231 waitUntilAppWindowIsFullyLoaded(app1);
232- var app2 = ApplicationManager.startApplication("dialer-app");
233+ var app2 = ApplicationManager.startApplication("gallery-app");
234 waitUntilAppWindowIsFullyLoaded(app2);
235
236- // Make sure app1 is unfocused but still running
237- compare(app1.session.surface.activeFocus, false);
238- compare(app1.requestedState, ApplicationInfoInterface.RequestedRunning);
239+ // Make sure app1 is exempt with a requested suspend
240+ verify(app1.exemptFromLifecycle);
241+ verify(!app1.session.surface.activeFocus);
242+ compare(app1.requestedState, ApplicationInfoInterface.RequestedSuspended);
243 }
244
245 function test_switchToStagedForcesLegacyAppClosing_data() {

Subscribers

People subscribed via source and target branches