提交 cbe3a79f 编写于 作者: G Gloria

Update docs against 17609+17492+18406+18357

Signed-off-by: wusongqing<wusongqing@huawei.com>
上级 43011586
...@@ -5,6 +5,7 @@ The **bundleManager** module provides APIs for bundle management, including addi ...@@ -5,6 +5,7 @@ The **bundleManager** module provides APIs for bundle management, including addi
> **NOTE** > **NOTE**
> >
> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be called only after a [device administrator application](js-apis-enterprise-adminManager.md#adminmanagerenableadmin) is enabled.
## Modules to Import ## Modules to Import
...@@ -16,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager'; ...@@ -16,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager';
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void; addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result. Adds a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -38,8 +39,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -38,8 +39,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -48,9 +49,9 @@ let wantTemp = { ...@@ -48,9 +49,9 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.AddAllowedInstallBundles(wantTemp, appIds, (error) => { bundleManager.addAllowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) { if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message); console.log("error code:" + error.code + " error message:" + error.message);
} }
...@@ -61,7 +62,7 @@ bundleManager.AddAllowedInstallBundles(wantTemp, appIds, (error) => { ...@@ -61,7 +62,7 @@ bundleManager.AddAllowedInstallBundles(wantTemp, appIds, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void; addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are allowed to be installed by the specified user for an enterprise device administrator application. This API uses an asynchronous callback to return the result. Adds a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -84,8 +85,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -84,8 +85,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -94,9 +95,9 @@ let wantTemp = { ...@@ -94,9 +95,9 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.AddAllowedInstallBundles(wantTemp, appIds, 100, (error) => { bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) { if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message); console.log("error code:" + error.code + " error message:" + error.message);
} }
...@@ -107,7 +108,7 @@ bundleManager.AddAllowedInstallBundles(wantTemp, appIds, 100, (error) => { ...@@ -107,7 +108,7 @@ bundleManager.AddAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;; addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are allowed to be installed by the administrator (if **userId** is not passed in) or the specified user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result. Adds a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -135,8 +136,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -135,8 +136,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -145,7 +146,7 @@ let wantTemp = { ...@@ -145,7 +146,7 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => { bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success"); console.log("success");
...@@ -158,7 +159,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => { ...@@ -158,7 +159,7 @@ bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void; removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the administrator for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result. Removes a list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -180,8 +181,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -180,8 +181,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -190,7 +191,7 @@ let wantTemp = { ...@@ -190,7 +191,7 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => { bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) { if (error != null) {
...@@ -203,7 +204,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => { ...@@ -203,7 +204,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void; removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are allowed to be installed by the specified user for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result. Removes a list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -226,8 +227,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -226,8 +227,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -236,7 +237,7 @@ let wantTemp = { ...@@ -236,7 +237,7 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => { bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) { if (error != null) {
...@@ -249,7 +250,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => { ...@@ -249,7 +250,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => {
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;; removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are allowed to be installed by the administrator (if **userId** is not passed in) or the specified user (if **userId** is passed in) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result. Removes a list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. The bundles removed from the list can no longer be installed. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -277,8 +278,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -277,8 +278,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -287,7 +288,7 @@ let wantTemp = { ...@@ -287,7 +288,7 @@ let wantTemp = {
bundleName: "com.example.myapplication", bundleName: "com.example.myapplication",
abilityName: "EntryAbility", abilityName: "EntryAbility",
}; };
let appIds = {"com.example.myapplication"}; let appIds = ["com.example.myapplication"];
bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => { bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success"); console.log("success");
...@@ -300,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => { ...@@ -300,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
getAllowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void; getAllowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result. Obtains the list of bundles that are allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -321,8 +322,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -321,8 +322,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -343,7 +344,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, (error) => { ...@@ -343,7 +344,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, (error) => {
getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void; getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are allowed to be installed by the specified user for an enterprise device administrator application. This API uses an asynchronous callback to return the result. Obtains the list of bundles that are allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -365,8 +366,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -365,8 +366,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -387,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => { ...@@ -387,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
getAllowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;; getAllowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are allowed to be installed for an enterprise device administrator application. This API uses a promise to return the result. Obtains the list of bundles that are allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY **Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...@@ -414,8 +415,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes ...@@ -414,8 +415,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message | | ID| Error Message |
| ------- | ---------------------------------------------------------------------------- | | ------- | ---------------------------------------------------------------------------- |
| 9200003 | the administrator ability component is invalid. | | 9200001 | the application is not an administrator of the device. |
| 9200007 | the system ability work abnormally. | | 9200002 | the administrator application does not have permission to manage the device. |
**Example:** **Example:**
...@@ -430,3 +431,421 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => { ...@@ -430,3 +431,421 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
console.log("error code:" + error.code + " error message:" + error.message); console.log("error code:" + error.code + " error message:" + error.message);
}); });
``` ```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Adds a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| 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&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedInstallBundles
addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Adds a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be added to the disallowed bundle list. |
| 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**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.removeDisallowedInstallBundles
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedInstallBundles
removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback&lt;void&gt;): void;
Removes a list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| 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&lt;void&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedInstallBundles
removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise&lt;void&gt;;
Removes a list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| appIds | Array\&lt;string&gt; | Yes | Bundles to be removed from the disallowed bundle list. |
| 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**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value. If the operation fails, an error object is thrown. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the current administrator for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedInstallBundles(wantTemp, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void;
Obtains the list of bundles that are not allowed to be installed by the given user (specified by **userId**) for an enterprise device administrator application. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application. |
| 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&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. |
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.getDisallowedInstallBundles
getDisallowedInstallBundles(admin: Want, userId?: number): Promise&lt;Array&lt;string&gt;&gt;;
Obtains the list of bundles that are not allowed to be installed by the current administrator (if **userId** is not passed in) or the given user (if **userId** is passed in) for an enterprise device administrator application. This API uses a promise to return the result.
**Required permissions**: ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**System API**: This is a system API.
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | Yes | Target enterprise device administrator application.|
| 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**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the allowed bundle list.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**Example:**
```js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
console.log("success");
}).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.
先完成此消息的编辑!
想要评论请 注册