diff --git a/api/@ohos.enterpriseDeviceManager.d.ts b/api/@ohos.enterpriseDeviceManager.d.ts index 273c97f1174fee9f4667838aebe769b198c0706e..a44bcc448c4d4a30bb4b80013a2805475fafa6f5 100644 --- a/api/@ohos.enterpriseDeviceManager.d.ts +++ b/api/@ohos.enterpriseDeviceManager.d.ts @@ -54,98 +54,267 @@ declare namespace enterpriseDeviceManager { /** * Enables the given ability as a administrator of the device. - * * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. - * + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. + * @param { AdminType } type - type indicates the type of administrator to set. + * @param { AsyncCallback } callback - the callback of enableAdmin. + * @throws { BusinessError } 9200003 - the administrator ability component is invalid. + * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200007 - the system ability work abnormally. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly * @since 9 + */ + function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback): void; + + /** + * Enables the given ability as a administrator of the device. + * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. + * @param { AdminType } type - type indicates the type of administrator to set. + * @param { number } userId - userId indicates the user ID. + * @param { AsyncCallback } callback - the callback of enableAdmin. + * @throws { BusinessError } 9200003 - the administrator ability component is invalid. + * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200007 - the system ability work abnormally. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @param enterpriseInfo Indicates the enterprise information of the calling application. - * @param type Indicates the type of administrator to set. - * @param userId Indicates the user ID or do not pass user ID. - * @return {@code true} if enables administrator success. + * @systemapi + * @stagemodelonly + * @since 9 + */ + function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback): void; + + /** + * Enables the given ability as a administrator of the device. + * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. + * @param { AdminType } type - type indicates the type of administrator to set. + * @param { number } [userId] - userId indicates the user ID or do not pass user ID. + * @returns { Promise } the promise returned by the enableAdmin. + * @throws { BusinessError } 9200003 - the administrator ability component is invalid. + * @throws { BusinessError } 9200004 - failed to enable the adminstrator application of the device. + * @throws { BusinessError } 9200007 - the system ability work abnormally. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 */ - function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback): void; - function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback): void; - function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise; + function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise; /** - * Disables a current normal administrator ability. - * + * Disables a current normal administrator ability. * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. - * + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - the callback of disableAdmin. + * @throws { BusinessError } 9200005 - failed to disable the administrator application of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly * @since 9 + */ + function disableAdmin(admin: Want, callback: AsyncCallback): void; + + /** + * Disables a current normal administrator ability. + * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } userId - userId indicates the user ID. + * @param { AsyncCallback } callback - the callback of disableAdmin. + * @throws { BusinessError } 9200005 - failed to disable the administrator application of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @param userId Indicates the user ID or do not pass user ID. - * @return {@code true} if disables administrator success. + * @systemapi + * @stagemodelonly + * @since 9 + */ + function disableAdmin(admin: Want, userId: number, callback: AsyncCallback): void; + + /** + * Disables a current normal administrator ability. + * Only apps with the ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN permission or the shell uid can call this method. * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } [userId] - userId indicates the user ID or do not pass user ID. + * @returns { Promise } the promise returned by the disableAdmin. + * @throws { BusinessError } 9200005 - failed to disable the administrator application of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 */ - function disableAdmin(admin: Want, callback: AsyncCallback): void; - function disableAdmin(admin: Want, userId: number, callback: AsyncCallback): void; - function disableAdmin(admin: Want, userId?: number): Promise; + function disableAdmin(admin: Want, userId?: number): Promise; /** - * Disables a current super administrator ability. - * + * Disables a current super administrator ability. * Only the administrator app or apps with the shell uid can call this method. - * + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { string } bundleName - bundleName indicates the administrator bundle information. + * @param { AsyncCallback } callback - the callback of disableSuperAdmin. + * @throws { BusinessError } 9200005 - failed to disable the administrator application of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly * @since 9 + */ + function disableSuperAdmin(bundleName: String, callback: AsyncCallback): void; + + /** + * Disables a current super administrator ability. + * Only the administrator app or apps with the shell uid can call this method. + * @permission ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN + * @param { string } bundleName - bundleName indicates the administrator bundle information. + * @returns { Promise } the promise returned by the disableSuperAdmin. + * @throws { BusinessError } 9200005 - failed to disable the administrator application of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param bundleName Indicates the administrator bundle information. - * @return {@code true} if disables super administrator success. + * @systemapi + * @stagemodelonly + * @since 9 */ - function disableSuperAdmin(bundleName: String, callback: AsyncCallback): void; - function disableSuperAdmin(bundleName: String): Promise; + function disableSuperAdmin(bundleName: String): Promise; /** * Get whether the ability is enabled as device administrator. - * - * @since 9 + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - callback contained true if the administrator is enabled. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @param userId Indicates the user ID or do not pass user ID. - * @return {@code true} if the administrator is enabled. + * @systemapi + * @stagemodelonly + * @since 9 */ function isAdminEnabled(admin: Want, callback: AsyncCallback): void; + + /** + * Get whether the ability is enabled as device administrator. + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } userId - userId indicates the user ID. + * @param { AsyncCallback } callback - callback contained true if the administrator is enabled. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 + */ function isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback): void; + + /** + * Get whether the ability is enabled as device administrator. + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } [userId] - userId indicates the user ID or do not pass user ID. + * @returns { Promise } promise contained true if the administrator is enabled. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 + */ function isAdminEnabled(admin: Want, userId?: number): Promise; /** * Get information of the administrator's enterprise. - * - * @since 9 + * @param { Want } admin - admin indicates the administrator ability information. + * @param { AsyncCallback } callback - callback contained the enterprise info of administrator. + * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @return Returns the enterprise information of the administrator. + * @systemapi + * @stagemodelonly + * @since 9 */ function getEnterpriseInfo(admin: Want, callback: AsyncCallback): void; + + /** + * Get information of the administrator's enterprise. + * @param { Want } admin - admin indicates the administrator ability information. + * @returns { Promise } promise contained the enterprise info of administrator. + * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 + */ function getEnterpriseInfo(admin: Want): Promise; /** * Set the information of the administrator's enterprise. - * * Only the administrator app can call this method. - * + * @param { Want } admin - admin indicates the administrator ability information. + * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. + * @param { AsyncCallback } callback - the callback of setEnterpriseInfo. + * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly * @since 9 + */ + function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback): void; + + /** + * Set the information of the administrator's enterprise. + * Only the administrator app can call this method. + * @permission ohos.permission.SET_ENTERPRISE_INFO + * @param { Want } admin - admin indicates the administrator ability information. + * @param { EnterpriseInfo } enterpriseInfo - enterpriseInfo indicates the enterprise information of the calling application. + * @returns { Promise } the promise returned by the setEnterpriseInfo. + * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @param enterpriseInfo Indicates the enterprise information of the calling application. - * @return {@code true} if sets enterprise information success. + * @systemapi + * @stagemodelonly + * @since 9 */ - function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback): void; - function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise; + function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise; /** * Get whether the ability is enabled as super device administrator. - * - * @since 9 + * @param { string } bundleName - bundleName indicates the administrator bundle information. + * @param { AsyncCallback } callback - callback contained true if the administrator is super administrator. + * @throws { BusinessError } 401 - invalid input parameter. * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param bundleName Indicates the administrator bundle information. - * @return {@code true} if the administrator is enabled as super device administrator. + * @systemapi + * @stagemodelonly + * @since 9 */ function isSuperAdmin(bundleName: String, callback: AsyncCallback): void; + + /** + * Get whether the ability is enabled as super device administrator. + * @param { string } bundleName - bundleName indicates the administrator bundle information. + * @returns { Promise } promise contained true if the administrator is super administrator. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 + */ function isSuperAdmin(bundleName: String): Promise; /** diff --git a/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts b/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts index c29c0dda15f0914d3d49df606b81687b93eea872..4187a3f5f1334bca55d1c787babbb12b58b9c654 100644 --- a/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts +++ b/api/enterpriseDeviceManager/DeviceSettingsManager.d.ts @@ -24,14 +24,20 @@ import Want from "./../@ohos.application.Want"; export interface DeviceSettingsManager { /** - * Sets the system time.This function can be called by a super administrator. - * - * @since 9 - * @syscap SystemCapability.Customization.EnterpriseDeviceManager - * @param admin Indicates the administrator ability information. - * @param time Target time stamp (ms) - * @return {@code true} if success. + * Sets the system time. + * This function can be called by a super administrator. * @permission ohos.permission.EDM_MANAGE_DATETIME + * @param { Want } admin - admin indicates the administrator ability information. + * @param { number } time - time indicates rhe target time stamp (ms). + * @returns { Promise } the promise returned by the setDateTime. + * @throws { BusinessError } 9200001 - the applicayion is not an administrator of the device. + * @throws { BusinessError } 9200002 - the administrator applicayion does not have permission to manage the device. + * @throws { BusinessError } 201 - the application does not have permission to call this function. + * @throws { BusinessError } 401 - invalid input parameter. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @stagemodelonly + * @since 9 */ setDateTime(admin: Want, time: number, callback: AsyncCallback): void; setDateTime(admin: Want, time: number): Promise;