chore: 修复AM初次启动占用大量内存的问题
修复AM初次启动占用大量内存的问题 Log: Task: https://pms.uniontech.com/task-view-144887.html Influence: 正常启动 Change-Id: I6f76ee7101dd846d55f37cec949b9201bc331cd0
This commit is contained in:
parent
0206f1abea
commit
9833e1d7fb
@ -12,4 +12,4 @@ endmacro(install_symlink)
|
|||||||
install(FILES ${SERVICE_FILES} DESTINATION lib/systemd/user/)
|
install(FILES ${SERVICE_FILES} DESTINATION lib/systemd/user/)
|
||||||
|
|
||||||
# 添加软链接,系统启动时被dde-session-initialized拉起
|
# 添加软链接,系统启动时被dde-session-initialized拉起
|
||||||
install_symlink(dde-application-manager.service dde-session-initialized.target.wants)
|
# install_symlink(dde-application-manager.service dde-session-initialized.target.wants)
|
||||||
|
@ -8,9 +8,7 @@ CollectMode=inactive-or-failed
|
|||||||
StartLimitIntervalSec=10s
|
StartLimitIntervalSec=10s
|
||||||
StartLimitBurst=30
|
StartLimitBurst=30
|
||||||
|
|
||||||
Requisite=dde-session-initialized.target
|
#PartOf=dde-session-daemon.target
|
||||||
PartOf=dde-session-initialized.target
|
|
||||||
After=dde-session-initialized.target
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
@ -19,3 +17,7 @@ TimeoutStartSec=infinity
|
|||||||
Slice=components.slice
|
Slice=components.slice
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=300ms
|
RestartSec=300ms
|
||||||
|
|
||||||
|
|
||||||
|
#[Install]
|
||||||
|
#WantedBy=dde-session-daemon.target
|
||||||
|
@ -121,7 +121,7 @@ std::string BaseDir::userCacheDir()
|
|||||||
std::string BaseDir::userAppDir()
|
std::string BaseDir::userAppDir()
|
||||||
{
|
{
|
||||||
std::string dataDir = userDataDir();
|
std::string dataDir = userDataDir();
|
||||||
return (dataDir.size() > 0) ? dataDir + "appliations/" : "";
|
return (dataDir.size() > 0) ? dataDir + "applications/" : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> BaseDir::sysAppDirs()
|
std::vector<std::string> BaseDir::sysAppDirs()
|
||||||
|
@ -33,6 +33,7 @@ AppManager::AppManager(QObject *parent)
|
|||||||
, watcher(new DFWatcher(this))
|
, watcher(new DFWatcher(this))
|
||||||
, recorder(new AlRecorder(watcher, this))
|
, recorder(new AlRecorder(watcher, this))
|
||||||
{
|
{
|
||||||
|
qInfo() << "AppManager";
|
||||||
new DBusAdaptorRecorder(recorder);
|
new DBusAdaptorRecorder(recorder);
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
if (!con.registerService("org.deepin.daemon.AlRecorder1"))
|
if (!con.registerService("org.deepin.daemon.AlRecorder1"))
|
||||||
@ -53,6 +54,7 @@ AppManager::AppManager(QObject *parent)
|
|||||||
for (auto &dir : BaseDir::sysAppDirs())
|
for (auto &dir : BaseDir::sysAppDirs())
|
||||||
dataDirs << dir.c_str();
|
dataDirs << dir.c_str();
|
||||||
|
|
||||||
|
qInfo() << "get dataDirs: " << dataDirs;
|
||||||
recorder->watchDirs(dataDirs); // 监控应用desktop
|
recorder->watchDirs(dataDirs); // 监控应用desktop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ const QString configSuffix = ".json";
|
|||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
if (!con.registerService("org.deepin.daemon.DFWatcher1"))
|
if (!con.registerService("org.deepin.daemon.DFWatcher1"))
|
||||||
{
|
{
|
||||||
qInfo() << "register service app1 error:" << con.lastError().message();
|
qInfo() << "register service DFWatcher error:" << con.lastError().message();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,6 +54,7 @@ Dock::Dock(QObject *parent)
|
|||||||
registeModule("dock");
|
registeModule("dock");
|
||||||
|
|
||||||
QString sessionType {getenv("XDG_SESSION_TYPE")};
|
QString sessionType {getenv("XDG_SESSION_TYPE")};
|
||||||
|
qInfo() << "sessionType=" << sessionType;
|
||||||
if (sessionType.contains("wayland")) {
|
if (sessionType.contains("wayland")) {
|
||||||
// wayland env
|
// wayland env
|
||||||
isWayland = true;
|
isWayland = true;
|
||||||
@ -636,7 +637,7 @@ void Dock::smartHideModeTimerExpired()
|
|||||||
*/
|
*/
|
||||||
void Dock::initSettings()
|
void Dock::initSettings()
|
||||||
{
|
{
|
||||||
SETTING->init();
|
qInfo() << "init dock settings";
|
||||||
forceQuitAppStatus = SETTING->getForceQuitAppMode();
|
forceQuitAppStatus = SETTING->getForceQuitAppMode();
|
||||||
connect(SETTING, &DockSettings::hideModeChanged, this, [&](HideMode mode) {
|
connect(SETTING, &DockSettings::hideModeChanged, this, [&](HideMode mode) {
|
||||||
this->updateHideState(false);
|
this->updateHideState(false);
|
||||||
@ -668,7 +669,7 @@ void Dock::updateMenu()
|
|||||||
void Dock::initEntries()
|
void Dock::initEntries()
|
||||||
{
|
{
|
||||||
initDockedApps();
|
initDockedApps();
|
||||||
if (!isWaylandEnv())
|
if (!isWayland)
|
||||||
initClientList();
|
initClientList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ DockManager::DockManager(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, dock(new Dock(this))
|
, dock(new Dock(this))
|
||||||
{
|
{
|
||||||
|
qInfo() << "DockManager";
|
||||||
adaptor = new DBusAdaptorDock(dock);
|
adaptor = new DBusAdaptorDock(dock);
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
if (!con.registerService(dbusService)) {
|
if (!con.registerService(dbusService)) {
|
||||||
|
@ -69,24 +69,6 @@ Launcher::Launcher(QObject *parent)
|
|||||||
"Event", "", // TODO 修正事件参数
|
"Event", "", // TODO 修正事件参数
|
||||||
this, SLOT(handleFSWatcherEvents(QDBusMessage)));
|
this, SLOT(handleFSWatcherEvents(QDBusMessage)));
|
||||||
|
|
||||||
// 监控应用目录
|
|
||||||
watchDataDirs();
|
|
||||||
// 关联org.deepin.daemon.LRecorder1接口事件ServiceRestarted
|
|
||||||
QDBusConnection::sessionBus().connect("org.deepin.daemon.AlRecorder1",
|
|
||||||
"/org/deepin/daemon/AlRecorder1",
|
|
||||||
"org.deepin.daemon.AlRecorder1",
|
|
||||||
"ServiceRestarted",
|
|
||||||
this, SLOT(handleLRecoderRestart(QDBusMessage)));
|
|
||||||
|
|
||||||
|
|
||||||
QDBusConnectionInterface *ifc = QDBusConnection::sessionBus().interface();
|
|
||||||
connect(ifc, &QDBusConnectionInterface::serviceOwnerChanged, this, [ & ](const QString &name, const QString &oldOwner, const QString &newOwner) {
|
|
||||||
Q_UNUSED(name)
|
|
||||||
Q_UNUSED(oldOwner)
|
|
||||||
Q_UNUSED(newOwner)
|
|
||||||
watchDataDirs();
|
|
||||||
});
|
|
||||||
|
|
||||||
// 关联org.deepin.daemon.LRecorder1接口事件Launched
|
// 关联org.deepin.daemon.LRecorder1接口事件Launched
|
||||||
QDBusConnection::sessionBus().connect("org.deepin.daemon.AlRecorder1",
|
QDBusConnection::sessionBus().connect("org.deepin.daemon.AlRecorder1",
|
||||||
"/org/deepin/daemon/AlRecorder1",
|
"/org/deepin/daemon/AlRecorder1",
|
||||||
@ -461,12 +443,6 @@ void Launcher::handleFSWatcherEvents(QDBusMessage msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Launcher:: handleLRecoderRestart(QDBusMessage msg)
|
|
||||||
{
|
|
||||||
Q_UNUSED(msg)
|
|
||||||
watchDataDirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Launcher::initSettings 初始化启动器配置
|
* @brief Launcher::initSettings 初始化启动器配置
|
||||||
*/
|
*/
|
||||||
@ -882,18 +858,6 @@ Item Launcher::getItemByPath(QString itemPath)
|
|||||||
return Item();
|
return Item();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Launcher::watchDataDirs 监控应用数据目录
|
|
||||||
*/
|
|
||||||
void Launcher::watchDataDirs()
|
|
||||||
{
|
|
||||||
QStringList dataDirs;
|
|
||||||
dataDirs << QDir::homePath() + ".local/share";
|
|
||||||
dataDirs << "/usr/local/share" << "/usr/share";
|
|
||||||
QDBusInterface interface = QDBusInterface("org.deepin.daemon.AlRecorder1", "/org/deepin/daemon/AlRecorder1", "org.deepin.daemon.AlRecorder1");
|
|
||||||
interface.call("WatchDirs", dataDirs);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Launcher::emitItemChanged(const Item *item, QString status)
|
void Launcher::emitItemChanged(const Item *item, QString status)
|
||||||
{
|
{
|
||||||
LauncherItemInfo info(item->info);
|
LauncherItemInfo info(item->info);
|
||||||
|
@ -117,7 +117,6 @@ Q_SIGNALS:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void handleFSWatcherEvents(QDBusMessage msg);
|
void handleFSWatcherEvents(QDBusMessage msg);
|
||||||
void handleLRecoderRestart(QDBusMessage msg);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initSettings();
|
void initSettings();
|
||||||
@ -136,7 +135,6 @@ private:
|
|||||||
QString queryPkgName(const QString &itemID, const QString &itemPath);
|
QString queryPkgName(const QString &itemID, const QString &itemPath);
|
||||||
QString queryPkgNameWithDpkg(const QString &itemPath);
|
QString queryPkgNameWithDpkg(const QString &itemPath);
|
||||||
Item getItemByPath(QString itemPath);
|
Item getItemByPath(QString itemPath);
|
||||||
void watchDataDirs();
|
|
||||||
void emitItemChanged(const Item *item, QString status);
|
void emitItemChanged(const Item *item, QString status);
|
||||||
AppType getAppType(DesktopInfo &info, const Item &item);
|
AppType getAppType(DesktopInfo &info, const Item &item);
|
||||||
bool doUninstall(DesktopInfo &info, const Item &item);
|
bool doUninstall(DesktopInfo &info, const Item &item);
|
||||||
|
@ -27,6 +27,7 @@ LauncherManager::LauncherManager(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, launcher(new Launcher(this))
|
, launcher(new Launcher(this))
|
||||||
{
|
{
|
||||||
|
qInfo() << "LauncherManager";
|
||||||
new DBusAdaptorLauncher(launcher);
|
new DBusAdaptorLauncher(launcher);
|
||||||
QDBusConnection con = QDBusConnection::sessionBus();
|
QDBusConnection con = QDBusConnection::sessionBus();
|
||||||
if (!con.registerService(dbusService))
|
if (!con.registerService(dbusService))
|
||||||
|
Loading…
Reference in New Issue
Block a user