summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]CMakeLists.txt1
-rwxr-xr-x[-rw-r--r--]packaging/privacy-manager.spec40
-rwxr-xr-xpackaging/tizenprv00.privacy-popup.manifest25
-rwxr-xr-xpackaging/tizenprv00.privacy-popup.xml9
-rwxr-xr-xprivacy-popup/CMakeLists.txt65
-rw-r--r--privacy-popup/privacy-popup.c328
-rw-r--r--privacy-popup/privacy-popup.h57
7 files changed, 525 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5b97fd9..83f2016 100644..100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,3 +19,4 @@ ADD_SUBDIRECTORY(client)
#ADD_SUBDIRECTORY(test)
ADD_SUBDIRECTORY(capi)
ADD_SUBDIRECTORY(pkgmgr_plugin)
+ADD_SUBDIRECTORY(privacy-popup)
diff --git a/packaging/privacy-manager.spec b/packaging/privacy-manager.spec
index c47ccc5..f7f3fba 100644..100755
--- a/packaging/privacy-manager.spec
+++ b/packaging/privacy-manager.spec
@@ -9,6 +9,7 @@ Source1: privacy-manager-server.manifest
Source2: privacy-manager-client.manifest
Source3: privacy-manager-server.service
Source4: capi-security-privacy-manager.manifest
+Source5: tizenprv00.privacy-popup.manifest
BuildRequires: cmake
BuildRequires: pkgconfig(dlog)
BuildRequires: pkgconfig(glib-2.0)
@@ -78,6 +79,35 @@ Requires: privacy-manager-client = %{version}-%{release}
%description -n capi-security-privacy-manager-devel
The Privacy Manager API provides functions to get/set information about privacy information of installed packages.(DEV)
+%package -n tizenprv00.privacy-popup
+Summary: Privacy Popup
+Group: TO_BE/FILLED_IN
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+BuildRequires: cmake
+BuildRequires: gettext-tools
+BuildRequires: edje-tools
+BuildRequires: pkgconfig(aul)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(ail)
+BuildRequires: pkgconfig(appcore-efl)
+BuildRequires: pkgconfig(capi-appfw-application)
+BuildRequires: pkgconfig(pkgmgr-info)
+BuildRequires: pkgconfig(dlog)
+BuildRequires: pkgconfig(edje)
+BuildRequires: pkgconfig(eina)
+BuildRequires: pkgconfig(elementary)
+BuildRequires: pkgconfig(evas)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(ui-gadget-1)
+BuildRequires: pkgconfig(icu-i18n)
+BuildRequires: pkgconfig(bundle)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(privacy-manager-client)
+
+%description -n tizenprv00.privacy-popup
+The Privacy popup provides UI to set privacy information of application.
+
%prep
%setup -q
@@ -122,6 +152,9 @@ install -D %{SOURCE1} %{buildroot}%{_datadir}/privacy-manager-server.manifest
%make_install -n capi-security-privacy-manager
install -D %{SOURCE4} %{buildroot}%{_datadir}/capi-security-privacy-manager.manifest
+%make_install -n privacy-manager-privacy-popup
+install -D %{SOURCE5} %{buildroot}%{_datadir}/tizenprv00.privacy-popup.manifest
+
#mkdir -p %{buildroot}/etc/rc.d/rc3.d
#mkdir -p %{buildroot}/etc/rc.d/rc5.d
#ln -sf /etc/rc.d/init.d/privacy-manager-server.sh %{buildroot}/etc/rc.d/rc3.d/S10privacy-manager-server.sh
@@ -182,3 +215,10 @@ fi
%{_includedir}/privacymgr/*.h
%{_libdir}/libcapi-security-privacy-manager.so
%{_libdir}/pkgconfig/capi-security-privacy-manager.pc
+
+%files -n tizenprv00.privacy-popup
+%manifest %{_datadir}/tizenprv00.privacy-popup.manifest
+%defattr(-,root,root,-)
+/usr/bin/tizenprv00.privacy-popup
+/usr/share/packages/tizenprv00.privacy-popup.xml
+#/etc/smack/accesses2.d/tizenprv00.privacy-popup.rule
diff --git a/packaging/tizenprv00.privacy-popup.manifest b/packaging/tizenprv00.privacy-popup.manifest
new file mode 100755
index 0000000..ce48f24
--- /dev/null
+++ b/packaging/tizenprv00.privacy-popup.manifest
@@ -0,0 +1,25 @@
+<manifest>
+ <define>
+ <domain name="tizenprv00.privacy-popup" />
+ <request>
+ <smack request="system::homedir" type="rwax" />
+ <smack request="system::use_internet" type="rwax" />
+ <smack request="system::homedir" type="rwax" />
+ <smack request="isf" type="rwax" />
+ <smack request="device::app_logging" type="rawx" />
+ <smack request="ail::db" type="rawx" />
+ <smack request="system::vconf" type="rawx" />
+ <smack request="_" type="rawx" />
+ <smack request="ug_bluetooth" type="rwax" />
+ <smack request="org.tizen.setting" type="rx" />
+ <smack request="privacy-manager::daemon" type="rw" />
+ <smack request="svi-data" type="x" />
+ <smack request="system-server" type="rwa" />
+ <smack request="privacy-manager::db" type="rwa" />
+ <smack request="org.tizen.indicator" type="rw" />
+ </request>
+ </define>
+ <assign>
+ <filesystem path="/usr/bin/tizenprv00.privacy-popup" label="tizenprv00.privacy-popup" exec_label="tizenprv00.privacy-popup" />
+ </assign>
+</manifest>
diff --git a/packaging/tizenprv00.privacy-popup.xml b/packaging/tizenprv00.privacy-popup.xml
new file mode 100755
index 0000000..d15ca5a
--- /dev/null
+++ b/packaging/tizenprv00.privacy-popup.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns="http://tizen.org/ns/packages" package="tizenprv00.privacy-popup" version="0.1.0" install-location="internal-only">
+ <label>privacy-popup</label>
+ <author email="jc815.lee@samsung.com" href="www.samsung.com">Jaechul Lee</author>
+ <description>privacy popup</description>
+ <ui-application appid="tizenprv00.privacy-popup" exec="/usr/bin/tizenprv00.privacy-popup" nodisplay="true" multiple="false" type="capp" taskmanage="false">
+ <label>privacy-popup</label>
+ </ui-application>
+</manifest>
diff --git a/privacy-popup/CMakeLists.txt b/privacy-popup/CMakeLists.txt
new file mode 100755
index 0000000..614f530
--- /dev/null
+++ b/privacy-popup/CMakeLists.txt
@@ -0,0 +1,65 @@
+INCLUDE(FindPkgConfig)
+pkg_check_modules(privacy-popup-ug-test_pkgs
+#pkg_check_modules(privacy-popup_pkgs
+ REQUIRED
+ elementary
+ evas
+ ecore-x
+ ui-gadget-1
+ dlog
+ capi-appfw-application
+ appcore-efl
+)
+SET (this_target tizenprv00.privacy-popup)
+#SET (this_target privacy-manager-privacy-popup)
+
+SET(SRCS
+ privacy-popup.c
+)
+
+#SET(INCLUDEDIR "\${prefix}/include")
+#INCLUDE_DIRECTORIES(${privacy-popup_pkgs_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${privacy-popup-ug-test_pkgs_INCLUDE_DIRS})
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/inc)
+INCLUDE_DIRECTORIES(${ug-privacy-popup-ug-efl_pkgs_INCLUDE_DIRS} /usr/include/privacy_manager)
+
+
+FIND_PROGRAM(UNAME NAMES uname)
+EXEC_PROGRAM("${UNAME}" ARGS "-m" OUTPUT_VARIABLE "ARCH")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+MESSAGE("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
+
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+#SET(CMAKE_CXX_CFLAGS "${CMAKE_CXX_FLAGS} -fPIE")
+#SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed")
+
+
+ADD_EXECUTABLE(${this_target} ${SRCS})
+
+#TARGET_LINK_LIBRARIES(${this_target} --as-needed -pie)
+#TARGET_LINK_LIBRARIES(${this_target} ${privacy-popup_pkgs_LDFLAGS} ${privacy-popup_pkgs_LIBRARIES})
+TARGET_LINK_LIBRARIES(${this_target} "-lpkgmgr-info")
+TARGET_LINK_LIBRARIES(${this_target} "-lprivacy-manager-client")
+TARGET_LINK_LIBRARIES(${this_target} ${privacy-popup-ug-test_pkgs_LDFLAGS} ${privacy-popup-ug-test_pkgs_LIBRARIES})
+
+
+TARGET_LINK_LIBRARIES(${this_target}
+ #${privacy-popup_LIBRARIES}
+ ${privacy-popup-ug-test_LIBRARIES}
+)
+
+
+INSTALL(TARGETS
+ ${this_target}
+ DESTINATION
+ /usr/bin/
+)
+#INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/tizenprv00.privacy-popup.rule DESTINATION /etc/smack/accesses2.d)
+INSTALL(FILES ${CMAKE_SOURCE_DIR}/packaging/${this_target}.xml DESTINATION /usr/share/packages)
diff --git a/privacy-popup/privacy-popup.c b/privacy-popup/privacy-popup.c
new file mode 100644
index 0000000..a5098de
--- /dev/null
+++ b/privacy-popup/privacy-popup.c
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2011 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 "privacy-popup.h"
+
+static appdata ad;
+static service_h service;
+
+static char *package_id = NULL;
+static char *app_id = NULL;
+static bundle *bundle_data = NULL;
+int get_packageid_by_appid(const char* appid, char** packageid);
+Evas_Object* create_conform(Evas_Object *parent);
+
+static void destroy_privacy_popup()
+{
+ LOGD("exit");
+ //elm_shutdown();
+ elm_exit();
+}
+
+static void layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv) {
+ LOGD("layout_cb");
+ Evas_Object *base, *win;
+ appdata *mydata;
+
+ if (!ug || !priv)
+ return;
+
+ mydata = priv;
+
+ base = ug_get_layout(ug);
+ if (!base){
+ LOGE("base layout from UG is null! %p", base);
+ return;
+ }
+
+ win = ug_get_window();
+
+ switch (mode) {
+ case UG_MODE_FULLVIEW:
+ evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(win, base);
+ ug_disable_effect(ug);
+ evas_object_show(base);
+ break;
+ default:
+ break;
+ }
+}
+
+static void result_cb(ui_gadget_h ug, service_h service, void *priv) {
+ LOGD("result_cb");
+
+ if (!ug || !priv)
+ return;
+
+ if(!service){
+ LOGE("service is null. return without set_user_consented");
+ return;
+ }
+
+ char* exit_value = NULL;
+ service_get_extra_data(service, KEY_RESULT_EXIT, &exit_value);
+ if(!exit_value){
+ LOGD("no exit value from UG");
+ return;
+ }
+
+ LOGD("exit value : %s", exit_value);
+
+ if(strncmp(exit_value, KEY_RESULT_CANCEL, 2) == 0){
+ int result = privacy_manager_client_set_user_consented(package_id, true);
+ if(result != PRIV_MGR_ERROR_SUCCESS){
+ LOGD("set_user_censented failed : %d", result);
+ }
+ }
+}
+
+static void destroy_cb(ui_gadget_h ug, void *priv) {
+ LOGD("destroy_cb");
+
+ int result = privacy_manager_client_set_user_consented(package_id, true);
+
+ int res = aul_forward_app(app_id, bundle_data);
+ if(res < 0){
+ LOGE("aul_forward_app failed! result : %d", res);
+ destroy_privacy_popup();
+ }
+
+ if (!ug || !priv)
+ return;
+
+ ug_destroy(ug);
+ destroy_privacy_popup();
+}
+
+ui_gadget_h create_ug(appdata *data) {
+ LOGD("create_ug");
+
+ struct ug_cbs cbs = { 0, };
+ cbs.layout_cb = layout_cb;
+ cbs.result_cb = result_cb;
+ cbs.destroy_cb = destroy_cb;
+ cbs.priv = (void *) data;
+
+ service_create(&service);
+ LOGD("package_id : %s", package_id);
+ service_set_operation(service, KEY_SERVICE_OPERATION);
+ service_add_extra_data(service, KEY_PACKAGE_ID, package_id);
+
+ data->ug = ug_create(NULL, "setting-privacy-efl", UG_MODE_FULLVIEW, service, &cbs);
+ service_destroy(&service);
+
+ if(!data->ug){
+ LOGE("ug_create failed!");
+ }
+
+ return data->ug;
+}
+
+static void on_done(void *data, Evas_Object *obj, void *event_info) {
+ (void) data;
+ (void) obj;
+ (void) event_info;
+ LOGD("on_done");
+ destroy_privacy_popup();
+}
+
+Evas_Object* create_win(char* name)
+{
+ int w,h;
+ Evas_Object *win = elm_win_add(NULL, PACKAGE, ELM_WIN_BASIC);
+ if(!win){
+ return NULL;
+ }
+
+ elm_win_title_set(win, PACKAGE);
+ evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
+ ecore_x_window_size_get(ecore_x_window_root_first_get(), &w, &h);
+ evas_object_resize(win, w, h);
+ return win;
+}
+
+Evas_Object* create_conform(Evas_Object *parent)
+{
+ Evas_Object *conform = elm_conformant_add(parent);
+ if(!conform){
+ return NULL;
+ }
+ evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_win_resize_object_add(parent, conform);
+ evas_object_show(conform);
+
+ return conform;
+}
+
+Evas_Object* create_layout(Evas_Object *parent)
+{
+ Evas_Object *layout = elm_layout_add(parent);
+ elm_layout_theme_set(layout, "layout", "application", "default");
+ evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ elm_object_content_set(parent, layout);
+
+ return layout;
+}
+
+EAPI_MAIN int elm_main() {
+ LOGD("elm_main");
+
+ Evas_Object *win = create_win(PACKAGE);
+ if(!win){
+ LOGE("failed to create window");
+ return 0;
+ }
+ elm_win_conformant_set(win, EINA_TRUE);
+
+ Evas_Object *conform = create_conform(win);
+ if(!conform){
+ LOGE("failed to create window");
+ return 0;
+ }
+
+ // main layout
+ Evas_Object *main_layout = create_layout(conform);
+ if(!conform){
+ LOGE("failed to create layout");
+ return 0;
+ }
+
+ UG_INIT_EFL(win, UG_OPT_INDICATOR_ENABLE);
+ evas_object_show(win);
+
+ ad.win = win;
+ ad.conform = conform;
+ ad.main_layout = main_layout;
+
+ return 0;
+}
+
+static int app_create(void *data)
+{
+ LOGD("app_create");
+ return elm_main();
+}
+
+static int app_terminate(void *data)
+{
+ LOGD("app_terminate");
+
+ free(package_id);
+ free(app_id);
+ bundle_free(bundle_data);
+ return 0;
+}
+
+static int app_pause(void *data)
+{
+ LOGD("app_pause");
+
+ destroy_privacy_popup();
+ // else(ex screen of or lose top most)
+
+ return 0;
+}
+
+static int app_resume(void *data)
+{
+ LOGD("app_resume");
+ return 0;
+}
+
+static int app_reset(bundle *b, void *data)
+{
+ LOGD("app_reset");
+ evas_object_show(ad.win);
+
+ //AUL pass appid in bundle b
+ const char *appid = bundle_get_val(b, "__AUL_PRIVACY_APPID__");
+
+ if(!appid){
+ LOGE("appid is null! ");
+ destroy_privacy_popup();
+ return 0;
+ }
+
+ app_id = strndup(appid, strlen(appid));
+ LOGD("app id %s", appid);
+
+ int result = get_packageid_by_appid(appid, &package_id);
+
+ if(result != 0 || !package_id){
+ LOGE("Failed to get package id! exit");
+ destroy_privacy_popup();
+ }
+
+ LOGD("package id %s", package_id);
+ bundle_data = bundle_dup(b);
+
+
+ if(!create_ug(&ad)){
+ destroy_privacy_popup();
+ }
+ return 0;
+}
+
+int main(int argc, char **argv) {
+ elm_init(argc, argv);
+
+ struct appcore_ops ops = {
+ .create = app_create,
+ .terminate = app_terminate,
+ .pause = app_pause,
+ .resume = app_resume,
+ .reset = app_reset,
+ };
+ return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
+
+int get_packageid_by_appid(const char* appid, char** packageid)
+{
+ int result = 0;
+ char* pack_id = NULL;
+ pkgmgrinfo_appinfo_h app_info_handle = NULL;
+
+ result = pkgmgrinfo_appinfo_get_appinfo(appid, &app_info_handle);
+ if(result != 0){
+ LOGE("pkgmgrinfo_appinfo_get_appinfo() failed. result=[%d], appId=[%s]",result, appid);
+ return -1;
+ }
+
+ result = pkgmgrinfo_appinfo_get_pkgname(app_info_handle, &pack_id);
+ LOGD("pkgmgrinfo get_pkgname :%s", pack_id);
+
+ if(pack_id){
+ *packageid = (char*)malloc(sizeof(char)*strlen(pack_id));
+ if(*packageid == NULL){
+ LOGE("memory allocation failed to packageid!");
+ return -1;
+ }
+ strncpy(*packageid, pack_id, strlen(pack_id));
+ }
+ else{
+ LOGD("failed to get package id");
+ return -1;
+ }
+
+ if(app_info_handle)
+ {
+ pkgmgrinfo_appinfo_destroy_appinfo(app_info_handle);
+ }
+
+ return 0;
+}
+
diff --git a/privacy-popup/privacy-popup.h b/privacy-popup/privacy-popup.h
new file mode 100644
index 0000000..df4437b
--- /dev/null
+++ b/privacy-popup/privacy-popup.h
@@ -0,0 +1,57 @@
+
+/*
+ * Copyright (c) 2011 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 <Elementary.h>
+#include <Ecore_X.h>
+#include "dlog.h"
+#include <Evas.h>
+#include <app.h>
+
+
+#include <pkgmgr-info.h>
+#include <aul.h>
+#include <bundle.h>
+#include <appcore-efl.h>
+#include <privacy_manager_client.h>
+
+#include <stdio.h>
+#include <ui-gadget.h>
+#include <ui-gadget-module.h>
+#include <ui-gadget-engine.h>
+
+
+#ifdef LOG_TAG
+ #undef LOG_TAG
+#endif
+
+#ifndef LOG_TAG
+ #define LOG_TAG "PRIVACY_POPUP"
+#endif
+
+#define PACKAGE "privacy-popup"
+
+typedef struct appdata_t {
+ ui_gadget_h ug;
+ Evas_Object *conform;
+ Evas_Object *main_layout;
+ Evas_Object *win;
+} appdata;
+
+const char *KEY_PACKAGE_ID = "pkg_id";
+const char *KEY_SERVICE_OPERATION = "http://tizen.org/appcontrol/operation/configure/privacy/service";
+const char *KEY_RESULT_EXIT = "exit";
+const char *KEY_RESULT_OK = "ok";
+const char *KEY_RESULT_CANCEL = "cancel";