• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 #include "reminder_timer_info.h"
17 
18 #include "ans_log_wrapper.h"
19 #include "common_event_manager.h"
20 #ifdef HAS_HISYSEVENT_PART
21 #include "hisysevent.h"
22 #endif
23 #include "reminder_request.h"
24 
25 using namespace OHOS::EventFwk;
26 using namespace OHOS::HiviewDFX;
27 namespace OHOS {
28 namespace Notification {
SetType(const int & _type)29 void ReminderTimerInfo::SetType(const int &_type)
30 {
31     type = _type;
32 }
33 
SetRepeat(bool _repeat)34 void ReminderTimerInfo::SetRepeat(bool _repeat)
35 {
36     repeat = _repeat;
37 }
38 
SetInterval(const uint64_t & _interval)39 void ReminderTimerInfo::SetInterval(const uint64_t &_interval)
40 {
41     interval = _interval;
42 }
43 
SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> _wantAgent)44 void ReminderTimerInfo::SetWantAgent(std::shared_ptr<OHOS::AbilityRuntime::WantAgent::WantAgent> _wantAgent)
45 {
46     wantAgent = _wantAgent;
47 }
48 
OnTrigger()49 void ReminderTimerInfo::OnTrigger()
50 {
51     ANSR_LOGI("Timing is arrivelled.");
52     if (action_ == ReminderRequest::REMINDER_EVENT_ALARM_ALERT) {
53 #ifdef HAS_HISYSEVENT_PART
54         std::string eventType = "ALARM_TRIGGER";
55         HiSysEventWrite(HiSysEvent::Domain::NOTIFICATION, eventType, HiSysEvent::EventType::STATISTIC,
56             "UID", uid_, "PID", pid_, "NAME", bundleName_);
57 #endif
58     }
59 }
60 }
61 }
62