Disable Factory reset menu .
authoryigang.jing <yigang.jing@samsung.com>
Tue, 4 Dec 2012 08:44:29 +0000 (16:44 +0800)
committeryigang.jing <yigang.jing@samsung.com>
Wed, 5 Dec 2012 01:14:17 +0000 (09:14 +0800)
Change-Id: Id167bedb0c3c09e1a12f681faecd5d7a76cfc611

setting-reset/include/setting-reset.h
setting-reset/src/setting-reset-main.c

index 520fd9b..c4fda3a 100755 (executable)
@@ -55,7 +55,6 @@
 #define SIMPLY_SUPPORT_ALL_RESET 0
 #define SUPPORT_RESET_DETAILS 1
 #define SUPPORT_SIM_CARD_PROFILE 1
-#define SUPPORT_FACTORY_RESET 1
 #define SUPPORT_RESET_OLD 0
 
 typedef struct _SettingResetUG SettingResetUG;
@@ -84,8 +83,6 @@ struct _SettingResetUG {
        Evas_Object *reset_list;
        Evas_Object *main_scroller;
 
-       Evas_Object *pop_factory_reset;
-
        Setting_Done_List_Data list_data;
        Ecore_Animator *animator;
        Ecore_Idler *reset_all_idler;
index a0fc30b..7ab3e90 100755 (executable)
@@ -42,28 +42,6 @@ static void setting_reset_main_click_softkey_cancel_cb(void *data,
 static void setting_reset_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info);
 #endif
 
-
-
-#if SUPPORT_FACTORY_RESET
-static bool is_factory_reset_installed()
-{
-       char *file_name = "/usr/bin/factory-reset";
-
-       struct stat st;
-       if(stat(file_name, &st) == 0)
-       {
-               return true;
-       }
-       else
-       {
-               SETTING_TRACE_ERROR(" %s is *NOT* present\n", file_name);
-               return false;
-       }
-}
-#endif
-
-
-
 /* ***************************************************
  *
  *basic func
@@ -143,15 +121,7 @@ static int setting_reset_main_create(void *cb)
                                                                NULL, NULL,
                                                                0, SIM_CARD_PROFILE_SETTINGS_STR, NULL, NULL);
 #endif
-#if SUPPORT_FACTORY_RESET
-       /* 3. Factory reset */
-       setting_create_Gendial_field_def(scroller, &itc_1text,
-                                                               setting_reset_main_mouse_up_Gendial_list_cb,ad,
-                                                               SWALLOW_Type_INVALID,
-                                                               NULL, NULL,
-                                                               0,FACTORY_RESET_STR, NULL, NULL);
 
-#endif
 #if DISABLED_CODE
        /* Description */
        setting_create_Gendial_field_def(scroller, &itc_multiline_text, NULL,
@@ -310,172 +280,6 @@ static int setting_reset_main_cleanup(void *cb)
        return SETTING_RETURN_SUCCESS;
 }
 
-
-/*
-       execute /usr/bin/factory-reset after creating a process with fork()
- */
-#if SUPPORT_SECURITY
-static void
-setting_reset_main_result_password_ug_cb(ui_gadget_h ug, service_h result,
-                                        void *priv)
-{
-       SETTING_TRACE_BEGIN;
-       /* error check */
-       retm_if(priv == NULL, "Data parameter is NULL");
-
-       SettingResetUG *ad = (SettingResetUG *) priv;
-
-       char *ret_str = NULL;
-       service_get_extra_data(result, "result", &ret_str);
-       SETTING_TRACE("result:%s", ret_str);
-
-       retm_if(ret_str == NULL, "result paremeter is NULL");
-
-       if (ret_str) {
-               if (0 == safeStrCmp("Cancel", ret_str)) {
-                       /* Do not reset */
-               }
-               else if (0 == safeStrCmp("SETTING_PW_TYPE_RESET", ret_str)) {
-                       ug_destroy(ad->ug_loading);
-                       ad->ug_loading = NULL;
-                       /* do factory reset here. */
-                       int pid = -1;
-                       pid = fork();
-                       setting_retm_if(pid < 0, "failed to fork");
-
-                       if (pid == 0) {
-                               char *environ[] = { NULL };
-                               char *argv[] = {"factory-reset"};
-                               execve("/usr/bin/factory-reset", argv, environ);
-                               exit(0);
-                       }
-               }
-       }
-}
-
-static void
-setting_reset_main_layout_ug_cb(ui_gadget_h ug, enum ug_mode mode,
-                               void *priv)
-{
-       SettingResetUG *ad = (SettingResetUG *) priv;
-       Evas_Object *base;
-
-       if (!ug || !priv)
-               return;
-       SETTING_TRACE_BEGIN;
-
-       base = (Evas_Object *) ug_get_layout(ug);
-       if (!base)
-               return;
-
-       switch (mode) {
-       case UG_MODE_FULLVIEW:
-               evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
-                                                EVAS_HINT_EXPAND);
-               elm_win_resize_object_add(ad->win_get, base);
-               evas_object_show(base);
-               break;
-       default:
-               break;
-       }
-       SETTING_TRACE_END;
-}
-
-static void setting_reset_main_destroy_password_ug_cb(ui_gadget_h ug,
-                                                     void *priv)
-{
-       SETTING_TRACE_BEGIN;
-       /* if(ug) ug_destroy(ug); */
-       ret_if(!priv);
-       SettingResetUG *ad = (SettingResetUG *) priv;
-       if (ug) {
-               ug_destroy(ug);
-               ad->ug_loading = NULL;
-       }
-
-}
-#endif
-
-#if SUPPORT_SECURITY
-static bool setting_reset_main_create_password_sg(void *data)
-{
-       SETTING_TRACE_BEGIN;
-       /* error check */
-       retv_if(data == NULL, FALSE);
-
-       SettingResetUG *ad = (SettingResetUG *) data;
-
-       struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
-       if (!cbs)
-               return FALSE;
-       cbs->layout_cb = setting_reset_main_layout_ug_cb;
-       cbs->result_cb = setting_reset_main_result_password_ug_cb;
-       cbs->destroy_cb = setting_reset_main_destroy_password_ug_cb;
-       cbs->priv = (void *)ad;
-       service_h svc;
-       if (service_create(&svc)) {
-               FREE(cbs);
-               return FALSE;
-       }
-       service_add_extra_data(svc, "viewtype", "SETTING_PW_TYPE_RESET");
-
-       ad->ug_loading =
-           ug_create(ad->ug, "setting-password-efl", UG_MODE_FULLVIEW, svc, cbs);
-       if (NULL == ad->ug_loading) {   /* error handling */
-       }
-
-       service_destroy(svc);
-       FREE(cbs);
-
-       return TRUE;
-}
-#endif
-static void __ask_create_factory_reset_resp_cb(void *data, Evas_Object *obj,
-                                          void *event_info)
-{
-       SETTING_TRACE_BEGIN;
-
-       SettingResetUG *ad = (SettingResetUG *) data;
-       ret_if(NULL == data);
-
-       int response_type = btn_type(obj);
-       //int screen_lock_type = 0;
-
-       if (POPUP_RESPONSE_OK == response_type) {
-               SETTING_TRACE("OK");
-#if SUPPORT_SECURITY
-               vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &screen_lock_type);
-               if(screen_lock_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
-                       || screen_lock_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
-               {
-                       setting_reset_main_create_password_sg(ad);
-               }
-               else
-               {
-#endif
-                       /* do factory reset here. */
-                       int pid = -1;
-                       pid = fork();
-                       setting_retm_if(pid < 0, "failed to fork");
-
-                       if (pid == 0) {
-                               char *environ[] = { NULL };
-                               char *argv[] = {"factory-reset"};
-                               execve("/usr/bin/factory-reset", argv, environ);
-                               exit(0);
-                       }
-#if SUPPORT_SECURITY
-               }
-#endif
-       } else if (POPUP_RESPONSE_CANCEL == response_type) {
-               SETTING_TRACE("NO");
-               // do nothing
-       }
-
-       evas_object_del(ad->pop_factory_reset);
-       ad->pop_factory_reset = NULL;
-}
-
 #if SUPPORT_RESET_DETAILS
 static void
 setting_reset_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *event_info)
@@ -506,25 +310,7 @@ setting_reset_main_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj, void *
                setting_create_simple_popup(NULL, ad->win_get, NULL, "NOT IMPLMENTED YET");
        }
 #endif
-#if SUPPORT_FACTORY_RESET
-       else if (!safeStrCmp(FACTORY_RESET_STR, list_item->keyStr))
-       {
-               /* TBD */
-               SETTING_TRACE("FACTORY RESET");
-
-               if(is_factory_reset_installed())
-               {
-                       //setting_create_simple_popup(NULL, ad->win_get, NULL, "NOT IMPLMENTED YET");
-                       ad->pop_factory_reset = setting_create_popup_with_btn(ad,
-                                                         ad->win_get,
-                                                         NULL, _("Reset all settings and delete all data. This cannot be stopped once started"),
-                                                         __ask_create_factory_reset_resp_cb,
-                                                         0, 2, _("IDS_COM_SK_YES"),_("IDS_COM_SK_NO"));
-               } else {
-                       setting_create_simple_popup(NULL, ad->win_get, NULL, "NOT SUPPORTED");
-               }
-       }
-#endif
+
        /* to do : */
 }
 #endif