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:
@ -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);
|
||||
}
|
||||
|
||||
|
@ -41,16 +41,14 @@ public:
|
||||
bool addAutostart(QString fileName);
|
||||
bool removeAutostart(QString fileName);
|
||||
QStringList autostartList();
|
||||
QString dumpMemRecord();
|
||||
QString getApps();
|
||||
bool isAutostart(QString fileName);
|
||||
bool isMemSufficient();
|
||||
void launchApp(const QString &desktopFile);
|
||||
void launchApp(QString desktopFile, uint32_t timestamp, QStringList files);
|
||||
void launchAppAction(QString desktopFile, QString actionSection, uint32_t timestamp);
|
||||
void launchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
|
||||
void runCommand(QString exe, QStringList args);
|
||||
void runCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
||||
void tryAgain(bool launch);
|
||||
|
||||
Q_SIGNALS:
|
||||
void autostartChanged(QString status, QString fileName);
|
||||
@ -60,6 +58,7 @@ public Q_SLOTS:
|
||||
|
||||
private:
|
||||
bool setAutostart(QString fileName, bool value);
|
||||
bool doLaunchAppWithOptions(const QString &desktopFile);
|
||||
bool doLaunchAppWithOptions(QString desktopFile, uint32_t timestamp, QStringList files, QMap<QString, QString> options);
|
||||
bool launch(DesktopInfo *info, QString cmdLine, uint32_t timestamp, QStringList files);
|
||||
bool doRunCommandWithOptions(QString exe, QStringList args, QMap<QString, QString> options);
|
||||
|
Reference in New Issue
Block a user