1/* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit MDMKit 19 */ 20 21import type Want from './@ohos.app.ability.Want'; 22import adminManager from './@ohos.enterprise.adminManager'; 23 24/** 25 * This module provides the capability to manage the telephony of the enterprise devices. 26 * 27 * @namespace telephonyManager 28 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 29 * @stagemodelonly 30 * @since 20 31 */ 32declare namespace telephonyManager { 33 /** 34 * Disable sim slot 35 * This function can be called by a super administrator. 36 * 37 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 38 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 39 * The admin must have the corresponding permission. 40 * @param { number } slotId - Indicates the card slot index number, 41 * ranging from {@code 0} to the maximum card slot index number supported by the device. 42 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 43 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 44 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 45 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 46 * @stagemodelonly 47 * @since 20 48 */ 49 function setSimDisabled(admin: Want, slotId: number): void; 50 51 /** 52 * Enable sim slot 53 * This function can be called by a super administrator. 54 * 55 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 56 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 57 * The admin must have the corresponding permission. 58 * @param { number } slotId - Indicates the card slot index number, 59 * ranging from {@code 0} to the maximum card slot index number supported by the device. 60 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 61 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 62 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 63 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 64 * @stagemodelonly 65 * @since 20 66 */ 67 function setSimEnabled(admin: Want, slotId: number): void; 68 69 /** 70 * Get the state of the sim slot 71 * This function can be called by a super administrator. 72 * 73 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 74 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 75 * The admin must have the corresponding permission. 76 * @param { number } slotId - Indicates the card slot index number, 77 * ranging from {@code 0} to the maximum card slot index number supported by the device. 78 * @returns { boolean } the result of sim slot policy, ture means slotid is disableed. 79 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 80 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 81 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 82 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 83 * @stagemodelonly 84 * @since 20 85 */ 86 function isSimDisabled(admin: Want, slotId: number): boolean; 87 88 /** 89 * Add phone number to outgoing call number list. 90 * This function can be called by a super administrator. 91 * 92 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 93 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 94 * The admin must have the corresponding permission. 95 * @param { adminManager.Policy } policy - policy flag. 96 * @param { Array<string> } numbers - phone numbers will add to the trust/block list. 97 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 98 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 99 * @throws { BusinessError } 9200010 - A conflict policy has been configured. 100 * @throws { BusinessError } 9200012 - Parameter verification failed. 101 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 102 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 103 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 104 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 105 * @stagemodelonly 106 * @since 20 107 */ 108 function addOutgoingCallPolicyNumbers(admin: Want, policy: adminManager.Policy, numbers: Array<string>): void; 109 110 /** 111 * Remove phone number from outgoing call number list. 112 * This function can be called by a super administrator. 113 * 114 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 115 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 116 * The admin must have the corresponding permission. 117 * @param { adminManager.Policy } policy - policy flag. 118 * @param { Array<string> } numbers - phone numbers will remove from the trust/block list. 119 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 120 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 121 * @throws { BusinessError } 9200012 - Parameter verification failed. 122 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 123 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 124 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 125 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 126 * @stagemodelonly 127 * @since 20 128 */ 129 function removeOutgoingCallPolicyNumbers(admin: Want, policy: adminManager.Policy, numbers: Array<string>): void; 130 131 /** 132 * Get outgoing call number list. 133 * This function can be called by a super administrator. 134 * 135 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 136 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 137 * The admin must have the corresponding permission. 138 * @param { adminManager.Policy } policy - policy flag. 139 * @returns { Array<string> } phone numbers in the trust/block list. 140 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 141 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 142 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 143 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 144 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 145 * @stagemodelonly 146 * @since 20 147 */ 148 function getOutgoingCallPolicyNumbers(admin: Want, policy: adminManager.Policy): Array<string>; 149 150 /** 151 * Add phone number to incoming call policy number list. 152 * This function can be called by a super administrator. 153 * 154 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 155 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 156 * The admin must have the corresponding permission. 157 * @param { adminManager.Policy } policy - policy flag. 158 * @param { Array<string> } numbers - phone numbers will add to the trust/block list. 159 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 160 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 161 * @throws { BusinessError } 9200010 - A conflict policy has been configured. 162 * @throws { BusinessError } 9200012 - Parameter verification failed. 163 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 164 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 165 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 166 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 167 * @stagemodelonly 168 * @since 20 169 */ 170 function addIncomingCallPolicyNumbers(admin: Want, policy: adminManager.Policy, numbers: Array<string>): void; 171 172 /** 173 * Remove phone number from incoming call pplicy number list. 174 * This function can be called by a super administrator. 175 * 176 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 177 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 178 * The admin must have the corresponding permission. 179 * @param { adminManager.Policy } policy - policy flag. 180 * @param { Array<string> } numbers - phone numbers will remove from the trust/block list. 181 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 182 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 183 * @throws { BusinessError } 9200012 - Parameter verification failed. 184 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 185 * @throws { BusinessError } 203 - This function is prohibited by enterprise management policies. 186 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 187 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 188 * @stagemodelonly 189 * @since 20 190 */ 191 function removeIncomingCallPolicyNumbers(admin: Want, policy: adminManager.Policy, numbers: Array<string>): void; 192 193 /** 194 * Get incoming call policy number list. 195 * This function can be called by a super administrator. 196 * 197 * @permission ohos.permission.ENTERPRISE_MANAGE_TELEPHONY 198 * @param { Want } admin - admin indicates the enterprise admin extension ability information. 199 * The admin must have the corresponding permission. 200 * @param { adminManager.Policy } policy - policy flag. 201 * @returns { Array<string> } phone numbers in the trust/block list. 202 * @throws { BusinessError } 9200001 - The application is not an administrator application of the device. 203 * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device. 204 * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API. 205 * @throws { BusinessError } 801 - Capability not supported. Failed to call the API due to limited device capabilities. 206 * @syscap SystemCapability.Customization.EnterpriseDeviceManager 207 * @stagemodelonly 208 * @since 20 209 */ 210 function getIncomingCallPolicyNumbers(admin: Want, policy: adminManager.Policy): Array<string>; 211} 212 213export default telephonyManager; 214