diff --git a/conf/com.kylin.ProcessManager.xml b/conf/com.kylin.ProcessManager.xml index 28aba50..e6b19aa 100644 --- a/conf/com.kylin.ProcessManager.xml +++ b/conf/com.kylin.ProcessManager.xml @@ -2,6 +2,11 @@ "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> + + + + + diff --git a/debian/changelog b/debian/changelog index 507b212..8966f2c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +kylin-app-manager (3.22.1.0-ok1.16) yangtze; urgency=medium + + * 清空CGroup分组白名单;修改CGroup分组路径,解决无法弹出授权窗口的问题 + + -- guopengfei Tue, 31 Jan 2023 09:04:29 +0800 + kylin-app-manager (3.22.1.0-ok1.15) yangtze; urgency=medium * 添加CGroup分组白名单 diff --git a/debian/install b/debian/install index 864c47a..cc53fd4 100644 --- a/debian/install +++ b/debian/install @@ -1,2 +1,2 @@ conf/com.kylin.AppManager.service /usr/share/dbus-1/services -conf/kylin-app-manager.json /etc/kylin-app-manager/ \ No newline at end of file +conf/kylin-app-manager.json /etc/kylin-app-manager \ No newline at end of file diff --git a/kylin-app-manager/src/core/appcgroup.cpp b/kylin-app-manager/src/core/appcgroup.cpp index f27fa08..f4bd15d 100644 --- a/kylin-app-manager/src/core/appcgroup.cpp +++ b/kylin-app-manager/src/core/appcgroup.cpp @@ -8,7 +8,7 @@ AppCGroup::AppCGroup(QObject *parent) , m_processManagerInterface(new com::kylin::ProcessManager("com.kylin.ProcessManager", "/com/kylin/ProcessManager", QDBusConnection::systemBus())) { - + initCGroup(); } QString AppCGroup::createProcessCGroup(const QString &appId, const QList &pids) @@ -62,7 +62,7 @@ QString AppCGroup::cgroupNameWithPid(int pid) auto reply = m_processManagerInterface->CGroupNameWithPid(pid); while (!reply.isFinished()) { qApp->processEvents(); - sleep(1); + usleep(1); } if (reply.isError()) { qWarning() << __FUNCTION__ << "error, " << reply.error(); @@ -70,3 +70,27 @@ QString AppCGroup::cgroupNameWithPid(int pid) } return reply.value().value(kDbusResult).toString(); } + +void AppCGroup::initCGroup() +{ + QProcess p; + p.start("id", QStringList() << "-u"); + p.waitForFinished(); + auto userId = p.readAll().toUInt(); + auto rootPath = QString("user.slice/user-%1.slice/kylin-app-manager").arg(userId); + auto reply = m_processManagerInterface->InitCGroup(rootPath); + while (!reply.isFinished()) { + qApp->processEvents(); + usleep(1); + } + if (reply.isError()) { + qWarning() << __FUNCTION__ << "error, " << reply.error(); + return; + } + if (!reply.value().value(kDbusResult).toBool()) { + qWarning() << "Init CGroup failed, " + << reply.value().value(kDbusErrMsg).toString() + << "the root path is " << rootPath; + } + qDebug() << reply.value().value(kDbusResult) << rootPath; +} diff --git a/kylin-app-manager/src/core/appcgroup.h b/kylin-app-manager/src/core/appcgroup.h index 1dd2845..40f4335 100644 --- a/kylin-app-manager/src/core/appcgroup.h +++ b/kylin-app-manager/src/core/appcgroup.h @@ -21,6 +21,7 @@ public: QString cgroupNameWithPid(int pid); private: + void initCGroup(); private: com::kylin::ProcessManager *m_processManagerInterface; diff --git a/kylin-app-manager/src/core/appinfomanager.h b/kylin-app-manager/src/core/appinfomanager.h index 7ca02db..f35ecdf 100644 --- a/kylin-app-manager/src/core/appinfomanager.h +++ b/kylin-app-manager/src/core/appinfomanager.h @@ -272,11 +272,6 @@ private: "qaxbrowser-safe.desktop" }; const QStringList kNoCgroupApps = { - "ukui-control-center.desktop", - "kylin-installer.desktop", - "biometric-manager.desktop", - "kylin-software-center.desktop", - "gparted.desktop" }; };