mirror of
https://gitee.com/openharmony/base_location
synced 2024-11-23 23:10:05 +00:00
code check
Signed-off-by: 李文龙 <liwenlong22@huawei.com>
This commit is contained in:
parent
44714768cb
commit
5680a112b9
@ -16,6 +16,7 @@
|
||||
#define LOCATOR_IMPL_H
|
||||
|
||||
#include <vector>
|
||||
#include <atomic>
|
||||
|
||||
#include "iremote_object.h"
|
||||
|
||||
@ -638,6 +639,7 @@ private:
|
||||
std::mutex mutex_;
|
||||
std::mutex resumeMutex_;
|
||||
static std::mutex locatorMutex_;
|
||||
std::atomic_bool isObserverReg_ = false;
|
||||
static std::shared_ptr<LocatorImpl> instance_;
|
||||
sptr<ISystemAbilityStatusChange> saStatusListener_ =
|
||||
sptr<LocatorSystemAbilityListener>(new LocatorSystemAbilityListener());
|
||||
|
@ -420,7 +420,7 @@ void LocatorAbility::SendSwitchState(const int state)
|
||||
|
||||
bool LocatorAbility::CheckIfLocatorConnecting()
|
||||
{
|
||||
return LocatorRequiredDataManager::GetInstance()->IsConnecting() && GetActiveRequestNum() > 0;
|
||||
return LocatorRequiredDataManager::GetInstance()->IsConnecting() || GetActiveRequestNum() > 0;
|
||||
}
|
||||
|
||||
LocationErrCode LocatorAbility::EnableAbility(bool isEnabled)
|
||||
@ -945,8 +945,7 @@ LocationErrCode LocatorAbility::StartLocating(std::unique_ptr<RequestConfig>& re
|
||||
|
||||
bool LocatorAbility::IsCacheVaildScenario(const sptr<RequestConfig>& requestConfig)
|
||||
{
|
||||
if (requestConfig->GetFixNumber() == 1 &&
|
||||
requestConfig->GetPriority() != LOCATION_PRIORITY_ACCURACY &&
|
||||
if (requestConfig->GetPriority() != LOCATION_PRIORITY_ACCURACY &&
|
||||
((requestConfig->GetPriority() == LOCATION_PRIORITY_LOCATING_SPEED) ||
|
||||
(requestConfig->GetScenario() == SCENE_DAILY_LIFE_SERVICE) ||
|
||||
((requestConfig->GetScenario() == SCENE_UNSET) && (requestConfig->GetPriority() == PRIORITY_FAST_FIRST_FIX)) ||
|
||||
@ -981,7 +980,7 @@ bool LocatorAbility::NeedReportCacheLocation(const std::shared_ptr<Request>& req
|
||||
if (reportManager_ == nullptr || request == nullptr) {
|
||||
return false;
|
||||
}
|
||||
// report cache location in single location request
|
||||
// report cache location
|
||||
if (IsSingleRequest(request->GetRequestConfig()) && IsCacheVaildScenario(request->GetRequestConfig())) {
|
||||
auto cacheLocation = reportManager_->GetCacheLocation(request);
|
||||
if (cacheLocation != nullptr && callback != nullptr) {
|
||||
@ -1632,13 +1631,13 @@ bool LocatorAbility::IsProcessRunning(pid_t pid, const uint32_t tokenId)
|
||||
sptr<ISystemAbilityManager> samgrClient = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
|
||||
if (samgrClient == nullptr) {
|
||||
LBSLOGE(LOCATOR, "Get system ability manager failed.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
sptr<AppExecFwk::IAppMgr> iAppManager =
|
||||
iface_cast<AppExecFwk::IAppMgr>(samgrClient->GetSystemAbility(APP_MGR_SERVICE_ID));
|
||||
if (iAppManager == nullptr) {
|
||||
LBSLOGE(LOCATOR, "Failed to get ability manager service.");
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
std::vector<AppExecFwk::RunningProcessInfo> runningProcessList;
|
||||
int32_t res = iAppManager->GetAllRunningProcesses(runningProcessList);
|
||||
|
Loading…
Reference in New Issue
Block a user