@@ -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
@@ -360,11 +376,13 @@ Item {
362 onPromptlessChanged: {
378 onPromptlessChanged: {
379+ if (greeter.narrowMode) {
363− if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
380+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
364− lockscreen.hide()
381+ lockscreen.hide()
365− } else {
382+ } else {
366− lockscreen.reset();
383+ lockscreen.reset();
367− lockscreen.show();
384+ lockscreen.show();
@@ -414,7 +432,7 @@ Item {
414 Binding {
432 Binding {
415 target: LightDM.Greeter
433 target: LightDM.Greeter
416 property: "active"
434 property: "active"
417− value: greeter.shown || lockscreen.shown || greeter.fakeActiveForApp != ""
435+ value: greeter.shown || lockscreen.shown || greeter.hasLockedApp
420 Rectangle {
438 Rectangle {
@@ -426,7 +444,8 @@ Item {
427 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
445 // Just a tiny wrapper to adjust greeter's x without messing with its own dragging
428 id: greeterWrapper
446 id: greeterWrapper
447+ objectName: "greeterWrapper"
429− x: launcher.progress
448+ x: greeter.narrowMode ? launcher.progress : 0
430 y: panel.panelHeight
449 y: panel.panelHeight
431 width: parent.width
450 width: parent.width
432 height: parent.height - panel.panelHeight
451 height: parent.height - panel.panelHeight
@@ -439,7 +458,7 @@ Item {
439 property bool fullyShown: showProgress === 1.0
458 property bool fullyShown: showProgress === 1.0
440 onFullyShownChanged: {
459 onFullyShownChanged: {
441 // Wait until the greeter is completely covering lockscreen before resetting it.
460 // Wait until the greeter is completely covering lockscreen before resetting it.
442− if (fullyShown && !LightDM.Greeter.authenticated) {
461+ if (greeter.narrowMode && fullyShown && !LightDM.Greeter.authenticated) {
443 lockscreen.reset();
462 lockscreen.reset();
444 lockscreen.show();
463 lockscreen.show();
@@ -448,7 +467,7 @@ Item {
448 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
467 readonly property real showProgress: MathUtils.clamp((1 - x/width) + greeter.showProgress - 1, 0, 1)
449 onShowProgressChanged: {
468 onShowProgressChanged: {
450 if (showProgress === 0) {
469 if (showProgress === 0) {
451− if (LightDM.Greeter.authenticated) {
470+ if (LightDM.Greeter.promptless && LightDM.Greeter.authenticated) {
452 greeter.login()
471 greeter.login()
453 } else if (greeter.narrowMode) {
472 } else if (greeter.narrowMode) {
454 lockscreen.clear(false) // to reset focus if necessary
473 lockscreen.clear(false) // to reset focus if necessary
@@ -462,13 +481,16 @@ Item {
463 signal sessionStarted() // helpful for tests
482 signal sessionStarted() // helpful for tests
465− property string fakeActiveForApp: ""
484+ property string lockedApp: ""
485+ property bool hasLockedApp: lockedApp !== ""
467 available: true
487 available: true
468 hides: [launcher, panel.indicators]
488 hides: [launcher, panel.indicators]
469 shown: true
489 shown: true
470 loadContent: required || lockscreen.required // keeps content in memory for quick show()
490 loadContent: required || lockscreen.required // keeps content in memory for quick show()
492+ locked: shell.locked
472 defaultBackground: shell.background
494 defaultBackground: shell.background
474 width: parent.width
496 width: parent.width
@@ -476,6 +498,18 @@ Item {
477 dragHandleWidth: shell.edgeSize
499 dragHandleWidth: shell.edgeSize
501+ function startUnlock() {
503+ if (!LightDM.Greeter.authenticated) {
479 function login() {
513 function login() {
480 enabled = false;
514 enabled = false;
481 if (LightDM.Greeter.startSessionSync()) {
515 if (LightDM.Greeter.startSessionSync()) {
@@ -491,8 +525,10 @@ Item {
491 if (shown) {
525 if (shown) {
492 if (greeter.narrowMode) {
526 if (greeter.narrowMode) {
493 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
527 LightDM.Greeter.authenticate(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
495− greeter.fakeActiveForApp = "";
531+ greeter.lockedApp = "";
496 greeter.forceActiveFocus();
532 greeter.forceActiveFocus();
@@ -537,10 +573,7 @@ Item {
539 if (LightDM.Greeter.active) {
575 if (LightDM.Greeter.active) {
540− if (!LightDM.Greeter.authenticated) {
543− greeter.hide()
576+ greeter.startUnlock()
546 var animate = !LightDM.Greeter.active && !stages.shown
579 var animate = !LightDM.Greeter.active && !stages.shown
@@ -549,7 +582,8 @@ Item {
551 function showDash() {
584 function showDash() {
552− if (greeter.fakeActiveForApp !== "") { // just in case user gets here
585+ if (greeter.hasLockedApp || // just in case user gets here
586+ (!greeter.narrowMode && shell.locked)) {
@@ -576,7 +610,7 @@ Item {
576 anchors.fill: parent //because this draws indicator menus
610 anchors.fill: parent //because this draws indicator menus
577 indicators {
611 indicators {
578 hides: [launcher]
612 hides: [launcher]
579− available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && greeter.fakeActiveForApp === ""
613+ available: edgeDemo.panelEnabled && (!shell.locked || AccountsService.enableIndicatorsWhileLocked) && !greeter.hasLockedApp
580 contentEnabled: edgeDemo.panelContentEnabled
614 contentEnabled: edgeDemo.panelContentEnabled
581 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
615 width: parent.width > units.gu(60) ? units.gu(40) : parent.width
582 panelHeight: units.gu(3)
616 panelHeight: units.gu(3)
@@ -587,7 +621,7 @@ Item {
587 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
621 ApplicationManager.findApplication(ApplicationManager.focusedApplicationId).fullscreen
589 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
623 fullscreenMode: (topmostApplicationIsFullscreen && !LightDM.Greeter.active && launcher.progress == 0)
590− || greeter.fakeActiveForApp !== ""
624+ || greeter.hasLockedApp
593 Launcher {
627 Launcher {
@@ -600,7 +634,7 @@ Item {
600 anchors.bottom: parent.bottom
634 anchors.bottom: parent.bottom
601 width: parent.width
635 width: parent.width
602 dragAreaWidth: shell.edgeSize
636 dragAreaWidth: shell.edgeSize
603− available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && greeter.fakeActiveForApp === ""
637+ available: edgeDemo.launcherEnabled && (!shell.locked || AccountsService.enableLauncherWhileLocked) && !greeter.hasLockedApp
605 onShowDashHome: showHome()
639 onShowDashHome: showHome()
606 onDash: showDash()
640 onDash: showDash()
@@ -610,8 +644,8 @@ Item {
612 onLauncherApplicationSelected: {
646 onLauncherApplicationSelected: {
613− if (greeter.fakeActiveForApp !== "") {
647+ if (greeter.hasLockedApp) {
614− lockscreen.show()
648+ greeter.startUnlock()
616 if (!edgeDemo.running)
650 if (!edgeDemo.running)
617 shell.activateApplication(appId)
651 shell.activateApplication(appId)