清空CGroup分组白名单;修改CGroup分组路径,解决无法弹出授权窗口的问题
This commit is contained in:
parent
c3dec8ea7c
commit
e67c5011d9
|
@ -2,6 +2,11 @@
|
||||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||||
<node name="/com/kylin/ProcessManager">
|
<node name="/com/kylin/ProcessManager">
|
||||||
<interface name="com.kylin.ProcessManager">
|
<interface name="com.kylin.ProcessManager">
|
||||||
|
<method name="InitCGroup">
|
||||||
|
<arg name="rootPath" type="s" direction="in"/>
|
||||||
|
<arg name="result" type="a{sv}" direction="out"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QMap<QString,QVariant>"/>
|
||||||
|
</method>
|
||||||
<method name="CreateProcessCGroup">
|
<method name="CreateProcessCGroup">
|
||||||
<arg name="appId" type="s" direction="in"/>
|
<arg name="appId" type="s" direction="in"/>
|
||||||
<arg name="pids" type="ai" direction="in"/>
|
<arg name="pids" type="ai" direction="in"/>
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
kylin-app-manager (3.22.1.0-ok1.16) yangtze; urgency=medium
|
||||||
|
|
||||||
|
* 清空CGroup分组白名单;修改CGroup分组路径,解决无法弹出授权窗口的问题
|
||||||
|
|
||||||
|
-- guopengfei <guopengfei@kylinos.cn> Tue, 31 Jan 2023 09:04:29 +0800
|
||||||
|
|
||||||
kylin-app-manager (3.22.1.0-ok1.15) yangtze; urgency=medium
|
kylin-app-manager (3.22.1.0-ok1.15) yangtze; urgency=medium
|
||||||
|
|
||||||
* 添加CGroup分组白名单
|
* 添加CGroup分组白名单
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
conf/com.kylin.AppManager.service /usr/share/dbus-1/services
|
conf/com.kylin.AppManager.service /usr/share/dbus-1/services
|
||||||
conf/kylin-app-manager.json /etc/kylin-app-manager/
|
conf/kylin-app-manager.json /etc/kylin-app-manager
|
|
@ -8,7 +8,7 @@ AppCGroup::AppCGroup(QObject *parent)
|
||||||
, m_processManagerInterface(new com::kylin::ProcessManager("com.kylin.ProcessManager",
|
, m_processManagerInterface(new com::kylin::ProcessManager("com.kylin.ProcessManager",
|
||||||
"/com/kylin/ProcessManager", QDBusConnection::systemBus()))
|
"/com/kylin/ProcessManager", QDBusConnection::systemBus()))
|
||||||
{
|
{
|
||||||
|
initCGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString AppCGroup::createProcessCGroup(const QString &appId, const QList<int> &pids)
|
QString AppCGroup::createProcessCGroup(const QString &appId, const QList<int> &pids)
|
||||||
|
@ -62,7 +62,7 @@ QString AppCGroup::cgroupNameWithPid(int pid)
|
||||||
auto reply = m_processManagerInterface->CGroupNameWithPid(pid);
|
auto reply = m_processManagerInterface->CGroupNameWithPid(pid);
|
||||||
while (!reply.isFinished()) {
|
while (!reply.isFinished()) {
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
sleep(1);
|
usleep(1);
|
||||||
}
|
}
|
||||||
if (reply.isError()) {
|
if (reply.isError()) {
|
||||||
qWarning() << __FUNCTION__ << "error, " << reply.error();
|
qWarning() << __FUNCTION__ << "error, " << reply.error();
|
||||||
|
@ -70,3 +70,27 @@ QString AppCGroup::cgroupNameWithPid(int pid)
|
||||||
}
|
}
|
||||||
return reply.value().value(kDbusResult).toString();
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
QString cgroupNameWithPid(int pid);
|
QString cgroupNameWithPid(int pid);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void initCGroup();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
com::kylin::ProcessManager *m_processManagerInterface;
|
com::kylin::ProcessManager *m_processManagerInterface;
|
||||||
|
|
|
@ -272,11 +272,6 @@ private:
|
||||||
"qaxbrowser-safe.desktop"
|
"qaxbrowser-safe.desktop"
|
||||||
};
|
};
|
||||||
const QStringList kNoCgroupApps = {
|
const QStringList kNoCgroupApps = {
|
||||||
"ukui-control-center.desktop",
|
|
||||||
"kylin-installer.desktop",
|
|
||||||
"biometric-manager.desktop",
|
|
||||||
"kylin-software-center.desktop",
|
|
||||||
"gparted.desktop"
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue