From 561b86413e97c72364d309332687b428dfae7ed7 Mon Sep 17 00:00:00 2001 From: seolheui kim Date: Thu, 5 Jul 2018 17:39:54 +0900 Subject: [PATCH] Remove LaunchPad and AppBundle - 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 --- ode-key-storage-plugin/CMakeLists.txt | 4 ++ packaging/ode.spec | 4 +- server/CMakeLists.txt | 5 +- server/app-bundle.cpp | 51 -------------------- server/app-bundle.h | 55 ---------------------- server/external-encryption.cpp | 19 ++++---- server/launchpad.cpp | 67 --------------------------- server/launchpad.h | 40 ---------------- 8 files changed, 17 insertions(+), 228 deletions(-) delete mode 100644 server/app-bundle.cpp delete mode 100644 server/app-bundle.h delete mode 100644 server/launchpad.cpp delete mode 100644 server/launchpad.h diff --git a/ode-key-storage-plugin/CMakeLists.txt b/ode-key-storage-plugin/CMakeLists.txt index 297ff17..60a3f15 100755 --- a/ode-key-storage-plugin/CMakeLists.txt +++ b/ode-key-storage-plugin/CMakeLists.txt @@ -16,6 +16,10 @@ 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) diff --git a/packaging/ode.spec b/packaging/ode.spec index 8f05da7..db0d397 100755 --- a/packaging/ode.spec +++ b/packaging/ode.spec @@ -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 diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 9811434..78c105b 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -15,10 +15,8 @@ # 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 index e4e9ea9..0000000 --- a/server/app-bundle.cpp +++ /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 - -#include - -#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& array) -{ - std::unique_ptr 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 index 09fb8c8..0000000 --- a/server/app-bundle.h +++ /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 -#include - -#include - -class AppBundle { -public: - AppBundle(); - ~AppBundle(); - - template - void add(const std::string& key, const std::vector& value) - { - addArrayInternal(key, value); - } - - template - 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& array); - -private: - bundle* handle; -}; - -#endif //__DPM_APP_BUNDLE_H__ diff --git a/server/external-encryption.cpp b/server/external-encryption.cpp index 09af99f..e2e230e 100644 --- a/server/external-encryption.cpp +++ b/server/external-encryption.cpp @@ -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 index a41ea29..0000000 --- a/server/launchpad.cpp +++ /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 -#include -#include - -#include -#include - -#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 index 3726ee3..0000000 --- a/server/launchpad.h +++ /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 - -#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__ -- 2.34.1