fix work error of 3rd party lock list
authorHyejin Kim <hyejin0906.kim@samsung.com>
Thu, 18 Apr 2013 03:25:57 +0000 (12:25 +0900)
committerHyejin Kim <hyejin0906.kim@samsung.com>
Fri, 19 Apr 2013 04:39:59 +0000 (13:39 +0900)
Change-Id: Ia4870c88eaae1e52ed5b077260af6917c47a6459

packaging/org.tizen.setting.spec
setting-common/src/setting-common-data-slp-setting.c
setting-security/src/setting-security-locktype.c
setting-storage/src/setting-storage.c

index 9954fa6..46f9488 100755 (executable)
@@ -251,7 +251,7 @@ GOPTION="-g 6514"
 #resetSecurity
        rm -rf /opt/data/setting/set_info
        #vconftool $GOPTION set -t string db/setting/privacy_passwd ""
-       vconftool $GOPTION set -t int db/setting/screen_lock_type "0"
+       vconftool $GOPTION set -t int db/setting/screen_lock_type "1" -f
        vconftool $GOPTION set -t string db/setting/3rd_lock_pkg_name ""
        # NOT USED NOW.
        #vconftool $GOPTION set -t bool db/setting/rcs "0"
index eacf15e..f8ae538 100755 (executable)
@@ -275,14 +275,14 @@ static VconfNode g_itable[] = {
                {INT_SLP_SETTING_TASKSWITCHER_VIEWTYPE,VCONFKEY_TASKSWITCHER_VIEWTYPE, eINT, {0}, export_default, import_default},
 #endif
                /* memory */
-               {INT_SLP_SETTING_DEFAULT_MEM_WAP,VCONFKEY_SETAPPL_DEFAULT_MEM_WAP_INT, eINT, {0}, export_default, import_default},
+               //{INT_SLP_SETTING_DEFAULT_MEM_WAP,VCONFKEY_SETAPPL_DEFAULT_MEM_WAP_INT, eINT, {0}, export_default, import_default},
                {INT_SLP_SETTING_DEFAULT_MEM_BLUETOOTH,VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, eINT, {0}, export_default, import_default},
                {INT_SLP_SETTING_DEFAULT_MEM_CAMERA,VCONFKEY_SETAPPL_DEFAULT_MEM_CAMERA_INT, eINT, {0}, export_default, import_default},
                {INT_SLP_SETTING_DEFAULT_MEM_VOICE_RECORDER,VCONFKEY_SETAPPL_DEFAULT_MEM_VOICE_RECORDER_INT, eINT, {0}, export_default, import_default},
-               {INT_SLP_SETTING_DEFAULT_MEM_FM_RADIO,VCONFKEY_SETAPPL_DEFAULT_MEM_FM_RADIO_INT, eINT, {0}, export_default, import_default},
-               {INT_SLP_SETTING_DEFAULT_MEM_ALL_SHARE,VCONFKEY_SETAPPL_DEFAULT_MEM_ALL_SHARE_INT, eINT, {0}, export_default, import_default},
-               {INT_SLP_SETTING_DEFAULT_MEM_ADOBE_AIR,VCONFKEY_SETAPPL_DEFAULT_MEM_ADOBE_AIR_INT, eINT, {0}, export_default, import_default},
-               {INT_SLP_SETTING_DEFAULT_MEM_DVB_H,VCONFKEY_SETAPPL_DEFAULT_MEM_DVB_H_INT, eINT, {0}, export_default, import_default},
+               //{INT_SLP_SETTING_DEFAULT_MEM_FM_RADIO,VCONFKEY_SETAPPL_DEFAULT_MEM_FM_RADIO_INT, eINT, {0}, export_default, import_default},
+               //{INT_SLP_SETTING_DEFAULT_MEM_ALL_SHARE,VCONFKEY_SETAPPL_DEFAULT_MEM_ALL_SHARE_INT, eINT, {0}, export_default, import_default},
+               //{INT_SLP_SETTING_DEFAULT_MEM_ADOBE_AIR,VCONFKEY_SETAPPL_DEFAULT_MEM_ADOBE_AIR_INT, eINT, {0}, export_default, import_default},
+               //{INT_SLP_SETTING_DEFAULT_MEM_DVB_H,VCONFKEY_SETAPPL_DEFAULT_MEM_DVB_H_INT, eINT, {0}, export_default, import_default},
 
                /* other module */
                {INT_SLP_SETTING_SIM_SLOT,VCONFKEY_TELEPHONY_SIM_SLOT, eINT, {0}, export_default, import_default},
index b62be85..36a74ca 100755 (executable)
@@ -26,8 +26,8 @@
 #include <setting-security-locktype.h>
 #include <setting-security.h>
 #include <setting-debug.h>
-#include <ail.h>
 #include <pkgmgr-info.h>
+#include <ail.h>
 
 #define TBD 0
 
@@ -93,57 +93,98 @@ static char* __get_lockapp_pkgname_from_appname(char *app_name)
        return NULL;
 }
 
-ail_cb_ret_e __get_appinfo_cb(const ail_appinfo_h appinfo, void *user_data)
+//ail_cb_ret_e __get_appinfo_cb(const ail_appinfo_h appinfo, void *user_data)
+int __get_appinfo_cb(pkgmgrinfo_appinfo_h appinfo, void *user_data)
 {
        SETTING_TRACE_BEGIN;
 
+       if(!appinfo)
+       {
+               SETTING_TRACE_DEBUG("handle is NULL");
+               return -1;
+       }
+
        openlock_appdata *item = lockapp_data;
        openlock_appdata *new_item = NULL;
        char *pkg_name = NULL;
        char *app_name = NULL;
+       char *app_id = NULL;
+       ail_appinfo_h ai;
+       int ret = 0;
 
-       ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
+       //ret = pkgmgrinfo_appinfo_get_pkgname(appinfo, &pkg_name);
+       ret = pkgmgrinfo_appinfo_get_appid(appinfo, &app_id);
+
+       //ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
+       //ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &app_name);
+       if(ret != 0 || !app_id)
+       {
+               SETTING_TRACE_DEBUG("pkgmgrinfo_appinfo_get_appid returns error");
+               return -1;
+       }
+
+       ret = ail_get_appinfo(app_id, &ai);
+       if(ret != AIL_ERROR_OK)
+       {
+               SETTING_TRACE_DEBUG("ail_get_appinfo() returns error");
+               return -1;
+       }
        ail_appinfo_get_str(appinfo, AIL_PROP_NAME_STR, &app_name);
+       ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &pkg_name);
 
+       if(!app_name || !pkg_name)
+       {
+               SETTING_TRACE_DEBUG("ail_appinfo_get_str() returns error");
+               ail_destroy_appinfo(ai);
+               return -1;
+       }
+       SETTING_TRACE_DEBUG("app_name %s", app_name);
+       SETTING_TRACE_DEBUG("pkg_name %s", pkg_name);
+       
        while(item->next != NULL)
                item = item->next;
 
        if(item->index == 0 && item->pkg_name == NULL)
        {
+               SETTING_TRACE_DEBUG("first app");
                /* first app */
-               item->pkg_name = strdup(pkg_name);
-               item->app_name = strdup(app_name);
+               item->pkg_name = (char*)strdup(pkg_name);
+               item->app_name = (char*)strdup(app_name);
 
-               SETTING_TRACE_DEBUG("app info %d %s %s", item->index, item->pkg_name, item->app_name);
+               if(!pkg_name && !app_name)
+                       SETTING_TRACE_DEBUG("app info %d %s %s", item->index, item->pkg_name, item->app_name);
        }
        else
        {
+               SETTING_TRACE_DEBUG("create new");
                /* create new */
                new_item = (openlock_appdata*)malloc(sizeof(openlock_appdata));
                if(new_item != NULL)
                {
                        memset(new_item, 0x00, sizeof(openlock_appdata));
-                       new_item->pkg_name = strdup(pkg_name);
-                       new_item->app_name = strdup(app_name);
+                       new_item->pkg_name = (char*)strdup(pkg_name);
+                       new_item->app_name = (char*)strdup(app_name);
                        new_item->index = item->index + 1;
                        new_item->prev = item;
                        item->next = new_item;
 
-                       SETTING_TRACE_DEBUG("app info %d %s %s", new_item->index, new_item->pkg_name, new_item->app_name);
+                       if(!pkg_name && !app_name)
+                               SETTING_TRACE_DEBUG("app info %d %s %s", new_item->index, new_item->pkg_name, new_item->app_name);
                }
                else
                {
                        SETTING_TRACE_DEBUG("malloc() failed");
                }
        }
-       return AIL_CB_RET_CONTINUE;
+       return 0; //AIL_CB_RET_CONTINUE;
 }
 
-static void __add_3rd_party_lock(void *data)
+static int __add_3rd_party_lock(void *data)
 {
        SETTING_TRACE_BEGIN;
        ret_if(data == NULL);
 
+       int ret_index = -1;
        SettingSecurityUG *ad = (SettingSecurityUG *) data;
 
        /* Get info from AIL */
@@ -182,7 +223,7 @@ static void __add_3rd_party_lock(void *data)
        lockapp_data->app_name = NULL;
        lockapp_data->index = 0;
 
-       pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, __get_appinfo_cb, ad);        //ail_filter_list_appinfo_foreach(filter, __get_appinfo_cb, ad);
+       pkgmgrinfo_appinfo_filter_foreach_appinfo(filter, __get_appinfo_cb, NULL);      //ail_filter_list_appinfo_foreach(filter, __get_appinfo_cb, ad);
        pkgmgrinfo_appinfo_filter_destroy(filter);      //ail_filter_destroy(filter);
 
        /* Add to genlist */
@@ -191,6 +232,7 @@ static void __add_3rd_party_lock(void *data)
        int index = 0;
        for(index = 0; index < count; index++)
        {
+               SETTING_TRACE_DEBUG("add item [%d]", index);
                ad->data_locktype_3rd[index] = setting_create_Gendial_field_1radio(ad->sl_scroller,
                                                &(itc_1text_1icon_2),
                                                setting_security_locktype_mouse_up_Gendial_list_cb,     /*add to sel_cb */
@@ -204,8 +246,14 @@ static void __add_3rd_party_lock(void *data)
                } else {
                        SETTING_TRACE_ERROR("item_data is NULL");
                }
+
+               char *open_lock_name = NULL;
+               open_lock_name = vconf_get_str(VCONFKEY_SETAPPL_3RD_LOCK_PKG_NAME_STR);
+               if(safeStrCmp(open_lock_name, list->app_name) == 0)
+                       ret_index = index;
                list = list->next;
        }
+       return ret_index;
        SETTING_TRACE_END;
 }
 
@@ -253,7 +301,7 @@ void __add_locktype_items(void *data)
        }
 
        /* Add 3rd party lock apps in list. */
-       __add_3rd_party_lock(ad);
+       index = __add_3rd_party_lock(ad);
 
        /* update info */
        /* To do : If type is OTHER, should calculate something.*/
index 8f6cf90..7b2f3f9 100755 (executable)
@@ -249,12 +249,12 @@ UG_MODULE_API int setting_plugin_reset(service_h service, void *priv)
        SETTING_TRACE_BEGIN;
        int ret = 0;
        int value = SETTING_DEF_MEMORY_PHONE;
-       ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WAP_INT, value);
+       //ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_WAP_INT, value);
        ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_BLUETOOTH_INT, value);
        ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_CAMERA_INT, value);
 
        ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_VOICE_RECORDER_INT, value);
-       ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_FM_RADIO_INT, value);
-       ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_DVB_H_INT, value);
+       //ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_FM_RADIO_INT, value);
+       //ret += vconf_set_int(VCONFKEY_SETAPPL_DEFAULT_MEM_DVB_H_INT, value);
        return ret;
 }