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 #ifndef OHOS_ROSEN_WINDOW_SCENE_FOLD_SCREEN_CONTROLLER_H 16 #define OHOS_ROSEN_WINDOW_SCENE_FOLD_SCREEN_CONTROLLER_H 17 18 #include <refbase.h> 19 20 #include "common/include/task_scheduler.h" 21 #include "fold_screen_controller/fold_screen_policy.h" 22 #include "fold_screen_controller/fold_screen_state_machine.h" 23 #include "fold_screen_info.h" 24 25 namespace OHOS::Rosen { 26 enum class DisplayDeviceType :uint32_t { 27 DISPLAY_DEVICE_UNKNOWN = 0, 28 SINGLE_DISPLAY_DEVICE, 29 DOUBLE_DISPLAY_DEVICE, 30 }; 31 32 class FoldScreenController : public RefBase { 33 public: 34 FoldScreenController(std::recursive_mutex& displayInfoMutex, 35 std::shared_ptr<TaskScheduler> screenPowerTaskScheduler); 36 virtual ~FoldScreenController(); 37 38 void SetDisplayMode(const FoldDisplayMode displayMode); 39 FoldDisplayMode GetDisplayMode(); 40 bool IsFoldable(); 41 FoldStatus GetFoldStatus(); 42 void SetFoldStatus(FoldStatus foldStatus); 43 sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion(); 44 ScreenId GetCurrentScreenId(); 45 void LockDisplayStatus(bool locked); 46 void SetOnBootAnimation(bool onBootAnimation); 47 void UpdateForPhyScreenPropertyChange(); 48 private: 49 sptr<FoldScreenPolicy> GetFoldScreenPolicy(DisplayDeviceType productType); 50 sptr<FoldScreenPolicy> foldScreenPolicy_; 51 std::recursive_mutex& displayInfoMutex_; 52 std::shared_ptr<TaskScheduler> screenPowerTaskScheduler_; 53 }; 54 } // namespace OHOS::Rosen 55 #endif //OHOS_ROSEN_WINDOW_SCENE_FOLD_SCREEN_CONTROLLER_H