on xenial help sign in
With recent password support, we want to be able to unlock the device even with a password set. And we need to be able to do this once the new adbd lands. So I've added a DBus command to hide the greeter. This should be secure because all apps are constrained and if you're on the local session bus unconstrained, you already have access to anything you want.
c325074Michael Terry
plugins/LightDM/DBusGreeter.cpp+5
@@ -39,6 +39,11 @@ void DBusGreeter::ShowGreeter()
39 return Q_EMIT m_greeter->showGreeter();
39 return Q_EMIT m_greeter->showGreeter();
40}
40}
41
41
42+void DBusGreeter::HideGreeter()
43+{
44+ return Q_EMIT m_greeter->hideGreeter();
45+}
46+
42void DBusGreeter::isActiveChangedHandler()
47void DBusGreeter::isActiveChangedHandler()
43{
48{
44 notifyPropertyChanged("IsActive", isActive());
49 notifyPropertyChanged("IsActive", isActive());
plugins/LightDM/DBusGreeter.h+1
@@ -38,6 +38,7 @@ public:
38
38
39 bool isActive() const;
39 bool isActive() const;
40 Q_SCRIPTABLE void ShowGreeter(); // temporary, until we split the greeter again
40 Q_SCRIPTABLE void ShowGreeter(); // temporary, until we split the greeter again
41+ Q_SCRIPTABLE void HideGreeter(); // temporary, until we split the greeter again
41
42
42Q_SIGNALS:
43Q_SIGNALS:
43 void isActiveChanged();
44 void isActiveChanged();
plugins/LightDM/Greeter.h+1
@@ -62,6 +62,7 @@ Q_SIGNALS:
62 void isAuthenticatedChanged();
62 void isAuthenticatedChanged();
63 void promptlessChanged();
63 void promptlessChanged();
64 void showGreeter();
64 void showGreeter();
65+ void hideGreeter();
65
66
66 // This signal is emitted by external agents like indicators, and the UI
67 // This signal is emitted by external agents like indicators, and the UI
67 // should switch to this user if possible.
68 // should switch to this user if possible.
qml/Shell.qml+1−1
@@ -271,6 +271,7 @@ Item {
271 target: LightDM.Greeter
271 target: LightDM.Greeter
272
272
273 onShowGreeter: greeter.show()
273 onShowGreeter: greeter.show()
274+ onHideGreeter: greeter.login()
274
275
275 onShowPrompt: {
276 onShowPrompt: {
276 if (greeter.narrowMode) {
277 if (greeter.narrowMode) {
@@ -313,7 +314,6 @@ Item {
313 }
314 }
314
315
315 if (LightDM.Greeter.authenticated) {
316 if (LightDM.Greeter.authenticated) {
316− lockscreen.hide();
317 greeter.login();
317 greeter.login();
318 } else {
318 } else {
319 AccountsService.failedLogins++
319 AccountsService.failedLogins++
tests/qmltests/tst_Shell.qml+3−2
@@ -389,13 +389,14 @@ Item {
389 tryCompare(indicators, "fullyClosed", true);
389 tryCompare(indicators, "fullyClosed", true);
390 }
390 }
391
391
392−
392+ function test_showAndHideGreeterDBusCalls() {
393− function test_showGreeterDBusCall() {
394 var greeter = findChild(shell, "greeter")
393 var greeter = findChild(shell, "greeter")
395 tryCompare(greeter, "showProgress", 0)
394 tryCompare(greeter, "showProgress", 0)
396 waitForRendering(greeter);
395 waitForRendering(greeter);
397 LightDM.Greeter.showGreeter()
396 LightDM.Greeter.showGreeter()
398 tryCompare(greeter, "showProgress", 1)
397 tryCompare(greeter, "showProgress", 1)
398+ LightDM.Greeter.hideGreeter()
399+ tryCompare(greeter, "showProgress", 0)
399 }
400 }
400
401
401 function test_login() {
402 function test_login() {
tools/unlock-device+8−13
@@ -4,7 +4,7 @@
4# Our goal here is to get an Ubuntu Touch device into a testable unlocked state.
4# Our goal here is to get an Ubuntu Touch device into a testable unlocked state.
5# This will include a reboot.
5# This will include a reboot.
6
6
7−WAIT_COMMAND="adb reboot; sleep 5; adb wait-for-device; sleep 20"
7+WAIT_COMMAND="adb reboot; sleep 5; adb wait-for-device"
8
8
9while getopts s:w: opt; do
9while getopts s:w: opt; do
10 case $opt in
10 case $opt in
@@ -17,20 +17,15 @@ while getopts s:w: opt; do
17 esac
17 esac
18done
18done
19
19
20−UNLOCK_SCRIPT='
21−import dbus, logging;
22−from unity8 import process_helpers as helpers;
23−logging.basicConfig(level=logging.INFO);
24−bus = dbus.SystemBus().get_object("com.canonical.powerd", "/com/canonical/powerd");
25−cookie = bus.requestSysState("unlock-device-hold", 1, dbus_interface="com.canonical.powerd");
26−helpers.restart_unity_with_testability();
27−bus.clearSysState(cookie, dbus_interface="com.canonical.powerd");
28−helpers.unlock_unity()
29−'
30−
31eval "$WAIT_COMMAND"
20eval "$WAIT_COMMAND"
32
21
22+# Force a sleep of twenty no matter what, since we may need to wait for unity8
23+# to finish coming up (it's hard to tell when the greeter is actually rendered)
24+sleep 20
25+
26+GDBUS_CMD="gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter && echo Greeter unlocked"
27+
33−UNLOCK_OUTPUT=$(adb shell "sudo -u phablet -i python3 -c '$UNLOCK_SCRIPT'" 2>&1)
28+UNLOCK_OUTPUT=$(adb shell "if [ \"\$(id -u)\" = 0 ]; then sudo -u phablet -i $GDBUS_CMD; else $GDBUS_CMD; fi" 2>&1)
34if echo "$UNLOCK_OUTPUT" | grep 'Greeter unlocked' >/dev/null; then
29if echo "$UNLOCK_OUTPUT" | grep 'Greeter unlocked' >/dev/null; then
35 echo "I: Unlock passed"
30 echo "I: Unlock passed"
36 exit 0
31 exit 0