1 /* 2 * Copyright (c) 2022-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 #ifndef TIME_SYSEVENT_H 17 #define TIME_SYSEVENT_H 18 19 #include <string> 20 #include "timer_info.h" 21 22 namespace OHOS { 23 namespace MiscServices { 24 constexpr int32_t START_TIMER_OFFSET = 0x00000000; 25 constexpr int32_t TRIGGER_TIMER_OFFSET = 0x00000100; 26 constexpr int32_t TIMER_FAULT_OFFSET = 0x00000200; 27 constexpr int32_t MODIFY_TIME_OFFSET = 0x01000000; 28 constexpr int32_t EXACT_OFFSET = 4; 29 static const int COUNT_REPORT_ARRAY_LENGTH = 5; 30 31 enum ReportEventCode : int32_t { 32 RTC_WAKEUP_EXACT_TIMER_START = START_TIMER_OFFSET, 33 RTC_NONWAKEUP_EXACT_TIMER_START, 34 REALTIME_WAKEUP_EXACT_TIMER_START, 35 REALTIME_NONWAKEUP_EXACT_TIMER_START, 36 RTC_WAKEUP_NONEXACT_TIMER_START, 37 RTC_NONWAKEUP_NONEXACT_TIMER_START, 38 REALTIME_WAKEUP_NONEXACT_TIMER_START, 39 REALTIME_NONWAKEUP_NONEXACT_TIMER_START, 40 RTC_WAKEUP_EXACT_TIMER_TRIGGER = TRIGGER_TIMER_OFFSET, 41 RTC_NONWAKEUP_EXACT_TIMER_TRIGGER, 42 REALTIME_WAKEUP_EXACT_TIMER_TRIGGER, 43 REALTIME_NONWAKEUP_EXACT_TIMER_TRIGGER, 44 RTC_WAKEUP_NONEXACT_TIMER_TRIGGER, 45 RTC_NONWAKEUP_NONEXACT_TIMER_TRIGGER, 46 REALTIME_WAKEUP_NONEXACT_TIMER_TRIGGER, 47 REALTIME_NONWAKEUP_NONEXACT_TIMER_TRIGGER, 48 TIMER_WANTAGENT_FAULT_REPORT = TIMER_FAULT_OFFSET, 49 SET_TIME = MODIFY_TIME_OFFSET, 50 NTP_REFRESH, 51 SET_TIMEZONE, 52 }; 53 void StatisticReporter(int32_t size, std::shared_ptr<TimerInfo> timer); 54 void TimeBehaviorReport(ReportEventCode eventCode, std::string originTime, std::string newTime, int64_t ntpTime); 55 void TimerBehaviorReport(std::shared_ptr<TimerInfo> timer, bool isStart); 56 void TimerCountStaticReporter(int count, int (&uidArr)[COUNT_REPORT_ARRAY_LENGTH], 57 int (&createTimerCountArr)[COUNT_REPORT_ARRAY_LENGTH], int (&startTimerCountArr)[COUNT_REPORT_ARRAY_LENGTH]); 58 void TimeServiceFaultReporter(ReportEventCode eventCode, int errCode, int uid, std::string bundleOrProcessName, 59 std::string extraInfo); 60 } // namespace MiscServices 61 } // namespace OHOS 62 #endif // TIME_SYSEVENT_H 63