fix: AM 暴露出调起应用的接口

org.desktopspec.ApplicationManager启动应用服务接口导出

Log:
Influence: dbus接口暴露给启动器/任务栏等应用调用
Task: https://pms.uniontech.com/task-view-211667.html
Change-Id: I2ccbaf31513db18438cbd18daf96c8bc552e46c5
This commit is contained in:
songwentao
2022-11-04 14:22:45 +08:00
parent ecc94f01c8
commit f260303803
6 changed files with 84 additions and 150 deletions

View File

@ -95,16 +95,6 @@ QStringList StartManager::autostartList()
return autostartFiles;
}
QString StartManager::dumpMemRecord()
{
}
QString StartManager::getApps()
{
}
/**
* @brief StartManager::isAutostart
* @param fileName desktopFile
@ -133,6 +123,11 @@ bool StartManager::isMemSufficient()
return SETTING->getMemCheckerEnabled() ? MemInfo::isSufficient(minMemAvail, maxSwapUsed) : true;
}
void StartManager::launchApp(const QString &desktopFile)
{
doLaunchAppWithOptions(desktopFile);
}
void StartManager::launchApp(QString desktopFile, uint32_t timestamp, QStringList files)
{
doLaunchAppWithOptions(desktopFile, timestamp, files, QMap<QString, QString>());
@ -183,11 +178,6 @@ void StartManager::runCommandWithOptions(QString exe, QStringList args, QMap<QSt
doRunCommandWithOptions(exe, args, options);
}
void StartManager::tryAgain(bool launch)
{
}
void StartManager::onAutoStartupPathChange(const QString &dirPath)
{
QStringList autostartFilesList = getAutostartList();
@ -282,6 +272,19 @@ bool StartManager::setAutostart(QString fileName, bool value)
return true;
}
bool StartManager::doLaunchAppWithOptions(const QString &desktopFile)
{
DesktopInfo info(desktopFile.toStdString());
if (!info.isValidDesktop())
return false;
launch(&info, info.getCommandLine().c_str(), 0, QStringList());
dbusHandler->markLaunched(desktopFile);
return true;
}
bool StartManager::doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options)
{
// launchApp
@ -359,9 +362,23 @@ bool StartManager::launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp
QString exec = exeArgs[0];
exeArgs.removeAt(0);
#ifdef QT_DEBUG
qDebug() << "launchApp: " << desktopFile << " exec: " << exec << " args: " << exeArgs;
#endif
process.setWorkingDirectory(workingDir.c_str());
process.setEnvironment(envs);
if (desktopFile.contains("/persistent/linglong")) {
exeArgs.clear();
#ifdef QT_DEBUG
qDebug() << "exeArgs:" << cmdLine.section(" ", 1, 2);
#endif
exeArgs.append(cmdLine.section(" ", 1, 2).split(" "));
}
return process.startDetached(exec, exeArgs);
}