diff --git a/interfaces/innerkits/wm/window_manager_lite.h b/interfaces/innerkits/wm/window_manager_lite.h index 392ad04802e7afecbe02db02414d48edc2c1aad9..be1b749120bf656bb739e937e18c202dd6a2683c 100644 --- a/interfaces/innerkits/wm/window_manager_lite.h +++ b/interfaces/innerkits/wm/window_manager_lite.h @@ -112,6 +112,13 @@ public: * @return WM_OK means unregister success, others means unregister failed. */ WMError UnregisterWindowModeChangedListener(const sptr& listener); + /** + * @brief Get window mode type. + * + * @param void + * @return WM_OK means get success, others means get failed. + */ + WMError GetWindowModeType(WindowModeType& windowModeType) const; /** * @brief Register camera window changed listener. @@ -128,15 +135,13 @@ public: * @return WM_OK means unregister success, others means unregister failed. */ WMError UnregisterCameraWindowChangedListener(const sptr& listener); - /** - * @brief Get window mode type. + * @brief raise window to top by windowId * - * @param void - * @return WM_OK means get success, others means get failed. + * @param persistentId this window to raise + * @return WM_OK if raise success */ - WMError GetWindowModeType(WindowModeType& windowModeType) const; - + WMError RaiseWindowToTop(int32_t persistentId); /** * @brief Get top num main window info. * @@ -146,6 +151,25 @@ public: */ WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo); + /** + * @brief Register WMS connection status changed listener. + * @attention Callable only by u0 system user. A process only supports successful registration once. + * When the foundation service restarts, you need to re-register the listener. + * If you want to re-register, please call UnregisterWMSConnectionChangedListener first. + * + * @param listener IWMSConnectionChangedListener. + * @return WM_OK means register success, others means register failed. + */ + WMError RegisterWMSConnectionChangedListener(const sptr& listener); + + /** + * @brief Unregister WMS connection status changed listener. + * @attention Callable only by u0 system user. + * + * @return WM_OK means unregister success, others means unregister failed. + */ + WMError UnregisterWMSConnectionChangedListener(); + /** * @brief Get all main window info. * @@ -171,33 +195,6 @@ public: */ WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds); - /** - * @brief raise window to top by windowId - * - * @param persistentId this window to raise - * @return WM_OK if raise success - */ - WMError RaiseWindowToTop(int32_t persistentId); - - /** - * @brief Register WMS connection status changed listener. - * @attention Callable only by u0 system user. A process only supports successful registration once. - * When the foundation service restarts, you need to re-register the listener. - * If you want to re-register, please call UnregisterWMSConnectionChangedListener first. - * - * @param listener IWMSConnectionChangedListener. - * @return WM_OK means register success, others means register failed. - */ - WMError RegisterWMSConnectionChangedListener(const sptr& listener); - - /** - * @brief Unregister WMS connection status changed listener. - * @attention Callable only by u0 system user. - * - * @return WM_OK means unregister success, others means unregister failed. - */ - WMError UnregisterWMSConnectionChangedListener(); - /** * @brief Register WindowStyle changed listener. * @@ -205,6 +202,7 @@ public: * @return WM_OK means register success, others means unregister failed. */ WMError RegisterWindowStyleChangedListener(const sptr& listener); + /** * @brief Unregister WindowStyle changed listener. * @@ -212,6 +210,7 @@ public: * @return WM_OK means unregister success, others means unregister failed. */ WMError UnregisterWindowStyleChangedListener(const sptr& listener); + /** * @brief Get window style type. * diff --git a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp index a5a3992d8930d1a0bc58f5942a7e220f7415bee6..f6cce84f765174102f707f580c80209951a88bb2 100644 --- a/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp +++ b/interfaces/kits/napi/window_runtime/window_napi/js_window_listener.cpp @@ -120,7 +120,6 @@ void JsWindowListener::OnSystemBarPropertyChange(DisplayId displayId, const Syst std::unique_ptr complete = std::make_unique ( [self = weakRef_, displayId, tints, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { - auto thisListener = self.promote(); if (thisListener == nullptr || eng == nullptr) { WLOGFE("[NAPI]this listener or eng is nullptr"); @@ -406,6 +405,25 @@ void JsWindowListener::OnWaterMarkFlagUpdate(bool showWaterMark) env_, std::make_unique(callback, std::move(execute), std::move(complete))); } +void JsWindowListener::OnWindowVisibilityChangedCallback(const bool isVisible) +{ + std::unique_ptr complete = std::make_unique( + [self = weakRef_, isVisible, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { + auto thisListener = self.promote(); + if (thisListener == nullptr || eng == nullptr) { + WLOGFE("This listener or eng is nullptr"); + return; + } + napi_value argv[] = { CreateJsValue(eng, isVisible) }; + thisListener->CallJsMethod(WINDOW_VISIBILITY_CHANGE_CB.c_str(), argv, ArraySize(argv)); + } + ); + napi_ref callback = nullptr; + std::unique_ptr execute = nullptr; + NapiAsyncTask::Schedule("JsWindowListener::OnWindowVisibilityChangedCallback", env_, + std::make_unique(callback, std::move(execute), std::move(complete))); +} + void JsWindowListener::SetTimeout(int64_t timeout) { noInteractionTimeout_ = timeout; @@ -461,26 +479,6 @@ void JsWindowListener::OnWindowStatusChange(WindowStatus windowstatus) env_, std::make_unique(callback, std::move(execute), std::move(complete))); } -void JsWindowListener::OnWindowVisibilityChangedCallback(const bool isVisible) -{ - std::unique_ptr complete = std::make_unique( - [self = weakRef_, isVisible, eng = env_] (napi_env env, NapiAsyncTask &task, int32_t status) { - auto thisListener = self.promote(); - if (thisListener == nullptr || eng == nullptr) { - WLOGFE("This listener or eng is nullptr"); - return; - } - napi_value argv[] = { CreateJsValue(eng, isVisible) }; - thisListener->CallJsMethod(WINDOW_VISIBILITY_CHANGE_CB.c_str(), argv, ArraySize(argv)); - } - ); - - napi_ref callback = nullptr; - std::unique_ptr execute = nullptr; - NapiAsyncTask::Schedule("JsWindowListener::OnWindowVisibilityChangedCallback", env_, - std::make_unique(callback, std::move(execute), std::move(complete))); -} - void JsWindowListener::OnWindowTitleButtonRectChanged(const TitleButtonRect& titleButtonRect) { WLOGFD("[NAPI]OnWindowTitleButtonRectChanged"); @@ -585,4 +583,4 @@ void JsWindowListener::OnSubWindowClose(bool& terminateCloseProcess) AppExecFwk::EventQueue::Priority::IMMEDIATE); } } // namespace Rosen -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/window_scene/common/src/window_session_property.cpp b/window_scene/common/src/window_session_property.cpp index 1e1f232bd048c59f63417033e4da6a4b47e02b9e..25b8b218825300f2fdb73dda3f89112c0cf512b1 100755 --- a/window_scene/common/src/window_session_property.cpp +++ b/window_scene/common/src/window_session_property.cpp @@ -595,6 +595,11 @@ uint32_t WindowSessionProperty::GetCallingSessionId() const return callingSessionId_; } +void WindowSessionProperty::SetSessionPropertyChangeCallback(std::function&& callback) +{ + touchHotAreasChangeCallback_ = std::move(callback); +} + void WindowSessionProperty::SetPiPTemplateInfo(const PiPTemplateInfo& pipTemplateInfo) { pipTemplateInfo_ = pipTemplateInfo; @@ -871,24 +876,24 @@ int32_t WindowSessionProperty::GetCompatibleInPcLandscapeHeight() const return compatibleInPcLandscapeHeight_; } -void WindowSessionProperty::SetIsPcAppInPad(bool isPcAppInPad) +void WindowSessionProperty::SetSubWindowLevel(uint32_t subWindowLevel) { - isPcAppInPad_ = isPcAppInPad; + subWindowLevel_ = subWindowLevel; } -bool WindowSessionProperty::GetIsPcAppInPad() const +uint32_t WindowSessionProperty::GetSubWindowLevel() const { - return isPcAppInPad_; + return subWindowLevel_; } -void WindowSessionProperty::SetSubWindowLevel(uint32_t subWindowLevel) +void WindowSessionProperty::SetIsPcAppInPad(bool isPcAppInPad) { - subWindowLevel_ = subWindowLevel; + isPcAppInPad_ = isPcAppInPad; } -uint32_t WindowSessionProperty::GetSubWindowLevel() const +bool WindowSessionProperty::GetIsPcAppInPad() const { - return subWindowLevel_; + return isPcAppInPad_; } void WindowSessionProperty::SetIsSupportDragInPcCompatibleMode(bool isSupportDragInPcCompatibleMode) @@ -957,11 +962,12 @@ bool WindowSessionProperty::Marshalling(Parcel& parcel) const parcel.WriteBool(isSystemCalling_) && parcel.WriteUint32(static_cast(sessionGravity_)) && parcel.WriteUint32(sessionGravitySizePercent_) && parcel.WriteDouble(textFieldPositionY_) && parcel.WriteDouble(textFieldHeight_) && - parcel.WriteUint32(static_cast(windowState_)) && parcel.WriteBool(isNeedUpdateWindowMode_) && parcel.WriteUint32(callingSessionId_) && + parcel.WriteUint32(static_cast(windowState_)) && parcel.WriteBool(isLayoutFullScreen_) && parcel.WriteBool(isExtensionFlag_) && parcel.WriteUint32(static_cast(uiExtensionUsage_)) && + parcel.WriteUint32(static_cast(parentWindowType_)) && MarshallingWindowMask(parcel) && parcel.WriteParcelable(&keyboardLayoutParams_) && parcel.WriteBool(compatibleModeInPc_) && @@ -1019,12 +1025,13 @@ WindowSessionProperty* WindowSessionProperty::Unmarshalling(Parcel& parcel) property->SetKeyboardSessionGravity(static_cast(parcel.ReadUint32()), parcel.ReadUint32()); property->SetTextFieldPositionY(parcel.ReadDouble()); property->SetTextFieldHeight(parcel.ReadDouble()); - property->SetWindowState(static_cast(parcel.ReadUint32())); property->SetIsNeedUpdateWindowMode(parcel.ReadBool()); property->SetCallingSessionId(parcel.ReadUint32()); + property->SetWindowState(static_cast(parcel.ReadUint32())); property->SetIsLayoutFullScreen(parcel.ReadBool()); property->SetExtensionFlag(parcel.ReadBool()); property->SetUIExtensionUsage(static_cast(parcel.ReadUint32())); + property->SetParentWindowType(static_cast(parcel.ReadUint32())); UnmarshallingWindowMask(parcel, property); sptr keyboardLayoutParams = parcel.ReadParcelable(); if (keyboardLayoutParams == nullptr) { @@ -1381,11 +1388,6 @@ double WindowSessionProperty::GetTextFieldHeight() const return textFieldHeight_; } -void WindowSessionProperty::SetSessionPropertyChangeCallback(std::function&& callback) -{ - touchHotAreasChangeCallback_ = std::move(callback); -} - bool WindowSessionProperty::IsLayoutFullScreen() const { return isLayoutFullScreen_; diff --git a/window_scene/interfaces/include/ws_common.h b/window_scene/interfaces/include/ws_common.h index 0d6c84c7fb9c7e573b16175647ec7f92b1fa97fd..157e6667be920dc79ea8ca1e70918897bc5c83b3 100644 --- a/window_scene/interfaces/include/ws_common.h +++ b/window_scene/interfaces/include/ws_common.h @@ -272,7 +272,7 @@ struct SessionInfo { uint32_t windowType_ = 1; // WINDOW_TYPE_APP_MAIN_WINDOW sptr callerToken_ = nullptr; sptr rootToken_ = nullptr; - uint64_t screenId_ = -1ULL; // -1ULL: SCREEN_ID_INVALID + uint64_t screenId_ = -1ULL; // -1ULL:SCREEN_ID_INVALID bool isPersistentRecover_ = false; mutable std::shared_ptr want; // want for ability start diff --git a/window_scene/session/container/include/zidl/session_stage_interface.h b/window_scene/session/container/include/zidl/session_stage_interface.h index 65fc35b133402788e7c0ea71a760392bb7bb1aee..e3631424e185d806fad515d36cfdec85e65f91e8 100644 --- a/window_scene/session/container/include/zidl/session_stage_interface.h +++ b/window_scene/session/container/include/zidl/session_stage_interface.h @@ -101,9 +101,9 @@ public: virtual WSError UpdateDisplayId(uint64_t displayId) = 0; virtual void NotifyDisplayMove(DisplayId from, DisplayId to) = 0; virtual WSError SwitchFreeMultiWindow(bool enable) = 0; - virtual WSError GetUIContentRemoteObj(sptr& uiContentRemoteObj) = 0; - virtual void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) = 0; virtual void NotifySessionFullScreen(bool fullScreen) {} + virtual void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) = 0; + virtual WSError GetUIContentRemoteObj(sptr& uiContentRemoteObj) = 0; // **Non** IPC interface virtual void NotifyBackpressedEvent(bool& isConsumed) {} diff --git a/window_scene/session/container/include/zidl/session_stage_ipc_interface_code.h b/window_scene/session/container/include/zidl/session_stage_ipc_interface_code.h index 872249cbee7770e7d33fc67806068370ab8f3ac7..b2480cdce038ba38b88d9fa444ad61bc0f8ec611 100644 --- a/window_scene/session/container/include/zidl/session_stage_ipc_interface_code.h +++ b/window_scene/session/container/include/zidl/session_stage_ipc_interface_code.h @@ -53,8 +53,8 @@ enum class SessionStageInterfaceCode { TRANS_ID_GET_UI_CONTENT_REMOTE_OBJ, TRANS_ID_NOTIFY_KEYBOARD_INFO_CHANGE, TRANS_ID_NOTIFY_DENSITY_FOLLOW_HOST, - TRANS_ID_NOTIFY_DENSITY_UNIQUE, TRANS_ID_NOTIFY_SESSION_FULLSCREEN, + TRANS_ID_NOTIFY_DENSITY_UNIQUE, }; } // namespace Rosen } // namespace OHOS diff --git a/window_scene/session/container/include/zidl/session_stage_proxy.h b/window_scene/session/container/include/zidl/session_stage_proxy.h index 74ae8226cf0f0218b5f97617812a10489473d1c1..369e0b1fcd521b0225f632e1f8ef7df3b10937df 100644 --- a/window_scene/session/container/include/zidl/session_stage_proxy.h +++ b/window_scene/session/container/include/zidl/session_stage_proxy.h @@ -66,8 +66,8 @@ public: WSError SwitchFreeMultiWindow(bool enable) override; WSError GetUIContentRemoteObj(sptr& uiContentRemoteObj) override; void NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo& keyboardPanelInfo) override; - void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) override; void NotifySessionFullScreen(bool fullScreen) override; + void SetUniqueVirtualPixelRatio(bool useUniqueDensity, float virtualPixelRatio) override; private: static inline BrokerDelegator delegator_; diff --git a/window_scene/session/container/include/zidl/session_stage_stub.h b/window_scene/session/container/include/zidl/session_stage_stub.h index 866536550ac4eac0ea9fe1cd4a1a2fabb557a44d..26a93d96ee8f1b3ae6f00a2e14c727556cf09f10 100644 --- a/window_scene/session/container/include/zidl/session_stage_stub.h +++ b/window_scene/session/container/include/zidl/session_stage_stub.h @@ -66,8 +66,8 @@ private: int HandleSwitchFreeMultiWindow(MessageParcel& data, MessageParcel& reply); int HandleGetUIContentRemoteObj(MessageParcel& data, MessageParcel& reply); int HandleNotifyKeyboardPanelInfoChange(MessageParcel& data, MessageParcel& reply); - int HandleSetUniqueVirtualPixelRatio(MessageParcel& data, MessageParcel& reply); int HandleNotifySessionFullScreen(MessageParcel& data, MessageParcel& reply); + int HandleSetUniqueVirtualPixelRatio(MessageParcel& data, MessageParcel& reply); }; } // namespace OHOS::Rosen #endif // OHOS_WINDOW_SCENE_SESSION_STAGE_STUB_H diff --git a/window_scene/session/container/src/zidl/session_stage_stub.cpp b/window_scene/session/container/src/zidl/session_stage_stub.cpp index 1b69a93bf6465888fcc43a75fd11e1ef413578f1..e1d9d6aeb077156cec7f14050f80ed493aea49bc 100644 --- a/window_scene/session/container/src/zidl/session_stage_stub.cpp +++ b/window_scene/session/container/src/zidl/session_stage_stub.cpp @@ -100,10 +100,10 @@ int SessionStageStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag return HandleGetUIContentRemoteObj(data, reply); case static_cast(SessionStageInterfaceCode::TRANS_ID_NOTIFY_KEYBOARD_INFO_CHANGE): return HandleNotifyKeyboardPanelInfoChange(data, reply); - case static_cast(SessionStageInterfaceCode::TRANS_ID_NOTIFY_DENSITY_UNIQUE): - return HandleSetUniqueVirtualPixelRatio(data, reply); case static_cast(SessionStageInterfaceCode::TRANS_ID_NOTIFY_SESSION_FULLSCREEN): return HandleNotifySessionFullScreen(data, reply); + case static_cast(SessionStageInterfaceCode::TRANS_ID_NOTIFY_DENSITY_UNIQUE): + return HandleSetUniqueVirtualPixelRatio(data, reply); default: WLOGFE("Failed to find function handler!"); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); diff --git a/window_scene/session/host/include/scene_session.h b/window_scene/session/host/include/scene_session.h index d1eba0bf03ff094885f9310fc7fb13e930b763ff..6e39332c50c8fac0e38dffdfd1c14de326880098 100644 --- a/window_scene/session/host/include/scene_session.h +++ b/window_scene/session/host/include/scene_session.h @@ -35,7 +35,6 @@ namespace { constexpr int32_t MAX_DECOR_HEIGHT = 112; } class SceneSession; - using SpecificSessionCreateCallback = std::function(const SessionInfo& info, sptr property)>; using SpecificSessionDestroyCallback = std::function; @@ -69,6 +68,7 @@ using ClearCallbackMapFunc = std::function; using OnOutsideDownEvent = std::function; using HandleSecureSessionShouldHideCallback = std::function& sceneSession)>; +using SystemSessionBufferAvailableCallback = std::function; using ClearDisplayStatusBarTemporarilyFlags = std::function; using CameraSessionChangeCallback = std::function; using NotifyLandscapeMultiWindowSessionFunc = std::function; @@ -76,7 +76,6 @@ using NotifyKeyboardGravityChangeFunc = std::function& sceneSession, const sptr& property, WSPropertyChangeAction action)>; using NotifyKeyboardLayoutAdjustFunc = std::function; -using SystemSessionBufferAvailableCallback = std::function; using NotifyLayoutFullScreenChangeFunc = std::function; using SetSkipSelfWhenShowOnVirtualScreenCallback = std::function; using NotifyForceSplitFunc = std::function; @@ -143,6 +142,7 @@ public: sptr token = nullptr, int32_t pid = -1, int32_t uid = -1); WSError Foreground(sptr property, bool isFromClient = false) override; WSError Background(bool isFromClient = false) override; + virtual void RegisterBufferAvailableCallback(const SystemSessionBufferAvailableCallback& func) {}; WSError BackgroundTask(const bool isSaveSnapshot = true); WSError Disconnect(bool isFromClient = false) override; void SetClientIdentityToken(const std::string& clientIdentityToken); @@ -152,7 +152,6 @@ public: virtual sptr GetKeyboardSession() const { return nullptr; }; virtual SessionGravity GetKeyboardGravity() const { return SessionGravity::SESSION_GRAVITY_DEFAULT; }; virtual void OnKeyboardPanelUpdated() {}; - virtual void RegisterBufferAvailableCallback(const SystemSessionBufferAvailableCallback& func) {}; WSError UpdateActiveStatus(bool isActive) override; WSError OnSessionEvent(SessionEvent event) override; @@ -175,6 +174,7 @@ public: WSError NotifyClientToUpdateRect(std::shared_ptr rsTransaction) override; WSError OnNeedAvoid(bool status) override; AvoidArea GetAvoidAreaByType(AvoidAreaType type) override; + WSError TransferPointerEvent(const std::shared_ptr& pointerEvent, bool needNotifyClient = true) override; WSError RequestSessionBack(bool needMoveToBackground) override; @@ -185,12 +185,13 @@ public: WSError UpdateWindowAnimationFlag(bool needDefaultAnimationFlag) override; void SetZOrder(uint32_t zOrder) override; std::vector GetTouchHotAreas() const override; + void NotifyUILostFocus() override; + void SetScale(float scaleX, float scaleY, float pivotX, float pivotY) override; void SetFloatingScale(float floatingScale) override; WSError RaiseAboveTarget(int32_t subWindowId) override; WSError UpdatePiPRect(const Rect& rect, SizeChangeReason reason) override; WSError UpdatePiPControlStatus(WsPiPControlType controlType, WsPiPControlStatus status) override; void NotifyPiPWindowPrepareClose() override; - void SetScale(float scaleX, float scaleY, float pivotX, float pivotY) override; void RequestHideKeyboard(bool isAppColdStart = false); WSError ProcessPointDownSession(int32_t posX, int32_t posY) override; WSError SendPointEventForMoveDrag(const std::shared_ptr& pointerEvent) override; @@ -265,7 +266,6 @@ public: bool IsFloatingWindowAppType() const; bool IsNeedDefaultAnimation() const; bool IsDirtyWindow(); - void NotifyUILostFocus() override; void SetSystemTouchable(bool touchable) override; bool IsVisibleForAccessibility() const; bool GetIsDisplayStatusBarTemporarily() const; @@ -273,11 +273,11 @@ public: void SetStartingWindowExitAnimationFlag(bool enable); bool NeedStartingWindowExitAnimation() const override; + void NotifyWindowVisibility(); WSError UpdateAvoidArea(const sptr& avoidArea, AvoidAreaType type) override; WSError OnShowWhenLocked(bool showWhenLocked); void SaveUpdatedIcon(const std::shared_ptr &icon); void NotifyTouchOutside(); - void NotifyWindowVisibility(); bool CheckOutTouchOutsideRegister(); void UpdateNativeVisibility(bool visible); void UpdateRotationAvoidArea(); @@ -301,9 +301,9 @@ public: void SetIsStartMoving(const bool startMoving); bool IsSystemSpecificSession() const; void SetIsSystemSpecificSession(bool isSystemSpecificSession); - void SetShouldHideNonSecureWindows(bool shouldHide); WSError SetPipActionEvent(const std::string& action, int32_t status); WSError SetPiPControlEvent(WsPiPControlType controlType, WsPiPControlStatus status); + void SetShouldHideNonSecureWindows(bool shouldHide); void UpdateExtWindowFlags(int32_t extPersistentId, const ExtensionWindowFlags& extWindowFlags, const ExtensionWindowFlags& extWindowActions); ExtensionWindowFlags GetCombinedExtWindowFlags(); @@ -314,6 +314,10 @@ public: void SetSessionState(SessionState state) override; void UpdateSessionState(SessionState state) override; + void SetForceHideState(ForceHideState forceHideState); + ForceHideState GetForceHideState() const; + bool IsTemporarilyShowWhenLocked() const; + void SetTemporarilyShowWhenLocked(bool isTemporarilyShowWhenLocked); std::shared_ptr keepScreenLock_; @@ -323,10 +327,6 @@ public: static uint32_t GetWindowDragHotAreaType(uint32_t type, int32_t pointerX, int32_t pointerY); static void AddOrUpdateWindowDragHotArea(uint32_t type, const WSRect& area); WSError UpdateRectChangeListenerRegistered(bool isRegister) override; - void SetForceHideState(ForceHideState forceHideState); - ForceHideState GetForceHideState() const; - bool IsTemporarilyShowWhenLocked() const; - void SetTemporarilyShowWhenLocked(bool isTemporarilyShowWhenLocked); int32_t GetCustomDecorHeight() override { return customDecorHeight_; @@ -358,9 +358,8 @@ public: return systemConfig_.IsFreeMultiWindowMode(); } WMError GetAppForceLandscapeConfig(AppForceLandscapeConfig& config) override; - - bool IsPcOrPadEnableActivation() const; void UnregisterSessionChangeListeners() override; + bool IsPcOrPadEnableActivation() const; protected: void NotifySessionRectChange(const WSRect& rect, const SizeChangeReason& reason = SizeChangeReason::UNDEFINED); @@ -418,8 +417,8 @@ private: bool IsMovableWindowType(); bool IsFullScreenMovable(); void HandleCastScreenConnection(SessionInfo& info, sptr session); - void FixKeyboardPositionByKeyboardPanel(sptr panelSession, sptr keyboardSession); void UpdateSessionRectInner(const WSRect& rect, const SizeChangeReason& reason); + void FixKeyboardPositionByKeyboardPanel(sptr panelSession, sptr keyboardSession); WMError HandleUpdatePropertyByAction(const sptr& property, const sptr& sceneSession, WSPropertyChangeAction action); WMError HandleActionUpdateTurnScreenOn(const sptr& property, @@ -482,13 +481,14 @@ private: const sptr& property); void NotifySessionChangeByActionNotifyManager(const sptr& sceneSession, const sptr& property, WSPropertyChangeAction action); + NotifySessionPiPControlStatusChangeFunc sessionPiPControlStatusChangeFunc_; NotifyForceSplitFunc forceSplitFunc_; UpdatePrivateStateAndNotifyFunc updatePrivateStateAndNotifyFunc_; static wptr enterSession_; static std::mutex enterSessionMutex_; - mutable std::mutex sessionChangeCbMutex_; int32_t collaboratorType_ = CollaboratorType::DEFAULT_TYPE; + mutable std::mutex sessionChangeCbMutex_; WSRect lastSafeRect = { 0, 0, 0, 0 }; std::vector> subSession_; std::vector> toastSession_; @@ -508,15 +508,15 @@ private: int32_t customDecorHeight_ = 0; ForceHideState forceHideState_ { ForceHideState::NOT_HIDDEN }; static std::shared_mutex windowDragHotAreaMutex_; + std::string clientIdentityToken_ = { "" }; static std::map windowDragHotAreaMap_; - int32_t oriPosYBeforeRaisedBykeyboard_ = 0; + SessionChangeByActionNotifyManagerFunc sessionChangeByActionNotifyManagerFunc_; + int32_t oriPosYBeforeRaisedByKeyboard_ = 0; std::atomic_bool isTemporarilyShowWhenLocked_ { false }; std::shared_mutex modalUIExtensionInfoListMutex_; std::vector modalUIExtensionInfoList_; mutable std::shared_mutex uiExtNodeIdToPersistentIdMapMutex_; std::map uiExtNodeIdToPersistentIdMap_; - std::string clientIdentityToken_ = { "" }; - SessionChangeByActionNotifyManagerFunc sessionChangeByActionNotifyManagerFunc_; bool isAddBlank_ = false; bool bufferAvailableCallbackEnable_ = false; bool isStatusBarVisible_ = true; diff --git a/window_scene/session/host/src/scene_session.cpp b/window_scene/session/host/src/scene_session.cpp index 4a38503a73a1547f40dee40c7c318c9f4c3daa4d..97c1ec34de3cbe939f9964d3e20e4c78586a510b 100644 --- a/window_scene/session/host/src/scene_session.cpp +++ b/window_scene/session/host/src/scene_session.cpp @@ -3460,12 +3460,12 @@ void SceneSession::SetLastSafeRect(WSRect rect) int32_t SceneSession::GetOriPosYBeforeRaisedByKeyboard() const { - return oriPosYBeforeRaisedBykeyboard_; + return oriPosYBeforeRaisedByKeyboard_; } void SceneSession::SetOriPosYBeforeRaisedByKeyboard(int32_t posY) { - oriPosYBeforeRaisedBykeyboard_ = posY; + oriPosYBeforeRaisedByKeyboard_ = posY; } bool SceneSession::AddSubSession(const sptr& subSession) diff --git a/window_scene/session_manager/include/scene_session_manager_lite.h b/window_scene/session_manager/include/scene_session_manager_lite.h index fe2370354119f2edb114ea3c1d12894e241be3f1..80b72b496b5fc32e2c40d79a73a7ff46d9415ef2 100644 --- a/window_scene/session_manager/include/scene_session_manager_lite.h +++ b/window_scene/session_manager/include/scene_session_manager_lite.h @@ -65,11 +65,11 @@ public: WMError GetWindowModeType(WindowModeType& windowModeType) override; WSError RaiseWindowToTop(int32_t persistentId) override; WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo) override; - WMError GetAllMainWindowInfos(std::vector& infos) override; - WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds) override; WSError RegisterIAbilityManagerCollaborator(int32_t type, const sptr& impl) override; WSError UnregisterIAbilityManagerCollaborator(int32_t type) override; + WMError GetAllMainWindowInfos(std::vector& infos) override; + WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds) override; WMError GetWindowStyleType(WindowStyleType& windowStyletype) override; protected: diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h index ddf861a02dbfed56b11fd8c9824bcc135356828f..97e6e1998d20c30a3bb1486fdeb243ff67505439 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_interface.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_interface.h @@ -108,8 +108,8 @@ public: TRANS_ID_GET_WINDOW_RECT, TRANS_ID_GET_WINDOW_MODE_TYPE, TRANS_ID_GET_UNRELIABLE_WINDOW_INFO, - TRANS_ID_GET_WINDOW_STYLE_TYPE, TRANS_ID_GET_PROCESS_SURFACENODEID_BY_PERSISTENTID, + TRANS_ID_GET_WINDOW_STYLE_TYPE, }; virtual WSError SetSessionLabel(const sptr &token, const std::string &label) = 0; @@ -254,10 +254,10 @@ public: } WMError GetWindowModeType(WindowModeType& windowModeType) override { return WMError::WM_OK; } - WMError GetWindowStyleType(WindowStyleType& windowStyleType) override { return WMError::WM_OK; } - virtual WMError GetProcessSurfaceNodeIdByPersistentId(const int32_t pid, const std::vector& persistentIds, std::vector& surfaceNodeIds) = 0; + + WMError GetWindowStyleType(WindowStyleType& windowStyleType) override { return WMError::WM_OK; } }; } // namespace OHOS::Rosen #endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_lite_interface.h b/window_scene/session_manager/include/zidl/scene_session_manager_lite_interface.h index 7c4f2f7c813bad6cc1b40541ec151221ec2e44cf..a1a196ed27f6f85083524b4d95c898af047d7097 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_lite_interface.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_lite_interface.h @@ -68,12 +68,12 @@ public: TRANS_ID_CHECK_WINDOW_ID, TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID, TRANS_ID_GET_WINDOW_MODE_TYPE, - TRANS_ID_GET_TOPN_MAIN_WINDOW_INFO, - TRANS_ID_GET_ALL_MAIN_WINDOW_INFO, - TRANS_ID_CLEAR_MAIN_SESSIONS, TRANS_ID_RAISE_WINDOW_TO_TOP, + TRANS_ID_GET_TOPN_MAIN_WINDOW_INFO, TRANS_ID_REGISTER_COLLABORATOR, TRANS_ID_UNREGISTER_COLLABORATOR, + TRANS_ID_GET_ALL_MAIN_WINDOW_INFO, + TRANS_ID_CLEAR_MAIN_SESSIONS, TRANS_ID_GET_WINDOW_STYLE_TYPE, TRANS_ID_GET_MAIN_WINDOW_STATES_BY_PID, }; diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_lite_proxy.h b/window_scene/session_manager/include/zidl/scene_session_manager_lite_proxy.h index 02cb9ec3f44f58a6c453ec3caa19861b977138a5..1a959df436dc0a8926b1920e51bd059fb6e16274 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_lite_proxy.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_lite_proxy.h @@ -70,13 +70,13 @@ public: WMError CheckWindowId(int32_t windowId, int32_t &pid) override; WMError GetVisibilityWindowInfo(std::vector>& infos) override; WMError GetWindowModeType(WindowModeType& windowModeType) override; - WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo) override; - WMError GetAllMainWindowInfos(std::vector& infos) override; - WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds) override; WSError RaiseWindowToTop(int32_t persistentId) override; + WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo) override; WSError RegisterIAbilityManagerCollaborator(int32_t type, const sptr& impl) override; WSError UnregisterIAbilityManagerCollaborator(int32_t type) override; + WMError GetAllMainWindowInfos(std::vector& infos) override; + WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds) override; WMError GetWindowStyleType(WindowStyleType& windowModeType) override; private: diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_lite_stub.h b/window_scene/session_manager/include/zidl/scene_session_manager_lite_stub.h index 390e46e24706d118e722a1da0b5920da837a56a9..66ed9223d5b4209fdabfd5e0900ecb095aa95ad6 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_lite_stub.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_lite_stub.h @@ -61,12 +61,12 @@ private: int HandleCheckWindowId(MessageParcel &data, MessageParcel &reply); int HandleGetVisibilityWindowInfo(MessageParcel& data, MessageParcel& reply); int HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply); - int HandleGetMainWinodowInfo(MessageParcel& data, MessageParcel& reply); - int HandleGetAllMainWindowInfos(MessageParcel& data, MessageParcel& reply); - int HandleClearMainSessions(MessageParcel& data, MessageParcel& reply); int HandleRaiseWindowToTop(MessageParcel& data, MessageParcel& reply); + int HandleGetMainWinodowInfo(MessageParcel& data, MessageParcel& reply); int HandleRegisterCollaborator(MessageParcel& data, MessageParcel& reply); int HandleUnregisterCollaborator(MessageParcel& data, MessageParcel& reply); + int HandleGetAllMainWindowInfos(MessageParcel& data, MessageParcel& reply); + int HandleClearMainSessions(MessageParcel& data, MessageParcel& reply); int HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply); int ProcessRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option); diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h index 2852c7a79fa3de25611e2a9d25cd19398f3ec633..c180bbc919f2f57ec5b87c44edd468a92bb09646 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_proxy.h @@ -112,9 +112,9 @@ public: WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override; WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override; WMError GetWindowModeType(WindowModeType& windowModeType) override; - WMError GetWindowStyleType(WindowStyleType& windowStyleType) override; WMError GetProcessSurfaceNodeIdByPersistentId(const int32_t pid, const std::vector& persistentIds, std::vector& surfaceNodeIds) override; + WMError GetWindowStyleType(WindowStyleType& windowStyleType) override; private: template diff --git a/window_scene/session_manager/include/zidl/scene_session_manager_stub.h b/window_scene/session_manager/include/zidl/scene_session_manager_stub.h index a6bb075412fc889935d7655d19a1c4abdf1e7edd..16afb4937d4ded03d2bca1a46c73b1de10d26001 100644 --- a/window_scene/session_manager/include/zidl/scene_session_manager_stub.h +++ b/window_scene/session_manager/include/zidl/scene_session_manager_stub.h @@ -95,8 +95,8 @@ private: int HandleGetCallingWindowWindowStatus(MessageParcel& data, MessageParcel& reply); int HandleGetCallingWindowRect(MessageParcel& data, MessageParcel& reply); int HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply); - int HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply); int HandleGetProcessSurfaceNodeIdByPersistentId(MessageParcel& data, MessageParcel& reply); + int HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply); int ProcessRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option); }; diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_lite_proxy.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_lite_proxy.cpp index 09f29ef955ba9c3ed11530f9ca8fbf53bd625cff..ff98264c7d033a23380c99546a6f46a055567557 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_lite_proxy.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_lite_proxy.cpp @@ -827,6 +827,30 @@ WMError SceneSessionManagerLiteProxy::GetWindowModeType(WindowModeType& windowMo return static_cast(reply.ReadInt32()); } +WSError SceneSessionManagerLiteProxy::RaiseWindowToTop(int32_t persistentId) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option(MessageOption::TF_SYNC); + if (!data.WriteInterfaceToken(GetDescriptor())) { + TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); + return WSError::WS_ERROR_IPC_FAILED; + } + if (!data.WriteInt32(persistentId)) { + TLOGE(WmsLogTag::WMS_MAIN, "Write persistentId failed"); + return WSError::WS_ERROR_IPC_FAILED; + } + + if (Remote()->SendRequest(static_cast( + SceneSessionManagerLiteMessage::TRANS_ID_RAISE_WINDOW_TO_TOP), + data, reply, option) != ERR_NONE) { + TLOGE(WmsLogTag::WMS_MAIN, "SendRequest failed"); + return WSError::WS_ERROR_IPC_FAILED; + } + int32_t ret = reply.ReadInt32(); + return static_cast(ret); +} + WMError SceneSessionManagerLiteProxy::GetMainWindowInfos(int32_t topNum, std::vector& topNInfo) { TLOGI(WmsLogTag::WMS_MAIN, "get main info in %{public}d", topNum); @@ -862,77 +886,6 @@ WMError SceneSessionManagerLiteProxy::GetMainWindowInfos(int32_t topNum, std::ve return static_cast(reply.ReadInt32()); } -WMError SceneSessionManagerLiteProxy::GetAllMainWindowInfos(std::vector& infos) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (Remote()->SendRequest(static_cast( - SceneSessionManagerLiteMessage::TRANS_ID_GET_ALL_MAIN_WINDOW_INFO), data, reply, option) != ERR_NONE) { - TLOGE(WmsLogTag::WMS_MAIN, "send request fail"); - return WMError::WM_ERROR_IPC_FAILED; - } - - WMError error = static_cast(GetParcelableInfos(reply, infos)); - if (error != WMError::WM_OK) { - TLOGE(WmsLogTag::WMS_MAIN, "get info error"); - return error; - } - - return static_cast(reply.ReadInt32()); -} - -WMError SceneSessionManagerLiteProxy::ClearMainSessions(const std::vector& persistentIds, - std::vector& clearFailedIds) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (!data.WriteInt32Vector(persistentIds)) { - TLOGE(WmsLogTag::WMS_MAIN, "Write persistentIds failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (Remote()->SendRequest(static_cast( - SceneSessionManagerLiteMessage::TRANS_ID_CLEAR_MAIN_SESSIONS), data, reply, option) != ERR_NONE) { - TLOGE(WmsLogTag::WMS_MAIN, "send request fail"); - return WMError::WM_ERROR_IPC_FAILED; - } - reply.ReadInt32Vector(&clearFailedIds); - return static_cast(reply.ReadInt32()); -} - -WSError SceneSessionManagerLiteProxy::RaiseWindowToTop(int32_t persistentId) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option(MessageOption::TF_SYNC); - if (!data.WriteInterfaceToken(GetDescriptor())) { - TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); - return WSError::WS_ERROR_IPC_FAILED; - } - if (!data.WriteInt32(persistentId)) { - TLOGE(WmsLogTag::WMS_MAIN, "Write persistentId failed"); - return WSError::WS_ERROR_IPC_FAILED; - } - - if (Remote()->SendRequest(static_cast( - SceneSessionManagerLiteMessage::TRANS_ID_RAISE_WINDOW_TO_TOP), - data, reply, option) != ERR_NONE) { - TLOGE(WmsLogTag::WMS_MAIN, "SendRequest failed"); - return WSError::WS_ERROR_IPC_FAILED; - } - int32_t ret = reply.ReadInt32(); - return static_cast(ret); -} - WSError SceneSessionManagerLiteProxy::RegisterIAbilityManagerCollaborator(int32_t type, const sptr& impl) { @@ -992,6 +945,53 @@ WSError SceneSessionManagerLiteProxy::UnregisterIAbilityManagerCollaborator(int3 return static_cast(reply.ReadInt32()); } +WMError SceneSessionManagerLiteProxy::GetAllMainWindowInfos(std::vector& infos) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(GetDescriptor())) { + TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); + return WMError::WM_ERROR_IPC_FAILED; + } + if (Remote()->SendRequest(static_cast( + SceneSessionManagerLiteMessage::TRANS_ID_GET_ALL_MAIN_WINDOW_INFO), data, reply, option) != ERR_NONE) { + TLOGE(WmsLogTag::WMS_MAIN, "send request fail"); + return WMError::WM_ERROR_IPC_FAILED; + } + + WMError error = static_cast(GetParcelableInfos(reply, infos)); + if (error != WMError::WM_OK) { + TLOGE(WmsLogTag::WMS_MAIN, "get info error"); + return error; + } + + return static_cast(reply.ReadInt32()); +} + +WMError SceneSessionManagerLiteProxy::ClearMainSessions(const std::vector& persistentIds, + std::vector& clearFailedIds) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(GetDescriptor())) { + TLOGE(WmsLogTag::WMS_MAIN, "WriteInterfaceToken failed"); + return WMError::WM_ERROR_IPC_FAILED; + } + if (!data.WriteInt32Vector(persistentIds)) { + TLOGE(WmsLogTag::WMS_MAIN, "Write persistentIds failed"); + return WMError::WM_ERROR_IPC_FAILED; + } + if (Remote()->SendRequest(static_cast( + SceneSessionManagerLiteMessage::TRANS_ID_CLEAR_MAIN_SESSIONS), data, reply, option) != ERR_NONE) { + TLOGE(WmsLogTag::WMS_MAIN, "send request fail"); + return WMError::WM_ERROR_IPC_FAILED; + } + reply.ReadInt32Vector(&clearFailedIds); + return static_cast(reply.ReadInt32()); +} + WMError SceneSessionManagerLiteProxy::GetWindowStyleType(WindowStyleType& windowStyleType) { MessageParcel data; diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp index e565a0ba1b03a628436b5aa075ec48dc6910ac67..7372f4822aea26372496a8d0738db6c8493d8fa9 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_lite_stub.cpp @@ -469,6 +469,15 @@ int SceneSessionManagerLiteStub::HandleGetWindowModeType(MessageParcel& data, Me return ERR_NONE; } +int SceneSessionManagerLiteStub::HandleRaiseWindowToTop(MessageParcel& data, MessageParcel& reply) +{ + auto persistentId = data.ReadInt32(); + WSError errCode = RaiseWindowToTop(persistentId); + reply.WriteUint32(static_cast(errCode)); + return ERR_NONE; +} + + int SceneSessionManagerLiteStub::HandleGetMainWinodowInfo(MessageParcel &data, MessageParcel &reply) { TLOGI(WmsLogTag::WMS_MAIN, "run HandleGetMainWinodowInfo lite"); @@ -501,6 +510,31 @@ int SceneSessionManagerLiteStub::HandleGetMainWinodowInfo(MessageParcel &data, M return ERR_NONE; } +int SceneSessionManagerLiteStub::HandleRegisterCollaborator(MessageParcel& data, MessageParcel& reply) +{ + TLOGD(WmsLogTag::WMS_MAIN, "called."); + int32_t type = data.ReadInt32(); + sptr collaboratorObject = data.ReadRemoteObject(); + if (collaboratorObject == nullptr) { + TLOGE(WmsLogTag::WMS_MAIN, "collaboratorObject is null."); + return ERR_NULL_OBJECT; + } + sptr collaborator = + iface_cast(collaboratorObject); + WSError ret = RegisterIAbilityManagerCollaborator(type, collaborator); + reply.WriteInt32(static_cast(ret)); + return ERR_NONE; +} + +int SceneSessionManagerLiteStub::HandleUnregisterCollaborator(MessageParcel& data, MessageParcel& reply) +{ + TLOGD(WmsLogTag::WMS_MAIN, "called."); + int32_t type = data.ReadInt32(); + WSError ret = UnregisterIAbilityManagerCollaborator(type); + reply.WriteInt32(static_cast(ret)); + return ERR_NONE; +} + int SceneSessionManagerLiteStub::HandleGetAllMainWindowInfos(MessageParcel& data, MessageParcel& reply) { std::vector infos; @@ -537,39 +571,6 @@ int SceneSessionManagerLiteStub::HandleClearMainSessions(MessageParcel& data, Me return ERR_NONE; } -int SceneSessionManagerLiteStub::HandleRaiseWindowToTop(MessageParcel& data, MessageParcel& reply) -{ - auto persistentId = data.ReadInt32(); - WSError errCode = RaiseWindowToTop(persistentId); - reply.WriteUint32(static_cast(errCode)); - return ERR_NONE; -} - -int SceneSessionManagerLiteStub::HandleRegisterCollaborator(MessageParcel& data, MessageParcel& reply) -{ - TLOGD(WmsLogTag::WMS_MAIN, "called."); - int32_t type = data.ReadInt32(); - sptr collaboratorObject = data.ReadRemoteObject(); - if (collaboratorObject == nullptr) { - TLOGE(WmsLogTag::WMS_MAIN, "collaboratorObject is null."); - return ERR_NULL_OBJECT; - } - sptr collaborator = - iface_cast(collaboratorObject); - WSError ret = RegisterIAbilityManagerCollaborator(type, collaborator); - reply.WriteInt32(static_cast(ret)); - return ERR_NONE; -} - -int SceneSessionManagerLiteStub::HandleUnregisterCollaborator(MessageParcel& data, MessageParcel& reply) -{ - TLOGD(WmsLogTag::WMS_MAIN, "called."); - int32_t type = data.ReadInt32(); - WSError ret = UnregisterIAbilityManagerCollaborator(type); - reply.WriteInt32(static_cast(ret)); - return ERR_NONE; -} - int SceneSessionManagerLiteStub::HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply) { WindowStyleType windowStyleType = Rosen::WindowStyleType::WINDOW_STYLE_DEFAULT; diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp index b40ed48c423a9f79398918e678248fdfd89bc6e2..d55cbcab7f123944af7bad310c9be5e3d7b3a36a 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_proxy.cpp @@ -1831,23 +1831,6 @@ WMError SceneSessionManagerProxy::GetWindowModeType(WindowModeType& windowModeTy return static_cast(reply.ReadInt32()); } -WMError SceneSessionManagerProxy::GetWindowStyleType(WindowStyleType& windowStyleType) -{ - MessageParcel data; - MessageParcel reply; - MessageOption option; - if (!data.WriteInterfaceToken(GetDescriptor())) { - TLOGE(WmsLogTag::WMS_LIFE, "GetwindowStyleType Write interfaceToken failed"); - return WMError::WM_ERROR_IPC_FAILED; - } - if (Remote()->SendRequest(static_cast( - SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_STYLE_TYPE), data, reply, option) != ERR_NONE) { - return WMError::WM_ERROR_IPC_FAILED; - } - windowStyleType = static_cast(reply.ReadUint32()); - return static_cast(reply.ReadInt32()); -} - WMError SceneSessionManagerProxy::GetProcessSurfaceNodeIdByPersistentId(const int32_t pid, const std::vector& persistentIds, std::vector& surfaceNodeIds) { @@ -1880,4 +1863,21 @@ WMError SceneSessionManagerProxy::GetProcessSurfaceNodeIdByPersistentId(const in reply.ReadUInt64Vector(&surfaceNodeIds); return static_cast(reply.ReadInt32()); } + +WMError SceneSessionManagerProxy::GetWindowStyleType(WindowStyleType& windowStyleType) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!data.WriteInterfaceToken(GetDescriptor())) { + TLOGE(WmsLogTag::WMS_LIFE, "GetwindowStyleType Write interfaceToken failed"); + return WMError::WM_ERROR_IPC_FAILED; + } + if (Remote()->SendRequest(static_cast( + SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_STYLE_TYPE), data, reply, option) != ERR_NONE) { + return WMError::WM_ERROR_IPC_FAILED; + } + windowStyleType = static_cast(reply.ReadUint32()); + return static_cast(reply.ReadInt32()); +} } // namespace OHOS::Rosen diff --git a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp index 3d9355a5647bd820228eb837a8825209dbad8cc0..968261ef1e707b69b0a9e42345ed4086d16b33b6 100644 --- a/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp +++ b/window_scene/session_manager/src/zidl/scene_session_manager_stub.cpp @@ -147,14 +147,14 @@ int SceneSessionManagerStub::ProcessRemoteRequest(uint32_t code, MessageParcel& return HandleShiftAppWindowFocus(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID): return HandleGetVisibilityWindowInfo(data, reply); - case static_cast(SceneSessionManagerMessage::TRANS_ID_ADD_EXTENSION_WINDOW_STAGE_TO_SCB): - return HandleAddExtensionWindowStageToSCB(data, reply); - case static_cast(SceneSessionManagerMessage::TRANS_ID_REMOVE_EXTENSION_WINDOW_STAGE_FROM_SCB): - return HandleRemoveExtensionWindowStageFromSCB(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_UPDATE_MODALEXTENSION_RECT_TO_SCB): return HandleUpdateModalExtensionRect(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_PROCESS_MODALEXTENSION_POINTDOWN_TO_SCB): return HandleProcessModalExtensionPointDown(data, reply); + case static_cast(SceneSessionManagerMessage::TRANS_ID_ADD_EXTENSION_WINDOW_STAGE_TO_SCB): + return HandleAddExtensionWindowStageToSCB(data, reply); + case static_cast(SceneSessionManagerMessage::TRANS_ID_REMOVE_EXTENSION_WINDOW_STAGE_FROM_SCB): + return HandleRemoveExtensionWindowStageFromSCB(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_ADD_OR_REMOVE_SECURE_SESSION): return HandleAddOrRemoveSecureSession(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS): @@ -167,10 +167,10 @@ int SceneSessionManagerStub::ProcessRemoteRequest(uint32_t code, MessageParcel& return HandleGetCallingWindowRect(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MODE_TYPE): return HandleGetWindowModeType(data, reply); - case static_cast(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_STYLE_TYPE): - return HandleGetWindowStyleType(data, reply); case static_cast(SceneSessionManagerMessage::TRANS_ID_GET_PROCESS_SURFACENODEID_BY_PERSISTENTID): return HandleGetProcessSurfaceNodeIdByPersistentId(data, reply); + case static_cast(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_STYLE_TYPE): + return HandleGetWindowStyleType(data, reply); default: WLOGFE("Failed to find function handler!"); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); @@ -993,19 +993,6 @@ int SceneSessionManagerStub::HandleGetWindowModeType(MessageParcel& data, Messag return ERR_NONE; } -int SceneSessionManagerStub::HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply) -{ - WindowStyleType windowStyleType = Rosen::WindowStyleType::WINDOW_STYLE_DEFAULT; - WMError errCode = GetWindowStyleType(windowStyleType); - TLOGI(WmsLogTag::WMS_LIFE, "windowStyleType:%{public}d!", static_cast(windowStyleType)); - if (!reply.WriteUint32(static_cast(windowStyleType))) { - TLOGE(WmsLogTag::WMS_LIFE, "Failed to WriteBool"); - return ERR_INVALID_DATA; - } - reply.WriteInt32(static_cast(errCode)); - return ERR_NONE; -} - int SceneSessionManagerStub::HandleGetProcessSurfaceNodeIdByPersistentId(MessageParcel& data, MessageParcel& reply) { int32_t pid = data.ReadInt32(); @@ -1020,4 +1007,17 @@ int SceneSessionManagerStub::HandleGetProcessSurfaceNodeIdByPersistentId(Message reply.WriteInt32(static_cast(errCode)); return ERR_NONE; } + +int SceneSessionManagerStub::HandleGetWindowStyleType(MessageParcel& data, MessageParcel& reply) +{ + WindowStyleType windowStyleType = Rosen::WindowStyleType::WINDOW_STYLE_DEFAULT; + WMError errCode = GetWindowStyleType(windowStyleType); + TLOGI(WmsLogTag::WMS_LIFE, "windowStyleType:%{public}d!", static_cast(windowStyleType)); + if (!reply.WriteUint32(static_cast(windowStyleType))) { + TLOGE(WmsLogTag::WMS_LIFE, "Failed to WriteBool"); + return ERR_INVALID_DATA; + } + reply.WriteInt32(static_cast(errCode)); + return ERR_NONE; +} } // namespace OHOS::Rosen diff --git a/wm/include/picture_in_picture_option.h b/wm/include/picture_in_picture_option.h index 0d29c54da1cf088de3851898f54e2955927b3044..c4db609fd2ab84f0d589b945fef8d0b7c29e8f9e 100644 --- a/wm/include/picture_in_picture_option.h +++ b/wm/include/picture_in_picture_option.h @@ -58,8 +58,8 @@ private: uint32_t contentHeight_ = 0; std::vector pipControlStatusInfoList_; std::vector pipControlEnableInfoList_; - std::shared_ptr xComponentController_ = nullptr; std::vector controlGroup_; + std::shared_ptr xComponentController_ = nullptr; napi_ref customNodeController_ = nullptr; napi_ref typeNode_ = nullptr; bool useTypeNode_ = false; diff --git a/wm/include/window_adapter_lite.h b/wm/include/window_adapter_lite.h index cd650ba774fee07491d42bd491fa509f2535a49c..08ed180616fe0221d969ece1045d489db9f2f819 100644 --- a/wm/include/window_adapter_lite.h +++ b/wm/include/window_adapter_lite.h @@ -45,13 +45,13 @@ public: virtual WMError GetVisibilityWindowInfo(std::vector>& infos); virtual void ClearWindowAdapter(); virtual WMError GetWindowModeType(WindowModeType& windowModeType); + virtual WMError RaiseWindowToTop(int32_t persistentId); virtual WMError GetMainWindowInfos(int32_t topNum, std::vector& topNInfo); + WMError RegisterWMSConnectionChangedListener(const WMSConnectionChangedCallbackFunc& callbackFunc); virtual WMError GetAllMainWindowInfos(std::vector& infos); virtual WMError ClearMainSessions(const std::vector& persistentIds); virtual WMError ClearMainSessions(const std::vector& persistentIds, std::vector& clearFailedIds); - virtual WMError RaiseWindowToTop(int32_t persistentId); virtual WMError GetWindowStyleType(WindowStyleType& windowStyleType); - WMError RegisterWMSConnectionChangedListener(const WMSConnectionChangedCallbackFunc& callbackFunc); private: static inline SingletonDelegator delegator; diff --git a/wm/src/window_adapter_lite.cpp b/wm/src/window_adapter_lite.cpp index 5273fd8e747ada7e67597e7b1579ac7e248d9c43..86dce414804d0f1e49841d0c6084c423229bccc8 100644 --- a/wm/src/window_adapter_lite.cpp +++ b/wm/src/window_adapter_lite.cpp @@ -41,7 +41,7 @@ WM_IMPLEMENT_SINGLE_INSTANCE(WindowAdapterLite) TLOGE(WmsLogTag::DEFAULT, "window manager proxy is nullptr"); \ return ret; \ } \ - } while(false) + } while (false) #define CHECK_PROXY_RETURN_IF_NULL(proxy) \ do { \ @@ -49,7 +49,7 @@ WM_IMPLEMENT_SINGLE_INSTANCE(WindowAdapterLite) TLOGE(WmsLogTag::DEFAULT, "window manager proxy is nullptr"); \ return; \ } \ - } while(false) + } while (false) WMError WindowAdapterLite::RegisterWindowManagerAgent(WindowManagerAgentType type, const sptr& windowManagerAgent) diff --git a/wm/src/window_manager_lite.cpp b/wm/src/window_manager_lite.cpp index 8c503f59251cf0f9be2d3ea69eb1dcee46decb3c..50398e4fa5e191e152c7777b61d28bb50fb592ef 100644 --- a/wm/src/window_manager_lite.cpp +++ b/wm/src/window_manager_lite.cpp @@ -460,7 +460,6 @@ WMError WindowManagerLite::GetWindowModeType(WindowModeType& windowModeType) con } return ret; } - WMError WindowManagerLite::RegisterWindowModeChangedListener(const sptr& listener) { if (listener == nullptr) { @@ -569,40 +568,6 @@ WMError WindowManagerLite::UnregisterCameraWindowChangedListener(const sptr& topNInfo) -{ - TLOGI(WmsLogTag::WMS_MAIN, "Get main window info lite"); - return SingletonContainer::Get().GetMainWindowInfos(topNum, topNInfo); -} - -WMError WindowManagerLite::GetAllMainWindowInfos(std::vector& infos) const -{ - if (!infos.empty()) { - TLOGE(WmsLogTag::WMS_MAIN, "infos is not empty."); - return WMError::WM_ERROR_INVALID_PARAM; - } - return SingletonContainer::Get().GetAllMainWindowInfos(infos); -} - -WMError WindowManagerLite::ClearMainSessions(const std::vector& persistentIds) -{ - if (persistentIds.empty()) { - TLOGW(WmsLogTag::WMS_MAIN, "Clear main Session failed, persistentIds is empty."); - return WMError::WM_OK; - } - return SingletonContainer::Get().ClearMainSessions(persistentIds); -} - -WMError WindowManagerLite::ClearMainSessions(const std::vector& persistentIds, - std::vector& clearFailedIds) -{ - if (persistentIds.empty()) { - TLOGW(WmsLogTag::WMS_MAIN, "Clear main Session failed, persistentIds is empty."); - return WMError::WM_OK; - } - return SingletonContainer::Get().ClearMainSessions(persistentIds, clearFailedIds); -} - WMError WindowManagerLite::RaiseWindowToTop(int32_t persistentId) { WMError ret = SingletonContainer::Get().RaiseWindowToTop(persistentId); @@ -612,6 +577,12 @@ WMError WindowManagerLite::RaiseWindowToTop(int32_t persistentId) return ret; } +WMError WindowManagerLite::GetMainWindowInfos(int32_t topNum, std::vector& topNInfo) +{ + TLOGI(WmsLogTag::WMS_MAIN, "Get main window info lite"); + return SingletonContainer::Get().GetMainWindowInfos(topNum, topNInfo); +} + WMError WindowManagerLite::RegisterWMSConnectionChangedListener(const sptr& listener) { int32_t clientUserId = GetUserIdByUid(getuid()); @@ -658,6 +629,34 @@ void WindowManagerLite::OnWMSConnectionChanged(int32_t userId, int32_t screenId, } } +WMError WindowManagerLite::GetAllMainWindowInfos(std::vector& infos) const +{ + if (!infos.empty()) { + TLOGE(WmsLogTag::WMS_MAIN, "infos is not empty."); + return WMError::WM_ERROR_INVALID_PARAM; + } + return SingletonContainer::Get().GetAllMainWindowInfos(infos); +} + +WMError WindowManagerLite::ClearMainSessions(const std::vector& persistentIds) +{ + if (persistentIds.empty()) { + TLOGW(WmsLogTag::WMS_MAIN, "Clear main Session failed, persistentIds is empty."); + return WMError::WM_OK; + } + return SingletonContainer::Get().ClearMainSessions(persistentIds); +} + +WMError WindowManagerLite::ClearMainSessions(const std::vector& persistentIds, + std::vector& clearFailedIds) +{ + if (persistentIds.empty()) { + TLOGW(WmsLogTag::WMS_MAIN, "Clear main Session failed, persistentIds is empty."); + return WMError::WM_OK; + } + return SingletonContainer::Get().ClearMainSessions(persistentIds, clearFailedIds); +} + WMError WindowManagerLite::NotifyWindowStyleChange(WindowStyleType type) { pImpl_->NotifyWindowStyleChange(type);