SET(SETTING_STORAGE setting-storage)
SET(SETTING_FILEVIEW setting-fileview)
SET(SETTING_PLUGIN setting-plugin)
-
+SET(SETTING_PRIVACY setting-privacy)
SET(SETTING_PROFILE_UG ug-setting-profile-efl)
SET(SETTING_DEVELOPEROPTION_UG ug-setting-developeroption-efl)
SET(SETTING_MEMORY_UG ug-setting-memory-efl)
SET(SETTING_FONT_UG ug-setting-font-efl)
SET(SETTING_STORAGE_UG ug-setting-storage-efl)
SET(SETTING_PLUGIN_UG ug-setting-plugin-efl)
+SET(SETTING_PRIVACY_UG ug-setting-privacy-efl)
SET(LIB_SETTING_COMMON setting-common)
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_POWERSAVING})
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_FONT})
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_FILEVIEW})
+ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/${SETTING_PRIVACY})
ADD_SUBDIRECTORY(src)
#define SUPPORT_FDN 0
#define SUPPORT_PARENTAL_MODE 0
+#define SUPPORT_PRIVACY 1
#define SETTING_ENABLE_TRACE
<operation name="http://tizen.org/appcontrol/operation/app_setting/show"/>
</application-service>
</ui-application>
+ <ui-application appid="setting-privacy-efl" exec="/usr/ug/bin/setting-privacy-efl" type="capp" nodisplay="true" taskmanage="false">
+ <icon>ug-setting-privacy-efl.png</icon>
+ <label>Setting Privacy </label>
+ <label xml:lang="en-us">Setting Privacy view </label>
+ <application-service>
+ <operation name="http://samsung.com/appcontrol/operation/configure/privacy/service"/>
+ </application-service>
+ <application-service>
+ <operation name="http://tizen.org/appcontrol/operation/configure/priavacy/service"/>
+ </application-service>
+ </ui-application>
</manifest>
BuildRequires: pkgconfig(capi-network-bluetooth)
BuildRequires: pkgconfig(capi-network-tethering)
BuildRequires: pkgconfig(capi-network-nfc)
+BuildRequires: pkgconfig(capi-security-privacy-manager)
+BuildRequires: pkgconfig(privacy-manager-client)
+BuildRequires: pkgconfig(privacy-manager-server)
BuildRequires: pkgconfig(ecore-evas)
BuildRequires: pkgconfig(pkgmgr)
BuildRequires: pkgconfig(pkgmgr-info)
ln -sf /usr/bin/ug-client /usr/ug/bin/setting-font-efl
ln -sf /usr/bin/ug-client /usr/ug/bin/setting-profile-efl
ln -sf /usr/bin/ug-client /usr/ug/bin/setting-plugin-efl
+ln -sf /usr/bin/ug-client /usr/ug/bin/setting-privacy-efl
%files -n org.tizen.setting
%manifest settings.manifest
#define KeyStr_Gestures "IDS_ST_BODY_GESTURES"
#define KeyStr_Touch "IDS_ST_BODY_TOUCH"
#define KeyStr_Security "IDS_ST_BODY_SECURITY"
+#define KeyStr_Privacy "Privacy"
#define KeyStr_Memory "IDS_ST_BODY_MEMORY"
#define KeyStr_Reset "IDS_COM_BODY_RESET"
#define KeyStr_AboutPhone "IDS_ST_BODY_ABOUT_PHONE"
__create_an_item(KeyStr_Powersaving, IMG_Powersaving, "setting-powersaving-efl", Cfg_Item_Pos_Level0, Cfg_Item_unResetable);
#endif
+#if SUPPORT_PRIVACY
+ __create_an_item(KeyStr_Privacy, IMG_Security, "setting-privacy-efl", Cfg_Item_Pos_Level0, Cfg_Item_unResetable);
+#endif
+
#if SUPPORT_FONT
__create_an_item(KeyStr_Font, IMG_Font, "setting-font-efl", Cfg_Item_Pos_Level1, Cfg_Item_Resetable);
#endif
--- /dev/null
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/${SETTING_COMMON}/include)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs_privacy REQUIRED elementary ecore ecore-x edje evas appcore-common appcore-efl ui-gadget-1 dlog aul pkgmgr-info pkgmgr
+capi-security-privacy-manager privacy-manager-client privacy-manager-server)
+
+FOREACH(flag ${pkgs_privacy_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ MESSAGE("add -DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+ADD_DEFINITIONS("-shared")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+ADD_LIBRARY(${SETTING_PRIVACY_UG} SHARED
+ ./src/setting-privacy.c
+ #./src/setting-privacy-main.c
+ ./src/setting-privacy-service.c
+ )
+
+TARGET_LINK_LIBRARIES(${SETTING_PRIVACY_UG} -L${CMAKE_BINARY_DIR}/${SETTING_COMMON} -lsetting-common)
+TARGET_LINK_LIBRARIES(${SETTING_PRIVACY_UG} ${pkgs_privacy_LDFLAGS})
+
+INSTALL(TARGETS ${SETTING_PRIVACY_UG} DESTINATION /usr/ug/lib)
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 __SETTING_PRIVACY_MAIN_H__
+#define __SETTING_PRIVACY_MAIN_H__
+
+#include <setting-privacy.h>
+
+static void setting_privacy_main_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info);
+static void setting_privacy_main_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info);
+#endif /* __SETTING_PRIVACY_MAIN_H__ */
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 __SETTING_PRIVACY_SERVICE_H__
+#define __SETTING_PRIVACY_SERVICE_H__
+
+#include <setting-privacy.h>
+
+typedef struct _setting_privacy_privacyinfo_t setting_privacy_privacyinfo_t;
+struct _setting_privacy_privacyinfo_t
+{
+ //char *pkg_name;
+ //char *main_appid;
+ //char *icon_path;
+ //char *pkg_label;
+ //bool nodisplay;
+
+ char *privacy_id;
+ char *privacy_name;
+ char *privacy_desc;
+ bool enabled;
+};
+
+#define KeyStr_PrivacyService_desc "This application can access below services. Uncheck the service which you do not want to use."
+
+static void setting_privacy_service_click_softkey_back_cb(void *data, Evas_Object *obj, void *event_info);
+static void setting_privacy_service_click_softkey_ok_cb(void *data, Evas_Object *obj, void *event_info);
+static void setting_privacy_service_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj, void *event_info);
+static void setting_privacy_service_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj, void *event_info);
+#endif /* __SETTING_PRIVACY_SERVICE_H__ */
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 __SETTING_PRIVACY_H__
+#define __SETTING_PRIVACY_H__
+
+#include <Elementary.h>
+#include <setting-common-draw-widget.h>
+#include <setting-common-view.h>
+
+
+typedef struct _SettingPrivacyUG SettingPrivacyUG;
+struct _SettingPrivacyUG {
+ ui_gadget_h ug;
+ ui_gadget_h ug_loading;
+ /* add more variables here (move your appdata to here) */
+ service_h bundle_data; /**< when loading this UG, bundle is stored */
+ char *pkg_id;
+ char *pkg_label;
+ char *privacy_id;
+ Evas *evas;
+ Evas_Object *win_main_layout;
+ Evas_Object *win_get;
+ Evas_Object *bg;
+ Evas_Object *ly_main;
+ Evas_Object *navi_bar; // for navigation effect
+ Evas_Object *genlist_privacy; //privacy genlist
+ Evas_Object *scroller;
+
+ Eina_List* privacy_check_list;
+
+ // UI elements - view main
+ Setting_GenGroupItem_Data *privacy_service;
+
+ Elm_Genlist_Item_Class itc_2text_2;
+ Elm_Genlist_Item_Class itc_1text_1icon;
+ //Eina_List* item_check_list; //check list
+ setting_view *view_to_load;
+};
+
+extern setting_view setting_view_privacy_service;
+#endif
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 <setting-privacy-main.h>
+//#include <package-manager.h>
+#include <privacy_manager.h>
+//#include <privacy_info.h>
+
+static int setting_privacy_main_create(void *cb);
+static int setting_privacy_main_destroy(void *cb);
+static int setting_privacy_main_update(void *cb);
+static int setting_privacy_main_cleanup(void *cb);
+
+setting_view setting_view_privacy_main = {
+ .create = setting_privacy_main_create,
+ .destroy = setting_privacy_main_destroy,
+ .update = setting_privacy_main_update,
+ .cleanup = setting_privacy_main_cleanup,
+};
+
+typedef struct _PrivacyNode PrivacyNode;
+struct _PrivacyNode
+{
+ char* pkgname; // ex) com.samsung.app
+ int state; // 0:OFF, 1:ON
+};
+
+
+static int get_privacy_app(const char *appid, bool* status)
+{
+ SETTING_TRACE_BEGIN;
+ //privacy_info_h handle;
+ return 0;
+}
+/*
+static void __apps_list_cb(const pkgmgrinfo_pkginfo_h handler, void* data)
+{
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ int r = 0;
+ char *pkg_name = NULL;
+ char *icon_path = NULL;
+ char *main_appid = NULL;
+ char *pkg_label = NULL;
+ bool nodisplay = 0;
+ pkgmgrinfo_appinfo_h appinfo_h = NULL;
+
+ r = pkgmgrinfo_pkginfo_get_pkgid(handler, &pkg_name);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_pkginfo_get_pkgid is failed code[%d] ", r);
+ goto end;
+ }
+ SETTING_TRACE("pkg_name: %s", pkg_name);
+
+ r = pkgmgrinfo_pkginfo_get_mainappid(handler, &main_appid);
+ if (r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_pkginfo_get_mainappid is failed code[%d]", r);
+ goto end;
+ }
+ SETTING_TRACE("main_appid: %s", main_appid);
+
+ r = pkgmgrinfo_appinfo_get_appinfo(main_appid, &appinfo_h);
+ if (r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_appinfo_get_appinfo is failed code[%d]", r);
+ goto end;
+ }
+
+ r = pkgmgrinfo_appinfo_is_nodisplay(appinfo_h, &nodisplay);
+ if (r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_appinfo_get_appinfo is failed code[%d]", r);
+ goto end;
+ }
+
+ r = pkgmgrinfo_appinfo_get_label(appinfo_h, &pkg_label);
+ if (r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_appinfo_get_appinfo is failed code[%d]", r);
+ goto end;
+ }
+
+ //PrivacyNode* node = (PrivacyNode*) malloc(sizeof(PrivacyNode));
+ //node->pkgname = strdup(pkg_name);
+ // TODO : free node->pkgname later
+
+ setting_create_Gendial_field_def(ad->genlist_privacy,
+ &(ad->itc_2text_2),
+ setting_privacy_main_list_Gendial_mouse_up_cb,
+ ad,
+ SWALLOW_Type_INVALID,
+ NULL,
+ NULL,
+ 0,
+ pkg_label, pkg_name,
+ NULL);
+
+ //ad->item_check_list = eina_list_append(ad->item_check_list, node);
+
+end:
+ if (appinfo_h) {
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+ }
+
+ SETTING_TRACE_END;
+}
+*/
+
+/*
+static void __info_cb(const privacy_info_h handler, void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+ bool enabled = false;
+ char *privacy_id = NULL;
+ char *name = NULL;
+ char *description = NULL;
+
+ int r = privacy_info_is_enabled(handler, &enabled);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("privacy_info_is_enabled is failed code[%d] ", r);
+ return;
+ }
+ SETTING_TRACE("check privacy_info_is_enabled 001");
+
+ if(enabled)
+ {
+ r = privacy_info_get_privacy_id(handler, &privacy_id);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_id is failed code[%d] ", r);
+ return;
+ }
+
+ r = privacy_info_get_privacy_display_name(handler, &name);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_display_name is failed code[%d] ", r);
+ return;
+ }
+
+ r = privacy_info_get_privacy_description(handler, &description);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_description is failed code[%d] ", r);
+ return;
+ }
+ setting_create_Gendial_field_def(ad->genlist_privacy,
+ &(ad->itc_2text_2),
+ setting_privacy_main_list_Gendial_mouse_up_cb,
+ ad,
+ SWALLOW_Type_INVALID,
+ NULL,
+ NULL,
+ 0,
+ name, description,
+ NULL);
+ }
+ SETTING_TRACE_END;
+}
+
+static void __apps_list_cb(const pkgmgrinfo_pkginfo_h handler, void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ int r = 0;
+ char *pkg_name = NULL;
+ r = pkgmgrinfo_pkginfo_get_pkgid(handler, &pkg_name);
+ if(r < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_pkginfo_get_pkgid is failed code[%d] ", r);
+ return;
+ }
+ SETTING_TRACE("pkg_name [%s]",pkg_name);
+ privacy_manager_foreach_privacy_info(pkg_name, __info_cb, ad);
+ SETTING_TRACE_END;
+}
+*/
+
+static void __apps_list_cb(const char* package_id, void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+ SETTING_TRACE("package_id : %s", package_id);
+
+}
+
+/**
+ * get 3rd party applist from AIL & searching dir/file by the defined rule
+ * @param data ad
+ * if data is NULL --> just get how many items are there
+ * if data is NOT NULL --> draw UI code
+ */
+static void setting_privacy_get_app_list(void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ //int r = pkgmgrinfo_pkginfo_get_list(__apps_list_cb, ad);
+ int r = privacy_manager_foreach_privacy_packages(__apps_list_cb, ad);
+ if (0 != r) {
+ SETTING_TRACE_ERROR("privacy_manager_foreach_privacy_packages failed. %d", r);
+ }
+}
+
+
+/* ***************************************************
+ **
+ **basic func
+ **
+ ****************************************************/
+static int setting_privacy_main_create(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+ Elm_Object_Item *item = NULL;
+ Evas_Object *scroller = NULL;
+ ad->ly_main =
+ setting_create_layout_navi_bar_genlist(ad->win_main_layout,
+ ad->win_get,
+ KeyStr_Privacy,
+ _("IDS_COM_BODY_BACK"),
+ NULL,
+ setting_privacy_main_click_softkey_back_cb,
+ NULL,
+ ad,
+ &scroller,
+ &(ad->navi_bar));
+
+ /* separator */
+ item = elm_genlist_item_append(scroller , &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ // init
+ //ad->item_check_list = NULL;
+
+ ad->genlist_privacy = scroller;
+ // get_applist
+ setting_privacy_get_app_list(ad);
+
+ /* separator */
+ item = elm_genlist_item_append(scroller , &itc_bottom_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ /* update info */
+ setting_view_privacy_main.is_create = 1;
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_main_destroy(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+
+ elm_naviframe_item_pop(ad->navi_bar);
+ setting_view_privacy_main.is_create = 0;
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_main_update(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+
+ /* to do */
+ /* update genlist when list add or delete */
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_main_cleanup(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+ return setting_privacy_main_destroy(ad);
+}
+
+/* ***************************************************
+ **
+ **call back func
+ **
+ ****************************************************/
+static void setting_privacy_main_click_softkey_back_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retm_if(data == NULL, "Data parameter is NULL");
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ /* Send destroy request */
+ ug_destroy_me(ad->ug);
+ SETTING_TRACE_END;
+}
+
+static void setting_privacy_main_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ /* error check */
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ //Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ //elm_genlist_item_selected_set(item, 0);
+ //Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
+ //change view to privacy services
+}
+
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 <setting-privacy-service.h>
+#include <package-manager.h>
+#include <privacy_manager.h>
+#include <pkgmgr-info.h>
+//#include <privacy_info.h>
+
+static int setting_privacy_service_create(void *cb);
+static int setting_privacy_service_destroy(void *cb);
+static int setting_privacy_service_update(void *cb);
+static int setting_privacy_service_cleanup(void *cb);
+
+setting_view setting_view_privacy_service = {
+ .create = setting_privacy_service_create,
+ .destroy = setting_privacy_service_destroy,
+ .update = setting_privacy_service_update,
+ .cleanup = setting_privacy_service_cleanup,
+};
+
+void _init_privacy_list(void *data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *)data;
+
+ setting_privacy_privacyinfo_t *list_data = NULL;
+ if(ad->privacy_check_list)
+ EINA_LIST_FREE(ad->privacy_check_list, list_data);
+
+ SETTING_TRACE_DEBUG("ad->privacy_check_list %d items", eina_list_count(ad->privacy_check_list));
+}
+
+static int _get_privacy_appinfo_by_pkgid(void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *)data;
+
+ int ret = 0;
+ pkgmgr_pkginfo_h pkg_handle = NULL;
+ char *pkg_name = NULL;
+ char *icon_path = NULL;
+ char *main_appid = NULL;
+ char *pkg_label = NULL;
+ pkgmgrinfo_appinfo_h appinfo_h = NULL;
+
+ //pkgmgr handle
+ SETTING_TRACE("pkgid [%s]", ad->pkg_id);
+ ret = pkgmgr_pkginfo_get_pkginfo(ad->pkg_id, &pkg_handle);
+ if (ret < 0)
+ {
+ SETTING_TRACE_ERROR("pkgmgr_pkginfo_get_pkginfo failed. %d", ret);
+ goto end;
+ }
+
+ //pkg_name
+ pkgmgrinfo_pkginfo_h handle = (pkgmgrinfo_pkginfo_h)pkg_handle;
+ ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkg_name);
+ if (ret < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_pkginfo_get_pkgid is failed %d", ret);
+ goto end;
+ }
+ SETTING_TRACE_DEBUG("pkg_name: %s", pkg_name);
+
+ //main appid
+ ret = pkgmgrinfo_pkginfo_get_mainappid(handle, &main_appid);
+ if (ret < 0)
+ {
+ SETTING_TRACE_ERROR("pkgmgrinfo_pkginfo_get_mainappid failed. %d", ret);
+ goto end;
+ }
+ SETTING_TRACE_DEBUG("main_appid: %s", main_appid);
+
+ //appinfo
+ ret = pkgmgrinfo_appinfo_get_appinfo(main_appid, &appinfo_h);
+ if (ret < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_appinfo_get_appinfo is failed %d", ret);
+ goto end;
+ }
+
+ //label
+ ret = pkgmgrinfo_appinfo_get_label(appinfo_h, &pkg_label);
+ if (ret < 0) {
+ SETTING_TRACE_ERROR("pkgmgrinfo_appinfo_get_label is failed %d", ret);
+ goto end;
+ }
+ if(pkg_label)
+ ad->pkg_label = (char*)strdup(pkg_label);
+ SETTING_TRACE_DEBUG("pkg_label: %s", pkg_label);
+
+end:
+ if (appinfo_h) {
+ pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h);
+ }
+ return ret;
+}
+
+static void _privacy_info_cb(const privacy_info_h* privacy_info, void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ int r=0;
+ char *privacy_id = NULL;
+ char *privacy_name = NULL;
+ char *privacy_desc = NULL;
+ bool enabled = false;
+ r = privacy_info_get_privacy_id(privacy_info, &privacy_id);
+ if(r != 0){
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_id failed : %d", r);
+ }
+ ad->privacy_id = strdup(privacy_id);
+ SETTING_TRACE("privacy_id : [%s]", privacy_id);
+
+ r = privacy_info_get_privacy_display_name(privacy_info, &privacy_name);
+ if(r != 0){
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_display_name failed : %d", r);
+ }
+ SETTING_TRACE("privacy_name : [%s]", privacy_name);
+
+ r = privacy_info_get_privacy_description(privacy_info, &privacy_desc);
+ if(r != 0){
+ SETTING_TRACE_ERROR("privacy_info_get_privacy_description failed : %d", r);
+ }
+ SETTING_TRACE("privacy_desc : [%s]", privacy_desc);
+
+ r = privacy_info_is_enabled(privacy_info, &enabled);
+ if(r != 0){
+ SETTING_TRACE_ERROR("privacy_info_is_enabled failed : %d", r);
+ }
+ SETTING_TRACE("enabled : [%d]", enabled);
+
+ setting_privacy_privacyinfo_t *app_info = NULL;
+ app_info = (setting_privacy_privacyinfo_t*)malloc(sizeof(setting_privacy_privacyinfo_t));
+ retv_if(app_info == NULL, -1);
+ memset(app_info, 0, sizeof(setting_privacy_privacyinfo_t));
+ app_info->privacy_id = strdup(privacy_id);
+ app_info->privacy_name = strdup(privacy_name);
+ app_info->privacy_desc = strdup(privacy_desc);
+ app_info->enabled = enabled;
+
+ ad->privacy_service =
+ setting_create_Gendial_field_def(ad->scroller,
+ &(ad->itc_1text_1icon),
+ setting_privacy_service_list_Gendial_mouse_up_cb,
+ /*NULL,*/ad,
+ SWALLOW_Type_1CHECK,
+ NULL,
+ NULL,
+ app_info->enabled, /* the initial state */
+ privacy_name, NULL,
+ setting_privacy_service_list_Gendial_chk_btn_cb);
+
+ if(ad->privacy_service) {
+ ad->privacy_service->userdata = ad;
+ } else {
+ SETTING_TRACE_ERROR("ad->privacy_service is NULL");
+ return SETTING_RETURN_FAIL;
+ }
+
+ //ad->privacy_check_list = eina_list_append(ad->privacy_check_list, app_info);
+
+ //FREE(privacy_id);
+ //FREE(privacy_name);
+ //FREE(privacy_desc);
+}
+
+/**
+ * get 3rd party applist from AIL & searching dir/file by the defined rule
+ * @param data ad
+ * if data is NULL --> just get how many items are there
+ * if data is NOT NULL --> draw UI code
+ */
+static void setting_privacy_get_privacy_list(void* data)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ char *pkg_id=NULL;
+ pkg_id = ad->pkg_id;
+ int r = 0;
+ r = privacy_manager_foreach_privacy_info(pkg_id ,_privacy_info_cb, ad);
+ if (0 != r) {
+ SETTING_TRACE_ERROR("privacy_manager_foreach_privacy_info failed. %d", r);
+ }
+}
+
+
+/* ***************************************************
+ **
+ **basic func
+ **
+ ****************************************************/
+static int setting_privacy_service_create(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+
+ //seperate default from app control
+ char *pkg_id = NULL;
+ service_h service = ad->bundle_data;
+ service_get_extra_data(service, "pkg_id", &pkg_id);
+
+ //need to pkgname from pkgid(pkgmgr)
+ ad->pkg_id = strdup(pkg_id);
+ SETTING_TRACE("pkgid [%s]", ad->pkg_id);
+ int r = _get_privacy_appinfo_by_pkgid(ad);
+ if (r != 0)
+ SETTING_TRACE("_get_privacy_app_pkg_by_pkgid : fail");
+
+ // init
+ ad->privacy_check_list = NULL;
+
+ // itc
+ setting_create_Gendial_itc("1text.1icon.3", &(ad->itc_1text_1icon));
+
+ Elm_Object_Item *item = NULL;
+ Evas_Object *scroller = NULL;
+ ad->ly_main =
+ setting_create_layout_navi_bar_genlist(ad->win_main_layout,
+ ad->win_get,
+ ad->pkg_label,
+ _("IDS_COM_BODY_BACK"),
+ NULL, //_("IDS_COM_SK_OK")
+ setting_privacy_service_click_softkey_back_cb,
+ NULL,
+ ad,
+ &ad->scroller,
+ &(ad->navi_bar));
+
+ /* separator */
+ item = elm_genlist_item_append(ad->scroller , &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ setting_create_Gendial_field_def(ad->scroller, &itc_multiline_text, NULL,
+ ad, SWALLOW_Type_LAYOUT_SPECIALIZTION_X,
+ NULL, NULL, 0, KeyStr_PrivacyService_desc, NULL, NULL);
+ /* separator */
+ item = elm_genlist_item_append(ad->scroller , &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ // get_applist
+ setting_privacy_get_privacy_list(ad);
+
+ /* separator */
+ item = elm_genlist_item_append(ad->scroller , &itc_bottom_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+ elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
+
+ /* update info */
+ setting_view_privacy_service.is_create = 1;
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_service_destroy(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+
+ if (ad->view_to_load == &setting_view_privacy_service) {
+ if (ad->ly_main) {
+ evas_object_del(ad->ly_main);
+ ad->ly_main = NULL;
+ }
+ } else {
+ elm_naviframe_item_pop(ad->navi_bar);
+ }
+ setting_view_privacy_service.is_create = 0;
+
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_service_update(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+
+ if (ad->ly_main != NULL) {
+ evas_object_show(ad->ly_main);
+ }
+
+ return SETTING_RETURN_SUCCESS;
+}
+
+static int setting_privacy_service_cleanup(void *cb)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
+
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) cb;
+ return setting_privacy_service_destroy(ad);
+}
+
+/* ***************************************************
+ **
+ **call back func
+ **
+ ****************************************************/
+static void setting_privacy_service_click_softkey_back_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retm_if(data == NULL, "Data parameter is NULL");
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ /* Send destroy request */
+ ug_destroy_me(ad->ug);
+ SETTING_TRACE_END;
+}
+
+static void setting_privacy_service_click_softkey_ok_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retm_if(data == NULL, "Data parameter is NULL");
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ SETTING_TRACE_END;
+}
+
+static void setting_privacy_service_list_Gendial_mouse_up_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ retm_if(data == NULL, "Data parameter is NULL");
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+
+ retm_if(event_info == NULL, "Invalid argument: event info is NULL");
+ Elm_Object_Item *item = (Elm_Object_Item *) event_info;
+ elm_genlist_item_selected_set(item, 0);
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
+
+ int old_status = elm_check_state_get(list_item->eo_check);
+ /* new status */
+ list_item->chk_status = !old_status;
+ elm_check_state_set(list_item->eo_check, list_item->chk_status);
+
+ /* privacy set */
+ SETTING_TRACE("ad->pkg_id : %s, ad->privacy_id:%s, list_item->chk_status:%d", ad->pkg_id, ad->privacy_id, list_item->chk_status);
+ int r = privacy_manager_set_package_privacy(ad->pkg_id, ad->privacy_id, list_item->chk_status);
+ if(r!=0)
+ SETTING_TRACE("privacy_manager_set_package_privacy : faied [%d]", r);
+}
+
+static void setting_privacy_service_list_Gendial_chk_btn_cb(void *data, Evas_Object *obj,
+ void *event_info)
+{
+ SETTING_TRACE_BEGIN;
+ /* error check */
+ //retm_if(data == NULL, "Data parameter is NULL");
+ //SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+ SettingPrivacyUG *ad = NULL;
+
+ retm_if(data == NULL, "Data parameter is NULL");
+ Setting_GenGroupItem_Data *list_item = (Setting_GenGroupItem_Data *) data;
+ ad = list_item->userdata;
+
+ /* new status */
+ list_item->chk_status = elm_check_state_get(list_item->eo_check);
+
+ /* privacy set */
+ SETTING_TRACE("ad->pkg_id : %s, ad->privacy_id:%s, list_item->chk_status:%d", ad->pkg_id, ad->privacy_id, list_item->chk_status);
+ int r = privacy_manager_set_package_privacy(ad->pkg_id, ad->privacy_id, list_item->chk_status);
+ if(r!=0)
+ SETTING_TRACE("privacy_manager_set_package_privacy : faied [%d]", r);
+}
+
--- /dev/null
+/*
+ * setting
+ *
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
+ *
+ * Contact: MyoungJune Park <mj2004.park@samsung.com>
+ *
+ * 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 <setting-privacy.h>
+
+#ifndef UG_MODULE_API
+#define UG_MODULE_API __attribute__ ((visibility("default")))
+#endif
+
+static void setting_privacy_ug_cb_resize(void *data, Evas *e,
+ Evas_Object *obj, void *event_info)
+{
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) data;
+ setting_view_update(&setting_view_privacy_service, ad);
+}
+
+setting_view *__get_privacy_view_to_load(void *data, service_h service)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retvm_if((!data), NULL, "data is NULL");
+ SettingPrivacyUG *privacyUG = (SettingPrivacyUG *)data;
+
+ setting_view_node_table_intialize();
+
+ // if argument is there, process it first
+ char *output_url = NULL;
+ int ret = service_get_operation(service, &output_url);
+
+ // service OK, but there's no argument
+ if(ret == SERVICE_ERROR_NONE
+ && 0 == safeStrCmp(output_url, "http://tizen.org/appcontrol/operation/configure/priavacy/service")
+ || 0 == safeStrCmp(output_url, "http://samsung.com/appcontrol/operation/configure/privacy/service"))
+ {
+ setting_view_node_table_register(&setting_view_privacy_service, NULL);
+ return &setting_view_privacy_service;
+
+ } else {
+ SETTING_TRACE("output url : [%s]", output_url);
+ // default action
+ //setting_view_node_table_register(&setting_view_privacy_service, setting_view_privacy_main);
+ //setting_view_node_table_register(&setting_view_privacy_main, NULL);
+ //return &setting_view_privacy_main;
+ }
+}
+
+static void *setting_privacy_ug_on_create(ui_gadget_h ug,
+ enum ug_mode mode, service_h service,
+ void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retvm_if((!priv), NULL, "!priv");
+ SettingPrivacyUG *privacyUG = priv;
+ privacyUG->ug = ug;
+ privacyUG->bundle_data = service;
+ setting_set_i18n(SETTING_PACKAGE, SETTING_LOCALEDIR);
+
+ /* register view node table */
+ //setting_view_node_table_intialize();
+ //setting_view_node_table_register(&setting_view_privacy_main, NULL);
+
+ privacyUG->win_main_layout = (Evas_Object *) ug_get_parent_layout(ug);
+ privacyUG->win_get = (Evas_Object *) ug_get_window();
+
+ evas_object_show(privacyUG->win_main_layout);
+ privacyUG->evas = evas_object_evas_get(privacyUG->win_main_layout);
+
+ setting_retvm_if(privacyUG->win_main_layout == NULL, NULL,
+ "cannot get main window ");
+
+ // create bg
+ privacyUG->bg = elm_bg_add(privacyUG->win_get);
+ elm_object_style_set(privacyUG->bg, "dialogue_field");
+ evas_object_size_hint_weight_set(privacyUG->bg, EVAS_HINT_EXPAND,
+ EVAS_HINT_EXPAND);
+
+ privacyUG->view_to_load = __get_privacy_view_to_load(privacyUG, service);
+ setting_retvm_if(NULL == privacyUG->view_to_load, NULL, "NULL == fontUG->view_to_load");
+
+ // creating a view.
+ setting_view_node_set_cur_view(privacyUG->view_to_load);
+ setting_view_create(privacyUG->view_to_load, (void *)privacyUG);
+ evas_object_event_callback_add(privacyUG->win_main_layout,
+ EVAS_CALLBACK_RESIZE,
+ setting_privacy_ug_cb_resize, privacyUG);
+
+ //----------------------------------------------------------------
+ // dialogue/2text.3
+ // add genlist
+ //----------------------------------------------------------------
+ setting_create_Gendial_itc("dialogue/2text.3", &(privacyUG->itc_2text_2));
+
+ return privacyUG->ly_main;
+}
+
+static void setting_privacy_ug_on_start(ui_gadget_h ug, service_h service,
+ void *priv)
+{
+}
+
+static void setting_privacy_ug_on_pause(ui_gadget_h ug, service_h service,
+ void *priv)
+{
+}
+
+static void setting_privacy_ug_on_resume(ui_gadget_h ug, service_h service,
+ void *priv)
+{
+}
+
+static void setting_privacy_ug_on_destroy(ui_gadget_h ug, service_h service,
+ void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ setting_retm_if((!priv), "!priv");
+ SettingPrivacyUG *privacyUG = priv;
+ evas_object_event_callback_del(privacyUG->win_main_layout, EVAS_CALLBACK_RESIZE, setting_privacy_ug_cb_resize); //fix flash issue for gallery
+ privacyUG->ug = ug;
+ if (privacyUG->bg) {
+ evas_object_del(privacyUG->bg);
+ }
+ privacyUG->bg = NULL;
+
+ // called when this shared gadget is terminated. similar with app_exit
+ setting_view_destroy(&setting_view_privacy_service, privacyUG);
+
+ if (NULL != ug_get_layout(privacyUG->ug)) {
+ evas_object_hide((Evas_Object *) ug_get_layout(privacyUG->ug));
+ evas_object_del((Evas_Object *) ug_get_layout(privacyUG->ug));
+ }
+}
+
+static void setting_privacy_ug_on_message(ui_gadget_h ug, service_h msg,
+ service_h service, void *priv)
+{
+ SETTING_TRACE_BEGIN;
+}
+
+static void setting_privacy_ug_on_event(ui_gadget_h ug,
+ enum ug_event event, service_h service,
+ void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ switch (event) {
+ case UG_EVENT_LOW_MEMORY:
+ break;
+ case UG_EVENT_LOW_BATTERY:
+ break;
+ case UG_EVENT_LANG_CHANGE:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT:
+ break;
+ case UG_EVENT_ROTATE_PORTRAIT_UPSIDEDOWN:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE:
+ break;
+ case UG_EVENT_ROTATE_LANDSCAPE_UPSIDEDOWN:
+ break;
+ case UG_EVENT_REGION_CHANGE:
+ break;
+ default:
+ break;
+ }
+}
+
+static void setting_privacy_ug_on_key_event(ui_gadget_h ug,
+ enum ug_key_event event,
+ service_h service, void *priv)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *ad = (SettingPrivacyUG *) priv;
+
+ switch (event) {
+ case UG_KEY_EVENT_END:
+ {
+ if (elm_naviframe_top_item_get(ad->navi_bar) ==
+ elm_naviframe_bottom_item_get(ad->
+ navi_bar)) {
+ ug_destroy_me(ug);
+ } else {
+
+ setting_view_cb_at_endKey(ad);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+UG_MODULE_API int UG_MODULE_INIT(struct ug_module_ops *ops)
+{
+ SETTING_TRACE_BEGIN;
+ SettingPrivacyUG *privacyUG = calloc(1, sizeof(SettingPrivacyUG));
+ setting_retvm_if(!privacyUG, -1, "Create SettingPrivacyUG obj failed");
+
+ ops->create = setting_privacy_ug_on_create;
+ ops->start = setting_privacy_ug_on_start;
+ ops->pause = setting_privacy_ug_on_pause;
+ ops->resume = setting_privacy_ug_on_resume;
+ ops->destroy = setting_privacy_ug_on_destroy;
+ ops->message = setting_privacy_ug_on_message;
+ ops->event = setting_privacy_ug_on_event;
+ ops->key_event = setting_privacy_ug_on_key_event;
+ ops->priv = privacyUG;
+ ops->opt = UG_OPT_INDICATOR_ENABLE;
+ return 0;
+}
+
+UG_MODULE_API void UG_MODULE_EXIT(struct ug_module_ops *ops)
+{
+ SETTING_TRACE_BEGIN;
+ struct SettingPrivacyUG *privacyUG;
+ setting_retm_if(!ops, "ops == NULL");
+
+ privacyUG = ops->priv;
+ if (privacyUG) {
+ FREE(privacyUG);
+ }
+}
+
+/* ***************************************************
+**
+** general func
+**
+** **************************************************/
+
+/**
+* Reset function to 'reset' the settings of the UG, it will be invoked by 'Reset' UG
+*
+* @param[in] data
+* @param[in] priv
+*/
+