return DPM_ERROR_NONE;
}
+
+int dpm_restriction_set_popimap_email_state(dpm_restriction_policy_h handle, int enable)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ return restriction.setPopImapEmailState(enable);
+}
+
+int dpm_restriction_get_popimap_email_state(dpm_restriction_policy_h handle, int *state)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(state, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ int ret = restriction.getPopImapEmailState();
+ if (ret < 0) {
+ return -1;
+ }
+ *state = ret;
+ return DPM_ERROR_NONE;
+}
+
+int dpm_restriction_set_messaging_state(dpm_restriction_policy_h handle, int enable)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ return restriction.setMessagingState(enable);
+}
+
+int dpm_restriction_get_messaging_state(dpm_restriction_policy_h handle, int *state)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(state, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ int ret = restriction.getMessagingState();
+ if (ret < 0) {
+ return -1;
+ }
+ *state = ret;
+ return DPM_ERROR_NONE;
+}
+
+int dpm_restriction_set_browser_state(dpm_restriction_policy_h handle, int enable)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ return restriction.setBrowserState(enable);
+}
+
+int dpm_restriction_get_browser_state(dpm_restriction_policy_h handle, int *state)
+{
+ RET_ON_FAILURE(handle, DPM_ERROR_INVALID_PARAMETER);
+ RET_ON_FAILURE(state, DPM_ERROR_INVALID_PARAMETER);
+
+ DevicePolicyContext &client = GetDevicePolicyContext(handle);
+ RestrictionPolicy restriction = client.createPolicyInterface<RestrictionPolicy>();
+ int ret = restriction.getBrowserState();
+ if (ret < 0) {
+ return -1;
+ }
+ *state = ret;
+ return DPM_ERROR_NONE;
+}
+
DPM_API int dpm_restriction_get_bluetooth_pairing_state(dpm_restriction_policy_h handle, int *enable);
/**
+* @brief Specifies whether the device allows access to POP or IMAP e-mail
+* @details An administrator can diable the email capability without any user interaction
+* @since_tizen 3.0
+* @param[in] handle The restriction policy handle
+* @param[in] enable TRUE to restrict POP or IMAP e-mail, else FALSE
+* @return #DPM_ERROR_NONE on success, otherwise a negative value
+* @retval #DPM_ERROR_NONE Successful
+* @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+* @retval #DPM_ERROR_PERMISSION_DENIED The application does not have
+* the privilege to call this API
+* @pre handle must be created by dpm_context_acquire_restriction_policy()
+* @see dpm_context_acquire_restriction_policy()
+* @see dpm_context_release_restriction_policy()
+* @see dpm_restriction_get_popimap_email_state()
+*/
+DPM_API int dpm_restriction_set_popimap_email_state(dpm_restriction_policy_h handle, int enable);
+
+/**
+* @brief Checks whether the device allows access to POP or IMAP e-mail
+* @details An administrator can check the email capability without any user interaction
+* @since_tizen 3.0
+* @param[in] handle The restriction policy handle
+* @param[out] enable TRUE if the access to POP or IMAP e-mail is disallowed, FALSE if allowed
+* @return #DPM_ERROR_NONE on success, otherwise a negative value
+* @retval #DPM_ERROR_NONE Successful
+* @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+* @pre handle must be created by dpm_context_acquire_restriction_policy()
+* @see dpm_context_acquire_restriction_policy()
+* @see dpm_context_release_restriction_policy()
+* @see dpm_restriction_set_popimap_email_state()
+*/
+DPM_API int dpm_restriction_get_popimap_email_state(dpm_restriction_policy_h handle, int *state);
+
+/**
+ * @brief Specifies whether the devce allows the use of SMS or text messaging.
+ * @details An administrator can disable the text messaging capability without any user interaction
+ * @since_tizen 3.0
+ * @privlevel partner
+ * @privilege %http://tizen.org/privilege/dpm.message
+ * @param[in] handle The restriction policy handle
+ * @param[in] enable TRUE to restrict the use of SMS or text messaging, else FALSE
+ * @return #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval #DPM_ERROR_NONE Successful
+ * @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+ * @retval #DPM_ERROR_PERMISSION_DENIED The application does not have
+ * the privilege to call this API
+ * @pre handle must be created by dpm_context_acquire_restriction_policy()
+ * @see dpm_context_acquire_restriction_policy()
+ * @see dpm_context_release_restriction_policy()
+ * @see dpm_restriction_get_messaging_state()
+ */
+DPM_API int dpm_restriction_set_messaging_state(dpm_restriction_policy_h handle, int enable);
+
+/**
+* @brief Checks whether the text messaging capability is enabled or not
+* @details An administrator can check whether text messaging capability is enabled or not.
+* @since_tizen 3.0
+* @param[in] handle The restriction policy handle
+* @param[out] enable TRUE if the use of SMS or text messging is disallowed, FALSE if allowed
+* @return #DPM_ERROR_NONE on success, otherwise a negative value
+* @retval #DPM_ERROR_NONE Successful
+* @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+* @pre handle must be created by dpm_context_acquire_restriction_policy()
+* @see dpm_context_acquire_restriction_policy()
+* @see dpm_context_release_restriction_policy()
+* @see dpm_restriction_set_messaging_state()
+*/
+DPM_API int dpm_restriction_get_messaging_state(dpm_restriction_policy_h handle, int *state);
+
+/**
+ * @brief Checks whether the device allows access to POP or IMAP e-mail
+ * @details An administrator can check the email capability without any user interaction
+ * @since_tizen 3.0
+ * @param[in] handle The restriction policy handle
+ * @param[out] enable TRUE if the access to POP or IMAP e-mail is disallowed, FALSE if allowed
+ * @return #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval #DPM_ERROR_NONE Successful
+ * @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+ * @pre handle must be created by dpm_context_acquire_restriction_policy()
+ * @see dpm_context_acquire_restriction_policy()
+ * @see dpm_context_release_restriction_policy()
+ * @see dpm_restriction_set_popimap_email_state()
+ */
+DPM_API int dpm_restriction_set_browser_state(dpm_restriction_policy_h handle, int enable);
+
+/**
+ * @brief Checks whether the web browser capability is enabled or not
+ * @details An administrator can check whether web browser capability is enabled or not.
+ * @since_tizen 3.0
+ * @param[in] handle The restriction policy handle
+ * @param[out] enable TRUE if the use of web browser is enabled, FALSE if allowed
+ * @return #DPM_ERROR_NONE on success, otherwise a negative value
+ * @retval #DPM_ERROR_NONE Successful
+ * @retval #DPM_ERROR_NOT_SUPPORTED Not supported
+ * @pre handle must be created by dpm_context_acquire_restriction_policy()
+ * @see dpm_context_acquire_restriction_policy()
+ * @see dpm_context_release_restriction_policy()
+ * @see dpm_restriction_set_browser_state()
+ */
+DPM_API int dpm_restriction_get_browser_state(dpm_restriction_policy_h handle, int *state);
+/**
* @} // end of DPM_RESTRICTION_POLICY
*/
}
}
+int RestrictionPolicy::setPopImapEmailState(int enable)
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::setPopImapEmailState", enable);
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
+int RestrictionPolicy::getPopImapEmailState()
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::getPopImapEmailState");
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
+int RestrictionPolicy::setMessagingState(int enable)
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::setMessagingState", enable);
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
+int RestrictionPolicy::getMessagingState()
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::getMessagingState");
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
+int RestrictionPolicy::setBrowserState(int enable)
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::setBrowserState", enable);
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
+int RestrictionPolicy::getBrowserState()
+{
+ try {
+ return context->methodCall<int>("RestrictionPolicy::getBrowserState");
+ } catch (runtime::Exception& e) {
+ return -1;
+ }
+}
+
} //namespace DevicePolicyManager
int setExternalStorageState(int enable);
int getExternalStorageState();
+ int setPopImapEmailState(int enable);
+ int getPopImapEmailState();
+
+ int setMessagingState(int enable);
+ int getMessagingState();
+
+ int setBrowserState(int enable);
+ int getBrowserState();
+
private:
PolicyControlContext& context;
};
<policy name="microphone">allowed</policy>
<policy name="location">allowed</policy>
<policy name="external-storage">allowed</policy>
- <policy name="text-messaging">allowed</policy>
- <policy name="pop-imap-email">allowed</policy>
+ <policy name="messaging">allowed</policy>
+ <policy name="popimap-email">allowed</policy>
<policy name="browser">allowed</policy>
<policy name="settings-changes">allowed</policy>
<policy name="tethering">allowed</policy>
context.registerNonparametricMethod(this, (int)(RestrictionPolicy::getUsbTetheringState));
context.registerParametricMethod(this, (int)(RestrictionPolicy::setExternalStorageState)(int));
context.registerNonparametricMethod(this, (int)(RestrictionPolicy::getExternalStorageState));
+ context.registerParametricMethod(this, (int)(RestrictionPolicy::setPopImapEmailState)(int));
+ context.registerNonparametricMethod(this, (int)(RestrictionPolicy::getPopImapEmailState));
+ context.registerParametricMethod(this, (int)(RestrictionPolicy::setMessagingState)(int));
+ context.registerNonparametricMethod(this, (int)(RestrictionPolicy::getMessagingState));
+ context.registerParametricMethod(this, (int)(RestrictionPolicy::setBrowserState)(int));
+ context.registerNonparametricMethod(this, (int)(RestrictionPolicy::getBrowserState));
context.createNotification("camera");
context.createNotification("clipboard");
context.createNotification("settings-changes");
context.createNotification("usb-debugging");
context.createNotification("usb-tethering");
+ context.createNotification("popimap-email");
+ context.createNotification("messaging");
+ context.createNotification("browser");
}
RestrictionPolicy::~RestrictionPolicy()
return IsPolicyAllowed(context, "external-storage");
}
+int RestrictionPolicy::setPopImapEmailState(int enable)
+{
+ return SetPolicyAllowed(context, "popimap-email", enable);
+}
+
+int RestrictionPolicy::getPopImapEmailState()
+{
+ return IsPolicyAllowed(context, "popimap-email");
+}
+
+int RestrictionPolicy::setMessagingState(int enable)
+{
+ return SetPolicyAllowed(context, "messaging", enable);
+}
+
+int RestrictionPolicy::getMessagingState()
+{
+ return IsPolicyAllowed(context, "messaging");
+}
+
+int RestrictionPolicy::setBrowserState(int enable)
+{
+ return SetPolicyAllowed(context, "browser", enable);
+}
+
+int RestrictionPolicy::getBrowserState()
+{
+ return IsPolicyAllowed(context, "browser");
+}
+
RestrictionPolicy restrictionPolicy(Server::instance());
} // namespace DevicePolicyManager