diff --git a/api/@ohos.EnterpriseAdminExtensionAbility.d.ts b/api/@ohos.EnterpriseAdminExtensionAbility.d.ts index a290390863bed628f4684622785e432018d53d7f..e968d3ff4b63904ae23b6766240923e55e17cfbb 100644 --- a/api/@ohos.EnterpriseAdminExtensionAbility.d.ts +++ b/api/@ohos.EnterpriseAdminExtensionAbility.d.ts @@ -38,4 +38,24 @@ export default class EnterpriseAdminExtensionAbility { * @StageModelOnly */ onAdminDisabled(): void; + + /** + * Called back when a bundle is installed. + * @param { string } bundleName - bundleName indicates the name of the bundle installed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 9 + */ + onBundleAdded(bundleName: string): void; + + /** + * Called back when a bundle is uninstalled. + * @param { string } bundleName - bundleName indicates the name of the bundle uninstalled. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @systemapi + * @StageModelOnly + * @since 9 + */ + onBundleRemoved(bundleName: string): void; } \ No newline at end of file diff --git a/api/@ohos.enterpriseDeviceManager.d.ts b/api/@ohos.enterpriseDeviceManager.d.ts index 273c97f1174fee9f4667838aebe769b198c0706e..b84e44e6d450033e399817893b209dc25aacf034 100644 --- a/api/@ohos.enterpriseDeviceManager.d.ts +++ b/api/@ohos.enterpriseDeviceManager.d.ts @@ -52,6 +52,23 @@ declare namespace enterpriseDeviceManager { ADMIN_TYPE_SUPER = 0x01 } + export enum ManagedEvent { + + /** + * The event of bundle added. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 9 + */ + MANAGED_EVENT_BUNDLE_ADDED = 0, + + /** + * The event of bundle removed. + * @syscap SystemCapability.Customization.EnterpriseDeviceManager + * @since 9 + */ + MANAGED_EVENT_BUNDLE_REMOVED = 1, + } + /** * Enables the given ability as a administrator of the device. * @@ -158,6 +175,73 @@ declare namespace enterpriseDeviceManager { function getDeviceSettingsManager(callback: AsyncCallback): void; function getDeviceSettingsManager(): Promise; + /** + * Subscribes the managed event of admin. + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @param { AsyncCallback } callback - the callback of subscribeManagedEvent. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200008 - the specified system events enum is invalid. + * @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 subscribeManagedEvent(admin: Want, managedEvents: Array, callback: AsyncCallback): void; + + /** + * Subscribes the managed event of admin. + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @returns { Promise } the promise returned by the subscribeManagedEvent. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200008 - the specified system events enum is invalid. + * @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 subscribeManagedEvent(admin: Want, managedEvents: Array): Promise; + + /** + * Unsubscribes the managed event of admin. + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @param { AsyncCallback } callback - the callback of unsubscribeManagedEvent. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200008 - the specified system events enum is invalid. + * @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 unsubscribeManagedEvent(admin: Want, managedEvents: Array, callback: AsyncCallback): void; + + /** + * Unsubscribes the managed event of admin. + * @permission ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT + * @param { Want } admin - admin indicates the administrator ability information. + * @param { Array } managedEvents - managedEvents indicates the managed events to subscribe. + * @returns { Promise } the promise returned by the unsubscribeManagedEvent. + * @throws { BusinessError } 9200001 - the application is not an administrator of the device. + * @throws { BusinessError } 9200008 - the specified system events enum is invalid. + * @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 unsubscribeManagedEvent(admin: Want, managedEvents: Array): Promise; } export default enterpriseDeviceManager; \ No newline at end of file