提交 062d1b63 编写于 作者: E ester.zhou

update docs (8828)

Signed-off-by: Nester.zhou <ester.zhou@huawei.com>
上级 94cfda62
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
- [@ohos.configPolicy](js-apis-config-policy.md) - [@ohos.configPolicy](js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager](js-apis-enterprise-device-manager.md) - [@ohos.enterpriseDeviceManager](js-apis-enterprise-device-manager.md)
- [@ohos.EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md) - [@ohos.EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md)
- enterpriseDeviceManager/[DeviceSettingsManager](js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)
- Security - Security
......
...@@ -18,7 +18,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba ...@@ -18,7 +18,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba
Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result. Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -27,8 +27,8 @@ Enables a device administrator application based on the specified bundle name an ...@@ -27,8 +27,8 @@ Enables a device administrator application based on the specified bundle name an
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ----------------------------------- | ---- | ------------------ | | -------------- | ----------------------------------- | ---- | ------------------ |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to enable. | | type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.| | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -57,7 +57,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ...@@ -57,7 +57,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result. Enables a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -66,8 +66,8 @@ Enables a device administrator application based on the specified bundle name an ...@@ -66,8 +66,8 @@ Enables a device administrator application based on the specified bundle name an
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- | | -------------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to enable. | | type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| userId | number | Yes | User ID The default value is the user ID of the caller. The value must be greater than or equal to 0.| | userId | number | Yes | User ID The default value is the user ID of the caller. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. | | callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. |
...@@ -97,7 +97,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId ...@@ -97,7 +97,7 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
Enables a device administrator application based on the specified bundle name and class name. This API uses a promise to return the result. Enables a device administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -106,8 +106,8 @@ Enables a device administrator application based on the specified bundle name an ...@@ -106,8 +106,8 @@ Enables a device administrator application based on the specified bundle name an
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ----------------------------------- | ---- | ---------------------------- | | -------------- | ----------------------------------- | ---- | ---------------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to enable. | | type | [AdminType](#admintype) | Yes | Type of the device administrator to enable. |
| userId | number | No | User ID The default value is the user ID of the caller. The value must be greater than or equal to 0.| | userId | number | No | User ID The default value is the user ID of the caller. The value must be greater than or equal to 0.|
**Return value** **Return value**
...@@ -141,7 +141,7 @@ disableAdmin(admin: Want, callback: AsyncCallback\<boolean>): void ...@@ -141,7 +141,7 @@ disableAdmin(admin: Want, callback: AsyncCallback\<boolean>): void
Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result. Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -174,7 +174,7 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<boolean>): vo ...@@ -174,7 +174,7 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<boolean>): vo
Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result. Disables a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -208,7 +208,7 @@ disableAdmin(admin: Want, userId?: number): Promise\<boolean> ...@@ -208,7 +208,7 @@ disableAdmin(admin: Want, userId?: number): Promise\<boolean>
Disables a device common administrator application based on the specified bundle name and class name. This API uses a promise to return the result. Disables a device common administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
**Required permissions**: ohos.permission.MANAGE_ADMIN **Required permissions**: ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager **System capability**: SystemCapability.Customization.EnterpriseDeviceManager
...@@ -467,7 +467,7 @@ Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callba ...@@ -467,7 +467,7 @@ Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callba
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------------------------- | ---- | ----------------------------------- | | -------- | --------------------------------------- | ---- | ----------------------------------- |
| callback | AsyncCallback<DeviceSettingsManager&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained.| | callback | AsyncCallback<[DeviceSettingsManager](js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)&gt; | Yes | Callback used to return the **DeviceSettingsManager** object obtained.|
**Example** **Example**
...@@ -503,7 +503,7 @@ Obtains a **DeviceSettingsManager** object. This API uses a promise to return th ...@@ -503,7 +503,7 @@ Obtains a **DeviceSettingsManager** object. This API uses a promise to return th
| Type | Description | | Type | Description |
| ------------------------------------ | ---------------------------------- | | ------------------------------------ | ---------------------------------- |
| Promise&lt;DeviceSettingsManager&gt; | Promise used to return the **DeviceSettingsManager** object obtained.| | Promise&lt;[DeviceSettingsManager](js-apis-enterpriseDeviceManager-DeviceSettingsManager.md)&gt; | Promise used to return the **DeviceSettingsManager** object obtained.|
**Example** **Example**
...@@ -536,7 +536,7 @@ Sets the enterprise information of a device administrator application. This API ...@@ -536,7 +536,7 @@ Sets the enterprise information of a device administrator application. This API
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ----------------------------------- | ---- | ---------------------- | | -------------- | ----------------------------------- | ---- | ---------------------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. | | enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application. |
| callback | AsyncCallback\<boolean&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback\<boolean&gt; | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -571,7 +571,7 @@ Sets the enterprise information of a device administrator application. This API ...@@ -571,7 +571,7 @@ Sets the enterprise information of a device administrator application. This API
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------- | ----------------------------------- | ---- | ------------ | | -------------- | ----------------------------------- | ---- | ------------ |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.| | enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | Yes | Enterprise information of the device administrator application.|
**Return value** **Return value**
...@@ -611,7 +611,7 @@ Obtains the enterprise information of a device administrator application. This A ...@@ -611,7 +611,7 @@ Obtains the enterprise information of a device administrator application. This A
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------ | | -------- | ---------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. | | admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Yes | Callback used to return the enterprise information of the device administrator application.| | callback | AsyncCallback&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Yes | Callback used to return the enterprise information of the device administrator application.|
**Example** **Example**
...@@ -648,7 +648,7 @@ Obtains the enterprise information of a device administrator application. This A ...@@ -648,7 +648,7 @@ Obtains the enterprise information of a device administrator application. This A
| Type | Description | | Type | Description |
| ---------------------------------------- | ------------------------- | | ---------------------------------------- | ------------------------- |
| Promise&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Promise used to return the enterprise information of the device administrator application.| | Promise&lt;[EnterpriseInfo](#enterpriseinfo)&gt; | Promise used to return the enterprise information of the device administrator application.|
**Example** **Example**
......
# Device Settings Management
The **EnterpriseDeviceManager** module provides capabilities to manage device settings, such as time settings. The APIs of this module can only be called by enterprise device administrator applications.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Usage
Before calling any API in **EnterpriseDeviceManager**, use **getDeviceSettingsManager** to create an **EnterpriseDeviceManager** instance.
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'
enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
let deviceMgr = mgr;
});
```
## DeviceSettingsManager.setDateTime
setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void
Sets the system time. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.EDM_MANAGE_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
| callback | AsyncCallback<void> | Yes| Callback used to the result. If the system time is set successfully, **err** is **null**; otherwise, **err** is an error object.|
**Example**
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.getDeviceSettingsManager((error, mgr) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
return;
}
mgr.setDateTime(wantTemp, 1526003846000, (error) => {
if (error) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
});
```
## DeviceSettingsManager.setDateTime
setDateTime(admin: Want, time: number): Promise<void>
Sets the system time. This API uses a promise to return the result.
**Required permissions**: ohos.permission.EDM_MANAGE_DATETIME
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
| time | number | Yes| Timestamp (ms).|
**Return value**
| Type | Description |
| ----- | ----------------------------------- |
| Promise<void> | Promise that returns no value.|
**Example**
```js
import enterpriseDeviceManager from '@ohos.enterpriseDeviceManager'
let wantTemp = {
bundleName: "bundleName",
abilityName: "abilityName",
};
enterpriseDeviceManager.getDeviceSettingsManager().then((mgr) => {
mgr.setDateTime(wantTemp, 1526003846000).then(() => {
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
}).catch((error) => {
console.log("error code:" + error.code + " error message:" + error.message);
})
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册