Remove LaunchPad and AppBundle 28/183428/2
authorseolheui kim <s414.kim@samsung.com>
Thu, 5 Jul 2018 08:39:54 +0000 (17:39 +0900)
committerseolheui kim <s414.kim@samsung.com>
Thu, 5 Jul 2018 09:52:02 +0000 (18:52 +0900)
- Remove launchpad and app-bundle to remove dependence on aul and bundle.
- Using launchpad is replaced with using ode-password service.
- ode-key-storage-plugin : need to dependency of capi-base-common by this change.

Change-Id: I5fe07b951738ab72deec80b271f7714929269a24
Signed-off-by: seolheui kim <s414.kim@samsung.com>
ode-key-storage-plugin/CMakeLists.txt
packaging/ode.spec
server/CMakeLists.txt
server/app-bundle.cpp [deleted file]
server/app-bundle.h [deleted file]
server/external-encryption.cpp
server/launchpad.cpp [deleted file]
server/launchpad.h [deleted file]

index 297ff17..60a3f15 100755 (executable)
 
 SET(PC_FILE "${PROJECT_NAME}-key-storage-plugin.pc")
 
+SET(DEPENDENCY capi-base-common)
+PKG_CHECK_MODULES(PC_DEPS REQUIRED ${DEPENDENCY})
+INCLUDE_DIRECTORIES(SYSTEM ${PC_DEPS_INCLUDE_DIRS})
+
 CONFIGURE_FILE(${PC_FILE}.in ${CMAKE_BINARY_DIR}/${PC_FILE} @ONLY)
 
 INSTALL(FILES ${CMAKE_BINARY_DIR}/${PC_FILE} DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
index 8f05da7..db0d397 100755 (executable)
@@ -11,9 +11,8 @@ BuildRequires: gcc
 BuildRequires: cmake
 BuildRequires: gettext-tools
 BuildRequires: pkgconfig(klay)
+BuildRequires: pkgconfig(vconf)
 BuildRequires: pkgconfig(glib-2.0)
-BuildRequires: pkgconfig(aul)
-BuildRequires: pkgconfig(bundle)
 BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(libcrypto)
@@ -131,6 +130,7 @@ developing device encryption client program.
 %package ksp-devel
 Summary: Header files for key storage plugin development
 Group: Development/Libraries
+BuildRequires: pkgconfig(capi-base-common)
 
 %description ksp-devel
 The ode-ksp-devel package includes header files necessary for key storage
index 9811434..78c105b 100644 (file)
 #
 SET(SERVER_SRCS        main.cpp
                                server.cpp
-                               launchpad.cpp
                                misc.cpp
                                ext4-tool.cpp
-                               app-bundle.cpp
                                file-footer.cpp
                                secure-erase.cpp
                                progress-bar.cpp
@@ -42,10 +40,9 @@ SET(SERVER_SRCS      main.cpp
 )
 
 SET(DEPENDENCY klay
+                               vconf
                                glib-2.0
                                gio-2.0
-                               aul
-                               bundle
                                libtzplatform-config
                                cynara-client
                                libcrypto
diff --git a/server/app-bundle.cpp b/server/app-bundle.cpp
deleted file mode 100644 (file)
index e4e9ea9..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *  Copyright (c) 2015 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 <memory>
-
-#include <klay/exception.h>
-
-#include "app-bundle.h"
-
-AppBundle::AppBundle() :
-       handle(nullptr)
-{
-       handle = ::bundle_create();
-       if (handle == nullptr) {
-               throw runtime::Exception("Failed to create bundle");
-       }
-}
-
-AppBundle::~AppBundle()
-{
-       ::bundle_free(handle);
-}
-
-void AppBundle::addInternal(const std::string& key, const std::string& value)
-{
-       ::bundle_add_str(handle, key.c_str(), value.c_str());
-}
-
-void AppBundle::addArrayInternal(const std::string& key, const std::vector<std::string>& array)
-{
-       std::unique_ptr<const char*[]> arrayptr(new const char*[array.size()]);
-
-       int index = 0;
-       for (const std::string& data : array) {
-               arrayptr.get()[index++] = data.c_str();
-       }
-
-       ::bundle_add_str_array(handle, key.c_str(), arrayptr.get(), array.size());
-}
diff --git a/server/app-bundle.h b/server/app-bundle.h
deleted file mode 100644 (file)
index 09fb8c8..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __DPM_APP_BUNDLE_H__
-#define __DPM_APP_BUNDLE_H__
-
-#include <string>
-#include <vector>
-
-#include <bundle.h>
-
-class AppBundle {
-public:
-       AppBundle();
-       ~AppBundle();
-
-       template<typename T>
-       void add(const std::string& key, const std::vector<T>& value)
-       {
-               addArrayInternal(key, value);
-       }
-
-       template<typename T>
-       void add(const std::string& key, const T& value)
-       {
-               addInternal(key, value);
-       }
-
-       bundle* get() const
-       {
-               return handle;
-       }
-
-private:
-       void addInternal(const std::string& key, const std::string& value);
-       void addArrayInternal(const std::string& key, const std::vector<std::string>& array);
-
-private:
-       bundle* handle;
-};
-
-#endif //__DPM_APP_BUNDLE_H__
index 09af99f..e2e230e 100644 (file)
@@ -28,8 +28,6 @@
 
 #include "misc.h"
 #include "logger.h"
-#include "launchpad.h"
-#include "app-bundle.h"
 #include "progress-bar.h"
 #include "rmi/common.h"
 #include "file-footer.h"
@@ -50,11 +48,14 @@ void spawnUI()
 {
        INFO(SINK, "Launching SD card password popup.");
        try {
-               AppBundle bundle;
-               bundle.add("viewtype", "SD_CARD_PASSWORD");
-
-               Launchpad launchpad(::tzplatform_getuid(TZ_SYS_DEFAULT_USER));
-               launchpad.launch("org.tizen.ode", bundle);
+               dbus::Connection &systemDBus = dbus::Connection::getSystem();
+               std::string unit("ode-password@external.service");
+
+               systemDBus.methodcall("org.freedesktop.systemd1",
+                                                               "/org/freedesktop/systemd1",
+                                                               "org.freedesktop.systemd1.Manager",
+                                                               "StartUnit",
+                                                               -1, "", "(ss)", unit.c_str(), "replace");
        } catch (runtime::Exception &e) {
                ERROR(SINK, "Failed to launch SD card password popup: " + std::string(e.what()));
        }
@@ -135,8 +136,8 @@ void externalAddEventReceiver()
                                                                externalCallback);
 
        systemDBus.subscribeSignal("",
-                                                               "/Org/Tizen/System/Pass/Core",
-                                                               "org.tizen.system.pass.core",
+                                                               "/Org/Tizen/System/DeviceD/Core",
+                                                               "org.tizen.system.deviced.core",
                                                                "BootingDone",
                                                                bootCompletionCallback);
 }
diff --git a/server/launchpad.cpp b/server/launchpad.cpp
deleted file mode 100644 (file)
index a41ea29..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  Copyright (c) 2015 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 <unistd.h>
-#include <signal.h>
-#include <sys/types.h>
-
-#include <aul.h>
-#include <klay/exception.h>
-
-#include "logger.h"
-#include "launchpad.h"
-
-Launchpad::Launchpad(const uid_t uid) :
-       user(uid)
-{
-       if (user == 0) {
-               throw runtime::Exception("No logined user for launching app");
-       }
-}
-
-bool Launchpad::isRunning(const std::string& appid)
-{
-       return ::aul_app_is_running_for_uid(appid.c_str(), user);
-}
-
-void Launchpad::launch(const std::string& appid)
-{
-       launch(appid, AppBundle());
-}
-
-void Launchpad::launch(const std::string& appid, const AppBundle& bundle)
-{
-       if (::aul_launch_app_for_uid(appid.c_str(), bundle.get(), user) < 0) {
-               throw runtime::Exception("Failed to launch app " + appid);
-       }
-}
-
-void Launchpad::resume(const std::string& appid)
-{
-       if (::aul_resume_app_for_uid(appid.c_str(), user) < 0) {
-               throw runtime::Exception("Failed to resume app " + appid);
-       }
-}
-
-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(SINK, "Failed to terminate app PID=" + std::to_string(pid));
-                       ::kill(pid, SIGKILL);
-               }
-       }
-}
diff --git a/server/launchpad.h b/server/launchpad.h
deleted file mode 100644 (file)
index 3726ee3..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  Copyright (c) 2015 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
- */
-
-#ifndef __DPM_LAUNCHPAD_H__
-#define __DPM_LAUNCHPAD_H__
-
-#include <string>
-
-#include "app-bundle.h"
-
-class Launchpad {
-public:
-       Launchpad(const uid_t uid = 0);
-       Launchpad(const Launchpad&) = delete;
-       Launchpad(Launchpad&&) = delete;
-
-       void launch(const std::string& appid);
-       void launch(const std::string& appid, const AppBundle& bundle);
-       void resume(const std::string& appid);
-       bool isRunning(const std::string& appid);
-       void terminate(const std::string& appid);
-
-private:
-       uid_t user;
-};
-
-#endif //__DPM_LAUNCHPAD_H__