Merge lp:~mterry/unity8/unlock-sim-after-wizard into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Michał Sawicz
Approved revision: 1639
Merged at revision: 1666
Proposed branch: lp:~mterry/unity8/unlock-sim-after-wizard
Merge into: lp:unity8
Prerequisite: lp:~dandrader/unity8/unifyShellTests
Diff against target: 113 lines (+34/-6)
4 files modified
qml/Greeter/Greeter.qml (+0/-5)
qml/Shell.qml (+11/-0)
qml/Wizard/Wizard.qml (+6/-1)
tests/qmltests/tst_Shell.qml (+17/-0)
To merge this branch: bzr merge lp:~mterry/unity8/unlock-sim-after-wizard
Reviewer Review Type Date Requested Status
Michał Sawicz functional Approve
Daniel d'Andrada (community) code Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+251612@code.launchpad.net

This proposal supersedes a proposal from 2015-02-25.

Commit message

Only call unlockAllModems once the wizard is done. (LP: #1425161)

Description of the change

Only call unlockAllModems once the wizard is done. (LP: #1425161)

This is only a problem in vivid because in RTM, the shell isn't running when the wizard is.

I never noticed this when testing because I'm a silly American.

== 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

 * 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?
 NA

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

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : Posted in a previous version of this proposal
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote : Posted in a previous version of this proposal

Would you mind rebasing it on top of lp:~dandrader/unity8/unifyShellTests?

With unifyShellTests, tests functions have to load the shell explicitly using the loadShell(form-factor) helper function, which will be useful for your new test.

Besides, the two conflict anyway, so either of the MPs would have to do that in any case.

Revision history for this message
Michael Terry (mterry) wrote :

OK, rebased on unifyShellTests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
62 - readonly property alias active: loader.active
63 + readonly property bool active: loader.active
"""

Why is that needed?

review: Needs Information
Revision history for this message
Michael Terry (mterry) wrote :

> Why is that needed?

Because the loader's active property was emitting a changed signal during object creation as an alias. Having it cached as a property made it only emit a changed signal when it actually did change.

I figured it was some quirk of qml that I didn't understand. But it seemed like a harmless enough change.

1638. By Michael Terry

Merge from unifyShellTests

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> > Why is that needed?
>
> Because the loader's active property was emitting a changed signal during
> object creation as an alias. Having it cached as a property made it only emit
> a changed signal when it actually did change.
>
> I figured it was some quirk of qml that I didn't understand. But it seemed
> like a harmless enough change.

That's really odd. Certainly deserves a comment in the code. Specially if your code will misbehave in case it's changed to an alias back again.

1639. By Michael Terry

Add some comments on why we cache the 'active' bool instead of using an alias

Revision history for this message
Michael Terry (mterry) wrote :

Added comment to explain

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Code looks ok, but I can't test if it fixes the bug as I don't have a spare SIM card (particularly one that has a PIN code) to try it.

review: Approve (code)
Revision history for this message
Michał Sawicz (saviq) :
review: Approve (functional)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qml/Greeter/Greeter.qml'
2--- qml/Greeter/Greeter.qml 2015-02-23 15:43:41 +0000
3+++ qml/Greeter/Greeter.qml 2015-03-11 14:48:55 +0000
4@@ -19,7 +19,6 @@
5 import LightDM 0.1 as LightDM
6 import Ubuntu.Components 1.1
7 import Ubuntu.SystemImage 0.1
8-import Unity.Connectivity 0.1
9 import Unity.Launcher 0.1
10 import "../Components"
11
12@@ -179,10 +178,6 @@
13 }
14 }
15
16- Component.onCompleted: {
17- Connectivity.unlockAllModems();
18- }
19-
20 Timer {
21 id: forcedDelayTimer
22 interval: 1000 * 60
23
24=== modified file 'qml/Shell.qml'
25--- qml/Shell.qml 2015-03-02 12:10:22 +0000
26+++ qml/Shell.qml 2015-03-11 14:48:55 +0000
27@@ -23,6 +23,7 @@
28 import Ubuntu.Components.Popups 1.0
29 import Ubuntu.Gestures 0.1
30 import Ubuntu.Telephony 0.1 as Telephony
31+import Unity.Connectivity 0.1
32 import Unity.Launcher 0.1
33 import Utils 0.1
34 import LightDM 0.1 as LightDM
35@@ -508,8 +509,18 @@
36
37 Wizard {
38 id: wizard
39+ objectName: "wizard"
40 anchors.fill: parent
41 background: shell.background
42+
43+ function unlockWhenDoneWithWizard() {
44+ if (!active) {
45+ Connectivity.unlockAllModems();
46+ }
47+ }
48+
49+ Component.onCompleted: unlockWhenDoneWithWizard()
50+ onActiveChanged: unlockWhenDoneWithWizard()
51 }
52
53 Rectangle {
54
55=== modified file 'qml/Wizard/Wizard.qml'
56--- qml/Wizard/Wizard.qml 2014-11-24 17:56:44 +0000
57+++ qml/Wizard/Wizard.qml 2015-03-11 14:48:55 +0000
58@@ -25,7 +25,12 @@
59 // The background wallpaper to use
60 property string background
61
62- readonly property alias active: loader.active
63+ // This is a bool instead of an alias because Loader classes like to emit
64+ // changed signals for 'active' during startup even if they aren't actually
65+ // changing values. Having it cached as a proper Qml bool property prevents
66+ // unnecessary 'changed' emissions and provides consuming classes the
67+ // expected behavior of no emission on startup.
68+ readonly property bool active: loader.active
69
70 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
71
72
73=== modified file 'tests/qmltests/tst_Shell.qml'
74--- tests/qmltests/tst_Shell.qml 2015-03-11 14:48:55 +0000
75+++ tests/qmltests/tst_Shell.qml 2015-03-11 14:48:55 +0000
76@@ -31,6 +31,7 @@
77 import Unity.Notifications 1.0
78 import Unity.Test 0.1 as UT
79 import Powerd 0.1
80+import Wizard 0.1 as Wizard
81
82 import "../../qml"
83
84@@ -288,6 +289,7 @@
85 setLightDMMockMode("single"); // back to the default value
86
87 AccountsService.demoEdges = false;
88+ Wizard.System.wizardEnabled = false;
89
90 // kill all (fake) running apps
91 killApps(ApplicationManager);
92@@ -940,6 +942,21 @@
93 tryCompare(unlockAllModemsSpy, "count", 1)
94 }
95
96+ function test_unlockAllModemsAfterWizard() {
97+ Wizard.System.wizardEnabled = true;
98+ loadShell("phone");
99+
100+ var wizard = findChild(shell, "wizard");
101+ compare(wizard.active, true);
102+ compare(Wizard.System.wizardEnabled, true);
103+ compare(unlockAllModemsSpy.count, 0);
104+
105+ wizard.hide();
106+ tryCompare(wizard, "active", false);
107+ compare(Wizard.System.wizardEnabled, false);
108+ compare(unlockAllModemsSpy.count, 1);
109+ }
110+
111 function test_tapOnRightEdgeReachesApplicationSurface() {
112 loadShell("phone");
113 swipeAwayGreeter();

Subscribers

People subscribed via source and target branches