!10221 窗口管理 编码规范问题整改

Merge pull request !10221 from LiangXinghui/local1
This commit is contained in:
openharmony_ci 2024-10-26 11:56:52 +00:00 committed by Gitee
commit 0452b24213
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 42 additions and 10 deletions

View File

@ -525,8 +525,14 @@ int SceneSessionManagerLiteStub::HandleCheckWindowId(MessageParcel& data, Messag
int SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(MessageParcel& data, MessageParcel& reply)
{
auto type = static_cast<WindowManagerAgentType>(data.ReadUint32());
WLOGFI("run HandleRegisterWindowManagerAgent!, type=%{public}u", static_cast<uint32_t>(type));
uint32_t typeId = 0;
if (!data.ReadUint32(typeId) ||
typeId < static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS) ||
typeId >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
return ERR_INVALID_DATA;
}
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(typeId);
WLOGFI("run HandleRegisterWindowManagerAgent!, type=%{public}u", typeId);
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
sptr<IWindowManagerAgent> windowManagerAgentProxy =
iface_cast<IWindowManagerAgent>(windowManagerAgentObject);
@ -537,8 +543,14 @@ int SceneSessionManagerLiteStub::HandleRegisterWindowManagerAgent(MessageParcel&
int SceneSessionManagerLiteStub::HandleUnregisterWindowManagerAgent(MessageParcel& data, MessageParcel& reply)
{
auto type = static_cast<WindowManagerAgentType>(data.ReadUint32());
WLOGFI("run HandleUnregisterWindowManagerAgent!, type=%{public}u", static_cast<uint32_t>(type));
uint32_t typeId = 0;
if (!data.ReadUint32(typeId) ||
typeId < static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS) ||
typeId >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
return ERR_INVALID_DATA;
}
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(typeId);
WLOGFI("run HandleUnregisterWindowManagerAgent!, type=%{public}u", typeId);
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
sptr<IWindowManagerAgent> windowManagerAgentProxy =
iface_cast<IWindowManagerAgent>(windowManagerAgentObject);

View File

@ -361,8 +361,14 @@ int SceneSessionManagerStub::HandleRequestFocusStatus(MessageParcel& data, Messa
int SceneSessionManagerStub::HandleRegisterWindowManagerAgent(MessageParcel& data, MessageParcel& reply)
{
auto type = static_cast<WindowManagerAgentType>(data.ReadUint32());
WLOGFI("run HandleRegisterWindowManagerAgent!, type=%{public}u", static_cast<uint32_t>(type));
uint32_t typeId = 0;
if (!data.ReadUint32(typeId) ||
typeId < static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS) ||
typeId >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
return ERR_INVALID_DATA;
}
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(typeId);
WLOGFI("run HandleRegisterWindowManagerAgent!, type=%{public}u", typeId);
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
sptr<IWindowManagerAgent> windowManagerAgentProxy =
iface_cast<IWindowManagerAgent>(windowManagerAgentObject);
@ -373,8 +379,14 @@ int SceneSessionManagerStub::HandleRegisterWindowManagerAgent(MessageParcel& dat
int SceneSessionManagerStub::HandleUnregisterWindowManagerAgent(MessageParcel& data, MessageParcel& reply)
{
auto type = static_cast<WindowManagerAgentType>(data.ReadUint32());
WLOGFI("run HandleUnregisterWindowManagerAgent!, type=%{public}u", static_cast<uint32_t>(type));
uint32_t typeId = 0;
if (!data.ReadUint32(typeId) ||
typeId < static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_FOCUS) ||
typeId >= static_cast<uint32_t>(WindowManagerAgentType::WINDOW_MANAGER_AGENT_TYPE_END)) {
return ERR_INVALID_DATA;
}
WindowManagerAgentType type = static_cast<WindowManagerAgentType>(typeId);
WLOGFI("run HandleUnregisterWindowManagerAgent!, type=%{public}u", typeId);
sptr<IRemoteObject> windowManagerAgentObject = data.ReadRemoteObject();
sptr<IWindowManagerAgent> windowManagerAgentProxy =
iface_cast<IWindowManagerAgent>(windowManagerAgentObject);
@ -787,7 +799,11 @@ int SceneSessionManagerStub::HandleGetUIContentRemoteObj(MessageParcel& data, Me
int SceneSessionManagerStub::HandleBindDialogTarget(MessageParcel& data, MessageParcel& reply)
{
WLOGFI("run HandleBindDialogTarget!");
uint64_t persistentId = data.ReadUint64();
uint64_t persistentId = 0;
if (!data.ReadUint64(persistentId)) {
TLOGE(WmsLogTag::WMS_LIFE, "Read persistentId failed");
return ERR_TRANSACTION_FAILED;
}
sptr<IRemoteObject> remoteObject = data.ReadRemoteObject();
WSError ret = BindDialogSessionTarget(persistentId, remoteObject);
reply.WriteUint32(static_cast<uint32_t>(ret));

View File

@ -369,7 +369,11 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel& data, M
break;
}
case WindowManagerMessage::TRANS_ID_BIND_DIALOG_TARGET: {
uint32_t windowId = data.ReadUint32();
uint32_t windowId = 0;
if (!data.ReadUint32(windowId)) {
TLOGE(WmsLogTag::DEFAULT, "Failed to readInt32 windowId");
return ERR_INVALID_DATA;
}
sptr<IRemoteObject> targetToken = data.ReadRemoteObject();
if (targetToken == nullptr) {
TLOGE(WmsLogTag::WMS_DIALOG, "Read targetToken object failed!");