• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 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 "request_manager.h"
17 
18 #include "privacy_kit.h"
19 
20 #include "common_utils.h"
21 #include "constant_definition.h"
22 #ifdef FEATURE_GNSS_SUPPORT
23 #include "gnss_ability_proxy.h"
24 #endif
25 #include "fusion_controller.h"
26 #include "location_log.h"
27 #include "location_sa_load_manager.h"
28 #include "locator_ability.h"
29 #include "locator_background_proxy.h"
30 #include "locator_event_manager.h"
31 #ifdef FEATURE_NETWORK_SUPPORT
32 #include "network_ability_proxy.h"
33 #endif
34 #ifdef FEATURE_PASSIVE_SUPPORT
35 #include "passive_ability_proxy.h"
36 #endif
37 #include "request_config.h"
38 
39 namespace OHOS {
40 namespace Location {
41 std::mutex RequestManager::requestMutex_;
RequestManager()42 RequestManager::RequestManager()
43 {
44     auto locatorDftManager = DelayedSingleton<LocatorDftManager>::GetInstance();
45     if (locatorDftManager != nullptr) {
46         locatorDftManager->Init();
47     }
48 }
49 
~RequestManager()50 RequestManager::~RequestManager()
51 {
52 }
53 
InitSystemListeners()54 bool RequestManager::InitSystemListeners()
55 {
56     LBSLOGI(REQUEST_MANAGER, "Init system listeners.");
57     return true;
58 }
59 
UpdateUsingPermission(std::shared_ptr<Request> request)60 void RequestManager::UpdateUsingPermission(std::shared_ptr<Request> request)
61 {
62     std::unique_lock<std::mutex> lock(permissionRecordMutex_, std::defer_lock);
63     lock.lock();
64     if (request == nullptr) {
65         LBSLOGE(REQUEST_MANAGER, "request is null");
66         lock.unlock();
67         return;
68     }
69     LBSLOGI(REQUEST_MANAGER, "UpdateUsingPermission : tokenId = %{public}d, firstTokenId = %{public}d",
70         request->GetTokenId(), request->GetFirstTokenId());
71     UpdateUsingApproximatelyPermission(request);
72     lock.unlock();
73 }
74 
UpdateUsingLocationPermission(std::shared_ptr<Request> request)75 void RequestManager::UpdateUsingLocationPermission(std::shared_ptr<Request> request)
76 {
77     uint32_t callingTokenId = request->GetTokenId();
78     uint32_t callingFirstTokenid = request->GetFirstTokenId();
79     int32_t uid = request->GetUid();
80     if (IsUidInProcessing(uid) &&
81         CommonUtils::CheckLocationPermission(callingTokenId, callingFirstTokenid)) {
82         if (!request->GetLocationPermState()) {
83             PrivacyKit::StartUsingPermission(callingTokenId, ACCESS_LOCATION);
84             request->SetLocationPermState(true);
85         }
86     } else {
87         if (request->GetLocationPermState()) {
88             PrivacyKit::StopUsingPermission(callingTokenId, ACCESS_LOCATION);
89             request->SetLocationPermState(false);
90         }
91     }
92 }
93 
UpdateUsingApproximatelyPermission(std::shared_ptr<Request> request)94 void RequestManager::UpdateUsingApproximatelyPermission(std::shared_ptr<Request> request)
95 {
96     uint32_t callingTokenId = request->GetTokenId();
97     uint32_t callingFirstTokenid = request->GetFirstTokenId();
98     int32_t uid = request->GetUid();
99     if (IsUidInProcessing(uid) &&
100         CommonUtils::CheckApproximatelyPermission(callingTokenId, callingFirstTokenid)) {
101         if (!request->GetApproximatelyPermState()) {
102             PrivacyKit::StartUsingPermission(callingTokenId, ACCESS_APPROXIMATELY_LOCATION);
103             request->SetApproximatelyPermState(true);
104         }
105     } else {
106         if (request->GetApproximatelyPermState()) {
107             PrivacyKit::StopUsingPermission(callingTokenId, ACCESS_APPROXIMATELY_LOCATION);
108             request->SetApproximatelyPermState(false);
109         }
110     }
111 }
112 
UpdateUsingBackgroundPermission(std::shared_ptr<Request> request)113 void RequestManager::UpdateUsingBackgroundPermission(std::shared_ptr<Request> request)
114 {
115     uint32_t callingTokenId = request->GetTokenId();
116     uint32_t callingFirstTokenid = request->GetFirstTokenId();
117     int32_t uid = request->GetUid();
118     std::string bundleName;
119     if (!CommonUtils::GetBundleNameByUid(uid, bundleName)) {
120         LBSLOGE(REQUEST_MANAGER, "Fail to Get bundle name: uid = %{public}d.", uid);
121         return;
122     }
123     if (DelayedSingleton<LocatorBackgroundProxy>::GetInstance().get()->IsAppBackground(bundleName) &&
124         IsUidInProcessing(uid) && CommonUtils::CheckBackgroundPermission(callingTokenId, callingFirstTokenid)) {
125         if (!request->GetBackgroundPermState()) {
126             PrivacyKit::StartUsingPermission(callingTokenId, ACCESS_BACKGROUND_LOCATION);
127             request->SetBackgroundPermState(true);
128         }
129     } else {
130         if (request->GetBackgroundPermState()) {
131             PrivacyKit::StopUsingPermission(callingTokenId, ACCESS_BACKGROUND_LOCATION);
132             request->SetBackgroundPermState(false);
133         }
134     }
135 }
136 
HandleStartLocating(std::shared_ptr<Request> request)137 void RequestManager::HandleStartLocating(std::shared_ptr<Request> request)
138 {
139     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
140     auto locatorDftManager = DelayedSingleton<LocatorDftManager>::GetInstance();
141     if (locatorAbility == nullptr || locatorDftManager == nullptr) {
142         return;
143     }
144     // restore request to all request list
145     bool isNewRequest = RestorRequest(request);
146     // update request map
147     if (isNewRequest) {
148         locatorAbility->RegisterPermissionCallback(request->GetTokenId(),
149             {ACCESS_APPROXIMATELY_LOCATION, ACCESS_LOCATION, ACCESS_BACKGROUND_LOCATION});
150         UpdateRequestRecord(request, true);
151         UpdateUsingPermission(request);
152         locatorDftManager->LocationSessionStart(request);
153     }
154     // process location request
155     HandleRequest();
156 }
157 
RestorRequest(std::shared_ptr<Request> newRequest)158 bool RequestManager::RestorRequest(std::shared_ptr<Request> newRequest)
159 {
160     std::unique_lock lock(requestMutex_);
161 
162     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
163     if (locatorAbility == nullptr) {
164         return false;
165     }
166     auto receivers = locatorAbility->GetReceivers();
167     if (receivers == nullptr) {
168         LBSLOGE(REQUEST_MANAGER, "receivers is empty");
169         return false;
170     }
171     if (newRequest == nullptr) {
172         LBSLOGE(REQUEST_MANAGER, "newRequest is empty");
173         return false;
174     }
175     newRequest->SetRequesting(true);
176     sptr<IRemoteObject> newCallback = newRequest->GetLocatorCallBack()->AsObject();
177 
178     LBSLOGI(REQUEST_MANAGER, "add request:%{public}s", newRequest->ToString().c_str());
179     // if callback and request config type is same, take new request configuration over the old one in request list
180     // otherwise, add restore the new request in the list.
181     auto iterator = receivers->find(newCallback);
182     if (iterator == receivers->end()) {
183         std::list<std::shared_ptr<Request>> requestList;
184         requestList.push_back(newRequest);
185         receivers->insert(make_pair(newCallback, requestList));
186         LBSLOGD(REQUEST_MANAGER, "add new receiver with new callback");
187         return true;
188     }
189 
190     sptr<RequestConfig> newConfig = newRequest->GetRequestConfig();
191     std::list<std::shared_ptr<Request>> requestWithSameCallback = iterator->second;
192     for (auto iter = requestWithSameCallback.begin(); iter != requestWithSameCallback.end(); ++iter) {
193         auto request = *iter;
194         if (request == nullptr) {
195             continue;
196         }
197         auto requestConfig = request->GetRequestConfig();
198         if (requestConfig == nullptr || newConfig == nullptr) {
199             continue;
200         }
201         if (newConfig->IsSame(*requestConfig)) {
202             request->SetRequestConfig(*newConfig);
203             LBSLOGI(REQUEST_MANAGER, "find same type request, update request configuration");
204             return false;
205         }
206     }
207     requestWithSameCallback.push_back(newRequest);
208     LBSLOGD(REQUEST_MANAGER, "add new receiver with old callback");
209     return true;
210 }
211 
UpdateRequestRecord(std::shared_ptr<Request> request,bool shouldInsert)212 void RequestManager::UpdateRequestRecord(std::shared_ptr<Request> request, bool shouldInsert)
213 {
214     std::shared_ptr<std::list<std::string>> proxys = std::make_shared<std::list<std::string>>();
215     request->GetProxyName(proxys);
216     if (proxys->empty()) {
217         LBSLOGE(REQUEST_MANAGER, "can not get proxy name according to request configuration");
218         return;
219     }
220 
221     for (std::list<std::string>::iterator iter = proxys->begin(); iter != proxys->end(); ++iter) {
222         std::string abilityName = *iter;
223         UpdateRequestRecord(request, abilityName, shouldInsert);
224     }
225 }
226 
UpdateRequestRecord(std::shared_ptr<Request> request,std::string abilityName,bool shouldInsert)227 void RequestManager::UpdateRequestRecord(std::shared_ptr<Request> request, std::string abilityName, bool shouldInsert)
228 {
229     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
230     if (locatorAbility == nullptr) {
231         LBSLOGE(REQUEST_MANAGER, "locatorAbility is null");
232         return;
233     }
234     std::unique_lock lock(requestMutex_);
235     auto requests = locatorAbility->GetRequests();
236     if (requests == nullptr) {
237         LBSLOGE(REQUEST_MANAGER, "requests map is empty");
238         return;
239     }
240     auto mapIter = requests->find(abilityName);
241     if (mapIter == requests->end()) {
242         LBSLOGE(REQUEST_MANAGER, "can not find %{public}s ability request list.", abilityName.c_str());
243         return;
244     }
245 
246     auto list = &(mapIter->second);
247     LBSLOGD(REQUEST_MANAGER, "%{public}s ability current request size %{public}s",
248         abilityName.c_str(), std::to_string(list->size()).c_str());
249     if (shouldInsert) {
250         list->push_back(request);
251         runningUids_.push_back(request->GetUid());
252     } else {
253         for (auto iter = list->begin(); iter != list->end();) {
254             auto findRequest = *iter;
255             if (request == findRequest) {
256                 iter = list->erase(iter);
257                 runningUids_.remove(findRequest->GetUid());
258                 LBSLOGD(REQUEST_MANAGER, "find request");
259             } else {
260                 ++iter;
261             }
262         }
263     }
264     LBSLOGD(REQUEST_MANAGER, "%{public}s ability request size %{public}s",
265         abilityName.c_str(), std::to_string(list->size()).c_str());
266 }
267 
HandleStopLocating(sptr<ILocatorCallback> callback)268 void RequestManager::HandleStopLocating(sptr<ILocatorCallback> callback)
269 {
270     if (callback == nullptr) {
271         LBSLOGE(REQUEST_MANAGER, "stop locating but callback is null");
272         return;
273     }
274     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
275     if (locatorAbility == nullptr) {
276         LBSLOGE(REQUEST_MANAGER, "locatorAbility is null");
277         return;
278     }
279     std::unique_lock<std::mutex> lock(requestMutex_, std::defer_lock);
280     lock.lock();
281     auto receivers = locatorAbility->GetReceivers();
282     if (receivers == nullptr) {
283         LBSLOGE(REQUEST_MANAGER, "receivers map is empty");
284         lock.unlock();
285         return;
286     }
287     sptr<IRemoteObject> deadCallback = callback->AsObject();
288     // get dead request list
289     LBSLOGD(REQUEST_MANAGER, "stop callback");
290     auto iterator = receivers->find(deadCallback);
291     if (iterator == receivers->end()) {
292         LBSLOGD(REQUEST_MANAGER, "this callback has no record in receiver map");
293         lock.unlock();
294         return;
295     }
296 
297     auto requests = iterator->second;
298     auto deadRequests = std::make_shared<std::list<std::shared_ptr<Request>>>();
299     for (auto iter = requests.begin(); iter != requests.end(); ++iter) {
300         auto request = *iter;
301         locatorAbility->UnregisterPermissionCallback(request->GetTokenId());
302         deadRequests->push_back(request);
303         LBSLOGI(REQUEST_MANAGER, "remove request:%{public}s", request->ToString().c_str());
304     }
305     LBSLOGD(REQUEST_MANAGER, "get %{public}s dead request", std::to_string(deadRequests->size()).c_str());
306     // update request map
307     if (deadRequests->size() == 0) {
308         lock.unlock();
309         return;
310     }
311     iterator->second.clear();
312     receivers->erase(iterator);
313     lock.unlock();
314     DeleteRequestRecord(deadRequests);
315     deadRequests->clear();
316     // process location request
317     HandleRequest();
318 }
319 
DeleteRequestRecord(std::shared_ptr<std::list<std::shared_ptr<Request>>> requests)320 void RequestManager::DeleteRequestRecord(std::shared_ptr<std::list<std::shared_ptr<Request>>> requests)
321 {
322     for (auto iter = requests->begin(); iter != requests->end(); ++iter) {
323         auto request = *iter;
324         UpdateRequestRecord(request, false);
325         UpdateUsingPermission(request);
326         auto locatorBackgroundProxy = DelayedSingleton<LocatorBackgroundProxy>::GetInstance();
327         if (locatorBackgroundProxy == nullptr) {
328             LBSLOGE(REQUEST_MANAGER, "DeleteRequestRecord: LocatorBackgroundProxy is nullptr.");
329             break;
330         }
331         locatorBackgroundProxy.get()->OnDeleteRequestRecord(request);
332     }
333 }
334 
HandleRequest()335 void RequestManager::HandleRequest()
336 {
337     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
338     if (locatorAbility == nullptr) {
339         LBSLOGE(REQUEST_MANAGER, "locatorAbility is null");
340         return;
341     }
342     std::unique_lock<std::mutex> lock(requestMutex_, std::defer_lock);
343     lock.lock();
344     auto requests = locatorAbility->GetRequests();
345     lock.unlock();
346     if (requests == nullptr) {
347         LBSLOGE(REQUEST_MANAGER, "requests map is empty");
348         return;
349     }
350     std::map<std::string, std::list<std::shared_ptr<Request>>>::iterator iter;
351     for (iter = requests->begin(); iter != requests->end(); ++iter) {
352         std::string abilityName = iter->first;
353         std::list<std::shared_ptr<Request>> requestList = iter->second;
354         HandleRequest(abilityName, requestList);
355     }
356 }
357 
HandleRequest(std::string abilityName,std::list<std::shared_ptr<Request>> list)358 void RequestManager::HandleRequest(std::string abilityName, std::list<std::shared_ptr<Request>> list)
359 {
360     // generate work record, and calculate interval
361     std::shared_ptr<WorkRecord> workRecord = std::make_shared<WorkRecord>();
362     for (auto iter = list.begin(); iter != list.end(); iter++) {
363         auto request = *iter;
364         if (!AddRequestToWorkRecord(request, workRecord)) {
365             continue;
366         }
367         if (!ActiveLocatingStrategies(request)) {
368             continue;
369         }
370         LBSLOGD(REQUEST_MANAGER, "add pid:%{public}d uid:%{public}d %{public}s", request->GetPid(), request->GetUid(),
371             request->GetPackageName().c_str());
372     }
373     LBSLOGD(REQUEST_MANAGER, "detect %{public}s ability requests(size:%{public}s) work record:%{public}s",
374         abilityName.c_str(), std::to_string(list.size()).c_str(), workRecord->ToString().c_str());
375 
376     ProxySendLocationRequest(abilityName, *workRecord);
377 }
378 
ActiveLocatingStrategies(const std::shared_ptr<Request> & request)379 bool RequestManager::ActiveLocatingStrategies(const std::shared_ptr<Request>& request)
380 {
381     if (request == nullptr) {
382         return false;
383     }
384     auto requestConfig = request->GetRequestConfig();
385     if (requestConfig == nullptr) {
386         return false;
387     }
388     int requestType = requestConfig->GetScenario();
389     if (requestType == SCENE_UNSET) {
390         requestType = requestConfig->GetPriority();
391     }
392     auto fusionController = DelayedSingleton<FusionController>::GetInstance();
393     if (fusionController != nullptr) {
394         fusionController->ActiveFusionStrategies(requestType);
395     }
396     return true;
397 }
398 
AddRequestToWorkRecord(std::shared_ptr<Request> & request,std::shared_ptr<WorkRecord> & workRecord)399 bool RequestManager::AddRequestToWorkRecord(std::shared_ptr<Request>& request,
400     std::shared_ptr<WorkRecord>& workRecord)
401 {
402     if (request == nullptr) {
403         return false;
404     }
405     UpdateUsingPermission(request);
406     if (!request->GetIsRequesting()) {
407         return false;
408     }
409     uint32_t tokenId = request->GetTokenId();
410     uint32_t firstTokenId = request->GetFirstTokenId();
411     // if location access permission granted, add request info to work record
412     if (!CommonUtils::CheckLocationPermission(tokenId, firstTokenId) &&
413         !CommonUtils::CheckApproximatelyPermission(tokenId, firstTokenId)) {
414         LBSLOGI(LOCATOR, "CheckLocationPermission return false, tokenId=%{public}d", tokenId);
415         return false;
416     }
417     auto requestConfig = request->GetRequestConfig();
418     if (requestConfig == nullptr) {
419         return false;
420     }
421     // add request info to work record
422     if (workRecord != nullptr) {
423         workRecord->Add(request->GetUid(), request->GetPid(), request->GetPackageName(),
424             requestConfig->GetTimeInterval(), request->GetUuid());
425     }
426     return true;
427 }
428 
ProxySendLocationRequest(std::string abilityName,WorkRecord & workRecord)429 void RequestManager::ProxySendLocationRequest(std::string abilityName, WorkRecord& workRecord)
430 {
431     auto locationSaLoadManager = DelayedSingleton<LocationSaLoadManager>::GetInstance();
432     if (locationSaLoadManager == nullptr) {
433         return;
434     }
435     int systemAbilityId = CommonUtils::AbilityConvertToId(abilityName);
436     locationSaLoadManager->LoadLocationSa(systemAbilityId);
437     sptr<IRemoteObject> remoteObject = CommonUtils::GetRemoteObject(systemAbilityId, CommonUtils::InitDeviceId());
438     if (remoteObject == nullptr) {
439         LBSLOGE(LOCATOR, "%{public}s: remote obj is nullptr", __func__);
440         return;
441     }
442     workRecord.SetDeviceId(CommonUtils::InitDeviceId());
443     if (abilityName == GNSS_ABILITY) {
444 #ifdef FEATURE_GNSS_SUPPORT
445         std::unique_ptr<GnssAbilityProxy> gnssProxy = std::make_unique<GnssAbilityProxy>(remoteObject);
446         gnssProxy->SendLocationRequest(workRecord);
447 #endif
448     } else if (abilityName == NETWORK_ABILITY) {
449 #ifdef FEATURE_NETWORK_SUPPORT
450         std::unique_ptr<NetworkAbilityProxy> networkProxy = std::make_unique<NetworkAbilityProxy>(remoteObject);
451         networkProxy->SendLocationRequest(workRecord);
452 #endif
453     } else if (abilityName == PASSIVE_ABILITY) {
454 #ifdef FEATURE_PASSIVE_SUPPORT
455         std::unique_ptr<PassiveAbilityProxy> passiveProxy = std::make_unique<PassiveAbilityProxy>(remoteObject);
456         passiveProxy->SendLocationRequest(workRecord);
457 #endif
458     }
459     auto fusionController = DelayedSingleton<FusionController>::GetInstance();
460     if (fusionController != nullptr) {
461         fusionController->Process(abilityName);
462     }
463 }
464 
GetRemoteObject(std::string abilityName)465 sptr<IRemoteObject> RequestManager::GetRemoteObject(std::string abilityName)
466 {
467     sptr<IRemoteObject> remoteObject = nullptr;
468     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
469     if (locatorAbility == nullptr) {
470         LBSLOGE(REQUEST_MANAGER, "locatorAbility is null");
471         return remoteObject;
472     }
473     auto remoteManagerMap = locatorAbility->GetProxyMap();
474     if (remoteManagerMap == nullptr) {
475         LBSLOGE(REQUEST_MANAGER, "proxy map is empty");
476         return remoteObject;
477     }
478     auto remoteObjectIter = remoteManagerMap->find(abilityName);
479     if (remoteObjectIter == remoteManagerMap->end()) {
480         LBSLOGE(REQUEST_MANAGER, "sa init fail!");
481         return remoteObject;
482     }
483     remoteObject = remoteObjectIter->second;
484     return remoteObject;
485 }
486 
HandlePowerSuspendChanged(int32_t pid,int32_t uid,int32_t state)487 void RequestManager::HandlePowerSuspendChanged(int32_t pid, int32_t uid, int32_t state)
488 {
489     if (!IsUidInProcessing(uid)) {
490         LBSLOGE(REQUEST_MANAGER, "Current uid : %{public}d is not locating.", uid);
491         return;
492     }
493     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
494     if (locatorAbility == nullptr) {
495         LBSLOGE(REQUEST_MANAGER, "locatorAbility is null");
496         return;
497     }
498     auto requests = locatorAbility->GetRequests();
499     if (requests == nullptr || requests->empty()) {
500         LBSLOGE(REQUEST_MANAGER, "requests map is empty");
501         return;
502     }
503     bool isActive = (state == static_cast<int>(AppExecFwk::ApplicationState::APP_STATE_FOREGROUND));
504     for (auto mapIter = requests->begin(); mapIter != requests->end(); mapIter++) {
505         auto list = mapIter->second;
506         for (auto request : list) {
507             std::string uid1 = std::to_string(request->GetUid());
508             std::string uid2 = std::to_string(uid);
509             std::string pid1 = std::to_string(request->GetPid());
510             std::string pid2 = std::to_string(pid);
511             if ((uid1.compare(uid2) != 0) || (pid1.compare(pid2) != 0)) {
512                 continue;
513             }
514             auto locatorBackgroundProxy = DelayedSingleton<LocatorBackgroundProxy>::GetInstance();
515             if (locatorBackgroundProxy != nullptr) {
516                 locatorBackgroundProxy.get()->OnSuspend(request, isActive);
517             }
518         }
519     }
520     if (DelayedSingleton<LocatorAbility>::GetInstance() != nullptr) {
521         DelayedSingleton<LocatorAbility>::GetInstance().get()->ApplyRequests();
522     }
523 }
524 
HandlePermissionChanged(uint32_t tokenId)525 void RequestManager::HandlePermissionChanged(uint32_t tokenId)
526 {
527     auto locatorAbility = DelayedSingleton<LocatorAbility>::GetInstance();
528     if (locatorAbility == nullptr) {
529         LBSLOGE(REQUEST_MANAGER, "HandlePermissionChanged locatorAbility is null");
530         return;
531     }
532     auto requests = locatorAbility->GetRequests();
533     if (requests == nullptr || requests->empty()) {
534         LBSLOGE(REQUEST_MANAGER, "HandlePermissionChanged requests map is empty");
535         return;
536     }
537     for (auto mapIter = requests->begin(); mapIter != requests->end(); mapIter++) {
538         auto list = mapIter->second;
539         for (auto request : list) {
540             if (request == nullptr || tokenId != request->GetTokenId()) {
541                 continue;
542             }
543             auto backgroundProxy = DelayedSingleton<LocatorBackgroundProxy>::GetInstance();
544             if (backgroundProxy != nullptr) {
545                 backgroundProxy.get()->UpdateListOnRequestChange(request);
546             }
547         }
548     }
549 }
550 
IsUidInProcessing(int32_t uid)551 bool RequestManager::IsUidInProcessing(int32_t uid)
552 {
553     if (runningUids_.size() == 0) {
554         return false;
555     }
556 
557     bool isFound = std::any_of(runningUids_.begin(), runningUids_.end(), [uid](int32_t i) {
558         return i == uid;
559     });
560     return isFound;
561 }
562 } // namespace Location
563 } // namespace OHOS
564