Change-Id: I00b9bfd80648cb1463255d1fba38aa3f58a95939
Signed-off-by: Jaemin Ryu <jm77.ryu@samsung.com>
#include <sys/types.h>
#include <unistd.h>
+#include <signal.h>
+
#include <aul.h>
#include "launchpad.h"
}
}
+bool Launchpad::instantiated(const std::string& appid)
+{
+ return ::aul_app_is_running_for_uid(appid.c_str(), user);
+}
+
int Launchpad::launch(const std::string& appid)
{
return launch(appid, Bundle());
return 0;
}
+
+void Launchpad::terminate(const std::string& appid)
+{
+ int pid = ::aul_app_get_pid_for_uid(appid.c_str(), user);
+ if (pid > 0) {
+ if (::aul_terminate_pid_for_uid(pid, user) < 0) {
+ WARN("Failed to terminate app PID=" + std::to_string(pid));
+ ::kill(pid, SIGKILL);
+ }
+ }
+}
int launch(const std::string& appid);
int launch(const std::string& appid, const Bundle& bundle);
+ bool instantiated(const std::string& appid);
+ void terminate(const std::string& appid);
private:
uid_t user;