4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd.
6 * Contact: MyoungJune Park <mj2004.park@samsung.com>
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
21 #include <setting-common-data-type.h>
22 #include <setting-common-data-slp-setting.h>
23 #include <setting-common-draw-widget.h>
24 #include <setting-common-view.h>
26 #include <setting-security-locktype.h>
27 #include <setting-security.h>
28 #include <setting-debug.h>
29 #include <security-server.h>
31 #include <efl_assist.h>
36 static int setting_security_locktype_create(void *cb);
37 static int setting_security_locktype_destroy(void *cb);
38 static int setting_security_locktype_update(void *cb);
39 static int setting_security_locktype_cleanup(void *cb);
40 static void __record_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
41 setting_view setting_view_security_locktype = {
42 .create = setting_security_locktype_create,
43 .destroy = setting_security_locktype_destroy,
44 .update = setting_security_locktype_update,
45 .cleanup = setting_security_locktype_cleanup,
48 openlock_appdata *lockapp_data = NULL;
50 /* ***************************************************
54 ****************************************************/
56 static int __get_lockapp_index_from_pkgname(char *pkg_name)
60 return SETTING_RETURN_FAIL;
62 openlock_appdata *item = lockapp_data;
63 for (; item != NULL; item = item->next) {
64 if (safeStrCmp(item->pkg_name, pkg_name) == 0)
67 return SETTING_RETURN_FAIL;
69 static int __get_lockapp_index_from_appname(char *app_name)
73 return SETTING_RETURN_FAIL;
75 openlock_appdata *item = lockapp_data;
76 for (; item != NULL; item = item->next) {
77 if (safeStrCmp(item->app_name, app_name) == 0)
80 return SETTING_RETURN_FAIL;
82 static char *__get_lockapp_pkgname_from_appname(char *app_name)
88 openlock_appdata *item = lockapp_data;
89 for (; item != NULL; item = item->next) {
90 if (safeStrCmp(item->app_name, app_name) == 0)
91 return item->app_name;
96 ail_cb_ret_e __get_appinfo_cb(const ail_appinfo_h appinfo, void *user_data)
100 openlock_appdata *item = lockapp_data;
101 openlock_appdata *new_item = NULL;
102 char *pkg_name = NULL;
103 char *app_name = NULL;
105 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
106 ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &app_name);
108 while (item->next != NULL)
111 if (item->index == 0 && item->pkg_name == NULL) {
113 item->pkg_name = strdup(pkg_name);
114 item->app_name = strdup(app_name);
116 SETTING_TRACE_DEBUG("app info %d %s %s", item->index, item->pkg_name, item->app_name);
119 new_item = (openlock_appdata *)malloc(sizeof(openlock_appdata));
120 if (new_item != NULL) {
121 memset(new_item, 0x00, sizeof(openlock_appdata));
122 new_item->pkg_name = strdup(pkg_name);
123 new_item->app_name = strdup(app_name);
124 new_item->index = item->index + 1;
125 new_item->prev = item;
126 item->next = new_item;
128 SETTING_TRACE_DEBUG("app info %d %s %s", new_item->index, new_item->pkg_name, new_item->app_name);
130 SETTING_TRACE_DEBUG("malloc() failed");
133 return AIL_CB_RET_CONTINUE;
136 static void __add_3rd_party_lock(void *data)
139 ret_if(data == NULL);
141 SettingSecurityUG *ad = (SettingSecurityUG *) data;
143 /* Get info from AIL */
148 ret = ail_filter_new(&filter);
149 if (ret != AIL_ERROR_OK) {
150 SETTING_TRACE_DEBUG("ail_filter_new() failed");
153 ret = ail_filter_add_str(filter, AIL_PROP_CATEGORIES_STR, "lockscreen");
154 ret = ail_filter_count_appinfo(filter, &count);
155 SETTING_TRACE_DEBUG("There is/are %d 3rd lock app(s)", count);
157 SETTING_TRACE_DEBUG("No 3rd lock app");
158 ail_filter_destroy(filter);
163 lockapp_data = (openlock_appdata *)malloc(sizeof(openlock_appdata));
164 if (lockapp_data == NULL) {
165 SETTING_TRACE_DEBUG("malloc() failed");
168 memset(lockapp_data, 0x00, sizeof(openlock_appdata));
169 lockapp_data->prev = NULL;
170 lockapp_data->next = NULL;
171 lockapp_data->pkg_name = NULL;
172 lockapp_data->app_name = NULL;
173 lockapp_data->index = 0;
175 ail_filter_list_appinfo_foreach(filter, __get_appinfo_cb, ad);
176 ail_filter_destroy(filter);
179 openlock_appdata *list = lockapp_data;
181 for (index = 0; index < count; index++) {
182 ad->data_locktype_3rd[index] = setting_create_Gendial_field_1radio(ad->sl_scroller,
183 &(itc_1text_1icon_3),
184 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
187 ad->lock_type_rd, SETTING_SCREEN_LOCK_TYPE_OTHER + index,
190 if (ad->data_locktype_3rd[index]) {
191 ad->data_locktype_3rd[index]->userdata = ad;
193 SETTING_TRACE_ERROR("item_data is NULL");
200 bool __voice_recorder_destroy(recorder_h handle)
204 SETTING_TRACE("Camcorder is already destroyed");
208 /*recorder_unset_recording_limit_reached_cb(handle); */
209 /*recorder_unset_recording_status_cb(handle); */
210 /*recorder_unset_state_changed_cb(handle); */
212 recorder_state_e rec_state = RECORDER_STATE_NONE;
213 recorder_get_state(handle, &rec_state);
214 if (rec_state == RECORDER_STATE_PAUSED || rec_state == RECORDER_STATE_RECORDING)
215 recorder_cancel(handle);
217 recorder_get_state(handle, &rec_state);
218 if (rec_state == RECORDER_STATE_READY)
219 recorder_unprepare(handle);
221 recorder_get_state(handle, &rec_state);
222 if (rec_state == RECORDER_STATE_CREATED)
223 recorder_destroy(handle);
228 recorder_h __voice_recorder_create()
231 recorder_h handle = NULL;
233 int mmf_ret = recorder_create_audiorecorder(&handle);
234 if (mmf_ret != RECORDER_ERROR_NONE) {
235 SETTING_TRACE_ERROR("recorder_create_audiorecorder Error : %x", mmf_ret);
240 SETTING_TRACE("Set attribut of recorder");
241 /*recorder_set_state_changed_cb(handle, cbs->state_changed_cb, cb_data); */
242 /*recorder_set_recording_status_cb(handle, cbs->recording_status_cb, cb_data); */
243 /*recorder_set_recording_limit_reached_cb(handle, cbs->limit_reached_cb, cb_data); */
244 /*recorder_set_error_cb(handle, cbs->error_cb, cb_data); */
245 recorder_audio_codec_e encoder = RECORDER_AUDIO_CODEC_AAC;
246 recorder_file_format_e file_format = RECORDER_FILE_FORMAT_MP4;
248 int sample_rate = 44100;
249 int bitrate = 64000;/* 288000 */
252 mmf_ret = recorder_attr_set_audio_device(handle, RECORDER_AUDIO_DEVICE_MIC);
253 if (mmf_ret != RECORDER_ERROR_NONE) {
254 SETTING_TRACE_ERROR("recorder_attr_set_audio_device().. [%x]", mmf_ret);
258 mmf_ret = recorder_set_audio_encoder(handle, encoder);
259 if (mmf_ret != RECORDER_ERROR_NONE) {
260 SETTING_TRACE_ERROR("recorder_set_audio_encoder().. [%x]", mmf_ret);
264 mmf_ret = recorder_set_file_format(handle, file_format);
265 if (mmf_ret != RECORDER_ERROR_NONE) {
266 SETTING_TRACE_ERROR("recorder_set_file_format().. [%x]", mmf_ret);
270 mmf_ret = recorder_attr_set_audio_samplerate(handle, sample_rate);
271 if (mmf_ret != RECORDER_ERROR_NONE) {
272 SETTING_TRACE_ERROR("recorder_attr_set_audio_samplerate().. [%x]", mmf_ret);
276 mmf_ret = recorder_attr_set_audio_encoder_bitrate(handle, bitrate);
277 if (mmf_ret != RECORDER_ERROR_NONE) {
278 SETTING_TRACE_ERROR("recorder_attr_set_audio_encoder_bitrate().. [%x]", mmf_ret);
282 /*mmf_ret = recorder_set_filename(handle, target_filename);
283 if (mmf_ret != RECORDER_ERROR_NONE) {
284 SETTING_TRACE_ERROR("recorder_set_filename().. [%x]", mmf_ret);
287 mmf_ret = recorder_attr_set_size_limit(handle, max_size);
288 if (mmf_ret != RECORDER_ERROR_NONE) {
289 SETTING_TRACE_ERROR("recorder_attr_set_size_limit().. [%x]", mmf_ret);
295 SETTING_TRACE("recorder_prepare");
296 mmf_ret = recorder_prepare(handle);
297 if (mmf_ret == RECORDER_ERROR_NONE) {
298 SETTING_TRACE("recorder_prepare success");
300 SETTING_TRACE_ERROR("recorder_prepare Error : %x\n", mmf_ret);
304 /*mmf_ret = recorder_start(handle);
305 if (mmf_ret == RECORDER_ERROR_NONE)
306 SETTING_TRACE("recorder_start success");
308 SETTING_TRACE_ERROR("recorder_start Error : %x", mmf_ret);
317 recorder_destroy(handle);
322 static void __change_simple_password_cb(void *data, Evas_Object *obj, void *event_info)
324 retm_if(data == NULL, "Data parameter is NULL");
325 Setting_GenGroupItem_Data *list_item =
326 (Setting_GenGroupItem_Data *) data;
329 SettingSecurityUG *ad = (SettingSecurityUG *)list_item->userdata;
333 ad->pw_type = SETTING_SEC_PW_CHANGE_SIMPLE_PASSWD;
334 setting_security_create_password_sg(ad);
337 static void __change_password_cb(void *data, Evas_Object *obj, void *event_info)
339 retm_if(data == NULL, "Data parameter is NULL");
340 Setting_GenGroupItem_Data *list_item =
341 (Setting_GenGroupItem_Data *) data;
344 SettingSecurityUG *ad = (SettingSecurityUG *)list_item->userdata;
348 ad->pw_type = SETTING_SEC_PW_CHANGE_PASSWD;
349 setting_security_create_password_sg(ad);
352 static Eina_Bool __update_locktype_items_status(void *data)
355 retv_if(data == NULL, FALSE);
357 SettingSecurityUG *ad = (SettingSecurityUG *) data;
362 char *encryption_state = NULL;
363 encryption_state = vconf_get_str(VCONFKEY_ODE_CRYPTO_STATE);
364 if (encryption_state != NULL) {
365 if (safeStrCmp(encryption_state, "mounted") == 0
366 || safeStrCmp(encryption_state, "encrypted") == 0) {
370 FREE(encryption_state);
372 vconf_get_bool(VCONFKEY_SETAPPL_MMC_ENCRYPTION_STATUS_BOOL, &enc_sde);
373 if (enc_ode || enc_sde)
374 ad->cur_enc_mode = TRUE;
376 ad->cur_enc_mode = FALSE;
378 if (ad->cur_enc_mode == TRUE) {
379 setting_disable_genlist_item(ad->data_locktype_none->item);
380 setting_disable_genlist_item(ad->data_locktype_swipe->item);
381 setting_disable_genlist_item(ad->data_locktype_motion->item);
382 /*setting_disable_genlist_item(ad->data_locktype_face); */
383 setting_disable_genlist_item(ad->data_locktype_simple->item);
386 while (ad->data_locktype_3rd[index] && ad->data_locktype_3rd[index]->item) {
387 setting_disable_genlist_item(ad->data_locktype_3rd[index]->item);
392 ADD_GL_LABLE(ad->sl_scroller, "IDS_ST_BODY_SCREEN_LOCK_TYPE_CANNOT_BE_CHANGED_WHILE_ENCRYPTING_THE_DEVICE");
393 } else if (enc_sde) {
394 ADD_GL_LABLE(ad->sl_scroller, "IDS_ST_BODY_SCREEN_LOCK_TYPE_CANNOT_BE_CHANGED_WHILE_ENCRYPTING_THE_SD_CARD");
398 /*ecore_timer_del(ad->update_locktype_timer); */
399 ad->update_locktype_timer = NULL;
401 return ECORE_CALLBACK_CANCEL;
404 void __add_locktype_items(void *data)
407 ret_if(data == NULL);
409 SettingSecurityUG *ad = (SettingSecurityUG *) data;
411 Elm_Object_Item *item = NULL;
416 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &locktype);
418 char *encryption_state = NULL;
419 encryption_state = vconf_get_str(VCONFKEY_ODE_CRYPTO_STATE);
420 if ((encryption_state != NULL) && (safeStrCmp(encryption_state, "mounted") == 0)) {
421 ad->cur_enc_mode = 1;
423 if (ode_init() == 0) {
424 int sde_status = sde_checkencrypt();
426 ad->cur_enc_mode = 1;
429 FREE(encryption_state);
431 radio = elm_radio_add(ad->sl_scroller);
432 elm_radio_state_value_set(radio, -1);
433 ad->lock_type_rd = radio;
436 item = elm_genlist_item_append(ad->sl_scroller, &itc_seperator, NULL, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
437 elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
439 evas_object_smart_callback_add(ad->sl_scroller, "realized", __gl_realized_cb, NULL);
441 /* to do : radio menu */
443 ad->data_locktype_none =
444 setting_create_Gendial_field_1radio(ad->sl_scroller,
445 &(itc_1text_1icon_3),
446 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
449 radio, SETTING_SCREEN_LOCK_TYPE_NONE,
451 setting_security_locktype_click_radio_cb);
452 if (ad->data_locktype_none) {
453 ad->data_locktype_none->userdata = ad;
454 ad->data_locktype_none->group_style = SETTING_GROUP_STYLE_TOP;
457 SETTING_TRACE_ERROR("item_data is NULL");
461 ad->data_locktype_swipe =
462 setting_create_Gendial_field_1radio(ad->sl_scroller,
463 &(itc_1text_1icon_3),
464 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
467 radio, SETTING_SCREEN_LOCK_TYPE_SWIPE,
469 setting_security_locktype_click_radio_cb);
470 if (ad->data_locktype_swipe) {
471 ad->data_locktype_swipe->userdata = ad;
472 ad->data_locktype_swipe->group_style = SETTING_GROUP_STYLE_CENTER;
474 SETTING_TRACE_ERROR("item_data is NULL");
478 ad->data_locktype_motion =
479 setting_create_Gendial_field_1radio(ad->sl_scroller,
480 &(itc_1text_1icon_3),
481 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
484 radio, SETTING_SCREEN_LOCK_TYPE_MOTION,
485 "IDS_ST_BODY_MOTION",
486 setting_security_locktype_click_radio_cb);
487 if (ad->data_locktype_motion) {
488 ad->data_locktype_motion->userdata = ad;
489 ad->data_locktype_motion->group_style = SETTING_GROUP_STYLE_CENTER;
491 SETTING_TRACE_ERROR("item_data is NULL");
494 /* 3) Face and voice */
495 ad->data_locktype_face =
496 setting_create_Gendial_field_1radio(ad->sl_scroller,
497 &(itc_1text_1icon_3),
498 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
501 radio, SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE,
503 setting_security_locktype_click_radio_cb);
504 if (ad->data_locktype_face) {
505 ad->data_locktype_face->userdata = ad;
506 ad->data_locktype_face->group_style = SETTING_GROUP_STYLE_CENTER;
508 SETTING_TRACE_ERROR("item_data is NULL");
511 /* 4) simple password */
512 if (locktype == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) {
513 ad->data_locktype_simple =
514 setting_create_Gendial_field_1radio_1button(ad->sl_scroller,
515 &(itc_1text_2icon_2),
516 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
518 SWALLOW_Type_1RADIO_1BTN,
519 "reveal", /* button style */
520 radio, SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD,
521 "IDS_ST_BODY_SIMPLE_PASSWORD",
522 setting_security_locktype_click_radio_cb, /* radio callback */
523 __change_simple_password_cb); /* button callback */
525 ad->data_locktype_simple =
526 setting_create_Gendial_field_1radio(ad->sl_scroller,
527 &(itc_1text_1icon_3),
528 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
530 SWALLOW_Type_1RADIO_1BTN,
531 radio, SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD,
532 "IDS_ST_BODY_SIMPLE_PASSWORD",
533 setting_security_locktype_click_radio_cb);
536 if (ad->data_locktype_simple) {
537 ad->data_locktype_simple->userdata = ad;
538 ad->data_locktype_simple->group_style = SETTING_GROUP_STYLE_CENTER;
540 SETTING_TRACE_ERROR("item_data is NULL");
544 if (locktype == SETTING_SCREEN_LOCK_TYPE_PASSWORD) {
545 ad->data_locktype_password =
546 setting_create_Gendial_field_1radio_1button(ad->sl_scroller,
547 &(itc_1text_2icon_2),
548 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
550 SWALLOW_Type_1RADIO_1BTN,
551 "reveal", /* button style */
552 radio, SETTING_SCREEN_LOCK_TYPE_PASSWORD,
553 "IDS_ST_BODY_PASSWORD",
554 setting_security_locktype_click_radio_cb, /* radio callback */
555 __change_password_cb); /* button callback */
557 ad->data_locktype_password =
558 setting_create_Gendial_field_1radio(ad->sl_scroller,
559 &(itc_1text_1icon_3),
560 setting_security_locktype_mouse_up_Gendial_list_cb, /*add to sel_cb */
563 radio, SETTING_SCREEN_LOCK_TYPE_PASSWORD,
564 "IDS_ST_BODY_PASSWORD",
565 setting_security_locktype_click_radio_cb);
567 if (ad->data_locktype_password) {
568 ad->data_locktype_password->userdata = ad;
569 ad->data_locktype_password->group_style = SETTING_GROUP_STYLE_BOTTOM;
571 SETTING_TRACE_ERROR("item_data is NULL");
574 /* Add 3rd party lock apps in list. */
575 __add_3rd_party_lock(ad);
578 /* To do : If type is OTHER, should calculate something.*/
579 if (locktype == SETTING_SCREEN_LOCK_TYPE_OTHER) {
580 char *open_lock_name = NULL;
581 open_lock_name = vconf_get_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
582 index = __get_index_of_lockapp(open_lock_name);
585 FREE(open_lock_name);
589 elm_radio_value_set(radio, locktype);
591 elm_radio_value_set(radio, locktype + index);
593 ad->update_locktype_timer = ecore_timer_add(0.5, __update_locktype_items_status, ad);
594 /*__update_locktype_items_status(ad); */
598 static void __lock_type_key_changed_cb(keynode_t *key, void *data)
600 ret_if(data == NULL);
602 SettingSecurityUG *ad = data;
604 char *vconf_name = vconf_keynode_get_name(key);
606 if (!safeStrCmp(vconf_name, VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT)) {
607 /*status = vconf_keynode_get_int(key); */
609 if (ad->sl_scroller) {
610 elm_genlist_clear(ad->sl_scroller);
611 __add_locktype_items(ad);
614 ug_destroy_me(ad->ug);
618 static int setting_security_locktype_create(void *cb)
621 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
623 SettingSecurityUG *ad = (SettingSecurityUG *) cb;
625 /* add basic layout */
627 Evas_Object *scroller = NULL;
628 if (&setting_view_security_locktype == ad->view_to_load) {
630 setting_create_layout_navi_bar_genlist(ad->win_main_layout,
632 "IDS_ST_BODY_SCREEN_LOCK_TYPE",
633 _("IDS_COM_BODY_BACK"),
635 setting_security_locktype_click_softkey_back_cb,
638 ad->screen_lock_main_item = elm_naviframe_top_item_get(ad->navi_bar);
640 ad->screen_lock_main_item = setting_push_layout_navi_bar_genlist(ad->win_main_layout,
642 "IDS_ST_BODY_SCREEN_LOCK_TYPE",
643 _("IDS_COM_BODY_BACK"), NULL,
644 setting_security_locktype_click_softkey_back_cb,
645 NULL, ad, &scroller, ad->navi_bar);
648 ad->sl_scroller = scroller;
650 __add_locktype_items(ad);
652 vconf_notify_key_changed(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, __lock_type_key_changed_cb, ad);
654 setting_view_security_locktype.is_create = 1;
656 ad->recorder_handle = __voice_recorder_create();
658 return SETTING_RETURN_SUCCESS;
661 static int setting_security_locktype_destroy(void *cb)
665 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
667 SettingSecurityUG *ad = (SettingSecurityUG *) cb;
669 (void)vconf_ignore_key_changed(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT,
670 __lock_type_key_changed_cb);
672 if (ad->recorder_handle) {
673 __voice_recorder_destroy(ad->recorder_handle);
674 ad->recorder_handle = NULL;
677 if (ad->update_locktype_timer) {
678 ecore_timer_del(ad->update_locktype_timer);
679 ad->update_locktype_timer = NULL;
682 evas_object_del(ad->notify);
685 ad->screen_lock_main_item = NULL;
686 if (&setting_view_security_locktype == ad->view_to_load) {
687 evas_object_del(ad->ly_main);
689 elm_naviframe_item_pop(ad->navi_bar);
691 setting_view_security_locktype.is_create = 0;
693 return SETTING_RETURN_SUCCESS;
696 static int setting_security_locktype_update(void *cb)
700 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
702 __update_locktype_items_status(cb);
704 return SETTING_RETURN_SUCCESS;
707 static int setting_security_locktype_cleanup(void *cb)
711 retv_if(cb == NULL, SETTING_GENERAL_ERR_NULL_DATA_PARAMETER);
713 SettingSecurityUG *ad = (SettingSecurityUG *) cb;
715 if (&setting_view_security_locktype == ad->view_to_load) {
716 return SETTING_RETURN_SUCCESS;
718 return setting_security_locktype_destroy(ad);
721 /* ***************************************************
725 ****************************************************/
726 const char *record_img[] = {
727 SETTING_ICON_PATH_CFG "motions/direct call/B15_direct_call_01.png",
728 /*SETTING_ICON_PATH_CFG "motions/direct call/B15_direct_call_02.png", */
729 /*SETTING_ICON_PATH_CFG "motions/direct call/B15_direct_call_03.png", */
732 const char *motion_img[] = {
733 SETTING_ICON_PATH_CFG "motions/unlock_illust_01.png",
734 SETTING_ICON_PATH_CFG "motions/unlock_illust_02.png",
739 __motion_set_cb(void *data, Evas_Object *obj, void *event_info)
742 SETTING_TRACE("[HYEJIN] __motion_guild_ly_cb() start. ");
744 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
745 SettingSecurityUG *ad = (SettingSecurityUG *) data;
747 if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, SETTING_SCREEN_LOCK_TYPE_MOTION) == 0) {
748 elm_radio_value_set(ad->lock_type_rd, SETTING_SCREEN_LOCK_TYPE_MOTION);
749 if (ad->old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
750 || ad->old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
751 SETTING_TRACE_DEBUG("set_pwd result : %d", security_server_set_pwd(ad->input_pwd, "0000", 0, 0));
753 int ckmc_ret = CKMC_ERROR_NONE;
754 ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL);
755 SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret);
758 elm_naviframe_item_pop(ad->navi_bar);
759 ug_destroy_me(ad->ug);
763 __motion_cancel_cb(void *data, Evas_Object *obj, void *event_info)
766 SETTING_TRACE("[HYEJIN] __motion_guild_ly_cb() start. ");
768 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
769 SettingSecurityUG *ad = (SettingSecurityUG *) data;
771 elm_naviframe_item_pop(ad->navi_bar);
772 ug_destroy_me(ad->ug);
775 ___camera_ug_kayout_cb(ui_gadget_h ug, enum ug_mode mode,
779 SettingSecurityUG *ad = (SettingSecurityUG *) priv;
785 base = (Evas_Object *) ug_get_layout(ug);
790 case UG_MODE_FULLVIEW:
791 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND,
793 /*elm_win_resize_object_add(ad->win_get, base); */
794 evas_object_show(base);
796 case UG_MODE_FRAMEVIEW:
797 elm_layout_content_set(ad->video_ly, "elm.swallow.content", base);
803 static void ___camera_ug_destory_cb(ui_gadget_h ug,
808 /*SettingSecurityUG *ad = (SettingSecurityUG *) priv;
811 ad->ug_loading = NULL;
815 void __load_camera_ug(SettingSecurityUG *ad)
818 if (app_control_create(&svc)) {
822 /*service_add_extra_data(svc, "launch-type", "select-one"); */
823 /*service_add_extra_data(svc, "file-type", "image"); */
824 /*service_set_window(service, win_id); */
825 app_control_set_operation(svc, "Normal");
826 /*service_set_mime(service, "image/jpg"); */
828 struct ug_cbs *cbs = (struct ug_cbs *)calloc(1, sizeof(struct ug_cbs));
830 app_control_destroy(svc);
834 cbs->layout_cb = ___camera_ug_kayout_cb;
835 cbs->result_cb = NULL;
836 cbs->destroy_cb = ___camera_ug_destory_cb;
837 cbs->priv = (void *)ad;
839 elm_object_tree_focus_allow_set(ad->ly_main, EINA_FALSE);
840 ad->ug_loading = setting_ug_create(ad->ug, "camera-efl", UG_MODE_FRAMEVIEW, svc, cbs);
841 SETTING_TRACE("ad->ug_loading = %p", ad->ug_loading);
843 if (NULL == ad->ug_loading) { /* error handling */
844 setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
847 app_control_destroy(svc);
853 __voice_record_back_cb(void *data, Evas_Object *obj, void *event_info)
856 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
857 SettingSecurityUG *ad = (SettingSecurityUG *) data;
858 elm_naviframe_item_pop(ad->navi_bar);
859 if (ad->video_ly_show_face_btn) elm_object_text_set(ad->video_ly_show_face_btn, _(Show_Face_Str));
860 __load_camera_ug(ad);
863 static void ___record_popup_cb(void *data, Evas_Object *obj,
866 setting_retm_if(NULL == data, "NULL == data");
867 SettingSecurityUG *ad = (SettingSecurityUG *) data;
868 const char *btn_str = elm_object_text_get(obj);
869 /*int response_type = btn_type(obj); */
870 if (0 == safeStrCmp(btn_str, _("IDS_COM_SK_DONE"))) {
871 /*__load_password_ug(ad); */
872 ad->pw_type = SETTING_SEC_PW_SIMPLE_PASSWD;
873 if (elm_radio_value_get(ad->lock_type_rd) != SETTING_SCREEN_LOCK_TYPE_PASSWORD)
874 ad->input_pwd = (char *)strdup("0000");
875 setting_security_create_password_sg(ad);
877 } else if (0 == safeStrCmp(btn_str, _(ADAPT_VOICE_STR))) {
878 if (ad->record_genlist) {
879 Evas_Object *scroller = ad->record_genlist;
880 elm_genlist_clear(scroller); /* first to clear list */
881 elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS);
883 ADD_GL_LABLE(scroller, _(Voice_Unlock_Guildtext));
884 ADD_GL_GIF(scroller, record_img)
885 ADD_GL_LABLE(scroller, _(Voice_Unlock_Guildtext2));
886 ADD_GL_BUTTON(scroller, _(Voice_Record_BtnStr), __record_btn_click_cb, ad)
890 evas_object_del(ad->notify);
894 static Eina_Bool __record_timer_cb(void *data)
897 retv_if(data == NULL, TRUE);
898 SettingSecurityUG *ad = (SettingSecurityUG *) data;
899 SETTING_TRACE("ad->processed_img_num:%d", ad->processed_img_num);
900 if (ad->processed_img_num < MAX_VOICE_TIME) {
902 recorder_state_e rec_state = RECORDER_STATE_NONE;
903 recorder_get_state(ad->recorder_handle, &rec_state);
904 if (rec_state == RECORDER_STATE_PAUSED || rec_state == RECORDER_STATE_RECORDING) {
905 if (recorder_commit(ad->recorder_handle) != RECORDER_ERROR_NONE)
906 SETTING_TRACE_ERROR("recorder_commit Error");
908 recorder_get_state(ad->recorder_handle, &rec_state);
909 if (rec_state == RECORDER_STATE_READY
910 && recorder_unprepare(ad->recorder_handle) == RECORDER_ERROR_NONE)
911 SETTING_TRACE("recorder_unprepare success");
914 /*vr_mm_camcorder_unrealize(model->handle); */
915 if (ad->processed_img_num != MAX_VOICE_TIME - 1) {
917 char file_path[MAX_COMMON_BUFFER_LEN + 1] = {0, };
918 snprintf(file_path, MAX_COMMON_BUFFER_LEN, "/opt/usr/data/setting/voiceRecord%d.mp4", ad->processed_img_num + 1);
919 if (recorder_set_filename(ad->recorder_handle, file_path) == RECORDER_ERROR_NONE) {
920 SETTING_TRACE("recorder_set_filename sucess");
921 if (recorder_prepare(ad->recorder_handle) == RECORDER_ERROR_NONE)
922 SETTING_TRACE("recorder_prepare success");
924 if (recorder_start(ad->recorder_handle) == RECORDER_ERROR_NONE)
925 SETTING_TRACE("recorder_start success");
931 elm_image_file_set(ad->image[ad->processed_img_num], SETTING_ICON_PATH_CFG"00_circle_button_press.png", NULL);
932 if (ad->record_genlist) {
933 Elm_Object_Item *first_item = elm_genlist_first_item_get(ad->record_genlist);
934 Setting_GenGroupItem_Data *item_data = elm_object_item_data_get(first_item);
936 G_FREE(item_data->keyStr);
937 char src[MAX_COMMON_BUFFER_LEN + 1] = {0, };
938 snprintf(src, sizeof(src), "%s (%d/4)", _(Speak_Now_Str), ad->processed_img_num + 1);
939 char dst[MAX_COMMON_BUFFER_LEN + 1] = {0, };
940 memset(dst, ' ', MAX_COMMON_BUFFER_LEN);
941 memcpy(dst, src, safeStrLen(src));
943 item_data->keyStr = (char *)g_strdup(dst);
944 elm_genlist_item_fields_update(item_data->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);
950 if (ad->processed_img_num == MAX_VOICE_TIME - 1) {
951 Evas_Object *btn = setting_create_button(ad->notify, _(ADAPT_VOICE_STR), NULL, ___record_popup_cb, data);
952 elm_object_style_set(btn, "popup");
953 elm_object_part_content_set(ad->notify, "button1", btn);
954 evas_object_show(btn);
956 btn = setting_create_button(ad->notify, _("IDS_COM_SK_DONE"), NULL, ___record_popup_cb, data);
957 elm_object_style_set(btn, "popup");
958 elm_object_part_content_set(ad->notify, "button2", btn);
959 evas_object_show(btn);
960 evas_object_show(ad->notify);
962 if (ad->update_timer) {
963 /*ecore_timer_del(ad->update_timer); */
964 ad->update_timer = NULL;
966 if (ad->record_genlist) {
968 Evas_Object *scroller = ad->record_genlist;
969 elm_genlist_clear(scroller); /* first to clear list */
970 elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS);
971 /*ADD_GL_LABLE(scroller, _(Voice_Recognized_text)); */
972 char dst[MAX_COMMON_BUFFER_LEN + 1] = {0, };
973 memset(dst, ' ', MAX_COMMON_BUFFER_LEN);
974 char *src = _(Voice_Recognized_text);
975 memcpy(dst, src, safeStrLen(src));
976 SETTING_TRACE("dst: %s", dst);
977 ADD_GL_LABLE(scroller, dst);
978 setting_create_Gendial_field_def(scroller, &(itc_1icon_with_no_line),
979 NULL, NULL, SWALLOW_Type_LOAD_LAYOUT,
980 NULL, NULL, 140, NULL, NULL,
983 ADD_GL_BUTTON(scroller, _(Voice_Record_BtnStr), __record_btn_click_cb, ad);
986 Elm_Object_Item *first_item = elm_genlist_first_item_get(ad->record_genlist);
987 Setting_GenGroupItem_Data *item_data = elm_object_item_data_get(first_item);
989 G_FREE(item_data->keyStr);
990 char *src[MAX_COMMON_BUFFER_LEN + 1] = {0, };
991 snprintf(src, sizeof(src), "%s", _(Voice_Recognized_text));
992 char *dst[MAX_COMMON_BUFFER_LEN + 1] = {0, };
993 memset(dst, ' ', MAX_COMMON_BUFFER_LEN);
994 memcpy(dst, src, safeStrLen(src));
996 item_data->keyStr = g_strdup(dst);
997 elm_genlist_item_fields_update(item_data->item, "*", ELM_GENLIST_ITEM_FIELD_TEXT);
1005 ad->processed_img_num++;
1010 Evas_Object *___customize_voice_record_popup(SettingSecurityUG *ad)
1012 SETTING_TRACE_BEGIN;
1013 Evas_Object *popup = elm_popup_add(ad->win_get);
1014 ea_object_event_callback_add(popup, EA_CALLBACK_BACK, ea_popup_back_cb_2, NULL);
1015 setting_add_hardkey_features(popup, ad);
1016 evas_object_size_hint_weight_set(ad->notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1019 Evas_Object *content_box = elm_box_add(popup);
1021 Evas_Object *image = setting_create_image(popup, SETTING_ICON_PATH_CFG "RB06-1_VoiceRecoder_icon_voice.png");
1025 elm_image_object_size_get(image, &w, &h);
1026 setting_resize_object(image, 1.5 * w, 1.5 * h);
1028 elm_box_pack_end(content_box, image);
1030 Evas_Object *layout = elm_layout_add(popup);
1031 evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1032 elm_layout_theme_set(layout, "layout", "application", "default");
1033 elm_object_part_content_set(layout, "elm.swallow.bg", setting_create_blank_rect_customize(popup, 680, 100));
1034 Evas_Object *icon_box = elm_box_add(popup);
1035 elm_box_horizontal_set(icon_box, 1);
1038 for (; i < MAX_VOICE_TIME; i++) {
1039 ad->image[i] = setting_create_image(popup, SETTING_ICON_PATH_CFG"00_circle_button_dim.png");
1040 elm_box_pack_end(icon_box, ad->image[i]);
1042 ad->processed_img_num = 0;
1043 elm_object_part_content_set(layout, "elm.swallow.content", icon_box);
1044 evas_object_show(icon_box);
1045 evas_object_show(layout);
1046 elm_box_pack_end(content_box, layout);
1048 elm_object_content_set(popup, content_box);
1049 /*evas_object_smart_callback_add(popup, "block,clicked", ___record_popup_cb, ad); */
1050 evas_object_show(popup);
1056 __record_btn_click_cb(void *data, Evas_Object *obj, void *event_info)
1058 SETTING_TRACE_BEGIN;
1060 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1061 Setting_GenGroupItem_Data *item_data = data;
1062 SettingSecurityUG *ad = item_data->userdata;
1063 retm_if(ad == NULL, "ad is NULL");
1065 if (ad->record_genlist) {
1066 /*refresh the genlist */
1067 Evas_Object *scroller = ad->record_genlist;
1068 elm_genlist_clear(scroller); /* first to clear list */
1069 elm_genlist_mode_set(scroller, ELM_LIST_COMPRESS);
1071 char src[MAX_COMMON_BUFFER_LEN + 1] = {0, };
1072 snprintf(src, sizeof(src), "%s (%d/4)", _(Speak_Now_Str), 0);
1073 char dst[MAX_COMMON_BUFFER_LEN + 1] = {0, };
1074 memset(dst, ' ', MAX_COMMON_BUFFER_LEN);
1075 memcpy(dst, src, safeStrLen(src));
1076 SETTING_TRACE("dst: %s", dst);
1077 ADD_GL_LABLE(scroller, dst);
1079 setting_create_Gendial_field_def(scroller, &(itc_1icon_with_no_line),
1080 NULL, NULL, SWALLOW_Type_LOAD_LAYOUT,
1081 NULL, NULL, 180, NULL, NULL,
1084 ADD_GL_BUTTON(scroller, _(Voice_Record_BtnStr), __record_btn_click_cb, ad);
1086 /*create the popup */
1087 ad->notify = ___customize_voice_record_popup(ad);
1088 if (recorder_set_filename(ad->recorder_handle, "/opt/usr/data/setting/voiceRecord0.mp4") == RECORDER_ERROR_NONE) {
1089 SETTING_TRACE("recorder_set_filename sucess");
1090 if (recorder_prepare(ad->recorder_handle) == RECORDER_ERROR_NONE)
1091 SETTING_TRACE("recorder_prepare success");
1093 if (recorder_start(ad->recorder_handle) == RECORDER_ERROR_NONE)
1094 SETTING_TRACE("recorder_start success");
1097 if (ad->update_timer) {
1098 ecore_timer_del(ad->update_timer);
1099 ad->update_timer = NULL;
1102 ecore_timer_add(2.0, (Ecore_Task_Cb) __record_timer_cb, ad);
1104 setting_create_simple_popup(ad, ad->win_get, NULL, _(UNSUPPORTED_FUNCTION));
1107 /*elm_object_item_text_set(navi_it, _(RESET_SETTINGS_STR)); */
1111 __face_setup_cb(void *data, Evas_Object *obj, void *event_info)
1113 SETTING_TRACE_BEGIN;
1115 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1116 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1117 const char *btn_str = elm_object_text_get(obj);
1119 if (ad->ug_loading) {
1120 setting_ug_destroy(ad->ug_loading);
1121 ad->ug_loading = NULL;
1124 if (!safeStrCmp(btn_str, _("IDS_COM_SK_CANCEL"))) {
1125 elm_naviframe_item_pop(ad->navi_bar);
1126 } else if (!safeStrCmp(btn_str, _(CONTINUE_STR))) {
1127 Elm_Object_Item *navi_it = setting_create_guild_layout(ad->navi_bar, NULL,
1128 _("IDS_COM_BODY_BACK"), NULL, NULL,
1129 __voice_record_back_cb, NULL, NULL,
1130 _(Voice_Unlock_Guildtext),
1131 record_img, _(Voice_Unlock_Guildtext2), _(Voice_Record_BtnStr), __record_btn_click_cb, ad);
1134 ad->record_genlist = elm_object_item_content_get(navi_it);
1135 if (0 != safeStrCmp(elm_object_widget_type_get(ad->record_genlist), "genlist")
1136 && 0 != safeStrCmp(elm_object_widget_type_get(ad->record_genlist), "elm_genlist")) {
1137 ad->record_genlist = NULL;/*only save the genlist content */
1144 __show_face_btn_click_cb(void *data, Evas_Object *obj, void *event_info)
1146 SETTING_TRACE_BEGIN;
1148 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1149 /*Setting_GenGroupItem_Data *item_data = data; */
1150 SettingSecurityUG *ad = data;
1151 retm_if(ad == NULL, "ad is NULL");
1152 const char *btn_str = elm_object_text_get(obj);
1153 SETTING_TRACE("btn_str:%s", btn_str);
1155 ad->video_ly_show_face_btn = obj;
1156 if (!safeStrCmp(btn_str, _(Show_Face_Str))) {
1157 elm_object_text_set(obj, _("Record your face"));
1160 ad->video_ly_content_camera = elm_layout_content_unset(ad->video_ly, "elm.swallow.content");
1161 if (ad->video_ly_content_camera)
1162 evas_object_hide(ad->video_ly_content_camera);
1163 if (ad->ug_loading) ug_pause(ad->ug_loading);
1165 if (ad->ug_loading) {
1166 setting_ug_destroy(ad->ug_loading);
1167 ad->ug_loading = NULL;
1169 /*elm_layout_content_unset(ad->video_ly, "elm.swallow.content"); */
1172 /*if (!ad->video_ly_content_face) */
1173 ad->video_ly_content_face = setting_create_image(ad->video_ly, SETTING_ICON_PATH_CFG "demo-face.png");
1175 elm_layout_content_set(ad->video_ly, "elm.swallow.content", ad->video_ly_content_face);
1177 } else if (!safeStrCmp(btn_str, _("Record your face"))) {
1178 elm_object_text_set(obj, _(Show_Face_Str));
1180 ad->video_ly_content_face = elm_layout_content_unset(ad->video_ly, "elm.swallow.content");
1181 if (ad->video_ly_content_face)
1182 evas_object_del(ad->video_ly_content_face);
1184 __load_camera_ug(ad);
1190 __face_warring3_cb(void *data, Evas_Object *obj, void *event_info)
1192 SETTING_TRACE_BEGIN;
1194 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1195 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1196 const char *btn_str = elm_object_text_get(obj);
1197 if (!safeStrCmp(btn_str, _("IDS_COM_SK_CANCEL"))) {
1198 elm_naviframe_item_pop(ad->navi_bar);
1199 } else if (!safeStrCmp(btn_str, _(CONTINUE_STR))) {
1200 setting_create_guild_layout2(ad->navi_bar,
1201 _(Setup_Face_Unlock_Str),
1202 _(CONTINUE_STR), _("IDS_COM_SK_CANCEL"), NULL,
1203 __face_setup_cb, __face_setup_cb, NULL,
1205 &(ad->video_ly), NULL, _(Show_Face_Str),
1206 __show_face_btn_click_cb, ad);
1207 ad->video_ly_show_face_btn = NULL;/*reset */
1208 __load_camera_ug(ad);
1214 __face_warring2_cb(void *data, Evas_Object *obj, void *event_info)
1216 SETTING_TRACE_BEGIN;
1218 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1219 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1220 const char *btn_str = elm_object_text_get(obj);
1221 if (!safeStrCmp(btn_str, _("IDS_COM_SK_CANCEL"))) {
1222 elm_naviframe_item_pop(ad->navi_bar);
1223 } else if (!safeStrCmp(btn_str, _(SET_UP_STR))) {
1224 setting_create_guild_layout(ad->navi_bar,
1225 _(Setup_Face_Unlock_Str),
1226 _(CONTINUE_STR), _("IDS_COM_SK_CANCEL"), NULL,
1227 __face_warring3_cb, __face_warring3_cb, NULL,
1228 _(Face_Unlock_Warring3),
1229 NULL, NULL, NULL, NULL, ad);
1235 __face_warring_cb(void *data, Evas_Object *obj, void *event_info)
1237 SETTING_TRACE_BEGIN;
1239 retm_if(data == NULL, "[Setting > Security] Data parameter is NULL");
1240 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1241 const char *btn_str = elm_object_text_get(obj);
1242 if (!safeStrCmp(btn_str, _("IDS_COM_SK_CANCEL"))) {
1243 elm_naviframe_item_pop(ad->navi_bar);
1244 } else if (!safeStrCmp(btn_str, _(CONTINUE_STR))) {
1245 setting_create_guild_layout(ad->navi_bar,
1246 _(About_Face_Unlock_Str),
1247 _(SET_UP_STR), _("IDS_COM_SK_CANCEL"), NULL,
1248 __face_warring2_cb, __face_warring2_cb, NULL,
1249 _(Face_Unlock_Warring2),
1250 NULL, NULL, NULL, NULL, ad);
1256 setting_security_locktype_mouse_up_Gendial_list_cb(void *data, Evas_Object *obj,
1259 SETTING_TRACE_BEGIN;
1261 setting_retm_if(data == NULL, "Data parameter is NULL");
1263 retm_if(event_info == NULL, "Invalid argument: event info is NULL");
1264 Elm_Object_Item *item = (Elm_Object_Item *) event_info;
1265 elm_genlist_item_selected_set(item, 0);
1266 Setting_GenGroupItem_Data *list_item =
1267 (Setting_GenGroupItem_Data *) elm_object_item_data_get(item);
1268 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1269 int lock_type = list_item->chk_status;
1270 SETTING_TRACE("clicking item[%s]", _(list_item->keyStr));
1271 int old_type = elm_radio_value_get(list_item->eo_check);
1273 ad->selected_lock_type = list_item->keyStr;
1275 /* If lock_type is same with old_lock_type, return. */
1276 if (lock_type == old_type) {
1277 SETTING_TRACE_DEBUG("[Screen Lock Type] Selected same type");
1282 char *pkg_name = NULL;
1284 switch (lock_type) {
1285 case SETTING_SCREEN_LOCK_TYPE_NONE:
1286 case SETTING_SCREEN_LOCK_TYPE_SWIPE:
1287 /* To do : Call security-server API. pw : 0000 */
1288 if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
1289 || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) {
1290 int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 0);
1291 SETTING_TRACE_DEBUG("set_pwd result : %d", result);
1293 int ckmc_ret = CKMC_ERROR_NONE;
1294 ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL);
1295 SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret);
1297 if (vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type) == 0) {
1299 elm_radio_value_set(list_item->eo_check, lock_type);
1301 /*SETTING_TRACE_DEBUG("PASS #1"); */
1302 ug_destroy_me(ad->ug);
1304 case SETTING_SCREEN_LOCK_TYPE_MOTION:
1305 /* To do : Call security-server API. pw : 0000 */
1306 /*if(old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD */
1307 /* || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) */
1308 /* SETTING_TRACE_DEBUG("set_pwd result : %d", security_server_set_pwd(ad->input_pwd, "0000", 0, 30)); */
1309 ad->old_type = old_type;
1311 /* motion unlock guide text */
1312 char motion_unlock_desc[MAX_COMMON_BUFFER_LEN] = {0,};
1313 snprintf(motion_unlock_desc, sizeof(motion_unlock_desc), "%s<br><br>%s<br>%s", _(Motion_Unlock_Guildtext1), _(Motion_Unlock_Guildtext2), _(Motion_Unlock_Guildtext3));
1314 setting_create_guild_layout(ad->navi_bar,
1315 _(About_Motion_Unlock_Str),
1316 _("IDS_COM_SK_CANCEL"), _(SET_AS_LOCK_STR), NULL,
1317 __motion_cancel_cb, __motion_set_cb, NULL,
1320 NULL, NULL, NULL, ad);
1322 case SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE:
1323 /* To do : Call security-server API. pw : 0000 */
1324 /*if(old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD */
1325 /* || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) */
1326 /* SETTING_TRACE_DEBUG("set_pwd result : %d", security_server_set_pwd(ad->input_pwd, "0000", 0, 30)); */
1327 ad->old_type = old_type;
1328 /*setting_create_simple_popup(NULL, ad->win_get, NULL, "NOT SUPPORT YET"); */
1329 /*if(vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type) == 0) */
1332 /* elm_radio_value_set(list_item->eo_check, lock_type); */
1334 setting_create_guild_layout(ad->navi_bar,
1335 _(About_Face_Unlock_Str),
1336 _(CONTINUE_STR), _("IDS_COM_SK_CANCEL"), NULL,
1337 __face_warring_cb, __face_warring_cb, NULL,
1338 _(Face_Unlock_Warring),
1339 NULL, NULL, NULL, NULL, ad);
1342 case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD:
1343 ad->pw_type = SETTING_SEC_PW_SIMPLE_PASSWD;
1344 if (old_type != SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1345 ad->input_pwd = (char *)strdup("0000");
1346 setting_security_create_password_sg(ad);
1348 case SETTING_SCREEN_LOCK_TYPE_PASSWORD:
1349 ad->pw_type = SETTING_SEC_PW_PASSWORD;
1350 if (old_type != SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
1351 ad->input_pwd = (char *)strdup("0000");
1352 setting_security_create_password_sg(ad);
1354 case SETTING_SCREEN_LOCK_TYPE_OTHER:
1355 SETTING_TRACE_DEBUG("set_pwd result : %d", security_server_set_pwd(ad->input_pwd, "0000", 0, 0));
1357 int ckmc_ret = CKMC_ERROR_NONE;
1358 ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL);
1359 SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret);
1360 index = __get_lockapp_index_from_appname(list_item->keyStr);
1361 pkg_name = __get_lockapp_pkgname_from_appname(list_item->keyStr);
1362 SETTING_TRACE_DEBUG("3rd lock selected. index[%d] pkg_name[%s]", index, pkg_name);
1363 vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, pkg_name);
1364 vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type);
1366 elm_radio_value_set(list_item->eo_check, lock_type + index);
1374 setting_security_locktype_click_radio_cb(void *data, Evas_Object *obj, void *event_info)
1376 SETTING_TRACE_BEGIN;
1377 setting_retm_if(data == NULL, "Data parameter is NULL");
1378 Setting_GenGroupItem_Data *list_item =
1379 (Setting_GenGroupItem_Data *) data;
1380 SettingSecurityUG *ad = list_item->userdata;
1382 int lock_type = elm_radio_value_get(obj);
1385 vconf_get_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, &old_type);
1387 if (old_type == lock_type)
1390 switch (lock_type) {
1391 case SETTING_SCREEN_LOCK_TYPE_NONE:
1392 case SETTING_SCREEN_LOCK_TYPE_SWIPE:
1393 /* To do : Call security-server API. pw : 0000 */
1394 if (old_type == SETTING_SCREEN_LOCK_TYPE_PASSWORD
1395 || old_type == SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD) {
1396 int result = security_server_set_pwd(ad->input_pwd, "0000", 0, 30);
1397 SETTING_TRACE_DEBUG("set_pwd result : %d", result);
1399 int ckmc_ret = CKMC_ERROR_NONE;
1400 ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL);
1401 SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret);
1403 vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type);
1404 ug_destroy_me(ad->ug);
1406 case SETTING_SCREEN_LOCK_TYPE_MOTION:
1407 ad->old_type = old_type;
1409 elm_radio_value_set(ad->lock_type_rd, old_type);
1411 /* motion unlock guide text */
1412 char motion_unlock_desc[MAX_COMMON_BUFFER_LEN] = {0,};
1413 snprintf(motion_unlock_desc, sizeof(motion_unlock_desc), "%s<br><br>%s<br>%s", _(Motion_Unlock_Guildtext1), _(Motion_Unlock_Guildtext2), _(Motion_Unlock_Guildtext3));
1414 setting_create_guild_layout(ad->navi_bar,
1415 _(About_Motion_Unlock_Str),
1416 _("IDS_COM_SK_CANCEL"), _(SET_AS_LOCK_STR), NULL,
1417 __motion_cancel_cb, __motion_set_cb, NULL,
1420 NULL, NULL, NULL, ad);
1422 case SETTING_SCREEN_LOCK_TYPE_FACE_AND_VOICE:
1423 ad->old_type = old_type;
1424 elm_radio_value_set(ad->lock_type_rd, old_type);
1425 setting_create_guild_layout(ad->navi_bar,
1426 _(About_Face_Unlock_Str),
1427 _(CONTINUE_STR), _("IDS_COM_SK_CANCEL"), NULL,
1428 __face_warring_cb, __face_warring_cb, NULL,
1429 _(Face_Unlock_Warring),
1430 NULL, NULL, NULL, NULL, ad);
1433 case SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD:
1434 elm_radio_value_set(ad->lock_type_rd, old_type);
1435 ad->pw_type = SETTING_SEC_PW_SIMPLE_PASSWD;
1436 if (old_type != SETTING_SCREEN_LOCK_TYPE_PASSWORD)
1437 ad->input_pwd = (char *)strdup("0000");
1438 setting_security_create_password_sg(ad);
1440 case SETTING_SCREEN_LOCK_TYPE_PASSWORD:
1441 elm_radio_value_set(ad->lock_type_rd, old_type);
1442 ad->pw_type = SETTING_SEC_PW_PASSWORD;
1443 if (old_type != SETTING_SCREEN_LOCK_TYPE_SIMPLE_PASSWORD)
1444 ad->input_pwd = (char *)strdup("0000");
1445 setting_security_create_password_sg(ad);
1447 case SETTING_SCREEN_LOCK_TYPE_OTHER:
1450 char *pkg_name = NULL;
1451 SETTING_TRACE_DEBUG("set_pwd result : %d", security_server_set_pwd(ad->input_pwd, "0000", 0, 30));
1453 int ckmc_ret = CKMC_ERROR_NONE;
1454 ckmc_ret = ckmc_change_user_password(user, ad->input_pwd, NULL);
1455 SETTING_TRACE("ckmc_change_user_password() returns %d", ckmc_ret);
1456 index = __get_lockapp_index_from_appname(list_item->keyStr);
1457 pkg_name = __get_lockapp_pkgname_from_appname(list_item->keyStr);
1458 SETTING_TRACE_DEBUG("3rd lock selected. index[%d] pkg_name[%s]", index, pkg_name);
1459 vconf_set_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR, pkg_name);
1460 vconf_set_int(VCONFKEY_SETAPPL_SCREEN_LOCK_TYPE_INT, lock_type);
1462 elm_radio_value_set(list_item->eo_check, lock_type + index);
1470 Eina_Bool setting_security_locktype_click_softkey_back_cb(void *data, Elm_Object_Item *it)
1472 SETTING_TRACE_BEGIN;
1474 retvm_if(data == NULL, EINA_FALSE, "[Setting > Security] Data parameter is NULL");
1476 SettingSecurityUG *ad = (SettingSecurityUG *) data;
1477 if (ad->ug_passwd) {
1481 if (&setting_view_security_locktype == ad->view_to_load) {
1482 /* Send destroy request */
1483 ug_destroy_me(ad->ug);
1485 setting_view_change(&setting_view_security_locktype, &setting_view_security_main, ad);