on xenial help sign in
Disable fingerprints when dialog/fullscreen-notification/indicators are up
695a655Michael Terry
qml/Greeter/Greeter.qml+12−9
@@ -39,6 +39,8 @@ Showable {
39 readonly property bool active: required || hasLockedApp
39 readonly property bool active: required || hasLockedApp
40 readonly property bool fullyShown: loader.item ? loader.item.fullyShown : false
40 readonly property bool fullyShown: loader.item ? loader.item.fullyShown : false
41
41
42+ property bool allowFingerprint: true
43+
42 // True when the greeter is waiting for PAM or other setup process
44 // True when the greeter is waiting for PAM or other setup process
43 readonly property alias waiting: d.waiting
45 readonly property alias waiting: d.waiting
44
46
@@ -126,9 +128,9 @@ Showable {
126 property int currentIndex
128 property int currentIndex
127 property bool waiting
129 property bool waiting
128 property bool isLockscreen // true when we are locking an active session, rather than first user login
130 property bool isLockscreen // true when we are locking an active session, rather than first user login
129− readonly property bool allowFingerprint: isLockscreen &&
131+ readonly property bool secureFingerprint: isLockscreen &&
130− AccountsService.failedFingerprintLogins <
132+ AccountsService.failedFingerprintLogins <
131− root.failedFingerprintLoginsDisableAttempts
133+ root.failedFingerprintLoginsDisableAttempts
132 readonly property bool alphanumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
134 readonly property bool alphanumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
133
135
134 // We want 'launcherOffset' to animate down to zero. But not to animate
136 // We want 'launcherOffset' to animate down to zero. But not to animate
@@ -498,6 +500,7 @@ Showable {
498
500
499 property var operation: null
501 property var operation: null
500 readonly property bool idEnabled: root.active &&
502 readonly property bool idEnabled: root.active &&
503+ root.allowFingerprint &&
501 Powerd.status === Powerd.On &&
504 Powerd.status === Powerd.On &&
502 Biometryd.available &&
505 Biometryd.available &&
503 AccountsService.enableFingerprintIdentification
506 AccountsService.enableFingerprintIdentification
@@ -522,13 +525,13 @@ Showable {
522 function failOperation(reason) {
525 function failOperation(reason) {
523 console.log("Failed to identify user by fingerprint:", reason);
526 console.log("Failed to identify user by fingerprint:", reason);
524 restartOperation();
527 restartOperation();
525− if (!d.allowFingerprint) {
528+ if (!d.secureFingerprint) {
526 d.startUnlock(false /* toTheRight */);
529 d.startUnlock(false /* toTheRight */);
527 }
530 }
528 if (loader.item) {
531 if (loader.item) {
529− var msg = d.allowFingerprint ? i18n.tr("Try again") :
532+ var msg = d.secureFingerprint ? i18n.tr("Try again") :
530− d.alphanumeric ? i18n.tr("Use passphrase") :
533+ d.alphanumeric ? i18n.tr("Use passphrase") :
531− i18n.tr("Use passcode");
534+ i18n.tr("Use passcode");
532 loader.item.showErrorMessage(msg);
535 loader.item.showErrorMessage(msg);
533 }
536 }
534 }
537 }
@@ -538,7 +541,7 @@ Showable {
538 onIdEnabledChanged: restartOperation()
541 onIdEnabledChanged: restartOperation()
539
542
540 onSucceeded: {
543 onSucceeded: {
541− if (!d.allowFingerprint) {
544+ if (!d.secureFingerprint) {
542 failOperation("too many failures");
545 failOperation("too many failures");
543 return;
546 return;
544 }
547 }
@@ -554,7 +557,7 @@ Showable {
554 root.forcedUnlock = true;
557 root.forcedUnlock = true;
555 }
558 }
556 onFailed: {
559 onFailed: {
557− if (!d.allowFingerprint) {
560+ if (!d.secureFingerprint) {
558 failOperation("too many failures");
561 failOperation("too many failures");
559 } else {
562 } else {
560 AccountsService.failedFingerprintLogins++;
563 AccountsService.failedFingerprintLogins++;
qml/Shell.qml+3
@@ -421,6 +421,9 @@ StyledItem {
421 launcherOffset: launcher.progress
421 launcherOffset: launcher.progress
422 forcedUnlock: wizard.active || shell.mode === "full-shell"
422 forcedUnlock: wizard.active || shell.mode === "full-shell"
423 background: wallpaperResolver.background
423 background: wallpaperResolver.background
424+ allowFingerprint: !dialogs.hasActiveDialog &&
425+ !notifications.topmostIsFullscreen &&
426+ !panel.indicators.shown
424
427
425 // avoid overlapping with Launcher's edge drag area
428 // avoid overlapping with Launcher's edge drag area
426 // FIXME: Fix TouchRegistry & friends and remove this workaround
429 // FIXME: Fix TouchRegistry & friends and remove this workaround
tests/qmltests/Greeter/tst_Greeter.qml+12
@@ -597,6 +597,18 @@ Item {
597 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Use passphrase"));
597 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Use passphrase"));
598 }
598 }
599
599
600+ function test_forcedDisallowedFingerprint() {
601+ var index = selectUser("has-password");
602+ unlockAndShowGreeter(); // turn on lockscreen mode
603+
604+ var biometryd = findInvisibleChild(greeter, "biometryd");
605+ verify(biometryd.operation);
606+ verify(biometryd.operation.running);
607+
608+ greeter.allowFingerprint = false;
609+ verify(!biometryd.operation);
610+ }
611+
600 function test_fingerprintFailureMessage() {
612 function test_fingerprintFailureMessage() {
601 var index = selectUser("has-password");
613 var index = selectUser("has-password");
602 unlockAndShowGreeter(); // turn on lockscreen mode
614 unlockAndShowGreeter(); // turn on lockscreen mode