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 "timer_info.h" 20 21 namespace OHOS { 22 namespace MiscServices { 23 constexpr int32_t START_TIMER_OFFSET = 0x00000000; 24 constexpr int32_t TRIGGER_TIMER_OFFSET = 0x00000100; 25 constexpr int32_t TIMER_FAULT_OFFSET = 0x00000200; 26 constexpr int32_t MODIFY_TIME_OFFSET = 0x01000000; 27 constexpr int32_t EXACT_OFFSET = 4; 28 static const int COUNT_REPORT_ARRAY_LENGTH = 5; 29 30 enum ReportEventCode : int32_t { 31 RTC_WAKEUP_EXACT_TIMER_START = START_TIMER_OFFSET, 32 RTC_NONWAKEUP_EXACT_TIMER_START, 33 REALTIME_WAKEUP_EXACT_TIMER_START, 34 REALTIME_NONWAKEUP_EXACT_TIMER_START, 35 RTC_WAKEUP_NONEXACT_TIMER_START, 36 RTC_NONWAKEUP_NONEXACT_TIMER_START, 37 REALTIME_WAKEUP_NONEXACT_TIMER_START, 38 REALTIME_NONWAKEUP_NONEXACT_TIMER_START, 39 RTC_WAKEUP_EXACT_TIMER_TRIGGER = TRIGGER_TIMER_OFFSET, 40 RTC_NONWAKEUP_EXACT_TIMER_TRIGGER, 41 REALTIME_WAKEUP_EXACT_TIMER_TRIGGER, 42 REALTIME_NONWAKEUP_EXACT_TIMER_TRIGGER, 43 RTC_WAKEUP_NONEXACT_TIMER_TRIGGER, 44 RTC_NONWAKEUP_NONEXACT_TIMER_TRIGGER, 45 REALTIME_WAKEUP_NONEXACT_TIMER_TRIGGER, 46 REALTIME_NONWAKEUP_NONEXACT_TIMER_TRIGGER, 47 TIMER_WANTAGENT_FAULT_REPORT = TIMER_FAULT_OFFSET, 48 SET_TIME = MODIFY_TIME_OFFSET, 49 NTP_REFRESH, 50 SET_TIMEZONE, 51 }; 52 void StatisticReporter(int32_t size, std::shared_ptr<TimerInfo> timer); 53 void TimeBehaviorReport(ReportEventCode eventCode, const std::string &originTime, const std::string &newTime, 54 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, const std::string &bundleOrProcessName, 59 const std::string &extraInfo); 60 } // namespace MiscServices 61 } // namespace OHOS 62 #endif // TIME_SYSEVENT_H 63