Replace deprecated dpm handles with device_policy_manager_h
[apps/native/ug-mobile-ap.git] / src / mh_view_main.c
index 1ed681f..b97aaf9 100755 (executable)
@@ -555,38 +555,29 @@ void _update_main_view(mh_appdata_t *ad, tethering_type_e type)
 static int __is_allowed(tethering_type_e type)
 {
        int state = 0;
-       dpm_context_h context = NULL;
-       dpm_restriction_policy_h policy = NULL;
+       device_policy_manager_h dpm = 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);
+       dpm = dpm_manager_create();
+       if (dpm == NULL) {
+               ERR("Failed to create device policy manager!!");
                return 0;
        }
 
        switch(type) {
                case TETHERING_TYPE_WIFI:
-                       dpm_restriction_get_wifi_hotspot_state(policy, &state);
+                       dpm_restriction_get_wifi_hotspot_state(dpm, &state);
                        break;
                case TETHERING_TYPE_USB:
-                       dpm_restriction_get_usb_tethering_state(policy, &state);
+                       dpm_restriction_get_usb_tethering_state(dpm, &state);
                        break;
                case TETHERING_TYPE_BT:
-                       dpm_restriction_get_bluetooth_tethering_state(policy, &state);
+                       dpm_restriction_get_bluetooth_tethering_state(dpm, &state);
                        break;
                default:
                        break;
        }
 
-       dpm_context_release_restriction_policy(context, policy);
-       dpm_context_destroy(context);
+       dpm_manager_destroy(dpm);
 
        return state;
 }