diff options
author | Yunjin Lee <yunjin-.lee@samsung.com> | 2017-07-20 23:00:40 +0900 |
---|---|---|
committer | Kim Kidong <kd0228.kim@samsung.com> | 2017-08-03 02:14:21 +0000 |
commit | 4665b3bb72f4a8511657fc55907460dc806ee7e3 (patch) | |
tree | 019755a62094ffec569305e9100a8fd1d9925e81 | |
parent | 0ecd04ff180e383716e5fc34e8cc26cc0b436323 (diff) | |
download | privacy-setting-4665b3bb72f4a8511657fc55907460dc806ee7e3.tar.gz privacy-setting-4665b3bb72f4a8511657fc55907460dc806ee7e3.tar.bz2 privacy-setting-4665b3bb72f4a8511657fc55907460dc806ee7e3.zip |
Terminate app when privacy of the app is offed
- User can change privacy status of an app
while the app is running on the background.
In case of changing status to off,
terminate the app for a clear permission revocation.
Change-Id: I520a9ff5225259472e02133afc540bbd532728f3
Signed-off-by: Yunjin Lee <yunjin-.lee@samsung.com>
-rwxr-xr-x | packaging/org.tizen.privacy-setting.spec | 1 | ||||
-rwxr-xr-x | packaging/org.tizen.privacy-setting.xml | 1 | ||||
-rwxr-xr-x | ui/CMakeLists.txt | 2 | ||||
-rw-r--r-- | ui/src/package_list_view.c | 1 | ||||
-rw-r--r-- | ui/src/package_privacy_list_view.c | 26 |
5 files changed, 29 insertions, 2 deletions
diff --git a/packaging/org.tizen.privacy-setting.spec b/packaging/org.tizen.privacy-setting.spec index fed647f..b60727e 100755 --- a/packaging/org.tizen.privacy-setting.spec +++ b/packaging/org.tizen.privacy-setting.spec @@ -25,6 +25,7 @@ BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(security-privilege-manager) BuildRequires: pkgconfig(security-manager) BuildRequires: pkgconfig(pkgmgr-info) +BuildRequires: pkgconfig(capi-appfw-app-manager) %description Application providing ui for managing other installed applications privacy status. diff --git a/packaging/org.tizen.privacy-setting.xml b/packaging/org.tizen.privacy-setting.xml index c317fd3..9d22c37 100755 --- a/packaging/org.tizen.privacy-setting.xml +++ b/packaging/org.tizen.privacy-setting.xml @@ -5,5 +5,6 @@ </ui-application> <privileges> <privilege>http://tizen.org/privilege/systemsettings.admin</privilege> + <privilege>http://tizen.org/privilege/appmanager.kill</privilege> </privileges> </manifest> diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index fc967c0..eac8d1f 100755 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE(FindPkgConfig) SET(pkg_name "org.tizen.privacy-setting") -pkg_check_modules(${pkg_name} REQUIRED glib-2.0 ui-gadget-1 evas elementary edje eina efl-extension security-privilege-manager dlog security-manager pkgmgr-info) +pkg_check_modules(${pkg_name} REQUIRED glib-2.0 ui-gadget-1 evas elementary edje eina efl-extension security-privilege-manager dlog security-manager pkgmgr-info capi-appfw-app-manager) SET(SRCS ${CMAKE_SOURCE_DIR}/common/src/common_utils.c diff --git a/ui/src/package_list_view.c b/ui/src/package_list_view.c index da64a17..6558c6e 100644 --- a/ui/src/package_list_view.c +++ b/ui/src/package_list_view.c @@ -140,7 +140,6 @@ static void __get_package_privacy_privilege_status(bool* status, const char* pri break; } else if (strcmp("Deny", result) == 0 || strcmp("Ask user", result) == 0) { *status = EINA_FALSE; - break; } else { LOGE("Unknown policy level: %s", result); break; diff --git a/ui/src/package_privacy_list_view.c b/ui/src/package_privacy_list_view.c index e942ed5..d36b99d 100644 --- a/ui/src/package_privacy_list_view.c +++ b/ui/src/package_privacy_list_view.c @@ -27,6 +27,7 @@ #include <glib.h> #include <pkgmgr-info.h> #include <tzplatform_config.h> +#include <app_manager_extension.h> #include "common_utils.h" #include "privacy_view.h" @@ -89,6 +90,30 @@ static void gl_realized_cb(void *data, Evas_Object *obj, void *event_info) elm_object_item_signal_emit(first, "elm,action,title,slide,start", "elm"); } + +static void __terminate_app() +{ + /* Get app context for each appid */ + GList *l; + for (l = pp_app_list; l != NULL; l = l->next) { + char* appid = (char*)l->data; + bool is_running = false; + /* If app is running then terminate app. */ + int ret = app_manager_is_running(appid, &is_running); + if (is_running) { + app_context_h context = NULL; + ret = app_manager_get_app_context(appid, &context); + if (ret != APP_MANAGER_ERROR_NONE) + LOGE("app_manager_get_app_context failed. ret = %d", ret); + ret = app_manager_terminate_app(context); + if (ret != APP_MANAGER_ERROR_NONE) + LOGE("app_manager_terminate_app failed. ret = %d", ret); + app_context_destroy(context); + } + } + +} + static void package_privacy_check_changed_cb(void *data, Evas_Object *obj, void *event_info) { Elm_Object_Item *ei = event_info; @@ -106,6 +131,7 @@ static void package_privacy_check_changed_cb(void *data, Evas_Object *obj, void if (pd->status) { level = "Ask user"; pd->status = false; + __terminate_app(); } else { level = "Allow"; pd->status = true; |