161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 461847f8eSopenharmony_ci * you may not use this file except in compliance with the License. 561847f8eSopenharmony_ci * You may obtain a copy of the License at 661847f8eSopenharmony_ci * 761847f8eSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 861847f8eSopenharmony_ci * 961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and 1361847f8eSopenharmony_ci * limitations under the License. 1461847f8eSopenharmony_ci */ 1561847f8eSopenharmony_ci 1661847f8eSopenharmony_ci/** 1761847f8eSopenharmony_ci * @file 1861847f8eSopenharmony_ci * @kit MDMKit 1961847f8eSopenharmony_ci */ 2061847f8eSopenharmony_ci 2161847f8eSopenharmony_ciimport type { AsyncCallback, Callback } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * This module provides the capability to control the enterprise devices. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace deviceControl 2861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 2961847f8eSopenharmony_ci * @since 10 3061847f8eSopenharmony_ci */ 3161847f8eSopenharmony_cideclare namespace deviceControl { 3261847f8eSopenharmony_ci /** 3361847f8eSopenharmony_ci * Allow the administrator to reset the enterprise devices. 3461847f8eSopenharmony_ci * This function can be called by a super administrator. 3561847f8eSopenharmony_ci * 3661847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_RESET_DEVICE 3761847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 3861847f8eSopenharmony_ci * The admin must have the corresponding permission. 3961847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of resetFactory. 4061847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 4161847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 4261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 4361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 4461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 4661847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 4761847f8eSopenharmony_ci * @systemapi 4861847f8eSopenharmony_ci * @StageModelOnly 4961847f8eSopenharmony_ci * @since 10 5061847f8eSopenharmony_ci */ 5161847f8eSopenharmony_ci function resetFactory(admin: Want, callback: AsyncCallback<void>): void; 5261847f8eSopenharmony_ci 5361847f8eSopenharmony_ci /** 5461847f8eSopenharmony_ci * Allow the administrator to reset the enterprise devices. 5561847f8eSopenharmony_ci * This function can be called by a super administrator. 5661847f8eSopenharmony_ci * 5761847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_RESET_DEVICE 5861847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 5961847f8eSopenharmony_ci * The admin must have the corresponding permission. 6061847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the resetFactory. 6161847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 6261847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 6361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 6461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 6561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 6761847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 6861847f8eSopenharmony_ci * @systemapi 6961847f8eSopenharmony_ci * @StageModelOnly 7061847f8eSopenharmony_ci * @since 10 7161847f8eSopenharmony_ci */ 7261847f8eSopenharmony_ci function resetFactory(admin: Want): Promise<void>; 7361847f8eSopenharmony_ci 7461847f8eSopenharmony_ci /** 7561847f8eSopenharmony_ci * Allows the administrator to shutdown the devices. 7661847f8eSopenharmony_ci * This function can be called by a super administrator. 7761847f8eSopenharmony_ci * 7861847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_REBOOT 7961847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 8061847f8eSopenharmony_ci * The admin must have the corresponding permission. 8161847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 8261847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 8361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 8461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 8561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 8661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 8761847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 8861847f8eSopenharmony_ci * @systemapi 8961847f8eSopenharmony_ci * @stagemodelonly 9061847f8eSopenharmony_ci * @since 11 9161847f8eSopenharmony_ci */ 9261847f8eSopenharmony_ci function shutdown(admin: Want): void; 9361847f8eSopenharmony_ci 9461847f8eSopenharmony_ci /** 9561847f8eSopenharmony_ci * Allows the administrator to reboot the devices. 9661847f8eSopenharmony_ci * This function can be called by a super administrator. 9761847f8eSopenharmony_ci * 9861847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_REBOOT 9961847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 10061847f8eSopenharmony_ci * The admin must have the corresponding permission. 10161847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 10261847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 10361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 10461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 10561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 10661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 10761847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 10861847f8eSopenharmony_ci * @systemapi 10961847f8eSopenharmony_ci * @stagemodelonly 11061847f8eSopenharmony_ci * @since 11 11161847f8eSopenharmony_ci */ 11261847f8eSopenharmony_ci function reboot(admin: Want): void; 11361847f8eSopenharmony_ci 11461847f8eSopenharmony_ci /** 11561847f8eSopenharmony_ci * Allows the administrator to lock screen. 11661847f8eSopenharmony_ci * This function can be called by a super administrator. 11761847f8eSopenharmony_ci * 11861847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_LOCK_DEVICE 11961847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 12061847f8eSopenharmony_ci * The admin must have the corresponding permission. 12161847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 12261847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 12361847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 12461847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 12561847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 12661847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 12761847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 12861847f8eSopenharmony_ci * @systemapi 12961847f8eSopenharmony_ci * @stagemodelonly 13061847f8eSopenharmony_ci * @since 11 13161847f8eSopenharmony_ci */ 13261847f8eSopenharmony_ci function lockScreen(admin: Want): void; 13361847f8eSopenharmony_ci 13461847f8eSopenharmony_ci /** 13561847f8eSopenharmony_ci * Allows the administrator to operate device. 13661847f8eSopenharmony_ci * This function can be called by a super administrator. 13761847f8eSopenharmony_ci * 13861847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_OPERATE_DEVICE 13961847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 14061847f8eSopenharmony_ci * The admin must have the corresponding permission. 14161847f8eSopenharmony_ci * @param { string } operate - operate indicates the operation to be performed, 14261847f8eSopenharmony_ci * the supported device operations include lockScreen, resetFactory, reboot and shutDown. 14361847f8eSopenharmony_ci * @param { string } [addition] - addition indicates the specify additional parameters when performing the operation. 14461847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 14561847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 14661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 14761847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 14861847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 14961847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 15061847f8eSopenharmony_ci * @stagemodelonly 15161847f8eSopenharmony_ci * @since 12 15261847f8eSopenharmony_ci */ 15361847f8eSopenharmony_ci function operateDevice(admin: Want, operate: string, addition?: string): void; 15461847f8eSopenharmony_ci} 15561847f8eSopenharmony_ci 15661847f8eSopenharmony_ciexport default deviceControl; 157