update wm/src/window_manager.cpp.

Signed-off-by: 黄四平 <huangsiping3@huawei.com>
This commit is contained in:
黄四平 2024-04-30 04:59:06 +00:00 committed by huangsiping
parent c90b5521c0
commit 14958fb734
28 changed files with 56 additions and 57 deletions

View File

@ -357,7 +357,7 @@ public:
* @param void
* @return WM_OK means get success, others means get failed.
*/
WMError GetWindowModStatus(WindowModeType &windowMod) const;
WMError GetWindowModeType(WindowModeType& windowModeType) const;
/**
* @brief Register system bar changed listener.
*

View File

@ -135,7 +135,7 @@ public:
* @param void
* @return WM_OK means get success, others means get failed.
*/
WMError GetWindowModStatus(WindowModeType &windowMod) const;
WMError GetWindowModeType(WindowModeType& windowModeType) const;
/**
* @brief Get top num main window info.
*

View File

@ -53,7 +53,7 @@ public:
MOCK_METHOD1(GetSystemConfig, WMError(SystemConfig& systemConfig));
MOCK_METHOD2(DispatchKeyEvent, void(uint32_t windowId, std::shared_ptr<MMI::KeyEvent> event));
MOCK_METHOD0(GetMaximizeMode, MaximizeMode());
MOCK_METHOD1(GetWindowModStatus, WMError(WindowModeType &windowMod));
MOCK_METHOD1(GetWindowModeType, WMError(WindowModeType& windowModeType));
};
}
} // namespace OHOS

View File

@ -29,7 +29,7 @@ public:
const sptr<IWindowManagerAgent>& windowManagerAgent));
MOCK_METHOD2(UnregisterWindowManagerAgent, WMError(WindowManagerAgentType type,
const sptr<IWindowManagerAgent>& windowManagerAgent));
MOCK_METHOD1(GetWindowModStatus, WMError(WindowModeType &windowMod));
MOCK_METHOD1(GetWindowModeType, WMError(WindowModeType& windowModeType));
MOCK_METHOD2(GetMainWindowInfos, WMError(int32_t topNum,
std::vector<MainWindowInfo>& topNInfo));
};

View File

@ -312,7 +312,7 @@ public:
int32_t ReclaimPurgeableCleanMem();
WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override;
WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override;
WMError GetWindowModStatus(WindowModeType &windowMod) override;
WMError GetWindowModeType(WindowModeType& windowModeType) override;
void OnBundleUpdated(const std::string& bundleName, int userId);
void OnConfigurationUpdated(const std::shared_ptr<AppExecFwk::Configuration>& configuration);

View File

@ -60,7 +60,7 @@ public:
WMError CheckWindowId(int32_t windowId, int32_t &pid) override;
WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override;
WSError UpdateWindowMode(int32_t persistentId, int32_t windowMode);
WMError GetWindowModStatus(WindowModeType &windowMod) override;
WMError GetWindowModeType(WindowModeType& windowModeType) override;
WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override;
protected:

View File

@ -104,7 +104,7 @@ public:
TRANS_ID_DESTROY_AND_DISCONNECT_SPECIFIC_SESSION_WITH_DETACH_CALLBACK,
TRANS_ID_GET_WINDOW_STATUS,
TRANS_ID_GET_WINDOW_RECT,
TRANS_ID_GET_WINDOW_MOD_TYPE,
TRANS_ID_GET_WINDOW_MODE_TYPE,
};
virtual WSError SetSessionLabel(const sptr<IRemoteObject> &token, const std::string &label) = 0;
@ -236,7 +236,7 @@ public:
{
return WMError::WM_OK;
}
WMError GetWindowModStatus(WindowModeType &windowMod) override { return WMError::WM_OK; }
WMError GetWindowModeType(WindowModeType& windowModeType) override { return WMError::WM_OK; }
};
} // namespace OHOS::Rosen
#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_INTERFACE_H

View File

@ -67,7 +67,7 @@ public:
TRANS_ID_GET_WINDOW_INFO,
TRANS_ID_CHECK_WINDOW_ID,
TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID,
TRANS_ID_GET_WINDOW_MOD_TYPE,
TRANS_ID_GET_WINDOW_MODE_TYPE,
TRANS_ID_GET_TOPN_MAIN_WINDOW_INFO,
};

View File

@ -59,7 +59,7 @@ public:
const sptr<IWindowManagerAgent>& windowManagerAgent) override;
WMError CheckWindowId(int32_t windowId, int32_t &pid) override;
WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) override;
WMError GetWindowModStatus(WindowModeType &windowMod) override;
WMError GetWindowModeType(WindowModeType& windowModeType) override;
WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) override;
private:

View File

@ -62,7 +62,7 @@ private:
int HandleUnregisterWindowManagerAgent(MessageParcel &data, MessageParcel &reply);
int HandleCheckWindowId(MessageParcel &data, MessageParcel &reply);
int HandleGetVisibilityWindowInfo(MessageParcel& data, MessageParcel& reply);
int HandleGetWindowModStatus(MessageParcel& data, MessageParcel& reply);
int HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply);
int HandleGetMainWinodowInfo(MessageParcel& data, MessageParcel& reply);
};
} // namespace OHOS::Rosen

View File

@ -105,7 +105,7 @@ public:
WSError GetHostWindowRect(int32_t hostWindowId, Rect& rect) override;
WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus) override;
WMError GetCallingWindowRect(int32_t persistentId, Rect& rect) override;
WMError GetWindowModStatus(WindowModeType &windowMod) override;
WMError GetWindowModeType(WindowModeType& windowModeType) override;
private:
template<typename T>

View File

@ -94,7 +94,7 @@ private:
int HandleGetHostWindowRect(MessageParcel& data, MessageParcel& reply);
int HandleGetCallingWindowWindowStatus(MessageParcel& data, MessageParcel& reply);
int HandleGetCallingWindowRect(MessageParcel& data, MessageParcel& reply);
int HandleGetWindowModStatus(MessageParcel& data, MessageParcel& reply);
int HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply);
};
} // namespace OHOS::Rosen
#endif // OHOS_ROSEN_WINDOW_SCENE_SESSION_MANAGER_STUB_H

View File

@ -8228,13 +8228,13 @@ WMError SceneSessionManager::GetCallingWindowRect(int32_t persistentId, Rect& re
return WMError::WM_OK;
}
WMError SceneSessionManager::GetWindowModStatus(WindowModeType &windowMod)
WMError SceneSessionManager::GetWindowModeType(WindowModeType& windowModeType)
{
if (!SessionPermission::IsSACalling()) {
WLOGFE("GetWindowModStatus permission denied!");
WLOGFE("GetWindowModeType permission denied!");
return WMError::WM_ERROR_INVALID_PERMISSION;
}
windowMod = GetWindowModType();
windowModeType = GetWindowModType();
return WMError::WM_OK;
}

View File

@ -199,9 +199,9 @@ WSError SceneSessionManagerLite::UpdateWindowMode(int32_t persistentId, int32_t
return SceneSessionManager::GetInstance().UpdateWindowMode(persistentId, windowMode);
}
WMError SceneSessionManagerLite::GetWindowModStatus(WindowModeType &windowMod)
WMError SceneSessionManagerLite::GetWindowModeType(WindowModeType& windowModeType)
{
return SceneSessionManager::GetInstance().GetWindowModStatus(windowMod);
return SceneSessionManager::GetInstance().GetWindowModeType(windowModeType);
}
WMError SceneSessionManagerLite::GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo)

View File

@ -769,7 +769,7 @@ WMError SceneSessionManagerLiteProxy::GetVisibilityWindowInfo(std::vector<sptr<W
return static_cast<WMError>(reply.ReadInt32());
}
WMError SceneSessionManagerLiteProxy::GetWindowModStatus(WindowModeType &windowMod)
WMError SceneSessionManagerLiteProxy::GetWindowModeType(WindowModeType& windowModeType)
{
WLOGFI("get Window mod status proxy");
MessageParcel data;
@ -781,12 +781,12 @@ WMError SceneSessionManagerLiteProxy::GetWindowModStatus(WindowModeType &windowM
MessageParcel reply;
MessageOption option;
if (Remote()->SendRequest(static_cast<uint32_t>(
SceneSessionManagerLiteMessage::TRANS_ID_GET_WINDOW_MOD_TYPE), data, reply, option) != ERR_NONE) {
SceneSessionManagerLiteMessage::TRANS_ID_GET_WINDOW_MODE_TYPE), data, reply, option) != ERR_NONE) {
WLOGFE("SendRequest failed");
return WMError::WM_ERROR_IPC_FAILED;
}
windowMod = static_cast<WindowModeType>(reply.ReadUint32());
windowModeType = static_cast<WindowModeType>(reply.ReadUint32());
return static_cast<WMError>(reply.ReadInt32());
}

View File

@ -83,8 +83,8 @@ const std::map<uint32_t, SceneSessionManagerLiteStubFunc> SceneSessionManagerLit
&SceneSessionManagerLiteStub::HandleCheckWindowId),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerLiteMessage::TRANS_ID_GET_VISIBILITY_WINDOW_INFO_ID),
&SceneSessionManagerLiteStub::HandleGetVisibilityWindowInfo),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerLiteMessage::TRANS_ID_GET_WINDOW_MOD_TYPE),
&SceneSessionManagerLiteStub::HandleGetWindowModStatus),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerLiteMessage::TRANS_ID_GET_WINDOW_MODE_TYPE),
&SceneSessionManagerLiteStub::HandleGetWindowModeType),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerLiteMessage::TRANS_ID_GET_TOPN_MAIN_WINDOW_INFO),
&SceneSessionManagerLiteStub::HandleGetMainWinodowInfo),
};
@ -415,12 +415,12 @@ int SceneSessionManagerLiteStub::HandleGetVisibilityWindowInfo(MessageParcel& da
return ERR_NONE;
}
int SceneSessionManagerLiteStub::HandleGetWindowModStatus(MessageParcel &data, MessageParcel &reply)
int SceneSessionManagerLiteStub::HandleGetWindowModeType(MessageParcel& data, MessageParcel& reply)
{
WindowModeType windowMod = Rosen::WindowModeType::WINDOW_MODE_OTHER;
WMError errCode = GetWindowModStatus(windowMod);
WLOGFI("run HandleGetWindowModStatus, windowMod:%{public}d!", static_cast<int32_t>(windowMod));
if (!reply.WriteUint32(static_cast<int32_t>(windowMod))) {
WindowModeType windowModeType = Rosen::WindowModeType::WINDOW_MODE_OTHER;
WMError errCode = GetWindowModeType(windowModeType);
WLOGFI("run HandleGetWindowModeType, windowModeType:%{public}d!", static_cast<int32_t>(windowModeType));
if (!reply.WriteUint32(static_cast<int32_t>(windowModeType))) {
WLOGE("Failed to WriteBool");
return ERR_INVALID_DATA;
}

View File

@ -1698,20 +1698,20 @@ WMError SceneSessionManagerProxy::GetCallingWindowRect(int32_t persistentId, Rec
return ret;
}
WMError SceneSessionManagerProxy::GetWindowModStatus(WindowModeType &windowMod)
WMError SceneSessionManagerProxy::GetWindowModeType(WindowModeType& windowModeType)
{
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) {
WLOGFE("GetWindowModStatus Write interfaceToken failed");
WLOGFE("GetWindowModeType Write interfaceToken failed");
return WMError::WM_ERROR_IPC_FAILED;
}
if (Remote()->SendRequest(static_cast<uint32_t>(
SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MOD_TYPE), data, reply, option) != ERR_NONE) {
SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MODE_TYPE), data, reply, option) != ERR_NONE) {
return WMError::WM_ERROR_IPC_FAILED;
}
windowMod = static_cast<WindowModeType>(reply.ReadUint32());
windowModeType = static_cast<WindowModeType>(reply.ReadUint32());
return static_cast<WMError>(reply.ReadInt32());
}
} // namespace OHOS::Rosen

View File

@ -149,8 +149,8 @@ const std::map<uint32_t, SceneSessionManagerStubFunc> SceneSessionManagerStub::s
&SceneSessionManagerStub::HandleGetCallingWindowWindowStatus),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_RECT),
&SceneSessionManagerStub::HandleGetCallingWindowRect),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MOD_TYPE),
&SceneSessionManagerStub::HandleGetWindowModStatus),
std::make_pair(static_cast<uint32_t>(SceneSessionManagerMessage::TRANS_ID_GET_WINDOW_MODE_TYPE),
&SceneSessionManagerStub::HandleGetWindowModeType),
};
int SceneSessionManagerStub::OnRemoteRequest(uint32_t code,
@ -933,12 +933,12 @@ int SceneSessionManagerStub::HandleGetCallingWindowRect(MessageParcel&data, Mess
return ERR_NONE;
}
int SceneSessionManagerStub::HandleGetWindowModStatus(MessageParcel &data, MessageParcel &reply)
int SceneSessionManagerStub::HandleGetWindowModeType(MessageParcel &data, MessageParcel &reply)
{
WindowModeType windowMod = Rosen::WindowModeType::WINDOW_MODE_OTHER;
WMError errCode = GetWindowModStatus(windowMod);
WLOGFI("run HandleGetWindowModStatus, windowMod:%{public}d!", static_cast<int32_t>(windowMod));
if (!reply.WriteUint32(static_cast<int32_t>(windowMod))) {
WindowModeType windowModeType = Rosen::WindowModeType::WINDOW_MODE_OTHER;
WMError errCode = GetWindowModeType(windowModeType);
WLOGFI("run HandleGetWindowModeType, windowModeType:%{public}d!", static_cast<int32_t>(windowModeType));
if (!reply.WriteUint32(static_cast<int32_t>(windowModeType))) {
WLOGE("Failed to WriteBool");
return ERR_INVALID_DATA;
}

View File

@ -124,7 +124,7 @@ public:
virtual WMError GetHostWindowRect(int32_t hostWindowId, Rect& rect);
virtual WMError GetCallingWindowWindowStatus(int32_t persistentId, WindowStatus& windowStatus);
virtual WMError GetCallingWindowRect(int32_t persistentId, Rect& rect);
virtual WMError GetWindowModStatus(WindowModeType &windowMod);
virtual WMError GetWindowModeType(WindowModeType& windowModeType);
private:
static inline SingletonDelegator<WindowAdapter> delegator;

View File

@ -42,7 +42,7 @@ public:
virtual WMError CheckWindowId(int32_t windowId, int32_t &pid);
virtual WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos);
virtual void ClearWindowAdapter();
virtual WMError GetWindowModStatus(WindowModeType &windowMod);
virtual WMError GetWindowModeType(WindowModeType& windowModeType);
virtual WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo);
private:

View File

@ -648,11 +648,11 @@ WMError WindowAdapter::GetCallingWindowRect(int32_t persistentId, Rect& rect)
return static_cast<WMError>(windowManagerServiceProxy_->GetCallingWindowRect(persistentId, rect));
}
WMError WindowAdapter::GetWindowModStatus(WindowModeType &windowMod)
WMError WindowAdapter::GetWindowModeType(WindowModeType& windowModeType)
{
INIT_PROXY_CHECK_RETURN(WMError::WM_ERROR_SAMGR);
WLOGFD("get window mod status");
return windowManagerServiceProxy_->GetWindowModStatus(windowMod);
return windowManagerServiceProxy_->GetWindowModeType(windowModeType);
}
} // namespace Rosen
} // namespace OHOS

View File

@ -135,11 +135,11 @@ void WindowAdapterLite::GetFocusWindowInfo(FocusChangeInfo& focusInfo)
return windowManagerServiceProxy_->GetFocusWindowInfo(focusInfo);
}
WMError WindowAdapterLite::GetWindowModStatus(WindowModeType &windowMod)
WMError WindowAdapterLite::GetWindowModeType(WindowModeType& windowModeType)
{
INIT_PROXY_CHECK_RETURN(WMError::WM_ERROR_SAMGR);
WLOGFD("get window mod status");
return windowManagerServiceProxy_->GetWindowModStatus(windowMod);
return windowManagerServiceProxy_->GetWindowModeType(windowModeType);
}
WMError WindowAdapterLite::GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo)

View File

@ -51,7 +51,6 @@ public:
WindowType windowType, DisplayId displayId);
void NotifyFocused(const sptr<FocusChangeInfo>& focusChangeInfo);
void NotifyWindowModeChange(WindowModeType type);
void NotifyWindowBackHomeStatus(bool isBackHome);
void NotifyUnfocused(const sptr<FocusChangeInfo>& focusChangeInfo);
void NotifySystemBarChanged(DisplayId displayId, const SystemBarRegionTints& tints);
void NotifyAccessibilityWindowInfo(const std::vector<sptr<AccessibilityWindowInfo>>& infos, WindowUpdateType type);
@ -860,9 +859,9 @@ void WindowManager::UpdateWindowModeTypeInfo(WindowModeType type) const
}
WMError WindowManager::GetWindowModStatus(WindowModeType &windowMod) const
WMError WindowManager::GetWindowModeType(WindowModeType& windowModeType) const
{
WMError ret = SingletonContainer::Get<WindowAdapter>().GetWindowModStatus(windowMod);
WMError ret = SingletonContainer::Get<WindowAdapter>().GetWindowModeType(windowModeType);
if (ret != WMError::WM_OK) {
WLOGFE("get window mod status failed");
}

View File

@ -424,9 +424,9 @@ void WindowManagerLite::UpdateWindowModeTypeInfo(WindowModeType type) const
pImpl_->NotifyWindowModeChange(type);
}
WMError WindowManagerLite::GetWindowModStatus(WindowModeType &windowMod) const
WMError WindowManagerLite::GetWindowModeType(WindowModeType& windowModeType) const
{
WMError ret = SingletonContainer::Get<WindowAdapterLite>().GetWindowModStatus(windowMod);
WMError ret = SingletonContainer::Get<WindowAdapterLite>().GetWindowModeType(windowModeType);
if (ret != WMError::WM_OK) {
WLOGFE("get window visibility info failed");
}

View File

@ -891,14 +891,14 @@ HWTEST_F(WindowManagerTest, Test01, Function | SmallTest | Level2)
ASSERT_EQ(WMError::WM_ERROR_INVALID_OPERATION, res4);
}
HWTEST_F(WindowManagerTest, GetWindowModStatus01, Function | SmallTest | Level2)
HWTEST_F(WindowManagerTest, GetWindowModeType01, Function | SmallTest | Level2)
{
std::vector<sptr<AccessibilityWindowInfo>> infos;
infos.clear();
WindowModeType windowMod;
WindowModeType windowModeType;
std::unique_ptr<Mocker> m = std::make_unique<Mocker>();
EXPECT_CALL(m->Mock(), GetWindowModStatus(_)).Times(1).WillOnce(Return(WMError::WM_OK));
ASSERT_EQ(WMError::WM_OK, WindowManager::GetInstance().GetWindowModStatus(windowMod));
EXPECT_CALL(m->Mock(), GetWindowModeType(_)).Times(1).WillOnce(Return(WMError::WM_OK));
ASSERT_EQ(WMError::WM_OK, WindowManager::GetInstance().GetWindowModeType(windowModeType));
}
}
} // namespace Rosen

View File

@ -87,7 +87,7 @@ public:
WMError SetAspectRatio(uint32_t windowId, float ratio);
void FlushWindowInfo(uint32_t windowId);
void SetDragFrameGravity(int32_t dragGravity);
WMError GetWindowModStatus(WindowModeType &windowMod) const;
WMError GetWindowModeType(WindowModeType& windowModeType) const;
private:
uint32_t GenWindowId();

View File

@ -214,7 +214,7 @@ public:
{
return WMError::WM_OK;
}
virtual WMError GetWindowModStatus(WindowModeType &windowMod)
virtual WMError GetWindowModeType(WindowModeType& windowModeType)
{
return WMError::WM_OK;
};

View File

@ -40,7 +40,7 @@ public:
virtual WMError GetVisibilityWindowInfo(std::vector<sptr<WindowVisibilityInfo>>& infos) { return WMError::WM_OK; };
virtual void GetFocusWindowInfo(FocusChangeInfo& focusInfo) = 0;
virtual WMError CheckWindowId(int32_t windowId, int32_t &pid) = 0;
virtual WMError GetWindowModStatus(WindowModeType &windowMod) { return WMError::WM_OK; };
virtual WMError GetWindowModeType(WindowModeType& windowModeType) { return WMError::WM_OK; }
virtual WMError GetMainWindowInfos(int32_t topNum, std::vector<MainWindowInfo>& topNInfo) = 0;
};
}