on xenial help sign in
Only unlock modems after we're done with the wizard
60faf71Michael Terry
qml/Greeter/Greeter.qml−5
@@ -19,7 +19,6 @@ import AccountsService 0.1
19import LightDM 0.1 as LightDM
19import LightDM 0.1 as LightDM
20import Ubuntu.Components 1.1
20import Ubuntu.Components 1.1
21import Ubuntu.SystemImage 0.1
21import Ubuntu.SystemImage 0.1
22−import Unity.Connectivity 0.1
23import Unity.Launcher 0.1
22import Unity.Launcher 0.1
24import "../Components"
23import "../Components"
25
24
@@ -179,10 +178,6 @@ Showable {
179 }
178 }
180 }
179 }
181
180
182− Component.onCompleted: {
183− Connectivity.unlockAllModems();
184− }
185−
186 Timer {
181 Timer {
187 id: forcedDelayTimer
182 id: forcedDelayTimer
188 interval: 1000 * 60
183 interval: 1000 * 60
qml/Shell.qml+11
@@ -23,6 +23,7 @@ import Ubuntu.Components 0.1
23import Ubuntu.Components.Popups 1.0
23import Ubuntu.Components.Popups 1.0
24import Ubuntu.Gestures 0.1
24import Ubuntu.Gestures 0.1
25import Ubuntu.Telephony 0.1 as Telephony
25import Ubuntu.Telephony 0.1 as Telephony
26+import Unity.Connectivity 0.1
26import Unity.Launcher 0.1
27import Unity.Launcher 0.1
27import Utils 0.1
28import Utils 0.1
28import LightDM 0.1 as LightDM
29import LightDM 0.1 as LightDM
@@ -535,8 +536,18 @@ Item {
535
536
536 Wizard {
537 Wizard {
537 id: wizard
538 id: wizard
539+ objectName: "wizard"
538 anchors.fill: parent
540 anchors.fill: parent
539 background: shell.background
541 background: shell.background
542+
543+ function unlockWhenDoneWithWizard() {
544+ if (!active) {
545+ Connectivity.unlockAllModems();
546+ }
547+ }
548+
549+ Component.onCompleted: unlockWhenDoneWithWizard()
550+ onActiveChanged: unlockWhenDoneWithWizard()
540 }
551 }
541
552
542 Rectangle {
553 Rectangle {
qml/Wizard/Wizard.qml+1−1
@@ -25,7 +25,7 @@ Showable {
25 // The background wallpaper to use
25 // The background wallpaper to use
26 property string background
26 property string background
27
27
28− readonly property alias active: loader.active
28+ readonly property bool active: loader.active
29
29
30 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
30 hideAnimation: StandardAnimation { property: "opacity"; to: 0 }
31
31
tests/qmltests/tst_Shell.qml+36−10
@@ -31,6 +31,7 @@ import Unity.Indicators 0.1
31import Unity.Notifications 1.0
31import Unity.Notifications 1.0
32import Unity.Test 0.1 as UT
32import Unity.Test 0.1 as UT
33import Powerd 0.1
33import Powerd 0.1
34+import Wizard 0.1 as Wizard
34
35
35import "../../qml"
36import "../../qml"
36
37
@@ -202,10 +203,22 @@ Item {
202 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
203 tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
203 launcherShowDashHomeSpy.target = null;
204 launcherShowDashHomeSpy.target = null;
204
205
205− shellLoader.itemDestroyed = false;
206+ stopShell();
206
207
207− shellLoader.active = false;
208+ // kill all (fake) running apps
209+ killApps(ApplicationManager);
210+
211+ unlockAllModemsSpy.clear()
212+ LightDM.Greeter.authenticate(""); // reset greeter
213+ Wizard.System.wizardEnabled = false;
208
214
215+ // reload our test subject to get it in a fresh state once again
216+ startShell();
217+ }
218+
219+ function stopShell() {
220+ shellLoader.itemDestroyed = false;
221+ shellLoader.active = false;
209 tryCompare(shellLoader, "status", Loader.Null);
222 tryCompare(shellLoader, "status", Loader.Null);
210 tryCompare(shellLoader, "item", null);
223 tryCompare(shellLoader, "item", null);
211 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
224 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
@@ -215,16 +228,10 @@ Item {
215 // iteration to do its work. So to ensure the reload, we will wait until the
228 // iteration to do its work. So to ensure the reload, we will wait until the
216 // Shell instance gets destroyed.
229 // Shell instance gets destroyed.
217 tryCompare(shellLoader, "itemDestroyed", true);
230 tryCompare(shellLoader, "itemDestroyed", true);
231+ }
218
232
219− // kill all (fake) running apps
233+ function startShell() {
220− killApps(ApplicationManager);
221−
222− unlockAllModemsSpy.clear()
223− LightDM.Greeter.authenticate(""); // reset greeter
224−
225− // reload our test subject to get it in a fresh state once again
226 shellLoader.active = true;
234 shellLoader.active = true;
227−
228 tryCompare(shellLoader, "status", Loader.Ready);
235 tryCompare(shellLoader, "status", Loader.Ready);
229 removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
236 removeTimeConstraintsFromDirectionalDragAreas(shellLoader.item);
230 }
237 }
@@ -725,6 +732,25 @@ Item {
725 tryCompare(unlockAllModemsSpy, "count", 1)
732 tryCompare(unlockAllModemsSpy, "count", 1)
726 }
733 }
727
734
735+ function test_unlockAllModemsAfterWizard() {
736+ // Stop and start shell to simulate wizard being enabled during
737+ // boot, instead of just being enabled after the fact.
738+ stopShell();
739+ Wizard.System.wizardEnabled = true;
740+ unlockAllModemsSpy.clear();
741+ startShell();
742+
743+ var wizard = findChild(shell, "wizard");
744+ compare(wizard.active, true);
745+ compare(Wizard.System.wizardEnabled, true);
746+ compare(unlockAllModemsSpy.count, 0);
747+
748+ wizard.hide();
749+ tryCompare(wizard, "active", false);
750+ compare(Wizard.System.wizardEnabled, false);
751+ compare(unlockAllModemsSpy.count, 1);
752+ }
753+
728 function test_tapOnRightEdgeReachesApplicationSurface() {
754 function test_tapOnRightEdgeReachesApplicationSurface() {
729 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
755 var topmostSpreadDelegate = findChild(shell, "appDelegate0");
730 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;
756 var topmostSurface = findChild(topmostSpreadDelegate, "surfaceContainer").surface;