mirror of
https://gitee.com/openharmony/base_location
synced 2024-11-23 14:59:51 +00:00
!849 IslocationEnable接口优先查sysparam
Merge pull request !849 from liuxinbing/master
This commit is contained in:
commit
0cb731ef8f
@ -70,6 +70,11 @@ LocatorImpl::~LocatorImpl()
|
||||
bool LocatorImpl::IsLocationEnabled()
|
||||
{
|
||||
LBSLOGD(LOCATION_NAPI, "IsLocationEnabled");
|
||||
int32_t state = DEFAULT_STATE;
|
||||
state = LocationDataRdbManager::GetSwitchMode();
|
||||
if (state == DISABLED || state == ENABLED) {
|
||||
return (state == ENABLED);
|
||||
}
|
||||
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
|
||||
return ERRCODE_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
@ -78,7 +83,6 @@ bool LocatorImpl::IsLocationEnabled()
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return false;
|
||||
}
|
||||
int32_t state = DEFAULT_STATE;
|
||||
state = proxy->GetSwitchState();
|
||||
return (state == ENABLED);
|
||||
}
|
||||
@ -575,6 +579,12 @@ bool LocatorImpl::SetReverseGeocodingMockInfo(std::vector<std::shared_ptr<Geocod
|
||||
LocationErrCode LocatorImpl::IsLocationEnabledV9(bool &isEnabled)
|
||||
{
|
||||
LBSLOGD(LOCATOR_STANDARD, "LocatorImpl::IsLocationEnabledV9()");
|
||||
int32_t state = DEFAULT_STATE;
|
||||
state = LocationDataRdbManager::GetSwitchMode();
|
||||
if (state == DISABLED || state == ENABLED) {
|
||||
isEnabled = (state == ENABLED);
|
||||
return ERRCODE_SUCCESS;
|
||||
}
|
||||
if (!SaLoadWithStatistic::InitLocationSa(LOCATION_LOCATOR_SA_ID)) {
|
||||
return ERRCODE_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
@ -583,7 +593,6 @@ LocationErrCode LocatorImpl::IsLocationEnabledV9(bool &isEnabled)
|
||||
LBSLOGE(LOCATOR_STANDARD, "%{public}s get proxy failed.", __func__);
|
||||
return ERRCODE_SERVICE_UNAVAILABLE;
|
||||
}
|
||||
int32_t state = DEFAULT_STATE;
|
||||
state = proxy->GetSwitchState();
|
||||
isEnabled = (state == ENABLED);
|
||||
return ERRCODE_SUCCESS;
|
||||
|
Loading…
Reference in New Issue
Block a user