161847f8eSopenharmony_ci/* 261847f8eSopenharmony_ci * Copyright (c) 2022 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 } from './@ohos.base'; 2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want'; 2361847f8eSopenharmony_ci 2461847f8eSopenharmony_ci/** 2561847f8eSopenharmony_ci * This module provides the capability to manage the datetime of the enterprise devices. 2661847f8eSopenharmony_ci * 2761847f8eSopenharmony_ci * @namespace dateTimeManager 2861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 2961847f8eSopenharmony_ci * @systemapi 3061847f8eSopenharmony_ci * @since 9 3161847f8eSopenharmony_ci */ 3261847f8eSopenharmony_cideclare namespace dateTimeManager { 3361847f8eSopenharmony_ci /** 3461847f8eSopenharmony_ci * Sets the system time. 3561847f8eSopenharmony_ci * This function can be called by a super administrator. 3661847f8eSopenharmony_ci * 3761847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 3861847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 3961847f8eSopenharmony_ci * The admin must have the corresponding permission. 4061847f8eSopenharmony_ci * @param { number } time - time indicates the target time stamp (ms). 4161847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of setDateTime. 4261847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 4361847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 4461847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 4561847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 4661847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 4761847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 4861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 4961847f8eSopenharmony_ci * @systemapi 5061847f8eSopenharmony_ci * @StageModelOnly 5161847f8eSopenharmony_ci * @since 9 5261847f8eSopenharmony_ci */ 5361847f8eSopenharmony_ci function setDateTime(admin: Want, time: number, callback: AsyncCallback<void>): void; 5461847f8eSopenharmony_ci 5561847f8eSopenharmony_ci /** 5661847f8eSopenharmony_ci * Sets the system time. 5761847f8eSopenharmony_ci * This function can be called by a super administrator. 5861847f8eSopenharmony_ci * 5961847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 6061847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 6161847f8eSopenharmony_ci * The admin must have the corresponding permission. 6261847f8eSopenharmony_ci * @param { number } time - time indicates the target time stamp (ms). 6361847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the setDateTime. 6461847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 6561847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 6661847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 6761847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 6861847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 6961847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 7061847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 7161847f8eSopenharmony_ci * @systemapi 7261847f8eSopenharmony_ci * @StageModelOnly 7361847f8eSopenharmony_ci * @since 9 7461847f8eSopenharmony_ci */ 7561847f8eSopenharmony_ci function setDateTime(admin: Want, time: number): Promise<void>; 7661847f8eSopenharmony_ci 7761847f8eSopenharmony_ci /** 7861847f8eSopenharmony_ci * Disallow modify the system time. 7961847f8eSopenharmony_ci * This function can be called by a super administrator. 8061847f8eSopenharmony_ci * 8161847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 8261847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 8361847f8eSopenharmony_ci * The admin must have the corresponding permission. 8461847f8eSopenharmony_ci * @param { boolean } disallow - true if the user is not allowed to modify the system time. 8561847f8eSopenharmony_ci * @param { AsyncCallback<void> } callback - the callback of disallowModifyDateTime. 8661847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 8761847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 8861847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 8961847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 9061847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 9161847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 9261847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 9361847f8eSopenharmony_ci * @systemapi 9461847f8eSopenharmony_ci * @StageModelOnly 9561847f8eSopenharmony_ci * @since 10 9661847f8eSopenharmony_ci */ 9761847f8eSopenharmony_ci function disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback<void>): void; 9861847f8eSopenharmony_ci 9961847f8eSopenharmony_ci /** 10061847f8eSopenharmony_ci * Disallow modify the system time. 10161847f8eSopenharmony_ci * This function can be called by a super administrator. 10261847f8eSopenharmony_ci * 10361847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 10461847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 10561847f8eSopenharmony_ci * The admin must have the corresponding permission. 10661847f8eSopenharmony_ci * @param { boolean } disallow - true if the user is not allowed to modify the system time. 10761847f8eSopenharmony_ci * @returns { Promise<void> } the promise returned by the disallowModifyDateTime. 10861847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 10961847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 11061847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 11161847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 11261847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 11361847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 11461847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 11561847f8eSopenharmony_ci * @systemapi 11661847f8eSopenharmony_ci * @StageModelOnly 11761847f8eSopenharmony_ci * @since 10 11861847f8eSopenharmony_ci */ 11961847f8eSopenharmony_ci function disallowModifyDateTime(admin: Want, disallow: boolean): Promise<void>; 12061847f8eSopenharmony_ci 12161847f8eSopenharmony_ci /** 12261847f8eSopenharmony_ci * Query the capability of modify the system time is allowed or disallowed. 12361847f8eSopenharmony_ci * This function can be called by a super administrator. 12461847f8eSopenharmony_ci * 12561847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 12661847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 12761847f8eSopenharmony_ci * If the admin is not empty, it must have the corresponding permission. 12861847f8eSopenharmony_ci * @param { AsyncCallback<boolean> } callback - return true if modify datetime is not allowed. 12961847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 13061847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 13161847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 13261847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 13361847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 13461847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 13561847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 13661847f8eSopenharmony_ci * @systemapi 13761847f8eSopenharmony_ci * @StageModelOnly 13861847f8eSopenharmony_ci * @since 10 13961847f8eSopenharmony_ci */ 14061847f8eSopenharmony_ci function isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback<boolean>): void; 14161847f8eSopenharmony_ci 14261847f8eSopenharmony_ci /** 14361847f8eSopenharmony_ci * Query the capability of modify the system time is allowed or disallowed. 14461847f8eSopenharmony_ci * This function can be called by a super administrator. 14561847f8eSopenharmony_ci * 14661847f8eSopenharmony_ci * @permission ohos.permission.ENTERPRISE_SET_DATETIME 14761847f8eSopenharmony_ci * @param { Want } admin - admin indicates the enterprise admin extension ability information. 14861847f8eSopenharmony_ci * If the admin is not empty, it must have the corresponding permission. 14961847f8eSopenharmony_ci * @returns { Promise<boolean> } return true if modify datetime is not allowed. 15061847f8eSopenharmony_ci * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 15161847f8eSopenharmony_ci * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 15261847f8eSopenharmony_ci * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 15361847f8eSopenharmony_ci * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API. 15461847f8eSopenharmony_ci * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 15561847f8eSopenharmony_ci * 2. Incorrect parameter types; 3. Parameter verification failed. 15661847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager 15761847f8eSopenharmony_ci * @systemapi 15861847f8eSopenharmony_ci * @StageModelOnly 15961847f8eSopenharmony_ci * @since 10 16061847f8eSopenharmony_ci */ 16161847f8eSopenharmony_ci function isModifyDateTimeDisallowed(admin: Want): Promise<boolean>; 16261847f8eSopenharmony_ci} 16361847f8eSopenharmony_ci 16461847f8eSopenharmony_ci 16561847f8eSopenharmony_ciexport default dateTimeManager; 166