@@ -88,9 +88,9 @@ Item {
91− function setFakeActiveForApp(app) {
91+ function setLockedApp(app) {
92 if (shell.locked) {
92 if (shell.locked) {
93− greeter.fakeActiveForApp = app
93+ greeter.lockedApp = app
94 lockscreen.hide()
94 lockscreen.hide()
@@ -170,31 +170,37 @@ Item {
170 Connections {
170 Connections {
171 target: ApplicationManager
171 target: ApplicationManager
172 onFocusRequested: {
172 onFocusRequested: {
173+ if (greeter.narrowMode) {
173− if (appId === "dialer-app") {
174+ if (appId === "dialer-app") {
174− // Always let the dialer-app through. Either user asked
175+ // Always let the dialer-app through. Either user asked
175− // for an emergency call or accepted an incoming call.
176+ // for an emergency call or accepted an incoming call.
176− setFakeActiveForApp(appId)
177+ setLockedApp(appId)
177− } else if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
178+ } else if (greeter.hasLockedApp && greeter.lockedApp !== appId) {
178− lockscreen.show();
179+ greeter.startUnlock()
183+ if (LightDM.Greeter.active) {
184+ greeter.startUnlock()
183 onFocusedApplicationIdChanged: {
189 onFocusedApplicationIdChanged: {
184− if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
190+ if (greeter.hasLockedApp && greeter.lockedApp !== ApplicationManager.focusedApplicationId) {
185− lockscreen.show();
191+ greeter.startUnlock()
187 panel.indicators.hide();
193 panel.indicators.hide();
190 onApplicationAdded: {
196 onApplicationAdded: {
191 if (greeter.shown && appId != "unity8-dash") {
197 if (greeter.shown && appId != "unity8-dash") {
192− greeter.hide();
198+ greeter.startUnlock()
194− if (appId === "dialer-app") {
200+ if (greeter.narrowMode && appId === "dialer-app") {
195 // Always let the dialer-app through. Either user asked
201 // Always let the dialer-app through. Either user asked
196 // for an emergency call or accepted an incoming call.
202 // for an emergency call or accepted an incoming call.
197− setFakeActiveForApp(appId)
203+ setLockedApp(appId)
199 launcher.hide();
205 launcher.hide();
@@ -202,9 +208,19 @@ Item {
204 id: applicationsDisplayLoader
210 id: applicationsDisplayLoader
211+ objectName: "applicationsDisplayLoader"
205 anchors.fill: parent
212 anchors.fill: parent
207− source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
214+ // When we have a locked app, we only want to show that one app.
215+ // FIXME: do this in a less traumatic way. We currently only allow
216+ // locked apps in phone mode (see FIXME in Lockscreen component in
217+ // this same file). When that changes, we need to do something
218+ // nicer here. But this code is currently just to prevent a
219+ // theoretical attack where user enters lockedApp mode, then makes
220+ // the screen larger (maybe connects to monitor) and tries to enter
222+ property bool tabletMode: shell.sideStageEnabled && !greeter.hasLockedApp
223+ source: tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
209 Binding {
225 Binding {
210 target: applicationsDisplayLoader.item
226 target: applicationsDisplayLoader.item
@@ -230,7 +246,7 @@ Item {
230 Binding {
246 Binding {
231 target: applicationsDisplayLoader.item
247 target: applicationsDisplayLoader.item
232 property: "spreadEnabled"
248 property: "spreadEnabled"
233− value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
249+ value: edgeDemo.stagesEnabled && !greeter.hasLockedApp
235 Binding {
251 Binding {
236 target: applicationsDisplayLoader.item
252 target: applicationsDisplayLoader.item
@@ -305,14 +321,14 @@ Item {
305 // and wider screens are tablets which don't. When we do allow this
321 // and wider screens are tablets which don't. When we do allow this
306 // on devices with a side stage and a SIM, work should be done to
322 // on devices with a side stage and a SIM, work should be done to
307 // ensure that the main stage is disabled while the dialer is present
323 // ensure that the main stage is disabled while the dialer is present
308− // in the side stage.
324+ // in the side stage. See the FIXME in the stage loader in this file.
309 showEmergencyCallButton: !shell.sideStageEnabled
325 showEmergencyCallButton: !shell.sideStageEnabled
311 onEntered: LightDM.Greeter.respond(passphrase);
327 onEntered: LightDM.Greeter.respond(passphrase);
312 onCancel: greeter.show()
328 onCancel: greeter.show()
313− onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter fake-active mode
329+ onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter locked-app mode
315− onShownChanged: if (shown) greeter.fakeActiveForApp = ""
331+ onShownChanged: if (shown) greeter.lockedApp = ""
318 id: forcedDelayTimer
334 id: forcedDelayTimer
@@ -361,11 +377,13 @@ Item {
363 onPromptlessChanged: {
379 onPromptlessChanged: {
364− if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
380+ if (greeter.narrowMode) {
365− lockscreen.hide()
381+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
366− } else {
382+ lockscreen.hide()
367− lockscreen.reset();
383+ } else {
368− lockscreen.show();
384+ lockscreen.reset();
@@ -415,7 +433,7 @@ Item {
415 Binding {
433 Binding {
416 target: LightDM.Greeter
434 target: LightDM.Greeter
417 property: "active"
435 property: "active"
418− value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
436+ value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
421 Rectangle {
439 Rectangle {
@@ -427,7 +445,8 @@ Item {
428 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
446 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
429 id: greeterWrapper
447 id: greeterWrapper
430− x: launcher.progress
448+ objectName: "greeterWrapper"
449+ x: greeter.narrowMode ? launcher.progress : 0
431 y: panel.panelHeight
450 y: panel.panelHeight
432 width: parent.width
451 width: parent.width
433 height: parent.height - panel.panelHeight
452 height: parent.height - panel.panelHeight
@@ -440,7 +459,7 @@ Item {
440 property bool fullyShown: showProgress === 1.0
459 property bool fullyShown: showProgress === 1.0
441 onFullyShownChanged: {
460 onFullyShownChanged: {
442 // Wait until the greeter is completely covering lockscreen before resetting it.
461 // Wait until the greeter is completely covering lockscreen before resetting it.
443− if (fullyShown && !LightDM.Greeter.authenticated) {
462+ if (greeter.narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
444 lockscreen.reset();
463 lockscreen.reset();
445 lockscreen.show();
464 lockscreen.show();
@@ -449,7 +468,7 @@ Item {
449 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
468 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
450 onShowProgressChanged: {
469 onShowProgressChanged: {
451 if (showProgress === 0) {
470 if (showProgress === 0) {
452− if (LightDM.Greeter.authenticated) {
471+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
453 greeter.login()
472 greeter.login()
454 } else if (greeter.narrowMode) {
473 } else if (greeter.narrowMode) {
455 lockscreen.clear(false) // to reset focus if necessary
474 lockscreen.clear(false) // to reset focus if necessary
@@ -463,13 +482,16 @@ Item {
464 signal sessionStarted() // helpful for tests
483 signal sessionStarted() // helpful for tests
466− property string fakeActiveForApp: ""
485+ property string lockedApp: ""
486+ property bool hasLockedApp: lockedApp !== ""
468 available: true
488 available: true
469 hides: [launcher, panel.indicators]
489 hides: [launcher, panel.indicators]
470 shown: true
490 shown: true
471 loadContent: required || lockscreen.required // keeps content in memory for quick show()
491 loadContent: required || lockscreen.required // keeps content in memory for quick show()
493+ locked: shell.locked
473 defaultBackground: shell.background
495 defaultBackground: shell.background
475 width: parent.width
497 width: parent.width
@@ -477,6 +499,18 @@ Item {
478 dragHandleWidth: shell.edgeSize
500 dragHandleWidth: shell.edgeSize
502+ function startUnlock() {
504+ if (!LightDM.Greeter.authenticated) {
480 function login() {
514 function login() {
481 enabled = false;
515 enabled = false;
482 if (LightDM.Greeter.startSessionSync()) {
516 if (LightDM.Greeter.startSessionSync()) {
@@ -492,8 +526,10 @@ Item {
492 if (shown) {
526 if (shown) {
493 if (greeter.narrowMode) {
527 if (greeter.narrowMode) {
494 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
528 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
496− greeter.fakeActiveForApp = "";
532+ greeter.lockedApp = "";
497 greeter.forceActiveFocus();
533 greeter.forceActiveFocus();
@@ -538,10 +574,7 @@ Item {
540 if (LightDM.Greeter.active) {
576 if (LightDM.Greeter.active) {
541− if (!LightDM.Greeter.authenticated) {
577+ greeter.startUnlock()
547 var animate = !LightDM.Greeter.active && !stages.shown
580 var animate = !LightDM.Greeter.active && !stages.shown
@@ -550,7 +583,8 @@ Item {
552 function showDash() {
585 function showDash() {
553− if (greeter.fakeActiveForApp !== "") { // just in case user gets here
586+ if (greeter.hasLockedApp || // just in case user gets here
587+ (!greeter.narrowMode && shell.locked)) {
@@ -577,7 +611,7 @@ Item {
577 anchors.fill: parent //because this draws indicator menus
611 anchors.fill: parent //because this draws indicator menus
578 indicators {
612 indicators {
579 hides: [launcher]
613 hides: [launcher]
580− available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && greeter.fakeActiveForApp === ""
614+ available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && !greeter.hasLockedApp
581 contentEnabled: edgeDemo.panelContentEnabled
615 contentEnabled: edgeDemo.panelContentEnabled
582 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
616 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
@@ -598,7 +632,7 @@ Item {
598 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
632 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
600 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
634 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
601− || greeter.fakeActiveForApp !== ""
635+ || greeter.hasLockedApp
604 Launcher {
638 Launcher {
@@ -611,7 +645,7 @@ Item {
611 anchors.bottom: parent.bottom
645 anchors.bottom: parent.bottom
612 width: parent.width
646 width: parent.width
613 dragAreaWidth: shell.edgeSize
647 dragAreaWidth: shell.edgeSize
614− available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && greeter.fakeActiveForApp === ""
648+ available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
616 onShowDashHome: showHome()
650 onShowDashHome: showHome()
617 onDash: showDash()
651 onDash: showDash()
@@ -621,8 +655,8 @@ Item {
623 onLauncherApplicationSelected: {
657 onLauncherApplicationSelected: {
624− if (greeter.fakeActiveForApp !== "") {
658+ if (greeter.hasLockedApp) {
625− lockscreen.show()
659+ greeter.startUnlock()
627 if (!edgeDemo.running)
661 if (!edgeDemo.running)
628 shell.activateApplication(appId)
662 shell.activateApplication(appId)