EXPORT_API int dpm_password_get_quality(device_policy_manager_h handle, dpm_password_quality_e *quality)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(quality, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_minimum_length(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_min_complex_chars(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_get_min_complex_chars(device_policy_manager_h handle, int *value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_maximum_failed_attempts_for_wipe(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_expires(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_get_expires(device_policy_manager_h handle, int *value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_history(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_get_history(device_policy_manager_h handle, int *value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_max_inactivity_time_device_lock(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_status(device_policy_manager_h handle, dpm_password_status_e status)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(status >= DPM_PASSWORD_STATUS_NORMAL &&
+ status <= DPM_PASSWORD_STATUS_MAX_ATTEMPTS_EXCEEDED,
+ DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_get_pattern(device_policy_manager_h handle, char **pattern)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
- RET_ON_FAILURE(*pattern, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(pattern, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_maximum_character_occurrences(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_maximum_numeric_sequence_length(device_policy_manager_h handle, int value)
{
RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(value >= 0, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
PasswordPolicy password = client.createPolicyInterface<PasswordPolicy>();
EXPORT_API int dpm_password_set_forbidden_strings(device_policy_manager_h handle, const char *strings[], int length)
{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(strings, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(length >= 0, DPM_ERROR_INVALID_PARAMETER);
+
int iter;
std::vector<std::string> forbiddenStrings;
EXPORT_API int dpm_restriction_set_camera_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_get_camera_state(device_policy_manager_h handle, int *is_allowed)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
EXPORT_API int dpm_restriction_set_microphone_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_get_microphone_state(device_policy_manager_h handle, int *is_allowed)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_set_usb_debugging_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_get_usb_debugging_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);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_set_settings_changes_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
- return restriction.setSettingsChangesState(allow);
+ return restriction.setSettingsChangesState(allow);
}
EXPORT_API int dpm_restriction_get_settings_changes_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);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_set_external_storage_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
- return restriction.setExternalStorageState(allow);
+ return restriction.setExternalStorageState(allow);
}
EXPORT_API int dpm_restriction_get_external_storage_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);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
- int ret = restriction.getExternalStorageState();
+ int ret = restriction.getExternalStorageState();
if (ret < 0) {
return 0;
}
EXPORT_API int dpm_restriction_set_clipboard_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
- return restriction.setClipboardState(allow);
+ return restriction.setClipboardState(allow);
}
EXPORT_API int dpm_restriction_get_clipboard_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);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
EXPORT_API int dpm_restriction_set_bluetooth_pairing_state(device_policy_manager_h handle, int allow)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);
BluetoothPolicy bluetooth = client.createPolicyInterface<BluetoothPolicy>();
EXPORT_API int dpm_restriction_get_bluetooth_pairing_state(device_policy_manager_h handle, int *is_allowed)
{
- RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
RET_ON_FAILURE(is_allowed, DPM_ERROR_INVALID_PARAMETER);
DevicePolicyContext &client = GetDevicePolicyContext(handle);