X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fmh_view_main.c;h=0892e084c797b6de80593a5f420ba817e1e08f80;hb=refs%2Ftags%2Fsubmit%2Ftizen%2F20160615.100519;hp=6f2af60190955774af953fd446817bd7eb9810c3;hpb=d094bc03ed882e06b3814f4d1caeccdff76a179a;p=apps%2Fnative%2Fug-mobile-ap.git diff --git a/src/mh_view_main.c b/src/mh_view_main.c index 6f2af60..0892e08 100755 --- a/src/mh_view_main.c +++ b/src/mh_view_main.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "mh_view_main.h" #include "mh_popup.h" @@ -573,11 +574,57 @@ void _update_main_view(mh_appdata_t *ad, tethering_type_e type) return; } +static int __is_allowed(tethering_type_e type) +{ + int state = 0; + dpm_context_h context = NULL; + dpm_restriction_policy_h policy = NULL; + + context = dpm_context_create(); + if (context == NULL) { + ERR("Failed to create dpm context!!"); + return 0; + } + + policy = dpm_context_acquire_restriction_policy(context); + if (policy == NULL) { + ERR("Failed to create policy handle"); + dpm_context_destroy(context); + return 0; + } + + switch(type) { + case TETHERING_TYPE_WIFI: + dpm_restriction_get_wifi_hotspot_state(policy, &state); + break; + case TETHERING_TYPE_USB: + dpm_restriction_get_usb_tethering_state(policy, &state); + break; + case TETHERING_TYPE_BT: + dpm_restriction_get_bluetooth_tethering_state(policy, &state); + break; + default: + break; + } + + dpm_context_release_restriction_policy(context, policy); + dpm_context_destroy(context); + + return state; +} + static void __wifi_onoff_changed_cb(void *data, Evas_Object *obj, void *event_info) { __MOBILE_AP_FUNC_ENTER__; + if (!__is_allowed(TETHERING_TYPE_WIFI)) { + ERR("Wi-Fi tethering is restricted!!"); + elm_check_state_set(obj, EINA_FALSE); + _create_security_restriction_noti(TETHERING_TYPE_WIFI); + return; + } + if (data == NULL) { ERR("The param is NULL\n"); return; @@ -621,6 +668,13 @@ static void __bt_onoff_changed_cb(void *data, Evas_Object *obj, void *event_info { __MOBILE_AP_FUNC_ENTER__; + if (!__is_allowed(TETHERING_TYPE_BT)) { + ERR("BT tethering is restricted!!"); + elm_check_state_set(obj, EINA_FALSE); + _create_security_restriction_noti(TETHERING_TYPE_BT); + return; + } + if (data == NULL) { ERR("The param is NULL\n"); return; @@ -669,6 +723,13 @@ static void __usb_onoff_changed_cb(void *data, Evas_Object *obj, void *event_inf { __MOBILE_AP_FUNC_ENTER__; + if (!__is_allowed(TETHERING_TYPE_USB)) { + ERR("USB tethering is restricted!!"); + elm_check_state_set(obj, EINA_FALSE); + _create_security_restriction_noti(TETHERING_TYPE_USB); + return; + } + if (data == NULL) { ERR("The param is NULL\n"); return;