• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef DISPLAY_COMMON_EVENT_MGR_H
17 #define DISPLAY_COMMON_EVENT_MGR_H
18 
19 #include "common_event_manager.h"
20 #include "common_event_subscriber.h"
21 #include "common_event_support.h"
22 #include "datashare_helper.h"
23 #include "display_common.h"
24 
25 namespace OHOS {
26 namespace DisplayPowerMgr {
27 class DisplayCommonEventManager : public OHOS::EventFwk::CommonEventSubscriber {
28 public:
29     explicit DisplayCommonEventManager(const OHOS::EventFwk::CommonEventSubscribeInfo &subscribeInfo);
30     virtual ~DisplayCommonEventManager() = default;
31     DisplayCommonEventManager(const DisplayCommonEventManager&) = delete;
32     DisplayCommonEventManager& operator=(const DisplayCommonEventManager&) = delete;
33     DisplayCommonEventManager(DisplayCommonEventManager&&) = delete;
34     DisplayCommonEventManager& operator=(DisplayCommonEventManager&&) = delete;
35 
36     void OnReceiveEvent(const OHOS::EventFwk::CommonEventData &data) override;
37     bool CheckIfSettingsDataReady();
38     bool SetKvDataReady();
39     void HandleBootBrightness();
40 
41 private:
42     sptr<IRemoteObject> GetDpmsRemoteObj();
43     bool CreateDataShareHelper(sptr<IRemoteObject> remoteObj);
44     bool isDataShareReady_ {false};
45     bool isKvDataReady_ {false};
46     std::mutex lock_ {};
47 };
48 } // namespace DisplayPowerMgr
49 } // namespace OHOS
50 #endif