• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 "sync_rule/screen_status.h"
17 
18 #include "common_event_manager.h"
19 #include "common_event_support.h"
20 #include "dfs_error.h"
21 #include "power_mgr_client.h"
22 #include "utils_log.h"
23 
24 namespace OHOS {
25 namespace FileManagement {
26 namespace CloudSync {
IsScreenOn()27 bool ScreenStatus::IsScreenOn()
28 {
29     return screenState_ == ScreenState::SCREEN_ON;
30 }
31 
InitScreenStatus()32 void ScreenStatus::InitScreenStatus()
33 {
34     bool isScreenOn = PowerMgr::PowerMgrClient::GetInstance().IsScreenOn();
35     screenState_ =  isScreenOn? ScreenState::SCREEN_ON : ScreenState::SCREEN_OFF;
36 }
37 
SetScreenState(ScreenState screenState)38 void ScreenStatus::SetScreenState(ScreenState screenState)
39 {
40     screenState_ = screenState;
41 }
42 } // namespace CloudSync
43 } // namespace FileManagement
44 } // namespace OHOS