Merge lp:~phablet-team/ubuntu-system-settings/fingerprint into lp:ubuntu-system-settings

Proposed by Jonas G. Drange
Status: Merged
Approved by: Ken VanDine
Approved revision: 1619
Merged at revision: 1667
Proposed branch: lp:~phablet-team/ubuntu-system-settings/fingerprint
Merge into: lp:ubuntu-system-settings
Diff against target: 459 lines (+187/-18)
6 files modified
debian/control (+4/-3)
plugins/security-privacy/LockSecurity.qml (+118/-12)
plugins/security-privacy/PageComponent.qml (+27/-1)
plugins/security-privacy/PhoneLocking.qml (+6/-1)
plugins/security-privacy/securityprivacy.cpp (+23/-0)
plugins/security-privacy/securityprivacy.h (+9/-1)
To merge this branch: bzr merge lp:~phablet-team/ubuntu-system-settings/fingerprint
Reviewer Review Type Date Requested Status
Jonas G. Drange (community) Needs Fixing
Ken VanDine Approve
system-apps-ci-bot continuous-integration Needs Fixing
PS Jenkins bot continuous-integration Pending
Review via email: mp+297454@code.launchpad.net

Commit message

expose fingerprint ID panel and the Fingerprint lock setting

To post a comment you must log in.
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
1618. By Jonas G. Drange

reflect changes in usc

1619. By Jonas G. Drange

update c

Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
system-apps-ci-bot (system-apps-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

Looks good

review: Approve
Revision history for this message
Jonas G. Drange (jonas-drange) :
review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2016-05-25 06:02:03 +0000
3+++ debian/control 2016-06-15 12:15:30 +0000
4@@ -65,19 +65,20 @@
5 Depends: ${misc:Depends},
6 ${shlibs:Depends},
7 accountsservice,
8- accountsservice-ubuntu-schemas (>= 0.0.5),
9+ accountsservice-ubuntu-schemas (>= 0.0.7),
10 aethercast [amd64 armhf i386],
11 bluez (>= 5.23),
12 click | ubuntu-snappy-cli,
13 dbus-property-service [amd64 armhf i386],
14 gsettings-desktop-schemas,
15- gsettings-ubuntu-schemas (>= 0.0.4),
16+ gsettings-ubuntu-schemas (>= 0.0.7),
17 indicator-bluetooth (>> 0.0.6+13.10.20131010),
18 indicator-datetime,
19 indicator-network (>= 0.7.1),
20 indicator-power (>= 12.10.6+15.04.20150130),
21 powerd (>= 0.15) | gnome-settings-daemon,
22 qmenumodel-qml,
23+ qml-module-biometryd,
24 qml-module-qt-labs-folderlistmodel,
25 qml-module-ubuntu-connectivity (>= 0.7.1),
26 qml-module-qtmultimedia | qml-module-qtmultimedia-gles,
27@@ -85,7 +86,7 @@
28 qtdeclarative5-ofono0.2 (>=0.82~),
29 qml-module-qtsysteminfo,
30 qtdeclarative5-ubuntu-content1,
31- qtdeclarative5-ubuntu-settings-components (>> 0.7+15.04.20160310),
32+ qtdeclarative5-ubuntu-settings-components (>= 0.8),
33 qtdeclarative5-ubuntu-ui-toolkit-plugin (>= 1.3.1584) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles (>= 1.3.1584),
34 suru-icon-theme (>= 14.04+15.04.20150813~),
35 whoopsie-preferences (>= 0.9),
36
37=== modified file 'plugins/security-privacy/LockSecurity.qml'
38--- plugins/security-privacy/LockSecurity.qml 2016-05-17 23:28:16 +0000
39+++ plugins/security-privacy/LockSecurity.qml 2016-06-15 12:15:30 +0000
40@@ -1,9 +1,10 @@
41 /*
42 * This file is part of system-settings
43 *
44- * Copyright (C) 2013 Canonical Ltd.
45+ * Copyright (C) 2013-2016 Canonical Ltd.
46 *
47 * Contact: Iain Lane <iain.lane@canonical.com>
48+ * Jonas G. Drange <jonas.drange@canonical.com>
49 *
50 * This program is free software: you can redistribute it and/or modify it
51 * under the terms of the GNU General Public License version 3, as published
52@@ -17,13 +18,14 @@
53 * You should have received a copy of the GNU General Public License along
54 * with this program. If not, see <http://www.gnu.org/licenses/>.
55 */
56-
57+import Biometryd 0.0
58 import GSettings 1.0
59 import QtQuick 2.4
60 import QtQuick.Layouts 1.1
61 import Ubuntu.Components 1.3
62 import Ubuntu.Components.ListItems 1.3 as ListItem
63 import Ubuntu.Components.Popups 1.3
64+import Ubuntu.Settings.Fingerprint 0.1
65 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
66 import SystemSettings 1.0
67
68@@ -49,6 +51,7 @@
69 }
70
71 property var dialog: null
72+ property int enrolledFingerprints: 0
73
74 UbuntuSecurityPrivacyPanel {
75 id: securityPrivacy
76@@ -62,6 +65,8 @@
77 return 1
78 case UbuntuSecurityPrivacyPanel.Passphrase:
79 return 2
80+ case UbuntuSecurityPrivacyPanel.Fingerprint:
81+ return 3
82 }
83 }
84
85@@ -73,6 +78,8 @@
86 return UbuntuSecurityPrivacyPanel.Passcode
87 case 2:
88 return UbuntuSecurityPrivacyPanel.Passphrase
89+ case 3:
90+ return UbuntuSecurityPrivacyPanel.Fingerprint
91 }
92 }
93
94@@ -355,9 +362,14 @@
95 Layout.fillWidth: true
96 text: i18n.tr("Cancel")
97 onClicked: {
98- PopupUtils.close(changeSecurityDialog)
99- unlockMethod.selectedIndex =
100- methodToIndex(securityPrivacy.securityType)
101+ PopupUtils.close(changeSecurityDialog);
102+ var newSelectedIndex;
103+ if (securityPrivacy.enableFingerprintIdentification) {
104+ newSelectedIndex = methodToIndex(UbuntuSecurityPrivacyPanel.Fingerprint);
105+ } else {
106+ newSelectedIndex = methodToIndex(securityPrivacy.securityType);
107+ }
108+ unlockMethod.selectedIndex = newSelectedIndex;
109 }
110 }
111
112@@ -416,6 +428,10 @@
113 currentInput.forceActiveFocus()
114 currentInput.selectAll()
115 changeSecurityDialog.enabled = true
116+
117+ // We can always safely disable FP ident here, but
118+ // in some cases it is required.
119+ securityPrivacy.enableFingerprintIdentification = false;
120 } else {
121 PopupUtils.close(changeSecurityDialog)
122 }
123@@ -448,12 +464,13 @@
124 property string swipe: i18n.tr("Swipe (no security)")
125 property string passcode: i18n.tr("4-digit passcode")
126 property string passphrase: i18n.tr("Passphrase")
127+ property string fingerprint: i18n.tr("Fingerprint")
128 property string swipeAlt: i18n.tr("Swipe (no security)… ")
129 property string passcodeAlt: i18n.tr("4-digit passcode…")
130 property string passphraseAlt: i18n.tr("Passphrase…")
131
132 id: unlockMethod
133- model: 3
134+ model: Biometryd.available ? 4 : 3
135 delegate: OptionSelectorDelegate {
136 objectName: {
137 switch (index) {
138@@ -463,19 +480,58 @@
139 return "method_code";
140 case 2:
141 return "method_phrase";
142+ case 3:
143+ return "method_finger";
144 default:
145 return "method_unknown";
146 }
147 }
148- text: index == 0 ? (unlockMethod.selectedIndex == 0 ? unlockMethod.swipe : unlockMethod.swipeAlt) :
149- (index == 1 ? (unlockMethod.selectedIndex == 1 ? unlockMethod.passcode : unlockMethod.passcodeAlt) :
150- (unlockMethod.selectedIndex == 2 ? unlockMethod.passphrase : unlockMethod.passphraseAlt))
151+ text: {
152+ var si = unlockMethod.selectedIndex;
153+ switch (index) {
154+ case 0:
155+ return si == 0 ? unlockMethod.swipe : unlockMethod.swipeAlt;
156+ case 1:
157+ return si == 1 ? unlockMethod.passcode : unlockMethod.passcodeAlt;
158+ case 2:
159+ return si == 2 ? unlockMethod.passphrase : unlockMethod.passphraseAlt;
160+ case 3:
161+ return unlockMethod.fingerprint;
162+ }
163+ }
164+ enabled: {
165+ // Fingerprint is the only one we disable, unless the user
166+ // has chosen FP ident and there are more than 0 enrolled
167+ // FPs and there's a pass{code|phrase} set.
168+ var passSet = (securityPrivacy.securityType ===
169+ UbuntuSecurityPrivacyPanel.Passcode
170+ || securityPrivacy.securityType ===
171+ UbuntuSecurityPrivacyPanel.Passphrase);
172+ var haveFps = page.enrolledFingerprints > 0;
173+ return index !== 3 || (haveFps && passSet);
174+ }
175 }
176 expanded: true
177 onDelegateClicked: {
178 if (selectedIndex === index && !changeControl.visible)
179 return // nothing to do
180
181+ // This check is needed for when FP is the chosen method,
182+ // but the user wants to disable FP in favour of the
183+ // securityType already set, for which there is nothing
184+ // to do, except turn off FP ident.
185+ if (methodToIndex(securityPrivacy.securityType) === index) {
186+ securityPrivacy.enableFingerprintIdentification = false;
187+ return
188+ }
189+
190+ // Bail if we enabled FP ident.
191+ if (index === 3) {
192+ // Toggle FP ident.
193+ securityPrivacy.enableFingerprintIdentification = true;
194+ return;
195+ }
196+
197 selectedIndex = index
198 openDialog()
199 }
200@@ -483,14 +539,22 @@
201 Binding {
202 target: unlockMethod
203 property: "selectedIndex"
204- value: methodToIndex(securityPrivacy.securityType)
205+ value: {
206+ if (securityPrivacy.enableFingerprintIdentification) {
207+ return methodToIndex(UbuntuSecurityPrivacyPanel.Fingerprint);
208+ } else {
209+ return methodToIndex(securityPrivacy.securityType);
210+ }
211+ }
212 }
213
214 ListItem.SingleControl {
215
216 id: changeControl
217- visible: securityPrivacy.securityType !==
218- UbuntuSecurityPrivacyPanel.Swipe
219+ visible: securityPrivacy.securityType ===
220+ UbuntuSecurityPrivacyPanel.Passcode &&
221+ securityPrivacy.securityType ===
222+ UbuntuSecurityPrivacyPanel.Passphrase
223
224 control: Button {
225 property string changePasscode: i18n.tr("Change passcode…")
226@@ -511,4 +575,46 @@
227 }
228 }
229 }
230+
231+ // This observer is used to decide whether or not to enabled Fingerprint ID
232+ // to be selected by the user as a security method.
233+ Observer {
234+ id: sizeObserver
235+ onFailed: {
236+ page.enrolledFingerprints = 0;
237+ _op = null;
238+ }
239+ onSucceeded: {
240+ page.enrolledFingerprints = result;
241+ _op = null;
242+ }
243+ onCanceled: _op = null
244+
245+ function start () {
246+ _op = Biometryd.defaultDevice.templateStore.size(user);
247+ _op.start(sizeObserver);
248+ }
249+
250+ property var _op: null
251+
252+ Component.onCompleted: {
253+ if (Biometryd.available)
254+ start();
255+ }
256+ Component.onDestruction: _op && _op.cancel();
257+ }
258+
259+ Connections {
260+ target: Biometryd
261+ onAvailableChanged: {
262+ if (available)
263+ sizeObserver.start();
264+ }
265+ }
266+
267+ User {
268+ id: user
269+ uid: UbuntuSettingsFingerprint.uid
270+ }
271+
272 }
273
274=== modified file 'plugins/security-privacy/PageComponent.qml'
275--- plugins/security-privacy/PageComponent.qml 2016-02-18 15:42:16 +0000
276+++ plugins/security-privacy/PageComponent.qml 2016-06-15 12:15:30 +0000
277@@ -18,12 +18,14 @@
278 * with this program. If not, see <http://www.gnu.org/licenses/>.
279 */
280
281+import Biometryd 0.0
282 import GSettings 1.0
283 import QMenuModel 0.1
284 import QtQuick 2.4
285 import Ubuntu.Components 1.3
286 import Ubuntu.Components.ListItems 1.3 as ListItem
287 import SystemSettings 1.0
288+import Ubuntu.Settings.Fingerprint 0.1
289 import Ubuntu.SystemSettings.Battery 1.0
290 import Ubuntu.SystemSettings.Diagnostics 1.0
291 import Ubuntu.SystemSettings.SecurityPrivacy 1.0
292@@ -151,11 +153,35 @@
293 text: i18n.tr("Security")
294 }
295 ListItem.SingleValue {
296+ id: fingerprintControl
297+ objectName: "fingerprintControl"
298+ text: i18n.tr("Fingerprint ID")
299+ progression: true
300+ onClicked: pageStack.push(fingeprintPage, {
301+ passcodeSet: securityPrivacy.securityType !== UbuntuSecurityPrivacyPanel.Swipe
302+ })
303+ visible: Biometryd.available
304+ }
305+
306+ Component {
307+ id: fingeprintPage
308+ Fingerprints {
309+ onRequestPasscode: {
310+ pageStack.pop();
311+ pageStack.push(Qt.resolvedUrl("LockSecurity.qml"));
312+ }
313+ }
314+ }
315+
316+ ListItem.SingleValue {
317 id: lockingControl
318 objectName: "lockingControl"
319 text: i18n.tr("Locking and unlocking")
320 progression: true
321- onClicked: pageStack.push(Qt.resolvedUrl("PhoneLocking.qml"), {usePowerd: usePowerd, powerSettings: powerSettings})
322+ onClicked: pageStack.push(Qt.resolvedUrl("PhoneLocking.qml"), {
323+ usePowerd: usePowerd,
324+ powerSettings: powerSettings
325+ })
326 }
327 ListItem.SingleValue {
328 id: simControl
329
330=== modified file 'plugins/security-privacy/PhoneLocking.qml'
331--- plugins/security-privacy/PhoneLocking.qml 2016-05-13 14:10:23 +0000
332+++ plugins/security-privacy/PhoneLocking.qml 2016-06-15 12:15:30 +0000
333@@ -31,7 +31,7 @@
334 title: i18n.tr("Locking and unlocking")
335
336 property bool usePowerd
337- property variant powerSettings
338+ property var powerSettings
339
340 UbuntuSecurityPrivacyPanel {
341 id: securityPrivacy
342@@ -56,10 +56,13 @@
343 property string swipe: i18n.ctr("Unlock with swipe", "None")
344 property string passcode: i18n.tr("Passcode")
345 property string passphrase: i18n.tr("Passphrase")
346+ property string fingerprint: i18n.tr("Fingerprint")
347
348 objectName: "lockSecurity"
349 text: i18n.tr("Lock security")
350 value: {
351+ if (securityPrivacy.enableFingerprintIdentification)
352+ return fingerprint
353 switch (securityPrivacy.securityType) {
354 case UbuntuSecurityPrivacyPanel.Swipe:
355 return swipe
356@@ -67,6 +70,8 @@
357 return passcode
358 case UbuntuSecurityPrivacyPanel.Passphrase:
359 return passphrase
360+ case UbuntuSecurityPrivacyPanel.Fingerprint:
361+ return fingerprint
362 }
363 }
364 progression: true
365
366=== modified file 'plugins/security-privacy/securityprivacy.cpp'
367--- plugins/security-privacy/securityprivacy.cpp 2015-01-28 15:02:09 +0000
368+++ plugins/security-privacy/securityprivacy.cpp 2016-06-15 12:15:30 +0000
369@@ -99,6 +99,8 @@
370 Q_EMIT enableLauncherWhileLockedChanged();
371 } else if (property == "EnableIndicatorsWhileLocked") {
372 Q_EMIT enableIndicatorsWhileLockedChanged();
373+ } else if (property == "EnableFingerprintIdentification") {
374+ Q_EMIT enableFingerprintIdentificationChanged();
375 }
376 } else if (interface == AS_TOUCH_INTERFACE) {
377 if (property == "MessagesWelcomeScreen") {
378@@ -118,6 +120,7 @@
379 void SecurityPrivacy::slotNameOwnerChanged()
380 {
381 // Tell QML so that it refreshes its view of the property
382+ Q_EMIT enableFingerprintIdentificationChanged();
383 Q_EMIT messagesWelcomeScreenChanged();
384 Q_EMIT statsWelcomeScreenChanged();
385 Q_EMIT enableLauncherWhileLockedChanged();
386@@ -126,6 +129,23 @@
387 Q_EMIT hereLicensePathChanged();
388 }
389
390+bool SecurityPrivacy::getEnableFingerprintIdentification()
391+{
392+ return m_accountsService.getUserProperty(AS_INTERFACE,
393+ "EnableFingerprintIdentification").toBool();
394+}
395+
396+void SecurityPrivacy::setEnableFingerprintIdentification(bool enabled)
397+{
398+ if (enabled == getEnableFingerprintIdentification())
399+ return;
400+
401+ m_accountsService.setUserProperty(AS_INTERFACE,
402+ "EnableFingerprintIdentification",
403+ QVariant::fromValue(enabled));
404+ Q_EMIT(enableFingerprintIdentificationChanged());
405+}
406+
407 bool SecurityPrivacy::getStatsWelcomeScreen()
408 {
409 return m_accountsService.getUserProperty(AS_TOUCH_INTERFACE,
410@@ -381,6 +401,9 @@
411 if (!setPasswordModeWithPolicykit(type, oldValue)) {
412 setDisplayHint(oldType);
413 return badPasswordMessage(oldType);
414+ } else {
415+ // Successfully enabling Swipe must disable fingerprint auth.
416+ setEnableFingerprintIdentification(false);
417 }
418 } else {
419 QString errorText = setPassword(oldValue, value);
420
421=== modified file 'plugins/security-privacy/securityprivacy.h'
422--- plugins/security-privacy/securityprivacy.h 2015-01-28 15:02:09 +0000
423+++ plugins/security-privacy/securityprivacy.h 2016-06-15 12:15:30 +0000
424@@ -40,6 +40,10 @@
425 {
426 Q_OBJECT
427 Q_ENUMS(SecurityType)
428+ Q_PROPERTY (bool enableFingerprintIdentification
429+ READ getEnableFingerprintIdentification
430+ WRITE setEnableFingerprintIdentification
431+ NOTIFY enableFingerprintIdentificationChanged)
432 Q_PROPERTY (bool statsWelcomeScreen
433 READ getStatsWelcomeScreen
434 WRITE setStatsWelcomeScreen
435@@ -71,12 +75,15 @@
436 enum SecurityType {
437 Swipe,
438 Passcode,
439- Passphrase
440+ Passphrase,
441+ Fingerprint
442 };
443
444 explicit SecurityPrivacy(QObject *parent = 0);
445 virtual ~SecurityPrivacy();
446
447+ bool getEnableFingerprintIdentification();
448+ void setEnableFingerprintIdentification(bool enabled);
449 bool getStatsWelcomeScreen();
450 void setStatsWelcomeScreen(bool enabled);
451 bool getMessagesWelcomeScreen();
452@@ -99,6 +106,7 @@
453 void slotNameOwnerChanged();
454
455 Q_SIGNALS:
456+ void enableFingerprintIdentificationChanged();
457 void statsWelcomeScreenChanged();
458 void messagesWelcomeScreenChanged();
459 void enableLauncherWhileLockedChanged();

Subscribers

People subscribed via source and target branches