更换GET_PHONE_NUMBERS

Signed-off-by: liuxiyao223 <liuxiyao223@huawei.com>
This commit is contained in:
liuxiyao223 2023-08-01 19:18:36 +08:00
parent 3aa1a82d8a
commit 89de785688
6 changed files with 11 additions and 5 deletions

View File

@ -83,7 +83,7 @@ The telephony core service module needs to provide APIs for related modules, inc
| function getDefaultVoiceSimId(callback: AsyncCallback\<number>): void; | Obtains the sim id of the default SIM card that provides the voice service. | |
| function isSimActive(slotId: number, callback: AsyncCallback\<boolean>): void | Checks whether the SIM card in the specified slot is activated. | |
| function hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void | Checks whether the specified slot is populated with a SIM card. | |
| function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void | Obtains the mobile station integrated services digital network (MSISDN) of the SIM card in the specified slot.|ohos.permission.GET_TELEPHONY_STATE |
| function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void | Obtains the mobile station integrated services digital network (MSISDN) of the SIM card in the specified slot.|ohos.permission.GET_PHONE_NUMBERS |
| function getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void | Obtains the voice mailbox identifier of the SIM card in the specified slot.| ohos.permission.GET_TELEPHONY_STATE |
| function getVoiceMailNumber(slotId: number, callback: AsyncCallback\<string>): void | Obtains the voice mailbox number of the SIM card in the specified slot.| ohos.permission.GET_TELEPHONY_STATE |
| function getCardType(slotId: number, callback: AsyncCallback\<CardType>): void | Obtains the type of the SIM card in the specified slot. | |

View File

@ -82,7 +82,7 @@
| function getDefaultVoiceSimId(callback: AsyncCallback\<number>): void; | 获取语音业务的默认卡ID | 无 |
| function isSimActive(slotId: number, callback: AsyncCallback\<boolean>): void | 检查指定卡槽的SIM卡是否激活 | 无 |
| function hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void | 检查SIM卡是否插入指定卡槽 | 无 |
| function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void | 获取指定卡槽SIM卡的MSISDNMobile Station Integrated Services Digital Network|ohos.permission.GET_TELEPHONY_STATE |
| function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void | 获取指定卡槽SIM卡的MSISDNMobile Station Integrated Services Digital Network|ohos.permission.GET_PHONE_NUMBERS |
| function getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void | 获取指定卡槽SIM卡语音信箱的身份标识 | ohos.permission.GET_TELEPHONY_STATE |
| function getVoiceMailNumber(slotId: number, callback: AsyncCallback\<string>): void | 获取指定卡槽SIM卡的语音邮箱号码 | ohos.permission.GET_TELEPHONY_STATE |
| function getCardType(slotId: number, callback: AsyncCallback\<CardType>): void | 获取指定卡槽SIM卡的类型 | 无 |

View File

@ -543,7 +543,7 @@ declare namespace sim {
* Obtains the MSISDN of the SIM card in a specified slot.
* The MSISDN is recorded in the EFMSISDN file of the SIM card.
*
* @permission ohos.permission.GET_TELEPHONY_STATE
* @permission ohos.permission.GET_PHONE_NUMBERS
* @param { number } slotId - Indicates the card slot index number,
* ranging from 0 to the maximum card slot index number supported by the device.
* @param { AsyncCallback<string> } callback - Indicates the callback for getting the MSISDN;
@ -567,7 +567,7 @@ declare namespace sim {
* Obtains the MSISDN of the SIM card in a specified slot.
* The MSISDN is recorded in the EFMSISDN file of the SIM card.
*
* @permission ohos.permission.GET_TELEPHONY_STATE
* @permission ohos.permission.GET_PHONE_NUMBERS
* @param { number } slotId - Indicates the card slot index number,
* ranging from 0 to the maximum card slot index number supported by the device.
* @returns { Promise<string> } Returns the MSISDN; returns an empty string if no SIM card is inserted or

View File

@ -1004,7 +1004,8 @@ int32_t CoreService::GetSimTelephoneNumber(int32_t slotId, std::u16string &telep
TELEPHONY_LOGE("Non-system applications use system APIs!");
return TELEPHONY_ERR_ILLEGAL_USE_OF_SYSTEM_API;
}
if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) {
if ((!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) &&
(!TelephonyPermission::CheckPermission(Permission::GET_PHONE_NUMBERS))) {
TELEPHONY_LOGE("permission denied!");
return TELEPHONY_ERR_PERMISSION_ERR;
}

View File

@ -16,6 +16,7 @@
"ohos.permission.COMMONEVENT_STICKY",
"ohos.permission.CONNECTIVITY_INTERNAL",
"ohos.permission.GET_TELEPHONY_STATE",
"ohos.permission.GET_PHONE_NUMBERS",
"ohos.permission.PERMISSION_USED_STATS",
"ohos.permission.RECEIVE_SMS",
"ohos.permission.SET_TELEPHONY_STATE",

View File

@ -61,6 +61,10 @@ static constexpr const char *SET_TELEPHONY_STATE = "ohos.permission.SET_TELEPHON
* This permission indicates being allowed to get state of telephony.
*/
static constexpr const char *GET_TELEPHONY_STATE = "ohos.permission.GET_TELEPHONY_STATE";
/**
* This permission indicates being allowed to get MSISDN of SIM card.
*/
static constexpr const char *GET_PHONE_NUMBERS = "ohos.permission.GET_PHONE_NUMBERS";
/**
* This permission indicates being allowed to set information about network.
*/