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 #ifndef OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H 17 #define OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H 18 19 #include "session/host/include/scene_session.h" 20 21 namespace OHOS::Rosen { 22 class SCBSystemSession : public SceneSession { 23 public: 24 SCBSystemSession(const SessionInfo& info, const sptr<SpecificSessionCallback>& specificCallback); 25 ~SCBSystemSession(); 26 WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; 27 28 WSError NotifyClientToUpdateRect(const std::string& updateReason, 29 std::shared_ptr<RSTransaction> rsTransaction) override; 30 void PresentFocusIfPointDown() override; 31 WSError TransferKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override; 32 WSError UpdateFocus(bool isFocused) override; 33 WSError UpdateWindowMode(WindowMode mode) override; 34 WSError SetSystemSceneBlockingFocus(bool blocking) override; 35 void BindKeyboardSession(sptr<SceneSession> session) override; 36 sptr<SceneSession> GetKeyboardSession() const override; 37 void SetSkipSelfWhenShowOnVirtualScreen(bool isSkip) override; 38 void SetSkipEventOnCastPlus(bool isSkip) override; 39 void SyncScenePanelGlobalPosition(bool needSync) override; IsNeedSyncScenePanelGlobalPosition()40 bool IsNeedSyncScenePanelGlobalPosition() override { return isNeedSyncGlobalPos_; } 41 bool IsVisibleForeground() const override; 42 bool IsVisibleNotBackground() const override; 43 44 /* 45 * App Use Control 46 */ 47 bool GetIsUseControlSession() const override; 48 void SetIsUseControlSession(bool isUseControlSession) override; 49 50 protected: 51 void UpdatePointerArea(const WSRect& rect) override; 52 void NotifyClientToUpdateAvoidArea() override; 53 54 private: 55 bool isNeedSyncGlobalPos_ = true; // can only accessed in main thread 56 57 /* 58 * App Use Control 59 */ 60 bool isUseControlSession_ = false; // Indicates whether the session is used for controlling a main session. 61 }; 62 } // namespace OHOS::Rosen 63 #endif // OHOS_ROSEN_WINDOW_SCENE_SCB_SYSTEM_SESSION_H 64