新开内部获取自由多窗状态接口

Signed-off-by: yangyuanzhou <yangyuanzhou@huawei.com>
This commit is contained in:
yangyuanzhou 2024-07-27 16:04:26 +08:00
parent 874a4f4c18
commit 547b535b21
16 changed files with 104 additions and 0 deletions

View File

@ -2106,6 +2106,14 @@ public:
* @return the height of status bar.
*/
virtual uint32_t GetStatusBarHeight() { return 0; }
/**
* @brief Get whether the free multi-window mode is enabled or not.
*
* @return true means the free multi-window mode is enabled, and false means the opposite.
*/
virtual bool GetFreeMultiWindowModeEnabledState() { return true; }
};
}
}

View File

@ -417,6 +417,7 @@ public:
std::string GetWindowDetectTaskName() const;
void RemoveWindowDetectTask();
WSError SwitchFreeMultiWindow(bool enable);
bool IsFreeMultiWindowEnable();
virtual int32_t GetCustomDecorHeight()
{
return 0;

View File

@ -2826,6 +2826,11 @@ WSError Session::SwitchFreeMultiWindow(bool enable)
return sessionStage_->SwitchFreeMultiWindow(enable);
}
bool Session::IsFreeMultiWindowEnable()
{
retrun systemConfig_.freeMultiWindowEnable_;
}
WSError Session::GetUIContentRemoteObj(sptr<IRemoteObject>& uiContentRemoteObj)
{
if (!IsSessionValid()) {

View File

@ -341,6 +341,7 @@ public:
std::shared_ptr<TaskScheduler> GetTaskScheduler() {return taskScheduler_;};
WSError SwitchFreeMultiWindow(bool enable);
WSError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable) override;
const SystemSessionConfig& GetSystemSessionConfig() const;
void ClearDisplayStatusBarTemporarilyFlags();
int32_t GetCustomDecorHeight(int32_t persistentId);

View File

@ -108,6 +108,7 @@ public:
TRANS_ID_GET_WINDOW_RECT,
TRANS_ID_GET_WINDOW_MODE_TYPE,
TRANS_ID_GET_UNRELIABLE_WINDOW_INFO,
TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE,
};
virtual WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) = 0;
@ -242,6 +243,10 @@ public:
{
return WSError::WS_OK;
}
WSError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable) override
{
return WSError::WS_OK;
}
WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override
{
return WMError::WM_OK;

View File

@ -109,6 +109,7 @@ public:
WSError UpdateExtWindowFlags(const sptr<IRemoteObject>& token, uint32_t extWindowFlags,
uint32_t extWindowActions) override;
WSError GetHostWindowRect(int32_t hostWindowId, Rect& rect) override;
WSError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable) override;
WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override;
WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override;
WMError MinimizeAllAppWindows(DisplayId displayId) override;

View File

@ -92,6 +92,7 @@ private:
int HandleAddOrRemoveSecureSession(MessageParcel& data, MessageParcel& reply);
int HandleUpdateExtWindowFlags(MessageParcel& data, MessageParcel& reply);
int HandleGetHostWindowRect(MessageParcel& data, MessageParcel& reply);
int HandleGetFreeMultiWindowEnableState(MessageParcel& data, MessageParcel& reply);
int HandleGetCallingWindowWindowStatus(MessageParcel& data, MessageParcel& reply);
int HandleGetCallingWindowRect(MessageParcel& data, MessageParcel& reply);
int HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply);

View File

@ -565,6 +565,27 @@ WSError SceneSessionManager::SwitchFreeMultiWindow(bool enable)
return WSError::WS_OK;
}
WSError SceneSessionManager::GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable)
{
TLOGI(WmsLogTag::WMS_UIEXT, "hostWindowId:%{public}d", hostWindowId);
if (!SessionPermission::IsSystemCalling()) {
TLOGE(WmsLogTag::WMS_UIEXT, "GetFreeMultiWindowEnableState permission denied!");
return WSError::WS_ERROR_NOT_SYSTEM_APP;
}
auto task = [this, hostWindowId, &enable]() {
auto sceneSession = GetSceneSession(hostWindowId);
if (sceneSession == nullptr) {
TLOGE(WmsLogTag::WMS_UIEXT, "Session with persistentId %{public}d not found", hostWindowId);
return WSError::WS_ERROR_INVALID_SESSION;
}
bool isEnable = sceneSession->IsFreeMultiWindowEnable();
enable = isEnable;
return WSError::WS_OK;
};
taskScheduler_->PostSyncTask(task, "GetFreeMultiWindowEnableState");
return WSError::WS_OK;
}
WSError SceneSessionManager::SetSessionContinueState(const sptr<IRemoteObject> &token,
const ContinueState& continueState)
{

View File

@ -1756,6 +1756,31 @@ WSError SceneSessionManagerProxy::GetHostWindowRect(int32_t hostWindowId, Rect&
return static_cast<WSError>(reply.ReadInt32());
}
WSError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable)
{
TLOGD(WmsLogTag::WMS_UIEXT, "run SceneSessionManagerProxy::GetFreeMultiWindowEnableState");
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) {
TLOGE(WmsLogTag::WMS_UIEXT, "Write interface token failed.");
return WSError::WS_ERROR_IPC_FAILED;
}
if (!data.WriteInt32(hostWindowId)) {
TLOGE(WmsLogTag::WMS_UIEXT, "Write hostWindowId failed");
return WSError::WS_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(
static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE),
data, reply, option) != ERR_NONE) {
TLOGE(WmsLogTag::WMS_UIEXT, "SendRequest GetFreeMultiWindowEnableState failed");
return WSError::WS_ERROR_IPC_FAILED;
}
auto isEnable = reply.ReadBool();
enable = isEnable;
return static_cast<WSError>(reply.ReadInt32());
}
WMError SceneSessionManagerProxy::GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus)
{
MessageParcel data;

View File

@ -167,6 +167,8 @@ int SceneSessionManagerStub::ProcessRemoteRequest(uint32_t code, MessageParcel&
return HandleGetCallingWindowRect(data, reply);
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MODE_TYPE):
return HandleGetWindowModeType(data, reply);
case static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE):
return HandleGetFreeMultiWindowEnableState(data, reply);
default:
WLOGFE("Failed to find function handler!");
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
@ -943,6 +945,17 @@ int SceneSessionManagerStub::HandleGetHostWindowRect(MessageParcel& data, Messag
return ERR_NONE;
}
int SceneSessionManagerStub::HandleGetFreeMultiWindowEnableState(MessageParcel& data, MessageParcel& reply)
{
TLOGD(WmsLogTag::WMS_UIEXT, "run HandleGetFreeMultiWindowEnableState!");
int32_t hostWindowId = data.ReadInt32();
bool enable = false;
WSError ret = GetFreeMultiWindowEnableState(hostWindowId, enable);
reply.WriteBool(enable);
reply.WriteInt32(static_cast<int32_t>(ret));
return ERR_NONE;
}
int SceneSessionManagerStub::HandleGetCallingWindowWindowStatus(MessageParcel&data, MessageParcel&reply)
{
TLOGI(WmsLogTag::WMS_KEYBOARD, "run HandleGetCallingWindowWindowStatus!");

View File

@ -128,6 +128,7 @@ public:
virtual WMError UpdateExtWindowFlags(const sptr<IRemoteObject>& token, uint32_t extWindowFlags,
uint32_t extWindowActions);
virtual WMError GetHostWindowRect(int32_t hostWindowId, Rect& rect);
virtual WMError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable);
virtual WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus);
virtual WMError GetCallingWindowRect(int32_t persistentId, Rect& rect);
virtual WMError GetWindowModeType(WindowModeType& windowModeType);

View File

@ -89,6 +89,7 @@ public:
WMError HideNonSecureWindows(bool shouldHide) override;
WMError SetWaterMarkFlag(bool isEnable) override;
Rect GetHostWindowRect(int32_t hostWindowId) override;
bool GetFreeMultiWindowModeEnabledState() override;
bool PreNotifyKeyEvent(const std::shared_ptr<MMI::KeyEvent>& keyEvent) override;
protected:

View File

@ -152,6 +152,7 @@ public:
WMError HideNonSecureWindows(bool shouldHide) override;
virtual WMError SetWindowMask(const std::vector<std::vector<uint32_t>>& windowMask) override;
WSError SwitchFreeMultiWindow(bool enable) override;
virtual bool GetFreeMultiWindowModeEnabledState() override;
void NotifyKeyboardPanelInfoChange(const KeyboardPanelInfo& keyboardPanelInfo) override;
void UpdateDensity() override;
WSError UpdateOrientation() override;

View File

@ -891,6 +891,15 @@ WMError WindowAdapter::GetHostWindowRect(int32_t hostWindowId, Rect& rect)
return static_cast<WMError>(wmsProxy->GetHostWindowRect(hostWindowId, rect));
}
WMError WindowAdapter::GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable)
{
INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING);
auto wmsProxy = GetWindowManagerServiceProxy();
CHECK_PROXY_RETURN_ERROR_IF_NULL(wmsProxy, WMError::WM_DO_NOTHING);
return static_cast<WMError>(wmsProxy->GetFreeMultiWindowEnableState(hostWindowId, enable));
}
WMError WindowAdapter::GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus)
{
INIT_PROXY_CHECK_RETURN(WMError::WM_DO_NOTHING);

View File

@ -3104,6 +3104,12 @@ WSError WindowSceneSessionImpl::SwitchFreeMultiWindow(bool enable)
return WSError::WS_OK;
}
WSError WindowSceneSessionImpl::GetFreeMultiWindowModeEnabledState()
{
return windowSystemConfig_.freeMultiWindowEnable_ &&
windowSystemConfig_.freeMultiWindowSupport_;
}
WMError WindowSceneSessionImpl::NotifyPrepareClosePiPWindow()
{
TLOGI(WmsLogTag::WMS_PIP, "NotifyPrepareClosePiPWindow type: %{public}u", GetType());

View File

@ -90,6 +90,7 @@ public:
TRANS_ID_UPDATE_EXTENSION_WINDOW_FLAGS,
TRANS_ID_GET_HOST_WINDOW_RECT,
TRANS_ID_GET_UNRELIABLE_WINDOW_INFO_ID,
TRANS_ID_GET_FREE_MULTI_WINDOW_ENABLE_STATE,
};
virtual WMError CreateWindow(sptr<IWindow>& window, sptr<WindowProperty>& property,
const std::shared_ptr<RSSurfaceNode>& surfaceNode,
@ -220,6 +221,10 @@ public:
{
return WSError::WS_OK;
}
WSError GetFreeMultiWindowEnableState(int32_t hostWindowId, bool& enable)
{
return WSError::WS_OK;
}
virtual WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus)
{
return WMError::WM_OK;