Skip to content

Conversation

@robertkill
Copy link
Contributor

@robertkill robertkill commented Nov 26, 2025

fix: 统一锁屏激活逻辑
移除 ENABLE_DSS_SNIPE 条件编译的锁屏激活代码,将所有锁屏激活逻辑统一到
login1 会话 ActiveChanged 信号下。DSS snipe 功能导致锁屏行为不一致和重
复的激活逻辑。现在所有锁屏激活都通过 login1 会话管理器的活动状态变化来处
理,确保不同会话类型下行为一致。

此更改还移除了 pushUserFrame 中的显式模型可见性设置,因为锁屏激活逻辑现
在通过统一的激活机制正确处理可见性。

Influence:

  1. 测试系统锁定时锁屏激活功能
  2. 验证会话激活时锁屏正确显示
  3. 测试用户切换功能仍然正常工作
  4. 验证会话未激活时锁屏不会显示
  5. 测试不同会话类型下的一致性

PMS: BUG-341543

deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 26, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#53
yixinshark
yixinshark previously approved these changes Nov 26, 2025
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 26, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#53
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 26, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#53
移除 ENABLE_DSS_SNIPE 条件编译的锁屏激活代码,将所有锁屏激活逻辑统一到
login1 会话 ActiveChanged 信号下。DSS snipe 功能导致锁屏行为不一致和重
复的激活逻辑。现在所有锁屏激活都通过 login1 会话管理器的活动状态变化来处
理,确保不同会话类型下行为一致。

此更改还移除了 pushUserFrame 中的显式模型可见性设置,因为锁屏激活逻辑现
在通过统一的激活机制正确处理可见性。

Influence:
1. 测试系统锁定时锁屏激活功能
2. 验证会话激活时锁屏正确显示
3. 测试用户切换功能仍然正常工作
4. 验证会话未激活时锁屏不会显示
5. 测试不同会话类型下的一致性

PMS: BUG-341543
deepin-ci-robot added a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 26, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#53
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: robertkill, 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

@deepin-ci-robot
Copy link

deepin pr auto review

我来帮你分析这段代码的变更。这段代码主要涉及锁屏功能的逻辑调整。让我从几个方面进行分析:

  1. 代码逻辑变更:
  • 原代码中,ENABLE_DSS_SNIPE 条件编译块位于 initConnections() 的前半部分,监听 SessionManagerInter::LockedChanged 信号
  • 新代码将该逻辑移到了 Login1SessionSelf::ActiveChanged 信号的处理函数中
  • 触发条件从 locked && !m_model->visible() 改为 active && !m_model->visible()
  1. 改进建议:

逻辑优化:

  • 这个改动是合理的,因为使用 ActiveChanged 信号更准确地反映了系统状态的变化
  • 将条件判断放在 ActiveChanged 的处理中可以更好地处理系统激活状态的变更

代码质量:

  • 建议在条件编译块内添加注释,说明 ENABLE_DSS_SNIPE 的具体用途
  • 可以考虑将这段逻辑提取为单独的函数,提高代码可读性

性能考虑:

  • 新的实现方式可能更高效,因为它减少了信号的处理次数
  • 但建议添加日志记录,以便于调试和追踪锁屏状态变化

安全考虑:

  • 建议在 showLockScreen() 调用前添加额外的安全检查
  • 可以考虑添加超时机制,防止锁屏界面无法显示的情况
  1. 具体改进建议代码:
void LockWorker::initConnections()
{
    // ... 其他连接代码 ...

    connect(m_login1SessionSelf, &Login1SessionSelf::ActiveChanged, this, [this](bool active) {
        qCInfo(DDE_SHELL) << "DBus lock service active changed, active: " << active << ", model visible: " << m_model->visible();
        
        if (!active) {
            m_authenticating = false;
            endAuthentication(m_account, AT_All);
            destroyAuthentication(m_account);
        } else {
            handleSessionActive();
        }
    });
}

void LockWorker::handleSessionActive()
{
#ifdef ENABLE_DSS_SNIPE
    // 处理DSS-SNIPE模式下的会话激活
    if (!m_model->visible()) {
        // 添加安全检查
        if (isSessionSecure()) {
            m_model->showLockScreen();
        } else {
            qCWarning(DDE_SHELL) << "Session not secure, skipping lock screen display";
        }
    }
#endif
}
  1. 额外建议:
  • 添加更多的错误处理和日志记录
  • 考虑添加单元测试来验证新的逻辑
  • 建议在代码文档中记录这个变更的原因和影响

这个改动总体上是积极的,它使锁屏逻辑更加合理和可靠。但建议按照上述建议进一步完善代码,提高其健壮性和可维护性。

@robertkill robertkill merged commit 2fcc70b into linuxdeepin:master Nov 26, 2025
14 of 15 checks passed
robertkill pushed a commit to linuxdeepin/dde-session-shell-snipe that referenced this pull request Nov 26, 2025
Synchronize source files from linuxdeepin/dde-session-shell.

Source-pull-request: linuxdeepin/dde-session-shell#53
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