on xenial help sign in
Disable fingerprints when dialog/fullscreen-notification/indicators are up
commit695a6556afebb31fb41434f71a6965540ee1454c authorMichael Terry <michael.terry@canonical.com> dateMon 20 Jun 2016, 12:25 (10 years ago) parent3785e04
3 files changed+27−9
qml/Greeter/Greeter.qml+12−9 qml/Shell.qml+3 tests/qmltests/Greeter/tst_Greeter.qml+12
qml/Greeter/Greeter.qml+12−9
@@ -39,6 +39,8 @@ Showable {
3939 readonly property bool active: required || hasLockedApp
4040 readonly property bool fullyShown: loader.item ? loader.item.fullyShown : false
4141
42+ property bool allowFingerprint: true
43+
4244 // True when the greeter is waiting for PAM or other setup process
4345 readonly property alias waiting: d.waiting
4446
@@ -126,9 +128,9 @@ Showable {
126128 property int currentIndex
127129 property bool waiting
128130 property bool isLockscreen // true when we are locking an active session, rather than first user login
129− readonly property bool allowFingerprint: isLockscreen &&
130− AccountsService.failedFingerprintLogins <
131− root.failedFingerprintLoginsDisableAttempts
131+ readonly property bool secureFingerprint: isLockscreen &&
132+ AccountsService.failedFingerprintLogins <
133+ root.failedFingerprintLoginsDisableAttempts
132134 readonly property bool alphanumeric: AccountsService.passwordDisplayHint === AccountsService.Keyboard
133135
134136 // We want 'launcherOffset' to animate down to zero. But not to animate
@@ -498,6 +500,7 @@ Showable {
498500
499501 property var operation: null
500502 readonly property bool idEnabled: root.active &&
503+ root.allowFingerprint &&
501504 Powerd.status === Powerd.On &&
502505 Biometryd.available &&
503506 AccountsService.enableFingerprintIdentification
@@ -522,13 +525,13 @@ Showable {
522525 function failOperation(reason) {
523526 console.log("Failed to identify user by fingerprint:", reason);
524527 restartOperation();
525− if (!d.allowFingerprint) {
528+ if (!d.secureFingerprint) {
526529 d.startUnlock(false /* toTheRight */);
527530 }
528531 if (loader.item) {
529− var msg = d.allowFingerprint ? i18n.tr("Try again") :
530− d.alphanumeric ? i18n.tr("Use passphrase") :
531− i18n.tr("Use passcode");
532+ var msg = d.secureFingerprint ? i18n.tr("Try again") :
533+ d.alphanumeric ? i18n.tr("Use passphrase") :
534+ i18n.tr("Use passcode");
532535 loader.item.showErrorMessage(msg);
533536 }
534537 }
@@ -538,7 +541,7 @@ Showable {
538541 onIdEnabledChanged: restartOperation()
539542
540543 onSucceeded: {
541− if (!d.allowFingerprint) {
544+ if (!d.secureFingerprint) {
542545 failOperation("too many failures");
543546 return;
544547 }
@@ -554,7 +557,7 @@ Showable {
554557 root.forcedUnlock = true;
555558 }
556559 onFailed: {
557− if (!d.allowFingerprint) {
560+ if (!d.secureFingerprint) {
558561 failOperation("too many failures");
559562 } else {
560563 AccountsService.failedFingerprintLogins++;
qml/Shell.qml+3
@@ -421,6 +421,9 @@ StyledItem {
421421 launcherOffset: launcher.progress
422422 forcedUnlock: wizard.active || shell.mode === "full-shell"
423423 background: wallpaperResolver.background
424+ allowFingerprint: !dialogs.hasActiveDialog &&
425+ !notifications.topmostIsFullscreen &&
426+ !panel.indicators.shown
424427
425428 // avoid overlapping with Launcher's edge drag area
426429 // FIXME: Fix TouchRegistry & friends and remove this workaround
tests/qmltests/Greeter/tst_Greeter.qml+12
@@ -597,6 +597,18 @@ Item {
597597 compare(viewShowErrorMessageSpy.signalArguments[0][0], i18n.tr("Use passphrase"));
598598 }
599599
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+
600612 function test_fingerprintFailureMessage() {
601613 var index = selectUser("has-password");
602614 unlockAndShowGreeter(); // turn on lockscreen mode