!778 整改接口权限

Merge pull request !778 from dingxiaochen/master
This commit is contained in:
openharmony_ci 2022-10-24 11:45:46 +00:00 committed by Gitee
commit 547e470806
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 21 additions and 1 deletions

View File

@ -79,7 +79,7 @@
| function getSimOperatorNumeric(slotId: number, callback: AsyncCallback\<string>): void; | 获取指定卡槽SIM卡的归属PLMNPublic Land Mobile Network号 | 无 |
| function getSimSpn(slotId: number, callback: AsyncCallback\<string>): void; | 获取指定卡槽SIM卡的运营商SPNService Provider Name | 无 |
| function getDefaultVoiceSlotId(callback: AsyncCallback\<number>): void; | 获取语音业务的默认卡卡槽 | 无 |
| function isSimActive(slotId: number, callback: AsyncCallback\<boolean>): void | 检查指定卡槽的SIM卡是否激活 | 无 |
| 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 getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void | 获取指定卡槽SIM卡语音信箱的身份标识 | ohos.permission.GET_TELEPHONY_STATE |

View File

@ -72,6 +72,7 @@ declare namespace radio {
/**
* Proactively requests to update location information.
*
* @permission ohos.permission.LOCATION
* @systemapi Hide this for inner system use.
* @since 8
*/

View File

@ -415,6 +415,7 @@ declare namespace sim {
function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void>;
/**
* @permission ohos.permission.GET_TELEPHONY_STATE
* @systemapi Hide this for inner system use.
* @since 8
*/

View File

@ -393,6 +393,10 @@ bool CoreService::GetNetworkSelectionMode(int32_t slotId, const sptr<INetworkSea
std::u16string CoreService::GetLocaleFromDefaultSim()
{
if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) {
TELEPHONY_LOGE("CoreService::GetLocaleFromDefaultSim, Permission denied!");
return std::u16string();
}
TELEPHONY_LOGI("CoreService::GetSimAccountInfo()");
if (simManager_ == nullptr) {
return std::u16string();
@ -662,6 +666,10 @@ bool CoreService::SetLockState(int32_t slotId, const LockInfo &options, LockStat
int32_t CoreService::GetLockState(int32_t slotId, LockType lockType)
{
if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) {
TELEPHONY_LOGE("CoreService::GetLockState, Permission denied!");
return TELEPHONY_PERMISSION_ERROR;
}
TELEPHONY_LOGI("CoreService::GetLockState(), lockType = %{public}d, slotId = %{public}d", lockType, slotId);
if (simManager_ == nullptr) {
return TELEPHONY_ERROR;
@ -726,6 +734,10 @@ std::u16string CoreService::GetSimTelephoneNumber(int32_t slotId)
std::u16string CoreService::GetSimTeleNumberIdentifier(const int32_t slotId)
{
if (!TelephonyPermission::CheckPermission(Permission::GET_TELEPHONY_STATE)) {
TELEPHONY_LOGE("CoreService::GetSimTeleNumberIdentifier, Permission denied!");
return std::u16string();
}
TELEPHONY_LOGI("CoreService::GetSimTeleNumberIdentifier(), slotId = %{public}d", slotId);
if (simManager_ == nullptr) {
return std::u16string();
@ -935,6 +947,10 @@ std::vector<sptr<CellInformation>> CoreService::GetCellInfoList(int32_t slotId)
bool CoreService::SendUpdateCellLocationRequest(int32_t slotId)
{
if (!TelephonyPermission::CheckPermission(Permission::CELL_LOCATION)) {
TELEPHONY_LOGE("CoreService::SendUpdateCellLocationRequest, Permission denied!");
return false;
}
if (networkSearchManager_ == nullptr) {
return false;
}

View File

@ -1312,6 +1312,7 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_GetUniqueDeviceId_0200, Func
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_SendUpdateCellLocationRequest_0100, Function | MediumTest | Level3)
{
AccessToken token;
if (NetworkSearchTest::telephonyService_ == nullptr ||
!(NetworkSearchTest::telephonyService_->HasSimCard(SLOT_ID))) {
TELEPHONY_LOGI("TelephonyTestService Remote service is null");
@ -1330,6 +1331,7 @@ HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_SendUpdateCellLocationReques
*/
HWTEST_F(NetworkSearchTest, Telephony_NetworkSearch_SendUpdateCellLocationRequest_0200, Function | MediumTest | Level3)
{
AccessToken token;
if (NetworkSearchTest::telephonyService_ == nullptr ||
!(NetworkSearchTest::telephonyService_->HasSimCard(SLOT_ID1))) {
TELEPHONY_LOGI("TelephonyTestService Remote service is null");