fix: treat system-directory apps as pre-installed when InstalledTime is missing - #380
fix: treat system-directory apps as pre-installed when InstalledTime is missing#38018202781743 wants to merge 1 commit into
Conversation
…is missing When firstLaunch is false and InstalledTime record is null (e.g. after factory reset restores a pre-installed app's desktop file while storage.json is preserved), the old code unconditionally set InstalledTime to the current timestamp, causing uninstalled-and-restored pre-installed apps to incorrectly appear in the 'recently installed' list. Add helper isFromSystemApplicationsDir() to check whether the desktop source path belongs to a system-level applications directory (excluding user-level XDG_DATA_HOME). System-level apps now get InstalledTime = 0 (treated as pre-installed); user-level apps keep the current timestamp behavior. PMS: BUG-308223 Multica: https://agent-dev.uniontech.com/dde/issues/7c6f66c7-a8af-46c1-b59f-bed257e5e6d5
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR adjusts how InstalledTime is initialized for applications whose desktop files originate from system-level application directories, so that system apps without an InstalledTime are treated as pre-installed instead of recently installed, and adds a helper to detect system vs user application directories. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
问题背景
卸载应用程序后执行"恢复出厂设置",恢复完成后已卸载的应用程序仍出现在启动器的"最近安装"列表中。
根因
dde-application-manager的ApplicationService构造函数中,当firstLaunch == false且InstalledTime记录缺失(null)时,原逻辑无条件设为当前时间戳。恢复出厂设置后,不可变系统 base 层恢复了预装应用的 desktop 文件,但storage.json(位于~/.local/share/)被保留,导致这些应用被误判为"最近安装"。修复方案
isFromSystemApplicationsDir():遍历getApplicationsDirs()返回的目录列表,排除以getXDGDataHome()开头的用户级目录,判断 desktop 来源路径是否属于系统级目录。InstalledTime为 null 的分支:系统级目录应用InstalledTime = 0(视为预装),用户级目录应用设为当前时间戳(行为不变)。改动文件
src/dbus/applicationservice.cpp关联
Summary by Sourcery
Bug Fixes: