• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 BUNDLE_ACTIVE_COMMON_EVENT_SUBSCRIBER_H
17 #define BUNDLE_ACTIVE_COMMON_EVENT_SUBSCRIBER_H
18 
19 #include <memory>
20 
21 #include "common_event_manager.h"
22 #include "common_event_support.h"
23 #include "common_event_data.h"
24 #include "time_service_client.h"
25 
26 #include "ibundle_active_service.h"
27 #include "ffrt.h"
28 
29 namespace OHOS {
30 namespace DeviceUsageStats {
31 using CommonEventSubscriber = OHOS::EventFwk::CommonEventSubscriber;
32 using CommonEventData = OHOS::EventFwk::CommonEventData;
33 using CommonEventSubscribeInfo = OHOS::EventFwk::CommonEventSubscribeInfo;
34 using CommonEventSupport = OHOS::EventFwk::CommonEventSupport;
35 using CommonEventManager = OHOS::EventFwk::CommonEventManager;
36 using MatchingSkills = OHOS::EventFwk::MatchingSkills;
37 class BundleActiveGroupController;
38 
39 class BundleActiveCommonEventSubscriber : public CommonEventSubscriber {
40 public:
BundleActiveCommonEventSubscriber(const CommonEventSubscribeInfo & subscriberInfo)41     BundleActiveCommonEventSubscriber(
42         const CommonEventSubscribeInfo &subscriberInfo) : CommonEventSubscriber(subscriberInfo) {}
43     ~BundleActiveCommonEventSubscriber() = default;
44     void OnReceiveEvent(const CommonEventData &data) override;
45 
46 private:
47     void HandleScreenEvent();
48     void HandleUserRemoveEvent(const CommonEventData &data);
49     void HandleUserSwitchEvent(const CommonEventData &data);
50     void HandlePackageRemoveEvent(const CommonEventData &data);
51     void HandlePackageAddEvent(const CommonEventData &data);
52     void HandleLockEvent(const CommonEventData &data);
53     ffrt::mutex mutex_;
54 };
55 }  // namespace DeviceUsageStats
56 }  // namespace OHOS
57 #endif  // BUNDLE_ACTIVE_COMMON_EVENT_SUBSCRIBER_H
58 
59