From a31d6f04986081bcc0393bf7938002a2d9759597 Mon Sep 17 00:00:00 2001 From: Oleksander Kostenko Date: Wed, 25 Jan 2017 17:18:44 +0200 Subject: [PATCH] TizenRefApp-7940 Implement task manager service (Model) Change-Id: I015cdd414fc522b37335577da7af2e4a3c784e54 Signed-off-by: Oleksander Kostenko --- inc/Config.h | 2 +- project_def.prop | 6 +- res/edje/main_layout.edc | 7 +- src/App/inc/App.h | 8 +- src/App/inc/MainController.h | 8 +- src/App/inc/MainLayout.h | 8 +- src/App/inc/Resource.h | 2 +- src/App/inc/TaskMngrService.h | 84 ++++++++++++ src/App/src/App.cpp | 2 +- src/App/src/MainController.cpp | 2 +- src/App/src/MainLayout.cpp | 5 +- src/App/src/TaskMngrService.cpp | 208 ++++++++++++++++++++++++++++++ src/Common/inc/AtspiAccessibleInterface.h | 8 +- src/Common/inc/BaseView.h | 8 +- src/Common/inc/Callback.h | 5 +- src/Common/inc/LangUtils.h | 11 +- src/Common/inc/Logger.h | 2 +- src/Common/inc/PathUtils.h | 8 +- src/Common/inc/View.h | 8 +- src/Common/inc/Window.h | 8 +- src/Common/src/Logger.cpp | 5 +- src/Common/src/PathUtils.cpp | 26 ++-- src/Common/src/View.cpp | 23 ++-- src/Common/src/Window.cpp | 2 +- src/main.cpp | 2 +- tizen-manifest.xml | 16 ++- 26 files changed, 367 insertions(+), 107 deletions(-) create mode 100644 src/App/inc/TaskMngrService.h create mode 100644 src/App/src/TaskMngrService.cpp diff --git a/inc/Config.h b/inc/Config.h index 050af59..943182d 100644 --- a/inc/Config.h +++ b/inc/Config.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/project_def.prop b/project_def.prop index b3b6fbd..d9386c8 100644 --- a/project_def.prop +++ b/project_def.prop @@ -9,7 +9,7 @@ type = app profile = wearable-3.0 # C/CPP Sources -USER_SRCS = src/App/src/App.cpp src/main.cpp src/Common/src/PathUtils.cpp src/Common/src/Window.cpp src/Common/src/Logger.cpp src/Common/src/View.cpp +USER_SRCS = src/App/src/App.cpp src/App/src/TaskMngrService.cpp src/main.cpp src/Common/src/PathUtils.cpp src/Common/src/Window.cpp src/Common/src/Logger.cpp src/App/src/MainController.cpp src/App/src/MainLayout.cpp src/Common/src/View.cpp # EDC Sources USER_EDCS = @@ -42,7 +42,7 @@ USER_CPP_INC_FILES = USER_INC_DIRS = $(USER_C_INC_DIRS) $(USER_CPP_INC_DIRS) # User Library Path -USER_LIB_DIRS = lib +USER_LIB_DIRS = # EDC Resource Path USER_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images @@ -52,7 +52,7 @@ USER_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts # EDC Flags USER_EXT_EDC_KEYS = EDC0 -USER_EXT_EDC0_EDCS = res/edje/taskmanager.edc +USER_EXT_EDC0_EDCS = res/edje/main_layout.edc USER_EXT_EDC0_EDCS_IMAGE_DIRS = ${OUTPUT_DIR} edje/images USER_EXT_EDC0_EDCS_SOUND_DIRS = ${OUTPUT_DIR} edje/sounds USER_EXT_EDC0_EDCS_FONT_DIRS = ${OUTPUT_DIR} edje/fonts diff --git a/res/edje/main_layout.edc b/res/edje/main_layout.edc index d65ef3f..3a48254 100644 --- a/res/edje/main_layout.edc +++ b/res/edje/main_layout.edc @@ -1,15 +1,14 @@ /* - * Task Manager - * Copyright (c) 2013 Samsung Electronics Co., Ltd. + * Copyright 2017 Samsung Electronics Co., Ltd * - * Licensed under the Flora License, Version 1.1 (the License); + * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://floralicense.org/license/ * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an AS IS BASIS, + * 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. diff --git a/src/App/inc/App.h b/src/App/inc/App.h index a2ef6df..8cdd57e 100644 --- a/src/App/inc/App.h +++ b/src/App/inc/App.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -20,14 +20,12 @@ #include #include -namespace TaskMngr -{ +namespace TaskMngr { class Window; class TaskMngrService; class MainController; - class App - { + class App { public: static App &getInst(); int start(int argc, char *argv[]); diff --git a/src/App/inc/MainController.h b/src/App/inc/MainController.h index d75b916..f64f91f 100644 --- a/src/App/inc/MainController.h +++ b/src/App/inc/MainController.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ #include "MainLayout.h" -namespace TaskMngr -{ +namespace TaskMngr { class MainController - : public MainLayout - { + : public MainLayout { public: MainController(Evas_Object *parent); virtual ~MainController(); diff --git a/src/App/inc/MainLayout.h b/src/App/inc/MainLayout.h index f7a5a28..91809a0 100644 --- a/src/App/inc/MainLayout.h +++ b/src/App/inc/MainLayout.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ #include "View.h" -namespace TaskMngr -{ +namespace TaskMngr { class MainLayout - : public View - { + : public View { public: MainLayout(Evas_Object *parent); virtual ~MainLayout(); diff --git a/src/App/inc/Resource.h b/src/App/inc/Resource.h index a617cc8..894848a 100644 --- a/src/App/inc/Resource.h +++ b/src/App/inc/Resource.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/App/inc/TaskMngrService.h b/src/App/inc/TaskMngrService.h new file mode 100644 index 0000000..971890a --- /dev/null +++ b/src/App/inc/TaskMngrService.h @@ -0,0 +1,84 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 TaskMngrService_h_ +#define TaskMngrService_h_ + +#include +#include +#include +#include + +namespace TaskMngr { + struct AppInfo { + std::string pkgid; + std::string appid; + std::string instanceId; + std::string name; + std::string icon; + std::string uri; + time_t launchTime; + }; + + class TaskMngrService { + public: + TaskMngrService(); + ~TaskMngrService(); + + /** + * @brief Shutdowns given currently running application. + * + * @param[in] appid The ID of the application + * @param[in] instance_id The instance ID of the application + * + * @return true or false on failure + */ + bool killApp(const std::string &appid, const std::string &instanceId = std::string()); + /** + * @brief Resumes the given application. + * + * @param[in] appid The ID of the application + * @param[in] uri The URI of the data + * + * @return true or false on failure + */ + bool launchApp(const std::string &appid, const std::string &uri = std::string()); + /** + * @brief Get or create list of launched applications + * + * @return list with information about launched applications + */ + std::vector getAppInfo(); + + private: + TaskMngrService(const TaskMngrService&) = delete; + TaskMngrService& operator=(TaskMngrService) = delete; + + void init(); + void finit(); + void filterCreate(); + void findAndAppendApp(); + bool appInfoCb(app_info_h app_info); + void fillAppInfoList(char **table, int &rows, int &cols); + + private: + rua_rec m_RuaRecord; + app_info_filter_h m_Filter; + std::vector m_AppInfo; + }; +} + +#endif /* TaskMngrService_h_ */ diff --git a/src/App/src/App.cpp b/src/App/src/App.cpp index 1e3bc9d..b92b630 100644 --- a/src/App/src/App.cpp +++ b/src/App/src/App.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/App/src/MainController.cpp b/src/App/src/MainController.cpp index 2a2ba4d..4d9d465 100644 --- a/src/App/src/MainController.cpp +++ b/src/App/src/MainController.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/App/src/MainLayout.cpp b/src/App/src/MainLayout.cpp index 1320bfb..ed63c31 100644 --- a/src/App/src/MainLayout.cpp +++ b/src/App/src/MainLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -51,8 +51,7 @@ void MainLayout::setIndex(Evas_Object *obj) void MainLayout::showNoContents(bool show) { - if (show && !m_pNoContent) - { + if (show && !m_pNoContent) { m_pNoContent = elm_layout_add(getEo()); elm_layout_theme_set(getEo(), "layout", "nocontents", "text"); setContent(m_pNoContent, "swl.bg"); diff --git a/src/App/src/TaskMngrService.cpp b/src/App/src/TaskMngrService.cpp new file mode 100644 index 0000000..78801a8 --- /dev/null +++ b/src/App/src/TaskMngrService.cpp @@ -0,0 +1,208 @@ +/* + * Copyright 2017 Samsung Electronics Co., Ltd + * + * Licensed under the Flora License, Version 1.1 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://floralicense.org/license/ + * + * 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 "TaskMngrService.h" +#include "Logger.h" +#include "Callback.h" + +#include +#include +#include +#include + +using namespace TaskMngr; + +TaskMngrService::TaskMngrService() + : m_RuaRecord() + , m_Filter() +{ + init(); +} + +TaskMngrService::~TaskMngrService() +{ + finit(); +} + +bool TaskMngrService::killApp(const std::string &appid, const std::string &instanceId) +{ + TRACE; + int ret = 0; + bool running = false; + app_context_h context = nullptr; + + if (instanceId.empty()) { + app_manager_is_running(appid.c_str(), &running); + if (running) { + app_manager_get_app_context(appid.c_str(), &context); + } else { + rua_delete_history_with_instance_id(appid.c_str(), nullptr); + return false; + } + } else { + app_manager_get_app_context_by_instance_id(appid.c_str(), instanceId.c_str(), &context); + } + + if (context) { + app_manager_terminate_app(context); + app_context_destroy(context); + } + + LOG("terminate app = ", appid); + ret = rua_delete_history_with_instance_id(appid.c_str(), instanceId.c_str()); + + return !ret; +} + +bool TaskMngrService::launchApp(const std::string &appid, const std::string &uri) +{ + TRACE; + int ret = 0; + app_control_h service = nullptr; + + app_control_create(&service); + if (!service) + return false; + + app_control_set_operation(service, APP_CONTROL_OPERATION_MAIN); + app_control_set_app_id(service, appid.c_str()); + + if (!uri.empty()) + app_control_set_uri(service, uri.c_str()); + + ret = app_control_send_launch_request(service, nullptr, nullptr); + app_control_destroy(service); + if (ret != APP_CONTROL_ERROR_NONE) { + LOG_ERROR("Failed to send launch request"); + return false; + } + + return true; +} + +std::vector TaskMngrService::getAppInfo() +{ + m_AppInfo.clear(); + + char **table = nullptr; + int rows = 0; + int cols = 0; + + if (rua_history_load_db(&table, &rows, &cols)) { + LOG_ERROR("rua_history_load_db failed!"); + } + + if (table) { + fillAppInfoList(table, rows, cols); + rua_history_unload_db(&table); + } + + return m_AppInfo; +} + +void TaskMngrService::init() +{ + if (rua_init()) { + LOG_ERROR("rua_init failed!"); + } + + filterCreate(); +} + +void TaskMngrService::finit() +{ + app_info_filter_destroy(m_Filter); + rua_fini(); +} + +void TaskMngrService::filterCreate() +{ + app_info_filter_create(&m_Filter); + app_info_filter_add_bool(m_Filter, PACKAGE_INFO_PROP_APP_TASKMANAGE, true); +} + +void TaskMngrService::findAndAppendApp() +{ + app_info_filter_add_string(m_Filter, PACKAGE_INFO_PROP_APP_ID, m_RuaRecord.pkg_name); + app_info_filter_foreach_appinfo(m_Filter, makeCbLast(&TaskMngrService::appInfoCb), this); +} + +bool TaskMngrService::appInfoCb(app_info_h appInfo) +{ + AppInfo item; + char *variable = nullptr; + int ret = 0; + + app_info_get_app_id(appInfo, &variable); + if (variable) { + item.appid = variable; + free(variable); + variable = nullptr; + } + + app_info_get_package(appInfo, &variable); + if (variable) { + item.pkgid = variable; + free(variable); + variable = nullptr; + } + + if (m_RuaRecord.uri) + item.uri = m_RuaRecord.uri; + + if (m_RuaRecord.instance_id) + item.instanceId = m_RuaRecord.instance_id; + + if (m_RuaRecord.instance_name) { + item.name = m_RuaRecord.instance_name; + } else { + app_info_get_label(appInfo, &variable); + if (variable) { + item.name = variable; + free(variable); + variable = nullptr; + } + } + + if (m_RuaRecord.icon) { + item.icon = m_RuaRecord.icon; + } else { + ret = app_info_get_icon(appInfo, &variable); + if (variable) { + item.icon = variable; + free(variable); + variable = nullptr; + } + } + item.launchTime = m_RuaRecord.launch_time; + + if (item.pkgid == "org.tizen.task-mgr" || item.pkgid == "org.tizen.taskmanager") { + LOG_ERROR("ignoring Recents app"); + return false; + } + + m_AppInfo.push_back(std::move(item)); + + return true; +} + +void TaskMngrService::fillAppInfoList(char **table, int &rows, int &cols) +{ + for (int row = 0; row < rows; ++row) { + rua_history_get_rec(&m_RuaRecord, table, rows, cols, row); + findAndAppendApp(); + } +} diff --git a/src/Common/inc/AtspiAccessibleInterface.h b/src/Common/inc/AtspiAccessibleInterface.h index 1be20ca..85aef1e 100644 --- a/src/Common/inc/AtspiAccessibleInterface.h +++ b/src/Common/inc/AtspiAccessibleInterface.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,11 @@ #include "Config.h" #include -namespace TaskMngr -{ +namespace TaskMngr { /** * @brief Wrapper for Elm_Interface_Atspi_Accessible interface (Screen reader) */ - class AtspiAccessibleInterface - { + class AtspiAccessibleInterface { public: AtspiAccessibleInterface(Elm_Interface_Atspi_Accessible *obj); void wrap(Elm_Interface_Atspi_Accessible *obj); diff --git a/src/Common/inc/BaseView.h b/src/Common/inc/BaseView.h index 9d4b20c..694015c 100644 --- a/src/Common/inc/BaseView.h +++ b/src/Common/inc/BaseView.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -21,13 +21,11 @@ #include "PathUtils.h" #include "AtspiAccessibleInterface.h" -namespace TaskMngr -{ +namespace TaskMngr { /** * @brief Basic interface for all visual objects used across the whole application. */ - class BaseView - { + class BaseView { public: BaseView(); virtual ~BaseView() {}; diff --git a/src/Common/inc/Callback.h b/src/Common/inc/Callback.h index faf09b0..9e3669b 100644 --- a/src/Common/inc/Callback.h +++ b/src/Common/inc/Callback.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,7 @@ template struct Callback; template -struct Callback -{ +struct Callback { using M = R(C::*)(A...); template diff --git a/src/Common/inc/LangUtils.h b/src/Common/inc/LangUtils.h index 950d04a..8523c4c 100644 --- a/src/Common/inc/LangUtils.h +++ b/src/Common/inc/LangUtils.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -25,11 +25,9 @@ #include #include -namespace TaskMngr -{ +namespace TaskMngr { // Translatable Text - struct TText - { + struct TText { explicit TText(const char *stringId, const char *domainName) : m_pDomain(domainName) , m_pMsg(stringId) @@ -55,8 +53,7 @@ namespace TaskMngr }; // dgettext - struct DText - { + struct DText { explicit DText(const char *stringId, const char *domainName) { m_pMsg = dgettext(domainName, stringId); diff --git a/src/Common/inc/Logger.h b/src/Common/inc/Logger.h index a833443..ab13ec2 100644 --- a/src/Common/inc/Logger.h +++ b/src/Common/inc/Logger.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/Common/inc/PathUtils.h b/src/Common/inc/PathUtils.h index 7ac905e..52f32fb 100644 --- a/src/Common/inc/PathUtils.h +++ b/src/Common/inc/PathUtils.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,8 @@ #include #include "Resource.h" -namespace TaskMngr -{ - namespace PathUtils - { +namespace TaskMngr { + namespace PathUtils { /** * @brief Gets the absolute path to file in the application resource directory. * @param[in] path to file in res. dir (without slash at begin/end) diff --git a/src/Common/inc/View.h b/src/Common/inc/View.h index 809038a..fa10784 100644 --- a/src/Common/inc/View.h +++ b/src/Common/inc/View.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -23,14 +23,12 @@ #include -namespace TaskMngr -{ +namespace TaskMngr { /** * @brief Wraps all basic Evas_Object operations and manages automatic self-removal by EVAS_CALLBACK_FREE and EVAS_CALLBACK_DEL events. */ class View - : public BaseView - { + : public BaseView { public: View(); diff --git a/src/Common/inc/Window.h b/src/Common/inc/Window.h index 8667ad8..dbe1c37 100644 --- a/src/Common/inc/Window.h +++ b/src/Common/inc/Window.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -19,11 +19,9 @@ #include "View.h" -namespace TaskMngr -{ +namespace TaskMngr { class Window - : public View - { + : public View { public: Window(); virtual ~Window(); diff --git a/src/Common/src/Logger.cpp b/src/Common/src/Logger.cpp index 4d0d316..5ee4c0a 100644 --- a/src/Common/src/Logger.cpp +++ b/src/Common/src/Logger.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,7 @@ #include "Logger.h" -namespace -{ +namespace { const std::string enterFraseFormat = "%s: %s(%d) -> [ENTER]"; const std::string leaveFraseFormat = "%s: %s -> [LEAVE]"; const log_priority defaultPriority = DLOG_DEBUG; diff --git a/src/Common/src/PathUtils.cpp b/src/Common/src/PathUtils.cpp index 03508ed..d819af4 100644 --- a/src/Common/src/PathUtils.cpp +++ b/src/Common/src/PathUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -28,11 +28,9 @@ std::string getResourcePath(const std::string &filePath) { std::string res; static std::string basePath; - if (basePath.empty()) - { + if (basePath.empty()) { char *path = app_get_resource_path(); - if (path) - { + if (path) { basePath = path; free(path); } @@ -48,11 +46,9 @@ std::string getDataPath(const std::string &filePath) { std::string res; static std::string basePath; - if (basePath.empty()) - { + if (basePath.empty()) { char *path = app_get_data_path(); - if (path) - { + if (path) { basePath = path; free(path); } @@ -68,8 +64,7 @@ std::string getResourcePath() { std::string res; char* resPath = app_get_resource_path(); - if (resPath) - { + if (resPath) { res = resPath; free(resPath); } @@ -80,8 +75,7 @@ std::string getResourcePath() std::string getLocalePath() { std::string resPath(getResourcePath()); - if (!resPath.empty()) - { + if (!resPath.empty()) { resPath.append("locale"); } @@ -90,8 +84,7 @@ std::string getLocalePath() static bool storageCb(int storageId, storage_type_e type, storage_state_e state, const char *path, void *userData) { - if (type == STORAGE_TYPE_INTERNAL) - { + if (type == STORAGE_TYPE_INTERNAL) { int *internalStorage = (int *)userData; *internalStorage = storageId; return false; @@ -113,8 +106,7 @@ const std::string &getDownloadPath() if (error == STORAGE_ERROR_NONE) storage_get_directory(storageId, STORAGE_DIRECTORY_DOWNLOADS, &dirPath); - if (dirPath) - { + if (dirPath) { downloadPath = dirPath; free(dirPath); } diff --git a/src/Common/src/View.cpp b/src/Common/src/View.cpp index f6b5c18..c94b711 100644 --- a/src/Common/src/View.cpp +++ b/src/Common/src/View.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,7 @@ using namespace TaskMngr; -namespace -{ +namespace { const char *thisKey = "this"; } @@ -52,8 +51,7 @@ Evas_Object_Event_Cb View::getCb(Evas_Callback_Type type) void View::setEventCb(Evas_Callback_Type type) { Evas_Object_Event_Cb cb = getCb(type); - if (cb) - { + if (cb) { evas_object_event_callback_add(m_pEo, type, cb, this); } else { LOG_ERROR("Not implemented"); @@ -63,16 +61,14 @@ void View::setEventCb(Evas_Callback_Type type) void View::setEo(Evas_Object *eo) { - if (m_pEo) - { + if (m_pEo) { LOG_ERROR("m_pEo not null"); assert(false); } BaseView::setEo(eo); - if (eo) - { + if (eo) { setData(this); setEventCb(EVAS_CALLBACK_FREE); setEventCb(EVAS_CALLBACK_DEL); @@ -82,8 +78,7 @@ void View::setEo(Evas_Object *eo) void View::unsetEventCb(Evas_Callback_Type type) { Evas_Object_Event_Cb cb = getCb(type); - if (cb) - { + if (cb) { evas_object_event_callback_del(m_pEo, type, cb); } else { LOG_ERROR("Not implemented"); @@ -161,8 +156,7 @@ std::string TaskMngr::markupToUtf8(const char *str) std::string res; char *markup = elm_entry_markup_to_utf8(str); - if (markup) - { + if (markup) { res = markup; free(markup); } @@ -177,8 +171,7 @@ std::string TaskMngr::utf8ToMarkup(const char *str) std::string res; char *markup = elm_entry_utf8_to_markup(str); - if (markup) - { + if (markup) { res = markup; free(markup); } diff --git a/src/Common/src/Window.cpp b/src/Common/src/Window.cpp index b13c92a..42be144 100644 --- a/src/Common/src/Window.cpp +++ b/src/Common/src/Window.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/src/main.cpp b/src/main.cpp index da2c9b2..ab5e33f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2016 Samsung Electronics Co., Ltd + * Copyright 2017 Samsung Electronics Co., Ltd * * Licensed under the Flora License, Version 1.1 (the "License"); * you may not use this file except in compliance with the License. diff --git a/tizen-manifest.xml b/tizen-manifest.xml index 7524f00..5a66445 100644 --- a/tizen-manifest.xml +++ b/tizen-manifest.xml @@ -1,8 +1,14 @@ - - - taskmanager.png - - + + + taskmanager.png + + + + http://tizen.org/privilege/packagemanager.clearcache + http://tizen.org/privilege/appmanager.kill.bgapp + http://tizen.org/privilege/appmanager.launch + http://tizen.org/privilege/packagemanager.info + -- 2.7.4