Skip to content

fix: gate Greeter account entry on the user notice - #591

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:release/2500u2-pajilfrom
52cyb:fix/384345-user-notice-2500u2-pajil
Nov 27, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:release/2500u2-pajilfrom
52cyb:fix/384345-user-notice-2500u2-pajil

Conversation

@52cyb

@52cyb 52cyb commented Nov 27, 2026 •

Copy link
Copy Markdown

改动

在 userlist=false、loginPromptInput=true 时,复用已有 Greeter 或从 Greeter 密码页点击「切换用户」,先运行账号输入前注册的任务。任务等待期间隐藏登录控件、重绘背景,任务结束后显示账号输入页。新建 Greeter 继续使用 pre-greeter。

验证

  • Greeter 和锁屏构建通过,8 项现有认证回归测试通过。
  • Qt 离屏和 Xvfb 测试覆盖等待时隐藏表单、多屏重挂载和背景重绘。
  • 特定 X11 场景复用 Greeter 时仍观察到账号输入页短暂可见,已单列待解决。

配套 PR 为 dde-session-ui #482。

PMS: BUG-384345

Summary by Sourcery

Gate account input behind configurable preparation tasks while keeping the Greeter UI hidden and synchronized until the flow is ready.

New Features:

  • Add configurable account-entry task execution before showing the account input screen when switching users or reactivating an existing Greeter session.
  • Support Greeter session activity tracking to restore account entry after the session becomes active again.

Bug Fixes:

  • Prevent login controls, keyboard input, and virtual keyboard access from appearing or remaining interactive while account-entry preparation is running.
  • Preserve the account-entry flow when sessions are removed under the relevant login configuration.

Enhancements:

  • Refresh Greeter background and login visibility consistently across session activation, task completion, and multi-screen remounting.
  • Refactor switch-user handling so login and lock-screen flows can apply different account-entry behavior.

Build:

  • Install the account-entry task helper when the related feature is enabled.

@sourcery-ai

sourcery-ai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Data structures

Expose the Greeter activity and account-entry signals and state needed to coordinate session reactivation with the UI.

  • src/lightdm-deepin-greeter/greeterworker.h L25-28, L47-53, L118-122 (+1 small edits)
  • src/lightdm-deepin-greeter/logincontent.h L25-29, L35-50 (+2 small edits)

API

Add the overridable user-switch hook and route the control widget’s switch request through it.

  • src/session-widgets/lockcontent.cpp L150-164
  • src/session-widgets/lockcontent.h L92

Uses of the API

Connect Greeter session events to account-entry UI state and initialize login-window visibility through the new gate.

  • src/app/lightdm-deepin-greeter.cpp L146-147, L162-165, L179

Implementation

Watch login1 session activity and preserve the account input when a reused Greeter session is removed or reactivated.

  • src/lightdm-deepin-greeter/greeterworker.cpp L18, L267-272, L418-478

Implement account-entry task selection, execution, pending-state handling, and return to the account input page.

  • src/lightdm-deepin-greeter/logincontent.cpp L9-13, L61-183, L195-197

UI

Gate login-window visibility and input while account-entry work is pending or the Greeter is inactive, keeping the background and virtual keyboard in sync.

  • src/lightdm-deepin-greeter/loginwindow.cpp L47-70, L89-94 (+3 small edits)
  • src/lightdm-deepin-greeter/loginwindow.h L1, L25

Configuration

Install the account-entry task helper only when the associated feature is enabled.

  • CMakeLists.txt L450-453
  • files/select-account-entry-task L1-21

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/lightdm-deepin-greeter/logincontent.cpp" line_range="138" />
<code_context>
         }
         loginFrame->setScreen(screen, count <= 0);
         QObject::connect(worker, &GreeterWorker::requestUpdateBackground, loginFrame, &LoginWindow::updateBackground);
</code_context>
<issue_to_address>
**Login controls stay hidden**

When a registered checker hangs while the Greeter deactivates, `setGreeterActive(false)` does not kill the selector because its `ForwardedErrorChannel` mode does not match the `ForwardedChannels` check. `reactivateAccountEntry()` then waits for the still-running process, so the finish handler never restores the login controls.

Kill the selector when the Greeter deactivates, regardless of its process channel mode, and let reactivation resume the account-entry flow.

Also at `src/lightdm-deepin-greeter/logincontent.cpp:136-137`, `src/lightdm-deepin-greeter/logincontent.cpp:146`.
</issue_to_address>

### Comment 2
<location path="src/lightdm-deepin-greeter/logincontent.cpp" line_range="166" />
<code_context>
+
+    const QDir configs(QStringLiteral("/usr/share/dde-session-shell/greeters.d/account-entry.conf.d"));
+    if (configs.entryList({QStringLiteral("*.json")}, QDir::Files).isEmpty()) {
+        enterAccountInput();
+        emit accountEntryVisibilityChanged();
+    } else {
</code_context>
<issue_to_address>
**Account entry appears without its notice**

When the selector or configured task cannot start, exits unsuccessfully, or produces unusable output, the finish handler falls through to `enterAccountInput()` while the Greeter is active, so the account-entry page appears without the configured task completing; selector exit code 1 is also not logged.

Validate the selector result and task completion before calling `enterAccountInput()`, and log selector exit code 1.
</issue_to_address>

### Comment 3
<location path="src/lightdm-deepin-greeter/greeterworker.cpp" line_range="421-428" />
<code_context>
+#ifdef ENABLE_DSS_SNIPE
+void GreeterWorker::watchSessionActivity()
+{
+    if (!m_login1SessionSelf || !m_login1SessionSelf->isValid())
+        return;
+
+    if (!QDBusConnection::systemBus().connect(m_login1SessionSelf->service(), m_login1SessionSelf->path(),
</code_context>
<issue_to_address>
**Reused Greeter skips the notice**

When the login1 session proxy is invalid or the PropertiesChanged subscription fails, `watchSessionActivity()` returns without activity tracking or a reactivation signal, so `LoginContent` retains its default active state and the reused Greeter can show the account-entry page without running the registered task.

Provide a fallback or retry for activity tracking so a reused Greeter receives the reactivation signal and runs the registered task.
</issue_to_address>

### Comment 4
<location path="src/lightdm-deepin-greeter/loginwindow.cpp" line_range="55" />
<code_context>
+    if (blocked && ownsContent) {
+        login->hide();
+        if (!m_model->isUseWayland() && windowHandle())
+            windowHandle()->setKeyboardGrabEnabled(false);
+    }
+
</code_context>
<issue_to_address>
**Keyboard grab stays disabled**

When the account-entry task or an inactive Greeter causes the blocked branch to run on X11, `updateLoginVisibility()` disables the X11 keyboard grab while the account-entry flow is blocked, but does not restore it when the flow unblocks; the Greeter then stops reserving keyboard input and keystrokes can reach other X clients.

Restore the keyboard grab when the Greeter becomes unblocked and visible, subject to the existing grab-state requirements.
</issue_to_address>

### Comment 5
<location path="src/lightdm-deepin-greeter/loginwindow.cpp" line_range="89-92" />
<code_context>

 bool LoginWindow::event(QEvent *event)
 {
+    if ((event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
+            && LoginContent::instance()->accountEntryBlocksLogin()) {
+        event->accept();
+        return true;
+    }
+
</code_context>
<issue_to_address>
**Power shortcuts stop during notice**

When an account-entry task is running and the user invokes a Greeter power shortcut, the early return consumes every key press and release while the account-entry task runs, including `Key_Sleep` and `Key_PowerOff`; `LoginWindow::event` therefore never reaches its existing handlers for those keys, so users cannot invoke those Greeter power actions during the task.

Allow the existing power-key handlers to run before consuming other key events while login is blocked.
</issue_to_address>

### Comment 6
<location path="src/lightdm-deepin-greeter/greeterworker.cpp" line_range="473" />
<code_context>
+    qCInfo(DDE_SHELL) << "Greeter login1 session active:" << active << "reactivated:" << reactivated;
+
+    if (reactivated && !m_model->userlistVisible() && getDconfigValue("loginPromptInput", false).toBool())
+        emit accountEntryActivated();
+    else
+        emit greeterActiveChanged(active);
</code_context>
<issue_to_address>
**Account form flashes before notice**

When an existing Greeter is reused in the reported X11 scenario and its frame is restored before the login1 activity-change handler runs, `accountEntryActivated` is emitted only after the login1 activity-change signal is delivered, so an X11 Greeter frame can be restored and show the existing account form before `LoginContent` starts the task and hides it; the user briefly sees the account-entry page before the notice.

Keep the account-entry content hidden until the reactivation handler has started the notice task, including across frame restoration.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@52cyb
52cyb force-pushed the fix/384345-user-notice-2500u2-pajil branch from e9c7d93 to 8198f70 Compare November 27, 2026 06:14
1. Run the registered account entry task when reusing the Greeter or
   switching users from its password page.
2. Keep the login controls hidden while the task is pending and repaint
   the Greeter background before showing another account entry page.
3. Use login1 activity transitions to keep initial Greeter activation
   on the existing pre-greeter path.

Log: Show the user notice before the account entry page.

Influence:
1. Check initial login and login after logout with the notice enabled.
2. Check switching users from a locked desktop to an existing Greeter.
3. Check switching users from the password page with multiple displays.

fix: 在显示 Greeter 账号输入页前运行用户须知

1. 复用 Greeter 或从 Greeter 密码页切换用户时运行已注册的任务。
2. 等待任务期间隐藏登录控件并重绘背景,结束后显示账号输入页。
3. 根据 login1 会话激活变化识别复用,新 Greeter 继续走 pre-greeter。

Influence:
1. 验证开机登录和注销后登录时的须知显示顺序。
2. 验证从桌面锁屏切回复用 Greeter 的流程。
3. 验证多屏下从 Greeter 密码页返回账号输入页的流程。

Log: 在账号输入页显示前展示用户须知。
PMS: BUG-384345
@52cyb
52cyb force-pushed the fix/384345-user-notice-2500u2-pajil branch from 8198f70 to 4804128 Compare November 27, 2026 06:18
@deepin-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 52cyb, yixinshark

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@52cyb

52cyb commented Nov 27, 2026

Copy link
Copy Markdown
Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Nov 27, 2026

Copy link
Copy Markdown

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit 3119238 into linuxdeepin:release/2500u2-pajil Nov 27, 2026
13 of 18 checks passed
@52cyb
52cyb deleted the fix/384345-user-notice-2500u2-pajil branch November 27, 2026 07:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants