rename appfw to app
authorYoungjae Shin <yj99.shin@samsung.com>
Fri, 23 Aug 2019 02:03:19 +0000 (11:03 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Thu, 19 Mar 2020 04:30:19 +0000 (13:30 +0900)
23 files changed:
CMakeLists.txt
app/AppAction.cpp [new file with mode: 0644]
app/AppAction.h [new file with mode: 0644]
app/AppActionLaunch.cpp [new file with mode: 0644]
app/AppActionLaunch.h [new file with mode: 0644]
app/AppFactory.cpp [new file with mode: 0644]
app/AppFactory.h [new file with mode: 0644]
app/AppPlugin.cpp [new file with mode: 0644]
app/CMakeLists.txt [new file with mode: 0644]
app/tizen_app_rule.xml [new file with mode: 0644]
appfw/AppfwAction.cpp [deleted file]
appfw/AppfwAction.h [deleted file]
appfw/AppfwActionLaunch.cpp [deleted file]
appfw/AppfwActionLaunch.h [deleted file]
appfw/AppfwFactory.cpp [deleted file]
appfw/AppfwFactory.h [deleted file]
appfw/AppfwPlugin.cpp [deleted file]
appfw/CMakeLists.txt [deleted file]
appfw/tizen_appfw_rule.xml [deleted file]
packaging/modes-plugins.spec
unittests/CMakeLists.txt
unittests/mdsp_test_app.cpp [new file with mode: 0644]
unittests/mdsp_test_appfw.cpp [deleted file]

index 5775cfb4dab62edf0973e7356cf47e9e421d36cd..26a3fb621b8dc82f9d0a34b6124a07b65117bcc5 100644 (file)
@@ -17,6 +17,6 @@ ENDIF(NOT DEFINED MODES_PLUGIN_DEFAULT_DIR)
 
 ADD_SUBDIRECTORY(wifi)
 ADD_SUBDIRECTORY(vconf)
-ADD_SUBDIRECTORY(appfw)
+ADD_SUBDIRECTORY(app)
 ADD_SUBDIRECTORY(bluetooth)
 ADD_SUBDIRECTORY(unittests)
diff --git a/app/AppAction.cpp b/app/AppAction.cpp
new file mode 100644 (file)
index 0000000..5d56958
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "AppAction.h"
+#include <modes_errors.h>
+
+MODES_NAMESPACE_USE;
+
+AppAction::AppAction()
+{
+}
+
+AppAction::~AppAction()
+{
+}
+
+int AppAction::set(const std::string &val)
+{
+       return MODES_ERROR_NOT_SUPPORTED;
+}
+
+int AppAction::undo(const std::string &val)
+{
+       return MODES_ERROR_NOT_SUPPORTED;
+}
+
+int AppAction::get(std::string *val)
+{
+       return MODES_ERROR_NOT_SUPPORTED;
+}
+
+void AppAction::setName(std::string name)
+{
+       this->name = name;
+}
+
+std::string AppAction::getName()
+{
+       return name;
+}
diff --git a/app/AppAction.h b/app/AppAction.h
new file mode 100644 (file)
index 0000000..7e53fb8
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <string>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_BEGIN
+
+class AppAction {
+public:
+       AppAction();
+       virtual ~AppAction();
+
+       std::string getName();
+       virtual int set(const std::string &val);
+       virtual int get(std::string *val);
+       virtual int undo(const std::string &val);
+
+protected:
+       void setName(std::string name);
+
+private:
+       std::string name;
+};
+
+MODES_NAMESPACE_END
+
diff --git a/app/AppActionLaunch.cpp b/app/AppActionLaunch.cpp
new file mode 100644 (file)
index 0000000..0c171f3
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "AppActionLaunch.h"
+
+#include <algorithm>
+#include <app_control.h>
+#include <app_manager.h>
+#include <app_manager_extension.h>
+#include <modes_errors.h>
+#include "plugin-log.h"
+
+MODES_NAMESPACE_USE;
+
+const std::string AppActionLaunch::NAME = "launch";
+std::list<std::string> AppActionLaunch::appidList;
+void AppActionLaunch::appContextStatusCallback(app_context_h app_context, app_context_status_e status, void *user_data)
+{
+       char *appid = NULL;
+       DBG("appContextStatusCallback(status:%d)", status);
+       if (app_context_get_app_id(app_context, &appid) != APP_MANAGER_ERROR_NONE) {
+               ERR("Failed to get appid\n");
+               return;
+       }
+
+       DBG("app_context_cb(appid:%s)", appid);
+       if (APP_CONTEXT_STATUS_TERMINATED == status) {
+               DBG("APP_CONTEXT_STATUS_TERMINATED appid : %s\n", appid);
+               appidList.remove(appid);
+       }
+
+       free(appid);
+       return;
+}
+
+AppActionLaunch::AppActionLaunch()
+{
+       setName(NAME);
+}
+
+int AppActionLaunch::set(const std::string &val)
+{
+       DBG("id(%s)", val.c_str());
+
+       auto found = std::find(appidList.begin(), appidList.end(), val);
+
+       if (found == appidList.end())
+       {
+               bool running;
+               app_manager_is_running(val.c_str(), &running);
+
+               if (running) {
+                       ERR("It's already running before started mode-supervisor daemon");
+                       return MODES_ERROR_CONFLICT;
+               }
+
+               app_control_h service;
+               app_control_create(&service);
+               app_control_set_app_id(service, val.c_str());
+               app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
+               app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_SINGLE);
+
+               int ret = app_control_send_launch_request(service, NULL, NULL);
+               if (APP_CONTROL_ERROR_NONE != ret) {
+                       ERR("app_control_send_launch_request() Fail(%s)", get_error_message(ret));
+                       return MODES_ERROR_IO_ERROR;
+               }
+               app_control_destroy(service);
+
+               appidList.push_back(val);
+
+               DBG("APP_CONTEXT_EVENT_LAUNCHED(appid : %s) added list\n", val.c_str());
+
+               ret = app_manager_set_app_context_status_cb(AppActionLaunch::appContextStatusCallback, val.c_str(), NULL);
+               if (APP_MANAGER_ERROR_NONE != ret) {
+                       ERR("app_manager_set_app_context_status_cb() Fail(%s)", get_error_message(ret));
+                       return MODES_ERROR_IO_ERROR;
+               }
+
+               appID = val;
+       }
+
+       return MODES_ERROR_NONE;
+}
+
+int AppActionLaunch::get(std::string *val)
+{
+       if(val)
+               *val = appID;
+       return MODES_ERROR_NONE;
+}
+
+int AppActionLaunch::undo(const std::string &val)
+{
+       bool running;
+       app_context_h runAppContext;
+
+       app_manager_is_running(val.c_str(), &running);
+       if (!running) {
+               DBG("It's NOT running");
+               return MODES_ERROR_NONE;
+       }
+
+       int ret = app_manager_unset_app_context_status_cb(AppActionLaunch::appContextStatusCallback, val.c_str());
+       if (APP_MANAGER_ERROR_NONE != ret) {
+               ERR("app_manager_unset_app_context_status_cb() Fail(%s)", get_error_message(ret));
+               return MODES_ERROR_IO_ERROR;
+       }
+
+       appidList.remove(val);
+
+       ret = app_manager_get_app_context(val.c_str(), &runAppContext);
+       if (APP_MANAGER_ERROR_NONE != ret) {
+               ERR("app_manager_get_app_context(%s) Fail(%s)", val.c_str(), get_error_message(ret));
+               return MODES_ERROR_IO_ERROR;
+       }
+       ret = app_manager_terminate_app(runAppContext);
+       if (APP_MANAGER_ERROR_NONE != ret) {
+               ERR("app_manager_terminate_app() Fail(%s)", get_error_message(ret));
+               return MODES_ERROR_IO_ERROR;
+       }
+       return MODES_ERROR_NONE;
+}
diff --git a/app/AppActionLaunch.h b/app/AppActionLaunch.h
new file mode 100644 (file)
index 0000000..40904e3
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <list>
+#include <string>
+#include <app_manager.h>
+#include <app_manager_extension.h>
+#include "AppAction.h"
+
+MODES_NAMESPACE_BEGIN
+
+class AppActionLaunch : public AppAction {
+public:
+       AppActionLaunch();
+
+       virtual int set(const std::string &val) override;
+       virtual int get(std::string *val) override;
+       virtual int undo(const std::string &val) override;
+
+       static const std::string NAME;
+       static void appContextStatusCallback(app_context_h app_context, app_context_status_e status, void *user_data);
+
+private:
+       std::string appID;
+       static std::list<std::string> appidList;
+};
+
+MODES_NAMESPACE_END
diff --git a/app/AppFactory.cpp b/app/AppFactory.cpp
new file mode 100644 (file)
index 0000000..8ea7c1e
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "AppFactory.h"
+#include "plugin-log.h"
+#include "AppActionLaunch.h"
+
+MODES_NAMESPACE_USE;
+
+AppFactory::AppFactory()
+{
+       actionMap[AppActionLaunch::NAME] = APP_ACT_LAUNCH;
+}
+
+AppAction* AppFactory::createAction(const std::string &key)
+{
+       auto search = actionMap.find(key);
+       if (search == actionMap.end()) {
+               ERR("No AppAction(%s)", key.c_str());
+               return nullptr;
+       }
+
+       switch (search->second) {
+       case APP_ACT_LAUNCH:
+               AppActionLaunch *appActionLaunch = new AppActionLaunch();
+               return appActionLaunch;
+               break;
+       }
+
+       return nullptr;
+}
+
+void AppFactory::destroyAction(AppAction *action)
+{
+       delete action;
+}
diff --git a/app/AppFactory.h b/app/AppFactory.h
new file mode 100644 (file)
index 0000000..a1b374d
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include <map>
+#include <string>
+#include "AppAction.h"
+
+MODES_NAMESPACE_BEGIN
+
+class AppFactory {
+public:
+       AppFactory();
+       ~AppFactory() = default;
+
+       AppAction* createAction(const std::string &key);
+       void destroyAction(AppAction *action);
+private:
+       enum actionKey{
+               APP_ACT_LAUNCH
+       };
+
+       std::map<std::string, enum actionKey> actionMap;
+};
+
+MODES_NAMESPACE_END
diff --git a/app/AppPlugin.cpp b/app/AppPlugin.cpp
new file mode 100644 (file)
index 0000000..8e9afb2
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <string>
+#include <modes_errors.h>
+#include <Plugin.h>
+#include "plugin-log.h"
+#include "AppFactory.h"
+
+MODES_NAMESPACE_USE;
+
+class AppPlugin : public Plugin {
+public:
+       AppPlugin();
+       ~AppPlugin();
+
+       int set(const std::string &key, const std::string &val, std::string *oldVal) override;
+       int undo(const std::string &key, const std::string &val) override;
+
+private:
+       AppFactory appFactory;
+};
+
+extern "C" API Plugin *objectCreate(void)
+{
+       return new AppPlugin;
+}
+
+extern "C" API void objectDelete(Plugin *plugin)
+{
+       delete plugin;
+}
+
+AppPlugin::AppPlugin()
+{
+       setName("app");
+}
+
+AppPlugin::~AppPlugin()
+{
+}
+
+int AppPlugin::set(const std::string &key, const std::string &val, std::string *oldVal)
+{
+       AppAction *action = appFactory.createAction(key);
+       RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
+
+       DBG("set [%s, %s]", key.c_str(), val.c_str());
+
+       int appRet = action->set(val);
+
+       if (oldVal)
+               action->get(oldVal);
+
+       appFactory.destroyAction(action);
+       return appRet;
+}
+
+int AppPlugin::undo(const std::string &key, const std::string &val)
+{
+       AppAction *action = appFactory.createAction(key);
+       RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
+
+       DBG("set [%s, %s]", key.c_str(), val.c_str());
+
+       int appRet = action->undo(val);
+       appFactory.destroyAction(action);
+       return appRet;
+}
diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d2632da
--- /dev/null
@@ -0,0 +1,13 @@
+SET(APP_PLUGIN "modes-plugin-app")
+
+FILE(GLOB APP_SRCS *.cpp)
+
+PKG_CHECK_MODULES(app_pkgs REQUIRED modes dlog capi-base-common capi-appfw-application capi-appfw-app-manager aul)
+INCLUDE_DIRECTORIES(${app_pkgs_INCLUDE_DIRS})
+LINK_DIRECTORIES(${app_pkgs_LIBRARY_DIRS})
+
+ADD_LIBRARY(${APP_PLUGIN} SHARED ${APP_SRCS})
+TARGET_LINK_LIBRARIES(${APP_PLUGIN} ${app_pkgs_LIBRARIES})
+SET_TARGET_PROPERTIES(${APP_PLUGIN} PROPERTIES NO_SONAME 1 )
+INSTALL(TARGETS ${APP_PLUGIN} DESTINATION ${MODES_PLUGIN_DEFAULT_DIR})
+INSTALL(FILES tizen_app_rule.xml DESTINATION ${MODES_ACTIONRULE_DEFAULT_DIR})
diff --git a/app/tizen_app_rule.xml b/app/tizen_app_rule.xml
new file mode 100644 (file)
index 0000000..e3a0d04
--- /dev/null
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<tizenModes xmlns="http://www.tizen.org" version="5.5">
+  <actionRule>
+    <rule name="app.launch" type="string" since="5.5" plugin="app">
+      <desc>Launch App</desc>
+      <domain>App Framework</domain>
+    </rule>
+  </actionRule>
+</tizenModes>
diff --git a/appfw/AppfwAction.cpp b/appfw/AppfwAction.cpp
deleted file mode 100644 (file)
index 32736be..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AppfwAction.h"
-#include <modes_errors.h>
-
-MODES_NAMESPACE_USE;
-
-AppfwAction::AppfwAction()
-{
-}
-
-AppfwAction::~AppfwAction()
-{
-}
-
-int AppfwAction::set(const std::string &val)
-{
-       return MODES_ERROR_NOT_SUPPORTED;
-}
-
-int AppfwAction::undo(const std::string &val)
-{
-       return MODES_ERROR_NOT_SUPPORTED;
-}
-
-int AppfwAction::get(std::string *val)
-{
-       return MODES_ERROR_NOT_SUPPORTED;
-}
-
-void AppfwAction::setName(std::string name)
-{
-       this->name = name;
-}
-
-std::string AppfwAction::getName()
-{
-       return name;
-}
diff --git a/appfw/AppfwAction.h b/appfw/AppfwAction.h
deleted file mode 100644 (file)
index c5f40ae..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <string>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_BEGIN
-
-class AppfwAction {
-public:
-       AppfwAction();
-       virtual ~AppfwAction();
-
-       std::string getName();
-       virtual int set(const std::string &val);
-       virtual int get(std::string *val);
-       virtual int undo(const std::string &val);
-
-protected:
-       void setName(std::string name);
-
-private:
-       std::string name;
-};
-
-MODES_NAMESPACE_END
-
diff --git a/appfw/AppfwActionLaunch.cpp b/appfw/AppfwActionLaunch.cpp
deleted file mode 100644 (file)
index 515a93f..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AppfwActionLaunch.h"
-
-#include <algorithm>
-#include <app_control.h>
-#include <app_manager.h>
-#include <app_manager_extension.h>
-#include <modes_errors.h>
-#include "plugin-log.h"
-
-MODES_NAMESPACE_USE;
-
-const std::string AppfwActionLaunch::NAME = "launch";
-std::list<std::string> AppfwActionLaunch::appidList;
-void AppfwActionLaunch::appContextStatusCallback(app_context_h app_context, app_context_status_e status, void *user_data)
-{
-       char *appid = NULL;
-       DBG("appContextStatusCallback(status:%d)", status);
-       if (app_context_get_app_id(app_context, &appid) != APP_MANAGER_ERROR_NONE) {
-               ERR("Failed to get appid\n");
-               return;
-       }
-
-       DBG("app_context_cb(appid:%s)", appid);
-       if (APP_CONTEXT_STATUS_TERMINATED == status) {
-               DBG("APP_CONTEXT_STATUS_TERMINATED appid : %s\n", appid);
-               appidList.remove(appid);
-       }
-
-       free(appid);
-       return;
-}
-
-AppfwActionLaunch::AppfwActionLaunch()
-{
-       setName(NAME);
-}
-
-int AppfwActionLaunch::set(const std::string &val)
-{
-       DBG("id(%s)", val.c_str());
-
-       auto found = std::find(appidList.begin(), appidList.end(), val);
-
-       if (found == appidList.end())
-       {
-               bool running;
-               app_manager_is_running(val.c_str(), &running);
-
-               if (running) {
-                       ERR("It's already running before started mode-supervisor daemon");
-                       return MODES_ERROR_CONFLICT;
-               }
-
-               app_control_h service;
-               app_control_create(&service);
-               app_control_set_app_id(service, val.c_str());
-               app_control_set_operation(service, APP_CONTROL_OPERATION_DEFAULT);
-               app_control_set_launch_mode(service, APP_CONTROL_LAUNCH_MODE_SINGLE);
-
-               int ret = app_control_send_launch_request(service, NULL, NULL);
-               if (APP_CONTROL_ERROR_NONE != ret) {
-                       ERR("app_control_send_launch_request() Fail(%s)", get_error_message(ret));
-                       return MODES_ERROR_IO_ERROR;
-               }
-               app_control_destroy(service);
-
-               appidList.push_back(val);
-
-               DBG("APP_CONTEXT_EVENT_LAUNCHED(appid : %s) added list\n", val.c_str());
-
-               ret = app_manager_set_app_context_status_cb(AppfwActionLaunch::appContextStatusCallback, val.c_str(), NULL);
-               if (APP_MANAGER_ERROR_NONE != ret) {
-                       ERR("app_manager_set_app_context_status_cb() Fail(%s)", get_error_message(ret));
-                       return MODES_ERROR_IO_ERROR;
-               }
-
-               appID = val;
-       }
-
-       return MODES_ERROR_NONE;
-}
-
-int AppfwActionLaunch::get(std::string *val)
-{
-       if(val)
-               *val = appID;
-       return MODES_ERROR_NONE;
-}
-
-int AppfwActionLaunch::undo(const std::string &val)
-{
-       bool running;
-       app_context_h runAppContext;
-
-       app_manager_is_running(val.c_str(), &running);
-       if (!running) {
-               DBG("It's NOT running");
-               return MODES_ERROR_NONE;
-       }
-
-       int ret = app_manager_unset_app_context_status_cb(AppfwActionLaunch::appContextStatusCallback, val.c_str());
-       if (APP_MANAGER_ERROR_NONE != ret) {
-               ERR("app_manager_unset_app_context_status_cb() Fail(%s)", get_error_message(ret));
-               return MODES_ERROR_IO_ERROR;
-       }
-
-       appidList.remove(val);
-
-       ret = app_manager_get_app_context(val.c_str(), &runAppContext);
-       if (APP_MANAGER_ERROR_NONE != ret) {
-               ERR("app_manager_get_app_context(%s) Fail(%s)", val.c_str(), get_error_message(ret));
-               return MODES_ERROR_IO_ERROR;
-       }
-       ret = app_manager_terminate_app(runAppContext);
-       if (APP_MANAGER_ERROR_NONE != ret) {
-               ERR("app_manager_terminate_app() Fail(%s)", get_error_message(ret));
-               return MODES_ERROR_IO_ERROR;
-       }
-       return MODES_ERROR_NONE;
-}
diff --git a/appfw/AppfwActionLaunch.h b/appfw/AppfwActionLaunch.h
deleted file mode 100644 (file)
index d9f6f8f..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <list>
-#include <string>
-#include <app_manager.h>
-#include <app_manager_extension.h>
-#include "AppfwAction.h"
-
-MODES_NAMESPACE_BEGIN
-
-class AppfwActionLaunch : public AppfwAction {
-public:
-       AppfwActionLaunch();
-
-       virtual int set(const std::string &val) override;
-       virtual int get(std::string *val) override;
-       virtual int undo(const std::string &val) override;
-
-       static const std::string NAME;
-       static void appContextStatusCallback(app_context_h app_context, app_context_status_e status, void *user_data);
-
-private:
-       std::string appID;
-       static std::list<std::string> appidList;
-};
-
-MODES_NAMESPACE_END
diff --git a/appfw/AppfwFactory.cpp b/appfw/AppfwFactory.cpp
deleted file mode 100644 (file)
index 200d423..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "AppfwFactory.h"
-#include "plugin-log.h"
-#include "AppfwActionLaunch.h"
-
-MODES_NAMESPACE_USE;
-
-AppfwFactory::AppfwFactory()
-{
-       actionMap[AppfwActionLaunch::NAME] = APPFW_ACT_LAUNCH;
-}
-
-AppfwAction* AppfwFactory::createAction(const std::string &key)
-{
-       auto search = actionMap.find(key);
-       if (search == actionMap.end()) {
-               ERR("No AppfwAction(%s)", key.c_str());
-               return nullptr;
-       }
-
-       switch (search->second) {
-       case APPFW_ACT_LAUNCH:
-               AppfwActionLaunch *appfwActionLaunch = new AppfwActionLaunch();
-               return appfwActionLaunch;
-               break;
-       }
-
-       return nullptr;
-}
-
-void AppfwFactory::destroyAction(AppfwAction *action)
-{
-       delete action;
-}
diff --git a/appfw/AppfwFactory.h b/appfw/AppfwFactory.h
deleted file mode 100644 (file)
index 74db4b0..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#pragma once
-
-#include <map>
-#include <string>
-#include "AppfwAction.h"
-
-MODES_NAMESPACE_BEGIN
-
-class AppfwFactory {
-public:
-       AppfwFactory();
-       ~AppfwFactory() = default;
-
-       AppfwAction* createAction(const std::string &key);
-       void destroyAction(AppfwAction *action);
-private:
-       enum actionKey{
-               APPFW_ACT_LAUNCH
-       };
-
-       std::map<std::string, enum actionKey> actionMap;
-};
-
-MODES_NAMESPACE_END
diff --git a/appfw/AppfwPlugin.cpp b/appfw/AppfwPlugin.cpp
deleted file mode 100644 (file)
index 6327f68..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <string>
-#include <modes_errors.h>
-#include <Plugin.h>
-#include "plugin-log.h"
-#include "AppfwFactory.h"
-
-MODES_NAMESPACE_USE;
-
-class AppfwPlugin : public Plugin {
-public:
-       AppfwPlugin();
-       ~AppfwPlugin();
-
-       int set(const std::string &key, const std::string &val, std::string *oldVal) override;
-       int undo(const std::string &key, const std::string &val) override;
-
-private:
-       AppfwFactory appfwFactory;
-};
-
-extern "C" API Plugin *objectCreate(void)
-{
-       return new AppfwPlugin;
-}
-
-extern "C" API void objectDelete(Plugin *plugin)
-{
-       delete plugin;
-}
-
-AppfwPlugin::AppfwPlugin()
-{
-       setName("appfw");
-}
-
-AppfwPlugin::~AppfwPlugin()
-{
-}
-
-int AppfwPlugin::set(const std::string &key, const std::string &val, std::string *oldVal)
-{
-       AppfwAction *action = appfwFactory.createAction(key);
-       RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
-
-       DBG("set [%s, %s]", key.c_str(), val.c_str());
-
-       int appfwRet = action->set(val);
-
-       if (oldVal)
-               action->get(oldVal);
-
-       appfwFactory.destroyAction(action);
-       return appfwRet;
-}
-
-int AppfwPlugin::undo(const std::string &key, const std::string &val)
-{
-       AppfwAction *action = appfwFactory.createAction(key);
-       RETVM_IF(nullptr == action, MODES_ERROR_INVALID_PARAMETER, "action(%s) is null", key.c_str());
-
-       DBG("set [%s, %s]", key.c_str(), val.c_str());
-
-       int appfwRet = action->undo(val);
-       appfwFactory.destroyAction(action);
-       return appfwRet;
-}
diff --git a/appfw/CMakeLists.txt b/appfw/CMakeLists.txt
deleted file mode 100644 (file)
index 355a895..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-SET(APPFW_PLUGIN "modes-plugin-appfw")
-
-FILE(GLOB APPFW_SRCS *.cpp)
-
-pkg_check_modules(appfw_pkgs REQUIRED modes dlog capi-base-common capi-appfw-application capi-appfw-app-manager aul)
-INCLUDE_DIRECTORIES(${appfw_pkgs_INCLUDE_DIRS})
-LINK_DIRECTORIES(${appfw_pkgs_LIBRARY_DIRS})
-
-ADD_LIBRARY(${APPFW_PLUGIN} SHARED ${APPFW_SRCS})
-TARGET_LINK_LIBRARIES(${APPFW_PLUGIN} ${appfw_pkgs_LIBRARIES})
-SET_TARGET_PROPERTIES(${APPFW_PLUGIN} PROPERTIES NO_SONAME 1 )
-INSTALL(TARGETS ${APPFW_PLUGIN} DESTINATION ${MODES_PLUGIN_DEFAULT_DIR})
-INSTALL(FILES tizen_appfw_rule.xml DESTINATION ${MODES_ACTIONRULE_DEFAULT_DIR})
diff --git a/appfw/tizen_appfw_rule.xml b/appfw/tizen_appfw_rule.xml
deleted file mode 100644 (file)
index fdf2893..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<tizenModes xmlns="http://www.tizen.org" version="5.5">
-  <actionRule>
-    <rule name="appfw.launch" type="string" since="5.5" plugin="appfw">
-      <desc>Launch App</desc>
-      <domain>App Framework</domain>
-    </rule>
-  </actionRule>
-</tizenModes>
index 404fc5c49792a14b7664fff56687a5d5343bcadf..6b0f6bb73f6035c06db624c64c0724acad7c40a2 100644 (file)
@@ -71,7 +71,7 @@ xmllint --noout --schema %{modes_data_dir}/schema/tizen_action_rule.xsd %{buildr
 systemctl restart modes.service
 
 %post unittests
-%{modes_plugin_test_dir}/modes-gtest-appfw
+%{modes_plugin_test_dir}/modes-gtest-app
 %{modes_plugin_test_dir}/modes-gtest-vconf
 
 %postun -p /sbin/ldconfig
index 9e7a56b6332b68bf580392435b7d309317ec0a1d..4d3c274453f08a5594438267e038228274c7bb46 100644 (file)
@@ -22,14 +22,14 @@ ADD_EXECUTABLE(${BT_PLUGIN_TEST} ${BT_SRCS})
 TARGET_LINK_LIBRARIES(${BT_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
 INSTALL(TARGETS ${BT_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
 #===================================================================#
-SET(APPFW_SRC_DIR "${CMAKE_SOURCE_DIR}/appfw" )
-SET(APPFW_PLUGIN_TEST "modes-gtest-appfw")
-FILE(GLOB APPFW_SRCS ${APPFW_SRC_DIR}/*.cpp)
-SET(APPFW_SRCS ${APPFW_SRCS} "mdsp_test_appfw.cpp")
+SET(APP_SRC_DIR "${CMAKE_SOURCE_DIR}/app" )
+SET(APP_PLUGIN_TEST "modes-gtest-app")
+FILE(GLOB APP_SRCS ${APP_SRC_DIR}/*.cpp)
+SET(APP_SRCS ${APP_SRCS} "mdsp_test_app.cpp")
 
-ADD_EXECUTABLE(${APPFW_PLUGIN_TEST} ${APPFW_SRCS})
-TARGET_LINK_LIBRARIES(${APPFW_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
-INSTALL(TARGETS ${APPFW_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
+ADD_EXECUTABLE(${APP_PLUGIN_TEST} ${APP_SRCS})
+TARGET_LINK_LIBRARIES(${APP_PLUGIN_TEST} ${test_pkgs_LIBRARIES})
+INSTALL(TARGETS ${APP_PLUGIN_TEST} DESTINATION ${TEST_INSTALL_DIR})
 #===================================================================#
 SET(VCONF_SRC_DIR "${CMAKE_SOURCE_DIR}/vconf" )
 SET(VCONF_PLUGIN_TEST "modes-gtest-vconf")
diff --git a/unittests/mdsp_test_app.cpp b/unittests/mdsp_test_app.cpp
new file mode 100644 (file)
index 0000000..cb23059
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include <glib.h>
+#include <string>
+#include <gtest/gtest.h>
+#include <Plugin.h>
+#include <modes_errors.h>
+#include <app_manager.h>
+#include <app_manager_extension.h>
+#include "plugin-def.h"
+
+MODES_NAMESPACE_USE;
+
+extern "C" API Plugin *objectCreate(void);
+extern "C" API void objectDelete(Plugin *plugin);
+
+class PluginTest : public ::testing::Test {
+protected:
+       void SetUp() override
+       {
+               loop = g_main_loop_new(NULL, FALSE);
+       }
+
+       void TearDown() override
+       {
+               g_main_loop_unref(loop);
+               loop = NULL;
+       }
+
+       static gboolean appPluginUndoConflictIdler(gpointer data)
+       {
+               app_context_h runAppContext;
+               Plugin *plugin = objectCreate();
+               result = plugin->set("launch", std::string("org.tizen.w-stopwatch"), nullptr);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               app_manager_get_app_context("org.tizen.w-stopwatch", &runAppContext);
+               app_manager_terminate_app(runAppContext);
+               result = plugin->undo("launch", std::string("org.tizen.w-stopwatch"));
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               objectDelete(plugin);
+               g_main_loop_quit(loop);
+
+               return G_SOURCE_REMOVE;
+       }
+
+       static gboolean appPluginSetUndoTimeout(gpointer data)
+       {
+               Plugin *plugin = (Plugin *)data;
+               result = plugin->undo("launch", std::string("org.tizen.w-stopwatch"));
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+               g_main_loop_quit(loop);
+               return false;
+       }
+
+       static gboolean appPluginSetUndoIdler(gpointer data)
+       {
+               Plugin *plugin = (Plugin *)data;
+               result = plugin->set("launch", std::string("org.tizen.w-stopwatch"), nullptr);
+               EXPECT_EQ(MODES_ERROR_NONE, result);
+
+               g_timeout_add(1000, appPluginSetUndoTimeout, plugin);
+               return G_SOURCE_REMOVE;
+       }
+
+       static int result;
+       static GMainLoop *loop;
+       static GThread *my_thread;
+};
+
+int PluginTest::result = 0;
+GMainLoop *PluginTest::loop = NULL;
+
+TEST_F(PluginTest, setUndoPluginApp)
+{
+       Plugin *plugin = objectCreate();
+       g_idle_add(appPluginSetUndoIdler, plugin);
+       g_main_loop_run(loop);
+       objectDelete(plugin);
+}
+
+TEST_F(PluginTest, undoConflictPluginApp)
+{
+       g_idle_add(appPluginUndoConflictIdler, nullptr);
+       g_main_loop_run(loop);
+}
+
+
+int main(int argc, char **argv) {
+       testing::InitGoogleTest(&argc, argv);
+       return RUN_ALL_TESTS();
+}
diff --git a/unittests/mdsp_test_appfw.cpp b/unittests/mdsp_test_appfw.cpp
deleted file mode 100644 (file)
index ea1bbf5..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <glib.h>
-#include <string>
-#include <gtest/gtest.h>
-#include <Plugin.h>
-#include <modes_errors.h>
-#include <app_manager.h>
-#include <app_manager_extension.h>
-#include "plugin-def.h"
-
-MODES_NAMESPACE_USE;
-
-extern "C" API Plugin *objectCreate(void);
-extern "C" API void objectDelete(Plugin *plugin);
-
-class PluginTest : public ::testing::Test {
-protected:
-       void SetUp() override
-       {
-               loop = g_main_loop_new(NULL, FALSE);
-       }
-
-       void TearDown() override
-       {
-               g_main_loop_unref(loop);
-               loop = NULL;
-       }
-
-       static gboolean appfwPluginUndoConflictIdler(gpointer data)
-       {
-               app_context_h runAppContext;
-               Plugin *plugin = objectCreate();
-               result = plugin->set("launch", std::string("org.tizen.w-stopwatch"), nullptr);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               app_manager_get_app_context("org.tizen.w-stopwatch", &runAppContext);
-               app_manager_terminate_app(runAppContext);
-               result = plugin->undo("launch", std::string("org.tizen.w-stopwatch"));
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               objectDelete(plugin);
-               g_main_loop_quit(loop);
-
-               return G_SOURCE_REMOVE;
-       }
-
-       static gboolean appfwPluginSetUndoTimeout(gpointer data)
-       {
-               Plugin *plugin = (Plugin *)data;
-               result = plugin->undo("launch", std::string("org.tizen.w-stopwatch"));
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-               g_main_loop_quit(loop);
-               return false;
-       }
-
-       static gboolean appfwPluginSetUndoIdler(gpointer data)
-       {
-               Plugin *plugin = (Plugin *)data;
-               result = plugin->set("launch", std::string("org.tizen.w-stopwatch"), nullptr);
-               EXPECT_EQ(MODES_ERROR_NONE, result);
-
-               g_timeout_add(1000, appfwPluginSetUndoTimeout, plugin);
-               return G_SOURCE_REMOVE;
-       }
-
-       static int result;
-       static GMainLoop *loop;
-       static GThread *my_thread;
-};
-
-int PluginTest::result = 0;
-GMainLoop *PluginTest::loop = NULL;
-
-TEST_F(PluginTest, setUndoPluginAppfw)
-{
-       Plugin *plugin = objectCreate();
-       g_idle_add(appfwPluginSetUndoIdler, plugin);
-       g_main_loop_run(loop);
-       objectDelete(plugin);
-}
-
-TEST_F(PluginTest, undoConflictPluginAppfw)
-{
-       g_idle_add(appfwPluginUndoConflictIdler, nullptr);
-       g_main_loop_run(loop);
-}
-
-
-int main(int argc, char **argv) {
-       testing::InitGoogleTest(&argc, argv);
-       return RUN_ALL_TESTS();
-}