• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 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 #include "sms_receive_reliability_handler.h"
17 
18 #include "common_event.h"
19 #include "common_event_support.h"
20 #include "gsm_sms_message.h"
21 #include "parameter.h"
22 #include "radio_event.h"
23 #include "sms_broadcast_subscriber_receiver.h"
24 #include "sms_hisysevent.h"
25 #include "sms_persist_helper.h"
26 #include "telephony_common_utils.h"
27 #include "telephony_log_wrapper.h"
28 #include "telephony_permission.h"
29 
30 namespace OHOS {
31 namespace Telephony {
32 using namespace std;
33 using namespace EventFwk;
34 static constexpr uint16_t PDU_POS_OFFSET = 1;
35 static constexpr uint16_t PDU_START_POS = 0;
36 static constexpr uint16_t SMS_INVALID_PAGE_COUNT = 0;
37 static constexpr uint16_t SMS_SINGLE_PAGE_COUNT = 1;
38 static constexpr uint16_t SMS_PAGE_INITIAL = 1;
39 static constexpr uint16_t SMS_PAGE_INCREMENT = 1;
40 static constexpr int16_t WAP_PUSH_PORT = 2948;
41 static constexpr int16_t SMS_TEXT_PORT = -1;
42 static constexpr int32_t TEXT_MSG_RECEIVE_CODE = 0;
43 static constexpr int32_t DATA_MSG_RECEIVE_CODE = 1;
44 static constexpr int64_t ONE_DAY_TOTAL_SECONDS = 86400;
45 static constexpr uint16_t MAX_TPDU_DATA_LEN = 255;
46 static constexpr int32_t EXPIRE_DAYS_PARA_SIZE = 128;
47 static constexpr const char *SMS_EXPIRE_DAYS = "const.telephony.sms.expire.days";
48 static constexpr const char *DEFAULT_EXPIRE_DAYS = "7";
49 static constexpr const char *SMS_PAGE_COUNT_INVALID = "0";
50 static constexpr const char *SMS_BROADCAST_SLOTID_KEY = "slotId";
51 static constexpr const char *SMS_BROADCAST_PDU_KEY = "pdus";
52 static constexpr const char *SMS_BROADCAST_SMS_TYPE_KEY = "isCdma";
53 static constexpr const char *SMS_BROADCAST_SMS_TEXT_TYPE_KEY = "TEXT_SMS_RECEIVE";
54 static constexpr const char *SMS_BROADCAST_SMS_DATA_TYPE_KEY = "DATA_SMS_RECEIVE";
55 static constexpr const char *SMS_BROADCAST_SMS_PORT_KEY = "port";
56 const std::string CT_SMSC = "10659401";
57 const std::string CT_SMSC_86 = "8610659401";
58 const std::string CT_SMSC_INTERNATION_86 = "+8610659401";
59 const std::string CT_AUTO_REG_SMS_ACTION = "ct_auto_reg_sms_receive_completed";
60 
SmsReceiveReliabilityHandler(int32_t slotId)61 SmsReceiveReliabilityHandler::SmsReceiveReliabilityHandler(int32_t slotId) : slotId_(slotId)
62 {
63     smsWapPushHandler_ = std::make_unique<SmsWapPushHandler>(slotId);
64     if (smsWapPushHandler_ == nullptr) {
65         TELEPHONY_LOGE("make sms wapPush Hander error.");
66     }
67 }
68 
~SmsReceiveReliabilityHandler()69 SmsReceiveReliabilityHandler::~SmsReceiveReliabilityHandler() {}
70 
DeleteExpireSmsFromDB()71 bool SmsReceiveReliabilityHandler::DeleteExpireSmsFromDB()
72 {
73     DataShare::DataSharePredicates predicates;
74     std::time_t timep;
75     int64_t currentTime = time(&timep);
76 
77     std::string smsExpire = GetSmsExpire();
78     if (!IsValidDecValue(smsExpire)) {
79         TELEPHONY_LOGE("system property telephony.sms.expire.days not decimal");
80         smsExpire = DEFAULT_EXPIRE_DAYS;
81     }
82     int64_t validityDuration = std::stoi(smsExpire) * ONE_DAY_TOTAL_SECONDS;
83     int64_t deadlineTime = currentTime - validityDuration;
84     if (deadlineTime <= 0) {
85         TELEPHONY_LOGE("deadlineTime is negative");
86         return false;
87     }
88 
89     predicates.EqualTo(SmsSubsection::SLOT_ID, std::to_string(slotId_))
90         ->BeginWrap()
91         ->LessThan(SmsSubsection::START_TIME, std::to_string(deadlineTime))
92         ->Or()
93         ->EqualTo(SmsSubsection::REW_PUD, "")
94         ->Or()
95         ->LessThan(SmsSubsection::SIZE, SMS_PAGE_COUNT_INVALID)
96         ->EndWrap();
97     return DelayedSingleton<SmsPersistHelper>::GetInstance()->Delete(predicates);
98 }
99 
GetSmsExpire()100 std::string SmsReceiveReliabilityHandler::GetSmsExpire()
101 {
102     char smsExpireDays[EXPIRE_DAYS_PARA_SIZE] = { 0 };
103     GetParameter(SMS_EXPIRE_DAYS, DEFAULT_EXPIRE_DAYS, smsExpireDays, EXPIRE_DAYS_PARA_SIZE);
104     return smsExpireDays;
105 }
106 
RemoveBlockedSms(std::vector<SmsReceiveIndexer> & dbIndexers)107 void SmsReceiveReliabilityHandler::RemoveBlockedSms(std::vector<SmsReceiveIndexer> &dbIndexers)
108 {
109     DataShare::DataSharePredicates predicates;
110     predicates.EqualTo(SmsSubsection::SLOT_ID, std::to_string(slotId_));
111     DelayedSingleton<SmsPersistHelper>::GetInstance()->Query(predicates, dbIndexers);
112 
113     for (auto smsPage = dbIndexers.begin(); smsPage != dbIndexers.end();) {
114         if (CheckBlockedPhoneNumber(smsPage->GetOriginatingAddress())) {
115             TELEPHONY_LOGI("indexer display address is block");
116             smsPage = dbIndexers.erase(smsPage);
117         } else if (smsPage->GetPdu().size() == 0 || smsPage->GetPdu().size() > MAX_TPDU_DATA_LEN) {
118             smsPage = dbIndexers.erase(smsPage);
119         } else {
120             smsPage++;
121         }
122     }
123 }
124 
CheckUnReceiveWapPush(std::vector<SmsReceiveIndexer> & dbIndexers)125 void SmsReceiveReliabilityHandler::CheckUnReceiveWapPush(std::vector<SmsReceiveIndexer> &dbIndexers)
126 {
127     for (auto place = dbIndexers.begin(); place != dbIndexers.end();) {
128         std::shared_ptr<vector<string>> userDataRaws = make_shared<vector<string>>();
129         userDataRaws->assign(MAX_SEGMENT_NUM, "");
130         if (place->GetDestPort() != WAP_PUSH_PORT) {
131             place++;
132             continue;
133         }
134         if (place->GetMsgCount() == SMS_SINGLE_PAGE_COUNT) {
135             GetWapPushUserDataSinglePage(*place, userDataRaws);
136         } else {
137             int32_t smsPagesCount = SMS_PAGE_INITIAL;
138             int32_t pos = static_cast<int32_t>(std::distance(dbIndexers.begin(), place));
139             GetWapPushUserDataMultipage(smsPagesCount, dbIndexers, pos, userDataRaws);
140             if (place->GetMsgCount() != smsPagesCount) {
141                 place = dbIndexers.erase(place);
142                 continue;
143             }
144         }
145 
146         if (!userDataRaws->at(PDU_START_POS).empty()) {
147             ReadyDecodeWapPushUserData(*place, userDataRaws);
148         }
149         place = dbIndexers.erase(place);
150     }
151 }
152 
GetWapPushUserDataSinglePage(SmsReceiveIndexer & indexer,std::shared_ptr<vector<string>> userDataRaws)153 void SmsReceiveReliabilityHandler::GetWapPushUserDataSinglePage(
154     SmsReceiveIndexer &indexer, std::shared_ptr<vector<string>> userDataRaws)
155 {
156     string pdu = StringUtils::StringToHex(indexer.GetPdu());
157     std::shared_ptr<SmsBaseMessage> baseMessage = GsmSmsMessage::CreateMessage(pdu);
158     if (baseMessage == nullptr) {
159         TELEPHONY_LOGE("baseMessage nullptr");
160         return;
161     }
162     userDataRaws->at(PDU_START_POS) = baseMessage->GetRawWapPushUserData();
163 }
164 
GetWapPushUserDataMultipage(int32_t & smsPagesCount,std::vector<SmsReceiveIndexer> & dbIndexers,int32_t place,std::shared_ptr<vector<string>> userDataRaws)165 void SmsReceiveReliabilityHandler::GetWapPushUserDataMultipage(int32_t &smsPagesCount,
166     std::vector<SmsReceiveIndexer> &dbIndexers, int32_t place, std::shared_ptr<vector<string>> userDataRaws)
167 {
168     if (place < 0 || place >= static_cast<int32_t>(dbIndexers.size())) {
169         TELEPHONY_LOGE("place invalid");
170         return;
171     }
172     string pdu = StringUtils::StringToHex(dbIndexers[place].GetPdu());
173     std::shared_ptr<SmsBaseMessage> baseMessage = GsmSmsMessage::CreateMessage(pdu);
174     if (baseMessage == nullptr) {
175         TELEPHONY_LOGE("baseMessage nullptr");
176         return;
177     }
178     if (dbIndexers[place].GetMsgSeqId() < PDU_POS_OFFSET || dbIndexers[place].GetMsgSeqId() > MAX_SEGMENT_NUM) {
179         TELEPHONY_LOGE("seqId invalid");
180         return;
181     }
182     userDataRaws->at(dbIndexers[place].GetMsgSeqId() - PDU_POS_OFFSET) = baseMessage->GetRawUserData();
183 
184     for (auto locate = dbIndexers.begin() + place + SMS_PAGE_INCREMENT; locate != dbIndexers.end();) {
185         if (dbIndexers[place].GetMsgRefId() != locate->GetMsgRefId()) {
186             locate++;
187             continue;
188         }
189         if (locate->GetPdu().size() > 0) {
190             smsPagesCount++;
191         }
192         pdu = StringUtils::StringToHex(locate->GetPdu());
193         baseMessage = GsmSmsMessage::CreateMessage(pdu);
194         if (baseMessage == nullptr) {
195             TELEPHONY_LOGE("baseMessage nullptr");
196             locate = dbIndexers.erase(locate);
197             return;
198         }
199         if (locate->GetMsgSeqId() < PDU_POS_OFFSET || locate->GetMsgSeqId() > MAX_SEGMENT_NUM) {
200             TELEPHONY_LOGE("seqId invalid");
201             locate = dbIndexers.erase(locate);
202             return;
203         }
204         userDataRaws->at(locate->GetMsgSeqId() - PDU_POS_OFFSET) = baseMessage->GetRawUserData();
205         locate = dbIndexers.erase(locate);
206     }
207 }
208 
ReadyDecodeWapPushUserData(SmsReceiveIndexer & indexerObj,std::shared_ptr<vector<string>> userDataRaws)209 void SmsReceiveReliabilityHandler::ReadyDecodeWapPushUserData(
210     SmsReceiveIndexer &indexerObj, std::shared_ptr<vector<string>> userDataRaws)
211 {
212     string userDataWapPush;
213     for (auto userDataRaw : *userDataRaws) {
214         userDataWapPush.append(userDataRaw);
215     }
216     shared_ptr<SmsReceiveIndexer> indexer = std::make_shared<SmsReceiveIndexer>(indexerObj.GetPdu(),
217         indexerObj.GetTimestamp(), indexerObj.GetDestPort(), indexerObj.GetIsCdma(), indexerObj.GetOriginatingAddress(),
218         indexerObj.GetVisibleAddress(), indexerObj.GetMsgRefId(), indexerObj.GetMsgSeqId(), indexerObj.GetMsgCount(),
219         false, StringUtils::StringToHex(indexerObj.GetPdu()));
220     indexer->SetDataBaseId(indexerObj.GetDataBaseId());
221 
222     if (smsWapPushHandler_ == nullptr) {
223         TELEPHONY_LOGI("smsWapPushHandler_ nullptr");
224         return;
225     }
226     if (!smsWapPushHandler_->DecodeWapPushPdu(indexer, userDataWapPush)) {
227         SmsHiSysEvent::WriteSmsReceiveFaultEvent(slotId_, SmsMmsMessageType::WAP_PUSH,
228             SmsMmsErrorCode::SMS_ERROR_PDU_DECODE_FAIL, "Wap push decode wap push fail");
229     }
230 }
231 
SmsReceiveReliabilityProcessing()232 void SmsReceiveReliabilityHandler::SmsReceiveReliabilityProcessing()
233 {
234     std::vector<SmsReceiveIndexer> dbIndexers;
235     RemoveBlockedSms(dbIndexers);
236     CheckUnReceiveWapPush(dbIndexers);
237 
238     for (auto position = dbIndexers.begin(); position != dbIndexers.end();) {
239         auto msgCount = position->GetMsgCount();
240         std::shared_ptr<vector<string>> pdus = make_shared<vector<string>>();
241         if (msgCount == SMS_INVALID_PAGE_COUNT) {
242             position++;
243             continue;
244         } else if (msgCount == SMS_SINGLE_PAGE_COUNT) {
245             pdus->push_back(StringUtils::StringToHex(position->GetPdu()));
246         } else {
247             int32_t smsPagesCount = SMS_PAGE_INITIAL;
248             int32_t pos = static_cast<int32_t>(std::distance(dbIndexers.begin(), position));
249             GetSmsUserDataMultipage(smsPagesCount, msgCount, dbIndexers, pos, pdus);
250             if (msgCount != smsPagesCount) {
251                 position = dbIndexers.erase(position);
252                 continue;
253             }
254         }
255         if (!pdus->at(PDU_START_POS).empty()) {
256             ReadySendSmsBroadcast(*position, pdus);
257         }
258         position = dbIndexers.erase(position);
259     }
260 }
261 
GetSmsUserDataMultipage(int32_t & smsPagesCount,uint16_t msgCount,std::vector<SmsReceiveIndexer> & dbIndexers,int32_t position,std::shared_ptr<std::vector<std::string>> pdus)262 void SmsReceiveReliabilityHandler::GetSmsUserDataMultipage(int32_t &smsPagesCount, uint16_t msgCount,
263     std::vector<SmsReceiveIndexer> &dbIndexers, int32_t position, std::shared_ptr<std::vector<std::string>> pdus)
264 {
265     if (position < 0 || position >= static_cast<int32_t>(dbIndexers.size())) {
266         TELEPHONY_LOGE("position over max");
267         return;
268     }
269     pdus->assign(msgCount, "");
270     if (dbIndexers[position].GetMsgSeqId() < PDU_POS_OFFSET || dbIndexers[position].GetMsgSeqId() > msgCount) {
271         TELEPHONY_LOGE("seqId invalid");
272         return;
273     }
274     pdus->at(dbIndexers[position].GetMsgSeqId() - PDU_POS_OFFSET) =
275         StringUtils::StringToHex(dbIndexers[position].GetPdu());
276     for (auto locate = dbIndexers.begin() + position + SMS_PAGE_INCREMENT; locate != dbIndexers.end();) {
277         if (dbIndexers[position].GetMsgRefId() != locate->GetMsgRefId()) {
278             locate++;
279             continue;
280         }
281         if (locate->GetMsgSeqId() < PDU_POS_OFFSET || locate->GetMsgSeqId() > msgCount) {
282             TELEPHONY_LOGE("seqId invalid");
283             locate = dbIndexers.erase(locate);
284             return;
285         }
286         pdus->at(locate->GetMsgSeqId() - PDU_POS_OFFSET) = StringUtils::StringToHex(locate->GetPdu());
287         locate = dbIndexers.erase(locate);
288         smsPagesCount++;
289     }
290 }
291 
ReadySendSmsBroadcast(SmsReceiveIndexer & indexerObj,std::shared_ptr<vector<string>> pdus)292 void SmsReceiveReliabilityHandler::ReadySendSmsBroadcast(
293     SmsReceiveIndexer &indexerObj, std::shared_ptr<vector<string>> pdus)
294 {
295     shared_ptr<SmsReceiveIndexer> indexer = std::make_shared<SmsReceiveIndexer>(indexerObj.GetPdu(),
296         indexerObj.GetTimestamp(), indexerObj.GetDestPort(), indexerObj.GetIsCdma(), indexerObj.GetOriginatingAddress(),
297         indexerObj.GetVisibleAddress(), indexerObj.GetMsgRefId(), indexerObj.GetMsgSeqId(), indexerObj.GetMsgCount(),
298         false, StringUtils::StringToHex(indexerObj.GetPdu()));
299     indexer->SetDataBaseId(indexerObj.GetDataBaseId());
300     TELEPHONY_LOGI("send sms from db for reliability");
301     SendBroadcast(indexer, pdus);
302 }
303 
DeleteMessageFormDb(const uint16_t refId,const uint16_t dataBaseId)304 void SmsReceiveReliabilityHandler::DeleteMessageFormDb(const uint16_t refId, const uint16_t dataBaseId)
305 {
306     if (refId == 0 && dataBaseId == 0) {
307         TELEPHONY_LOGE("DeleteMessageFormDb fail by refId error");
308         return;
309     }
310     if (refId == 0) {
311         DataShare::DataSharePredicates predicates;
312         predicates.EqualTo(SmsSubsection::ID, std::to_string(dataBaseId));
313         DelayedSingleton<SmsPersistHelper>::GetInstance()->Delete(predicates);
314     } else {
315         DataShare::DataSharePredicates predicates;
316         predicates.EqualTo(SmsSubsection::SMS_SUBSECTION_ID, std::to_string(refId));
317         DelayedSingleton<SmsPersistHelper>::GetInstance()->Delete(predicates);
318     }
319 }
320 
SendBroadcast(const std::shared_ptr<SmsReceiveIndexer> indexer,const shared_ptr<vector<string>> pdus)321 void SmsReceiveReliabilityHandler::SendBroadcast(
322     const std::shared_ptr<SmsReceiveIndexer> indexer, const shared_ptr<vector<string>> pdus)
323 {
324     if (indexer == nullptr || pdus == nullptr) {
325         TELEPHONY_LOGE("indexer or pdus is nullptr");
326         return;
327     }
328     std::vector<std::string> newPdus;
329     for (const auto &it : *pdus) {
330         if (!it.empty()) {
331             newPdus.emplace_back(it);
332         }
333     }
334     Want want;
335     CommonEventData data;
336     CommonEventPublishInfo publishInfo;
337     PacketSmsData(want, indexer, data, publishInfo);
338     want.SetParam(SMS_BROADCAST_PDU_KEY, newPdus);
339     data.SetWant(want);
340 
341     MatchingSkills smsSkills;
342     std::string addr = indexer->GetOriginatingAddress();
343     if (CT_SMSC.compare(addr) != 0 && CT_SMSC_86.compare(addr) != 0 && CT_SMSC_INTERNATION_86.compare(addr) != 0) {
344         TELEPHONY_LOGI("Sms Broadcast");
345         smsSkills.AddEvent(CommonEventSupport::COMMON_EVENT_SMS_RECEIVE_COMPLETED);
346     } else {
347         TELEPHONY_LOGI("CT AutoReg Broadcast");
348         smsSkills.AddEvent(CT_AUTO_REG_SMS_ACTION);
349     }
350     CommonEventSubscribeInfo smsSubscriberInfo(smsSkills);
351     smsSubscriberInfo.SetThreadMode(EventFwk::CommonEventSubscribeInfo::COMMON);
352     bool cbResult = false;
353     if (CT_SMSC.compare(addr) != 0 && CT_SMSC_86.compare(addr) != 0 && CT_SMSC_INTERNATION_86.compare(addr) != 0) {
354         auto smsReceiver = std::make_shared<SmsBroadcastSubscriberReceiver>(
355             smsSubscriberInfo, shared_from_this(), indexer->GetMsgRefId(), indexer->GetDataBaseId(), addr);
356         cbResult = CommonEventManager::PublishCommonEvent(data, publishInfo, smsReceiver);
357         sptrQueue.push(smsReceiver);
358     } else {
359         cbResult = CommonEventManager::PublishCommonEvent(data, publishInfo, nullptr);
360     }
361     HiSysEventCBResult(cbResult);
362     if (CT_SMSC.compare(addr) == 0 || CT_SMSC_86.compare(addr) == 0 || CT_SMSC_INTERNATION_86.compare(addr) == 0) {
363         TELEPHONY_LOGI("del ct auto sms from db");
364         DeleteAutoSmsFromDB(shared_from_this(), indexer->GetMsgRefId(), indexer->GetDataBaseId());
365     }
366 }
367 
PacketSmsData(EventFwk::Want & want,const std::shared_ptr<SmsReceiveIndexer> indexer,EventFwk::CommonEventData & data,EventFwk::CommonEventPublishInfo & publishInfo)368 void SmsReceiveReliabilityHandler::PacketSmsData(EventFwk::Want &want, const std::shared_ptr<SmsReceiveIndexer> indexer,
369     EventFwk::CommonEventData &data, EventFwk::CommonEventPublishInfo &publishInfo)
370 {
371     if (CT_SMSC.compare(indexer->GetOriginatingAddress()) != 0 &&
372         CT_SMSC_86.compare(indexer->GetOriginatingAddress()) != 0 &&
373         CT_SMSC_INTERNATION_86.compare(indexer->GetOriginatingAddress()) != 0) {
374         want.SetAction(CommonEventSupport::COMMON_EVENT_SMS_RECEIVE_COMPLETED);
375     } else {
376         want.SetAction(CT_AUTO_REG_SMS_ACTION);
377     }
378     TELEPHONY_LOGI("Sms slotId_:%{public}d", slotId_);
379     want.SetParam(SMS_BROADCAST_SLOTID_KEY, static_cast<int>(slotId_));
380     want.SetParam(SMS_BROADCAST_SMS_TYPE_KEY, indexer->GetIsCdma());
381     if (indexer->GetIsText() || indexer->GetDestPort() == SMS_TEXT_PORT) {
382         data.SetData(SMS_BROADCAST_SMS_TEXT_TYPE_KEY);
383         data.SetCode(TEXT_MSG_RECEIVE_CODE);
384     } else {
385         data.SetData(SMS_BROADCAST_SMS_DATA_TYPE_KEY);
386         data.SetCode(DATA_MSG_RECEIVE_CODE);
387         want.SetParam(SMS_BROADCAST_SMS_PORT_KEY, static_cast<short>(indexer->GetDestPort()));
388     }
389 
390     publishInfo.SetOrdered(true);
391     std::vector<std::string> smsPermissions;
392     smsPermissions.emplace_back(Permission::RECEIVE_MESSAGES);
393     publishInfo.SetSubscriberPermissions(smsPermissions);
394 }
395 
HiSysEventCBResult(bool publishResult)396 void SmsReceiveReliabilityHandler::HiSysEventCBResult(bool publishResult)
397 {
398     if (!publishResult) {
399         TELEPHONY_LOGE("SendBroadcast PublishBroadcastEvent result fail");
400         SmsHiSysEvent::WriteSmsReceiveFaultEvent(slotId_, SmsMmsMessageType::SMS_SHORT_MESSAGE,
401             SmsMmsErrorCode::SMS_ERROR_PUBLISH_COMMON_EVENT_FAIL, "publish short message broadcast event fail");
402         return;
403     }
404     DelayedSingleton<SmsHiSysEvent>::GetInstance()->SetSmsBroadcastStartTime();
405 }
406 
DeleteAutoSmsFromDB(std::shared_ptr<SmsReceiveReliabilityHandler> handler,uint16_t refId,uint16_t dataBaseId)407 void SmsReceiveReliabilityHandler::DeleteAutoSmsFromDB(
408     std::shared_ptr<SmsReceiveReliabilityHandler> handler, uint16_t refId, uint16_t dataBaseId)
409 {
410     handler->DeleteMessageFormDb(refId, dataBaseId);
411 }
412 
CheckBlockedPhoneNumber(std::string originatingAddress)413 bool SmsReceiveReliabilityHandler::CheckBlockedPhoneNumber(std::string originatingAddress)
414 {
415     return DelayedSingleton<SmsPersistHelper>::GetInstance()->QueryBlockPhoneNumber(originatingAddress);
416 }
417 
CheckSmsCapable()418 bool SmsReceiveReliabilityHandler::CheckSmsCapable()
419 {
420     auto helperPtr = DelayedSingleton<SmsPersistHelper>::GetInstance();
421     if (helperPtr == nullptr) {
422         return true;
423     }
424     return helperPtr->QueryParamBoolean(SmsPersistHelper::SMS_CAPABLE_PARAM_KEY, true);
425 }
426 } // namespace Telephony
427 } // namespace OHOS