1 /*
2 * Copyright (c) 2024 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 "location_sa_load_manager.h"
17
18 #include "common_utils.h"
19 #include "common_hisysevent.h"
20 #include "location_log_event_ids.h"
21
22 namespace OHOS {
23 namespace Location {
24
SaLoadWithStatistic()25 SaLoadWithStatistic::SaLoadWithStatistic()
26 {
27 }
28
~SaLoadWithStatistic()29 SaLoadWithStatistic::~SaLoadWithStatistic()
30 {
31 }
32
InitLocationSa(int32_t systemAbilityId)33 bool SaLoadWithStatistic::InitLocationSa(int32_t systemAbilityId)
34 {
35 auto startTime = CommonUtils::GetCurrentTimeStamp();
36 bool ret = LocationSaLoadManager::InitLocationSa(systemAbilityId);
37 auto endTime = CommonUtils::GetCurrentTimeStamp();
38 WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "load",
39 "ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
40 return ret;
41 }
42
UnInitLocationSa(int32_t systemAbilityId)43 bool SaLoadWithStatistic::UnInitLocationSa(int32_t systemAbilityId)
44 {
45 auto startTime = CommonUtils::GetCurrentTimeStamp();
46 bool ret = LocationSaLoadManager::UnInitLocationSa(systemAbilityId);
47 auto endTime = CommonUtils::GetCurrentTimeStamp();
48 WriteLocationInnerEvent(SA_LOAD, {"saId", std::to_string(systemAbilityId), "type", "unload",
49 "ret", std::to_string(ret), "startTime", std::to_string(startTime), "endTime", std::to_string(endTime)});
50 return ret;
51 }
52 }; // namespace Location
53 }; // namespace OHOS
54