*/
int dpm_restriction_get_browser_state(device_policy_manager_h handle, int *is_allowed);
+int dpm_restriction_set_usb_client_state(device_policy_manager_h handle, int allow);
+int dpm_restriction_get_usb_client_state(device_policy_manager_h handle, int *is_allowed);
+
/**
* @}
*/
return DPM_ERROR_NONE;
}
+
+EXPORT_API int dpm_restriction_set_usb_client_state(device_policy_manager_h handle, int allow)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+ try {
+ Status<int> status { -1 };
+ status = client.methodCall<int>("Usb::setClientState", allow);
+ return status.get();
+ } catch(...) {
+ return -1;
+ }
+}
+
+EXPORT_API int dpm_restriction_get_usb_client_state(device_policy_manager_h handle, int *is_allowed)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyClient &client = GetDevicePolicyClient(handle);
+
+ try{
+ Status<bool> status { true };
+ status = client.methodCall<bool>("Usb::getClientState");
+ *is_allowed = status.get();
+ } catch(...) {
+ return -1;
+ }
+
+ return DPM_ERROR_NONE;
+}