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 OHOS_ROSEN_WINDOW_SCENE_SECONDARY_DISPLAY_FOLD_POLICY_H 17 #define OHOS_ROSEN_WINDOW_SCENE_SECONDARY_DISPLAY_FOLD_POLICY_H 18 19 #include <refbase.h> 20 21 #include "common/include/task_scheduler.h" 22 #include "fold_screen_controller/fold_screen_policy.h" 23 #include "fold_screen_info.h" 24 #include "session/screen/include/screen_session.h" 25 26 namespace OHOS::Rosen { 27 class SecondaryDisplayFoldPolicy : public FoldScreenPolicy { 28 public: 29 SecondaryDisplayFoldPolicy(std::recursive_mutex& displayInfoMutex, 30 std::shared_ptr<TaskScheduler> screenPowerTaskScheduler); 31 ~SecondaryDisplayFoldPolicy() = default; 32 void ChangeScreenDisplayMode(FoldDisplayMode displayMode, 33 DisplayModeChangeReason reason = DisplayModeChangeReason::DEFAULT) override; 34 void SendSensorResult(FoldStatus foldStatus) override; 35 sptr<FoldCreaseRegion> GetCurrentFoldCreaseRegion() override; 36 void SetOnBootAnimation(bool onBootAnimation) override; 37 FoldDisplayMode GetModeMatchStatus() override; 38 std::vector<uint32_t> GetScreenParams() override; 39 void SetScreenSnapshotRect(RSSurfaceCaptureConfig& config) override; 40 void SetMainScreenRegion(DMRect& mainScreenRegion) override; 41 void SetSecondaryDisplayModeChangeStatus(bool status) override; 42 private: 43 void ChangeSuperScreenDisplayMode(sptr<ScreenSession> screenSession, 44 FoldDisplayMode displayMode); 45 void RecoverWhenBootAnimationExit(); 46 void ReportFoldDisplayModeChange(FoldDisplayMode displayMode); 47 void SendPropertyChangeResult(sptr<ScreenSession> screenSession, ScreenId screenId, 48 ScreenPropertyChangeReason reason, FoldDisplayMode displayMode); 49 void SetStatusFullActiveRectAndTpFeature(ScreenProperty &screenProperty); 50 void SetStatusMainActiveRectAndTpFeature(ScreenProperty &screenProperty); 51 void SetStatusGlobalFullActiveRectAndTpFeature(ScreenProperty &screenProperty); 52 void InitScreenParams(); 53 std::recursive_mutex& displayInfoMutex_; 54 std::shared_ptr<TaskScheduler> screenPowerTaskScheduler_; 55 std::vector<uint32_t> screenParams_; 56 }; 57 } // namespace OHOS::Rosen 58 #endif //OHOS_ROSEN_WINDOW_SCENE_SECONDARY_DISPLAY_FOLD_POLICY_H