on xenial help sign in
Allow unlocking the greeter via dbus
commit88584084354af6368faa6f5a9d0d3da966a11e78 authorMichael Terry <michael.terry@canonical.com> dateWed 27 Aug 2014, 11:11 (12 years ago) parent589c41e
6 files changed+12−15
plugins/LightDM/DBusGreeter.cpp+5 plugins/LightDM/DBusGreeter.h+1 plugins/LightDM/Greeter.h+1 qml/Shell.qml+1−1 tests/qmltests/tst_Shell.qml+3−2 tools/unlock-device+1−12
plugins/LightDM/DBusGreeter.cpp+5
@@ -39,6 +39,11 @@ void DBusGreeter::ShowGreeter()
3939 return Q_EMIT m_greeter->showGreeter();
4040}
4141
42+void DBusGreeter::HideGreeter()
43+{
44+ return Q_EMIT m_greeter->hideGreeter();
45+}
46+
4247void DBusGreeter::isActiveChangedHandler()
4348{
4449 notifyPropertyChanged("IsActive", isActive());
plugins/LightDM/DBusGreeter.h+1
@@ -38,6 +38,7 @@ public:
3838
3939 bool isActive() const;
4040 Q_SCRIPTABLE void ShowGreeter(); // temporary, until we split the greeter again
41+ Q_SCRIPTABLE void HideGreeter(); // temporary, until we split the greeter again
4142
4243Q_SIGNALS:
4344 void isActiveChanged();
plugins/LightDM/Greeter.h+1
@@ -62,6 +62,7 @@ Q_SIGNALS:
6262 void isAuthenticatedChanged();
6363 void promptlessChanged();
6464 void showGreeter();
65+ void hideGreeter();
6566
6667 // This signal is emitted by external agents like indicators, and the UI
6768 // should switch to this user if possible.
qml/Shell.qml+1−1
@@ -271,6 +271,7 @@ Item {
271271 target: LightDM.Greeter
272272
273273 onShowGreeter: greeter.show()
274+ onHideGreeter: greeter.login()
274275
275276 onShowPrompt: {
276277 if (greeter.narrowMode) {
@@ -313,7 +314,6 @@ Item {
313314 }
314315
315316 if (LightDM.Greeter.authenticated) {
316− lockscreen.hide();
317317 greeter.login();
318318 } else {
319319 AccountsService.failedLogins++
tests/qmltests/tst_Shell.qml+3−2
@@ -389,13 +389,14 @@ Item {
389389 tryCompare(indicators, "fullyClosed", true);
390390 }
391391
392−
393− function test_showGreeterDBusCall() {
392+ function test_showAndHideGreeterDBusCalls() {
394393 var greeter = findChild(shell, "greeter")
395394 tryCompare(greeter, "showProgress", 0)
396395 waitForRendering(greeter);
397396 LightDM.Greeter.showGreeter()
398397 tryCompare(greeter, "showProgress", 1)
398+ LightDM.Greeter.hideGreeter()
399+ tryCompare(greeter, "showProgress", 0)
399400 }
400401
401402 function test_login() {
tools/unlock-device+1−12
@@ -17,20 +17,9 @@ while getopts s:w: opt; do
1717 esac
1818done
1919
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−
3120eval "$WAIT_COMMAND"
3221
33−UNLOCK_OUTPUT=$(adb shell "sudo -u phablet -i python3 -c '$UNLOCK_SCRIPT'" 2>&1)
22+UNLOCK_OUTPUT=$(adb shell "sudo -u phablet -i gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter && echo Greeter unlocked" 2>&1)
3423if echo "$UNLOCK_OUTPUT" | grep 'Greeter unlocked' >/dev/null; then
3524 echo "I: Unlock passed"
3625 exit 0