on xenial help sign in
Dismiss the apps spread if greeter gets shown
36b4f8fDaniel d'Andrada
qml/Shell.qml+1−1
@@ -305,7 +305,7 @@ Item {
305 Binding {
305 Binding {
306 target: applicationsDisplayLoader.item
306 target: applicationsDisplayLoader.item
307 property: "spreadEnabled"
307 property: "spreadEnabled"
308− value: tutorial.spreadEnabled && (!greeter || !greeter.hasLockedApp)
308+ value: tutorial.spreadEnabled && (!greeter || (!greeter.hasLockedApp && !greeter.shown))
309 }
309 }
310 Binding {
310 Binding {
311 target: applicationsDisplayLoader.item
311 target: applicationsDisplayLoader.item
qml/Stages/PhoneStage.qml+16−1
@@ -51,6 +51,14 @@ Rectangle {
51 spreadView.contentX = -spreadView.shift;
51 spreadView.contentX = -spreadView.shift;
52 }
52 }
53 }
53 }
54+ onSpreadEnabledChanged: {
55+ if (!spreadEnabled) {
56+ // reset. go back to display the focused app
57+ spreadView.selectedIndex = -1;
58+ spreadView.phase = 0;
59+ spreadView.contentX = -spreadView.shift;
60+ }
61+ }
54 function updateFocusedAppOrientation() {
62 function updateFocusedAppOrientation() {
55 if (spreadRepeater.count > 0) {
63 if (spreadRepeater.count > 0) {
56 spreadRepeater.itemAt(0).matchShellOrientation();
64 spreadRepeater.itemAt(0).matchShellOrientation();
@@ -281,7 +289,13 @@ Rectangle {
281
289
282 switch (phase) {
290 switch (phase) {
283 case 0:
291 case 0:
292+ // the "spreadEnabled" part is because when code does "phase = 0; contentX = -shift" to
293+ // dismiss the spread because spreadEnabled went to false, for some reason, during tests,
294+ // Flickable might jump in and change contentX value back, causing the code below to do
295+ // "phase = 1" which will make the spread stay.
296+ // It sucks that we have no control whatsoever over whether or when Flickable animates its
297+ // contentX.
284− if (shiftedContentX > width * positionMarker2) {
298+ if (root.spreadEnabled && shiftedContentX > width * positionMarker2) {
285 phase = 1;
299 phase = 1;
286 }
300 }
287 break;
301 break;
@@ -456,6 +470,7 @@ Rectangle {
456 enabled: root.spreadEnabled &&
470 enabled: root.spreadEnabled &&
457 !spreadView.active &&
471 !spreadView.active &&
458 !snapAnimation.running &&
472 !snapAnimation.running &&
473+ !spreadDragArea.pressed &&
459 priv.animateX &&
474 priv.animateX &&
460 !root.beingResized
475 !root.beingResized
461 UbuntuNumberAnimation {
476 UbuntuNumberAnimation {
tests/qmltests/tst_OrientedShell.qml+45
@@ -951,6 +951,51 @@ Rectangle {
951 tryCompare(mockOskSettings, "stayHidden", false);
951 tryCompare(mockOskSettings, "stayHidden", false);
952 }
952 }
953
953
954+ /*
955+ Regression test for https://bugs.launchpad.net/ubuntu/+source/unity8/+bug/1471609
956+
957+ Steps:
958+ - Open an app which can rotate
959+ - Rotate the phone to landscape
960+ - Open the app spread
961+ - Press the power button while the app spread is open
962+ - Wait a bit and press power button again
963+
964+ Expected outcome:
965+ You see greeter in portrat (ie, primary orientation)
966+
967+ Actual outcome:
968+ You see greeter in landscape
969+
970+ Comments:
971+ Greeter supports only the primary orientation (portrait in phones) but
972+ the stage doesn't allow orientation changes while the apps spread is open,
973+ hence the bug.
974+ */
975+ function test_phoneWithSpreadInLandscapeWhenGreeterShowsUp() {
976+ loadShell("mako");
977+
978+ var gmailApp = ApplicationManager.startApplication("gmail-webapp");
979+ verify(gmailApp);
980+
981+ // ensure the mock gmail-webapp is as we expect
982+ compare(gmailApp.rotatesWindowContents, false);
983+ compare(gmailApp.supportedOrientations, Qt.PortraitOrientation | Qt.LandscapeOrientation
984+ | Qt.InvertedPortraitOrientation | Qt.InvertedLandscapeOrientation);
985+
986+ // wait until it's able to rotate
987+ tryCompare(shell, "orientationChangesEnabled", true);
988+
989+ rotateTo(90);
990+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle + 90);
991+
992+ performEdgeSwipeToShowAppSpread();
993+
994+ showGreeter();
995+
996+ tryCompare(shell, "transformRotationAngle", root.primaryOrientationAngle);
997+ }
998+
954 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
999 // angle - rotation angle in degrees clockwise, relative to the primary orientation.
955 function rotateTo(angle) {
1000 function rotateTo(angle) {
956 switch (angle) {
1001 switch (angle) {