@@ -87,9 +87,9 @@ Item {
90− function setFakeActiveForApp(app) {
90+ function setLockedApp(app) {
91 if (shell.locked) {
91 if (shell.locked) {
92− greeter.fakeActiveForApp = app
92+ greeter.lockedApp = app
93 lockscreen.hide()
93 lockscreen.hide()
@@ -169,31 +169,37 @@ Item {
169 Connections {
169 Connections {
170 target: ApplicationManager
170 target: ApplicationManager
171 onFocusRequested: {
171 onFocusRequested: {
172+ if (greeter.narrowMode) {
172− if (appId === "dialer-app") {
173+ if (appId === "dialer-app") {
173− // Always let the dialer-app through. Either user asked
174+ // Always let the dialer-app through. Either user asked
174− // for an emergency call or accepted an incoming call.
175+ // for an emergency call or accepted an incoming call.
175− setFakeActiveForApp(appId)
176+ setLockedApp(appId)
176− } else if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== appId) {
177+ } else if (greeter.hasLockedApp && greeter.lockedApp !== appId) {
177− lockscreen.show();
178+ greeter.startUnlock()
182+ if (LightDM.Greeter.active) {
183+ greeter.startUnlock()
182 onFocusedApplicationIdChanged: {
188 onFocusedApplicationIdChanged: {
183− if (greeter.fakeActiveForApp !== "" && greeter.fakeActiveForApp !== ApplicationManager.focusedApplicationId) {
189+ if (greeter.hasLockedApp && greeter.lockedApp !== ApplicationManager.focusedApplicationId) {
184− lockscreen.show();
190+ greeter.startUnlock()
186 panel.indicators.hide();
192 panel.indicators.hide();
189 onApplicationAdded: {
195 onApplicationAdded: {
190 if (greeter.shown && appId != "unity8-dash") {
196 if (greeter.shown && appId != "unity8-dash") {
191− greeter.hide();
197+ greeter.startUnlock()
193− if (appId === "dialer-app") {
199+ if (greeter.narrowMode && appId === "dialer-app") {
194 // Always let the dialer-app through. Either user asked
200 // Always let the dialer-app through. Either user asked
195 // for an emergency call or accepted an incoming call.
201 // for an emergency call or accepted an incoming call.
196− setFakeActiveForApp(appId)
202+ setLockedApp(appId)
198 launcher.hide();
204 launcher.hide();
@@ -201,9 +207,19 @@ Item {
203 id: applicationsDisplayLoader
209 id: applicationsDisplayLoader
210+ objectName: "applicationsDisplayLoader"
204 anchors.fill: parent
211 anchors.fill: parent
213+ // When we have a locked app, we only want to show that one app.
214+ // FIXME: do this in a less traumatic way. We currently only allow
215+ // locked apps in phone mode (see FIXME in Lockscreen component in
216+ // this same file). When that changes, we need to do something
217+ // nicer here. But this code is currently just to prevent a
218+ // theoretical attack where user enters lockedApp mode, then makes
219+ // the screen larger (maybe connects to monitor) and tries to enter
221+ property bool tabletMode: shell.sideStageEnabled && !greeter.hasLockedApp
206− source: shell.sideStageEnabled ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
222+ source: tabletMode ? "Stages/TabletStage.qml" : "Stages/PhoneStage.qml"
208 Binding {
224 Binding {
209 target: applicationsDisplayLoader.item
225 target: applicationsDisplayLoader.item
@@ -229,7 +245,7 @@ Item {
229 Binding {
245 Binding {
230 target: applicationsDisplayLoader.item
246 target: applicationsDisplayLoader.item
231 property: "spreadEnabled"
247 property: "spreadEnabled"
232− value: edgeDemo.stagesEnabled && greeter.fakeActiveForApp === "" // to support emergency dialer hack
248+ value: edgeDemo.stagesEnabled && !greeter.hasLockedApp
234 Binding {
250 Binding {
235 target: applicationsDisplayLoader.item
251 target: applicationsDisplayLoader.item
@@ -304,14 +320,14 @@ Item {
304 // and wider screens are tablets which don't. When we do allow this
320 // and wider screens are tablets which don't. When we do allow this
305 // on devices with a side stage and a SIM, work should be done to
321 // on devices with a side stage and a SIM, work should be done to
306 // ensure that the main stage is disabled while the dialer is present
322 // ensure that the main stage is disabled while the dialer is present
307− // in the side stage.
323+ // in the side stage. See the FIXME in the stage loader in this file.
308 showEmergencyCallButton: !shell.sideStageEnabled
324 showEmergencyCallButton: !shell.sideStageEnabled
310 onEntered: LightDM.Greeter.respond(passphrase);
326 onEntered: LightDM.Greeter.respond(passphrase);
311 onCancel: greeter.show()
327 onCancel: greeter.show()
312− onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter fake-active mode
328+ onEmergencyCall: shell.activateApplication("dialer-app") // will automatically enter locked-app mode
314− onShownChanged: if (shown) greeter.fakeActiveForApp = ""
330+ onShownChanged: if (shown) greeter.lockedApp = ""
317 id: forcedDelayTimer
333 id: forcedDelayTimer
@@ -367,11 +383,13 @@ Item {
367 if (!LightDM.Greeter.active) {
383 if (!LightDM.Greeter.active) {
368 return; // could happen if hideGreeter() comes in before we prompt
384 return; // could happen if hideGreeter() comes in before we prompt
386+ if (greeter.narrowMode) {
370− if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
387+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
371− lockscreen.hide()
388+ lockscreen.hide()
372− } else {
389+ } else {
373− lockscreen.reset();
390+ lockscreen.reset();
374− lockscreen.show();
391+ lockscreen.show();
@@ -422,7 +440,7 @@ Item {
422 Binding {
440 Binding {
423 target: LightDM.Greeter
441 target: LightDM.Greeter
424 property: "active"
442 property: "active"
425− value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
443+ value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
428 Rectangle {
446 Rectangle {
@@ -434,7 +452,8 @@ Item {
435 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
453 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
436 id: greeterWrapper
454 id: greeterWrapper
455+ objectName: "greeterWrapper"
437− x: launcher.progress
456+ x: greeter.narrowMode ? launcher.progress : 0
438 y: panel.panelHeight
457 y: panel.panelHeight
439 width: parent.width
458 width: parent.width
440 height: parent.height - panel.panelHeight
459 height: parent.height - panel.panelHeight
@@ -447,7 +466,7 @@ Item {
447 property bool fullyShown: showProgress === 1.0
466 property bool fullyShown: showProgress === 1.0
448 onFullyShownChanged: {
467 onFullyShownChanged: {
449 // Wait until the greeter is completely covering lockscreen before resetting it.
468 // Wait until the greeter is completely covering lockscreen before resetting it.
450− if (fullyShown && !LightDM.Greeter.authenticated) {
469+ if (greeter.narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
451 lockscreen.reset();
470 lockscreen.reset();
452 lockscreen.show();
471 lockscreen.show();
@@ -456,7 +475,7 @@ Item {
456 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
475 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
457 onShowProgressChanged: {
476 onShowProgressChanged: {
458 if (showProgress === 0) {
477 if (showProgress === 0) {
459− if (LightDM.Greeter.authenticated) {
478+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
460 greeter.login()
479 greeter.login()
461 } else if (greeter.narrowMode) {
480 } else if (greeter.narrowMode) {
462 lockscreen.clear(false) // to reset focus if necessary
481 lockscreen.clear(false) // to reset focus if necessary
@@ -470,13 +489,16 @@ Item {
471 signal sessionStarted() // helpful for tests
490 signal sessionStarted() // helpful for tests
473− property string fakeActiveForApp: ""
492+ property string lockedApp: ""
493+ property bool hasLockedApp: lockedApp !== ""
475 available: true
495 available: true
476 hides: [launcher, panel.indicators]
496 hides: [launcher, panel.indicators]
477 shown: true
497 shown: true
478 loadContent: required || lockscreen.required // keeps content in memory for quick show()
498 loadContent: required || lockscreen.required // keeps content in memory for quick show()
500+ locked: shell.locked
480 defaultBackground: shell.background
502 defaultBackground: shell.background
482 width: parent.width
504 width: parent.width
@@ -484,6 +506,18 @@ Item {
485 dragHandleWidth: shell.edgeSize
507 dragHandleWidth: shell.edgeSize
509+ function startUnlock() {
511+ if (!LightDM.Greeter.authenticated) {
487 function login() {
521 function login() {
488 enabled = false;
522 enabled = false;
489 if (LightDM.Greeter.startSessionSync()) {
523 if (LightDM.Greeter.startSessionSync()) {
@@ -504,8 +538,10 @@ Item {
505 if (greeter.narrowMode) {
539 if (greeter.narrowMode) {
506 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
540 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
508− greeter.fakeActiveForApp = "";
544+ greeter.lockedApp = "";
509 greeter.forceActiveFocus();
545 greeter.forceActiveFocus();
@@ -550,10 +586,7 @@ Item {
552 if (LightDM.Greeter.active) {
588 if (LightDM.Greeter.active) {
553− if (!LightDM.Greeter.authenticated) {
556− greeter.hide()
589+ greeter.startUnlock()
559 var animate = !LightDM.Greeter.active && !stages.shown
592 var animate = !LightDM.Greeter.active && !stages.shown
@@ -562,7 +595,8 @@ Item {
564 function showDash() {
597 function showDash() {
565− if (greeter.fakeActiveForApp !== "") { // just in case user gets here
598+ if (greeter.hasLockedApp || // just in case user gets here
599+ (!greeter.narrowMode && shell.locked)) {
@@ -589,7 +623,7 @@ Item {
589 anchors.fill: parent //because this draws indicator menus
623 anchors.fill: parent //because this draws indicator menus
590 indicators {
624 indicators {
591 hides: [launcher]
625 hides: [launcher]
592− available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && greeter.fakeActiveForApp === ""
626+ available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && !greeter.hasLockedApp
593 contentEnabled: edgeDemo.panelContentEnabled
627 contentEnabled: edgeDemo.panelContentEnabled
594 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
628 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
595 panelHeight: units.gu(3)
629 panelHeight: units.gu(3)
@@ -600,7 +634,7 @@ Item {
600 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
634 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
602 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
636 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
603− || greeter.fakeActiveForApp !== ""
637+ || greeter.hasLockedApp
606 Launcher {
640 Launcher {
@@ -613,7 +647,7 @@ Item {
613 anchors.bottom: parent.bottom
647 anchors.bottom: parent.bottom
614 width: parent.width
648 width: parent.width
615 dragAreaWidth: shell.edgeSize
649 dragAreaWidth: shell.edgeSize
616− available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && greeter.fakeActiveForApp === ""
650+ available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
618 onShowDashHome: showHome()
652 onShowDashHome: showHome()
619 onDash: showDash()
653 onDash: showDash()
@@ -623,8 +657,8 @@ Item {
625 onLauncherApplicationSelected: {
659 onLauncherApplicationSelected: {
626− if (greeter.fakeActiveForApp !== "") {
660+ if (greeter.hasLockedApp) {
627− lockscreen.show()
661+ greeter.startUnlock()
629 if (!edgeDemo.running)
663 if (!edgeDemo.running)
630 shell.activateApplication(appId)
664 shell.activateApplication(appId)