mirror of
https://github.com/openharmony/windowmanager.git
synced 2026-07-23 13:35:31 -04:00
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2021-2022 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef OHOS_ROSEN_SERIALIZE_HELPER
|
||||
#define OHOS_ROSEN_SERIALIZE_HELPER
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
enum PrimitiveType {
|
||||
// commom type
|
||||
PT_Uint32,
|
||||
PT_Float,
|
||||
PT_Bool,
|
||||
PT_String,
|
||||
PT_Rect,
|
||||
// custom type
|
||||
PT_SysBarPropMap,
|
||||
};
|
||||
|
||||
struct MemberVariable {
|
||||
PrimitiveType primitiveType_;
|
||||
size_t offset_;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // OHOS_ROSEN_SERIALIZE_HELPER
|
||||
@@ -25,11 +25,47 @@
|
||||
#include "dm_common.h"
|
||||
#include "wm_common.h"
|
||||
#include "wm_common_inner.h"
|
||||
#include "serialize_helper.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
class WindowProperty : public Parcelable {
|
||||
public:
|
||||
enum WindowPropertyReplicationState : uint64_t {
|
||||
WPRS_WindowName = 1 << 0,
|
||||
WPRS_WindowRect = 1 << 1,
|
||||
WPRS_RequestRect = 1 << 2,
|
||||
WPRS_DecoStatus = 1 << 3,
|
||||
WPRS_Type = 1 << 4,
|
||||
WPRS_Mode = 1 << 5,
|
||||
WPRS_LastMode = 1 << 6,
|
||||
WPRS_Level = 1 << 7,
|
||||
WPRS_Flags = 1 << 8,
|
||||
WPRS_IsFullScreen = 1 << 9,
|
||||
WPRS_Focusable = 1 << 10,
|
||||
WPRS_Touchable = 1 << 11,
|
||||
WPRS_IsPrivacyMode = 1 << 12,
|
||||
WPRS_IsTransparent = 1 << 13,
|
||||
WPRS_Alpha = 1 << 14,
|
||||
WPRS_Brightness = 1 << 15,
|
||||
WPRS_DisplayId = 1 << 16,
|
||||
WPRS_WindowId = 1 << 17,
|
||||
WPRS_ParentId = 1 << 18,
|
||||
WPRS_SysBarPropMap = 1 << 19,
|
||||
WPRS_IsDecorEnable = 1 << 20,
|
||||
WPRS_HitOffset = 1 << 21,
|
||||
WPRS_AnimationFlag = 1 << 22,
|
||||
WPRS_WindowSizeChangeReason = 1 << 23,
|
||||
WPRS_TokenState = 1 << 24,
|
||||
WPRS_CallingWindow = 1 << 25,
|
||||
WPRS_RequestedOrientation = 1 << 26,
|
||||
WPRS_TurnScreenOn = 1 << 27,
|
||||
WPRS_KeepScreenOn = 1 << 28,
|
||||
WPRS_ModeSupportInfo = 1 << 29,
|
||||
WPRS_DragType = 1 << 30,
|
||||
WPRS_OriginRect = static_cast<uint64_t>(1) << 31,
|
||||
WPRS_IsStretchable = static_cast<uint64_t>(1) << 32,
|
||||
};
|
||||
WindowProperty() = default;
|
||||
WindowProperty(const sptr<WindowProperty>& property);
|
||||
~WindowProperty() = default;
|
||||
@@ -108,10 +144,17 @@ public:
|
||||
|
||||
virtual bool Marshalling(Parcel& parcel) const override;
|
||||
static WindowProperty* Unmarshalling(Parcel& parcel);
|
||||
|
||||
bool Write(Parcel& parcel, uint64_t inDirtyState);
|
||||
void Read(Parcel& parcel);
|
||||
private:
|
||||
bool MapMarshalling(Parcel& parcel) const;
|
||||
static void MapUnmarshalling(Parcel& parcel, WindowProperty* property);
|
||||
|
||||
bool WriteMemberVariable(Parcel& parcel, const MemberVariable& mv);
|
||||
void ReadMemberVariable(Parcel& parcel, const MemberVariable& mv);
|
||||
static const std::unordered_map<uint64_t, MemberVariable> dataTypeMap_;
|
||||
|
||||
std::string windowName_;
|
||||
Rect requestRect_ { 0, 0, 0, 0 }; // window rect requested by the client (without decoration size)
|
||||
Rect windowRect_ { 0, 0, 0, 0 }; // actual window rect
|
||||
|
||||
@@ -19,7 +19,44 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Rosen {
|
||||
WindowProperty::WindowProperty(const sptr<WindowProperty>& property)
|
||||
const std::unordered_map<uint64_t, MemberVariable> WindowProperty::dataTypeMap_ = {
|
||||
{WPRS_RequestRect, {PrimitiveType::PT_Rect,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->requestRect_)}},
|
||||
{WPRS_DecoStatus, {PrimitiveType::PT_Bool,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->decoStatus_)}},
|
||||
{WPRS_Mode, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->mode_)}},
|
||||
{WPRS_Flags, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->flags_)}},
|
||||
{WPRS_Focusable, {PrimitiveType::PT_Bool,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->focusable_)}},
|
||||
{WPRS_Touchable, {PrimitiveType::PT_Bool,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->touchable_)}},
|
||||
{WPRS_Brightness, {PrimitiveType::PT_Float,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->brightness_)}},
|
||||
{WPRS_WindowId, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->windowId_)}},
|
||||
{WPRS_SysBarPropMap, {PrimitiveType::PT_SysBarPropMap,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->sysBarPropMap_)}},
|
||||
{WPRS_WindowSizeChangeReason, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->windowSizeChangeReason_)}},
|
||||
{WPRS_CallingWindow, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->callingWindow_)}},
|
||||
{WPRS_RequestedOrientation, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->requestedOrientation_)}},
|
||||
{WPRS_TurnScreenOn, {PrimitiveType::PT_Bool,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->turnScreenOn_)}},
|
||||
{WPRS_KeepScreenOn, {PrimitiveType::PT_Bool,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->keepScreenOn_)}},
|
||||
{WPRS_ModeSupportInfo, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->modeSupportInfo_)}},
|
||||
{WPRS_DragType, {PrimitiveType::PT_Uint32,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->dragType_)}},
|
||||
{WPRS_OriginRect, {PrimitiveType::PT_Rect,
|
||||
(size_t) & (static_cast<WindowProperty*>(nullptr)->originRect_)}},
|
||||
};
|
||||
|
||||
WindowProperty::WindowProperty(const sptr<WindowProperty> &property)
|
||||
{
|
||||
CopyFrom(property);
|
||||
}
|
||||
@@ -467,6 +504,108 @@ WindowProperty* WindowProperty::Unmarshalling(Parcel& parcel)
|
||||
return property;
|
||||
}
|
||||
|
||||
bool WindowProperty::WriteMemberVariable(Parcel& parcel, const MemberVariable& mv)
|
||||
{
|
||||
void* mvData = reinterpret_cast<uint8_t*>(this) + mv.offset_;
|
||||
switch (mv.primitiveType_) {
|
||||
case PrimitiveType::PT_Uint32:
|
||||
if (!parcel.WriteUint32(*reinterpret_cast<uint32_t*>(mvData))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PrimitiveType::PT_Float:
|
||||
if (!parcel.WriteFloat(*reinterpret_cast<float*>(mvData))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PrimitiveType::PT_Bool:
|
||||
if (!parcel.WriteBool(*reinterpret_cast<bool*>(mvData))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PrimitiveType::PT_String:
|
||||
if (!parcel.WriteString(*reinterpret_cast<std::string*>(mvData))) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PrimitiveType::PT_Rect:
|
||||
if (!parcel.WriteInt32(reinterpret_cast<Rect*>(mvData)->posX_) ||
|
||||
!parcel.WriteInt32(reinterpret_cast<Rect*>(mvData)->posY_) ||
|
||||
!parcel.WriteUint32(reinterpret_cast<Rect*>(mvData)->width_) ||
|
||||
!parcel.WriteUint32(reinterpret_cast<Rect*>(mvData)->height_)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case PrimitiveType::PT_SysBarPropMap:
|
||||
if (!MapMarshalling(parcel)) {
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
void WindowProperty::ReadMemberVariable(Parcel& parcel, const MemberVariable& mv)
|
||||
{
|
||||
void* mvData = reinterpret_cast<uint8_t*>(this) + mv.offset_;
|
||||
switch (mv.primitiveType_) {
|
||||
case PrimitiveType::PT_Uint32:
|
||||
*reinterpret_cast<uint32_t*>(mvData) = parcel.ReadUint32();
|
||||
break;
|
||||
case PrimitiveType::PT_Float:
|
||||
*reinterpret_cast<float*>(mvData) = parcel.ReadFloat();
|
||||
break;
|
||||
case PrimitiveType::PT_Bool:
|
||||
*reinterpret_cast<bool*>(mvData) = parcel.ReadBool();
|
||||
break;
|
||||
case PrimitiveType::PT_String:
|
||||
*reinterpret_cast<std::string*>(mvData) = parcel.ReadString();
|
||||
break;
|
||||
case PrimitiveType::PT_Rect:
|
||||
*reinterpret_cast<Rect*>(mvData) = {
|
||||
parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadUint32(), parcel.ReadUint32() };
|
||||
break;
|
||||
case PrimitiveType::PT_SysBarPropMap:
|
||||
MapUnmarshalling(parcel, this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool WindowProperty::Write(Parcel& parcel, uint64_t inDirtyState)
|
||||
{
|
||||
uint64_t dirtyState = inDirtyState;
|
||||
uint64_t replicationState;
|
||||
if (!parcel.WriteUint64(inDirtyState)) {
|
||||
return false;
|
||||
}
|
||||
while (dirtyState) {
|
||||
replicationState = dirtyState & (~dirtyState + 1);
|
||||
if (dataTypeMap_.count(replicationState)) {
|
||||
if (!WriteMemberVariable(parcel, dataTypeMap_.at(replicationState))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
dirtyState -= replicationState;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void WindowProperty::Read(Parcel& parcel)
|
||||
{
|
||||
uint64_t dirtyState = parcel.ReadUint64();
|
||||
uint64_t replicationState;
|
||||
while (dirtyState) {
|
||||
replicationState = dirtyState & (~dirtyState + 1);
|
||||
if (dataTypeMap_.count(replicationState)) {
|
||||
ReadMemberVariable(parcel, dataTypeMap_.at(replicationState));
|
||||
}
|
||||
dirtyState -= replicationState;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowProperty::CopyFrom(const sptr<WindowProperty>& property)
|
||||
{
|
||||
windowName_ = property->windowName_;
|
||||
|
||||
@@ -51,7 +51,8 @@ public:
|
||||
virtual WMError ToggleShownStateForAllAppWindows();
|
||||
virtual WMError MaxmizeWindow(uint32_t windowId);
|
||||
virtual WMError SetWindowLayoutMode(WindowLayoutMode mode);
|
||||
virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action);
|
||||
virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState);
|
||||
virtual WMError GetSystemConfig(SystemConfig& systemConfig);
|
||||
virtual WMError GetModeChangeHotZones(DisplayId displayId, ModeChangeHotZones& hotZones);
|
||||
|
||||
|
||||
@@ -245,10 +245,11 @@ WMError WindowAdapter::SetWindowLayoutMode(WindowLayoutMode mode)
|
||||
return windowManagerServiceProxy_->SetWindowLayoutMode(mode);
|
||||
}
|
||||
|
||||
WMError WindowAdapter::UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action)
|
||||
WMError WindowAdapter::UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState)
|
||||
{
|
||||
INIT_PROXY_CHECK_RETURN(WMError::WM_ERROR_SAMGR);
|
||||
return windowManagerServiceProxy_->UpdateProperty(windowProperty, action);
|
||||
return windowManagerServiceProxy_->UpdateProperty(windowProperty, action, dirtyState);
|
||||
}
|
||||
|
||||
WMError WindowAdapter::NotifyWindowTransition(sptr<WindowTransitionInfo> from, sptr<WindowTransitionInfo> to)
|
||||
|
||||
+45
-1
@@ -619,7 +619,51 @@ void WindowImpl::MapFloatingWindowToAppIfNeeded()
|
||||
|
||||
WMError WindowImpl::UpdateProperty(PropertyChangeAction action)
|
||||
{
|
||||
return SingletonContainer::Get<WindowAdapter>().UpdateProperty(property_, action);
|
||||
uint64_t dirtyState = 0;
|
||||
dirtyState |= WindowProperty::WPRS_WindowId;
|
||||
switch (action) {
|
||||
case PropertyChangeAction::ACTION_UPDATE_RECT:
|
||||
dirtyState |= WindowProperty::WPRS_DecoStatus | WindowProperty::WPRS_DragType |
|
||||
WindowProperty::WPRS_OriginRect | WindowProperty::WPRS_RequestRect |
|
||||
WindowProperty::WPRS_WindowSizeChangeReason;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_MODE:
|
||||
dirtyState |= WindowProperty::WPRS_Mode;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_FLAGS:
|
||||
dirtyState |= WindowProperty::WPRS_Flags;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_OTHER_PROPS:
|
||||
dirtyState |= WindowProperty::WPRS_SysBarPropMap;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_FOCUSABLE:
|
||||
dirtyState |= WindowProperty::WPRS_Focusable;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_TOUCHABLE:
|
||||
dirtyState |= WindowProperty::WPRS_Touchable;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_CALLING_WINDOW:
|
||||
dirtyState |= WindowProperty::WPRS_CallingWindow;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_ORIENTATION:
|
||||
dirtyState |= WindowProperty::WPRS_RequestedOrientation;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_TURN_SCREEN_ON:
|
||||
dirtyState |= WindowProperty::WPRS_TurnScreenOn;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_KEEP_SCREEN_ON:
|
||||
dirtyState |= WindowProperty::WPRS_KeepScreenOn;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_SET_BRIGHTNESS:
|
||||
dirtyState |= WindowProperty::WPRS_Brightness;
|
||||
break;
|
||||
case PropertyChangeAction::ACTION_UPDATE_MODE_SUPPORT_INFO:
|
||||
dirtyState |= WindowProperty::WPRS_ModeSupportInfo;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return SingletonContainer::Get<WindowAdapter>().UpdateProperty(property_, action, dirtyState);
|
||||
}
|
||||
|
||||
WMError WindowImpl::Create(const std::string& parentName, const std::shared_ptr<AbilityRuntime::Context>& context)
|
||||
|
||||
@@ -31,7 +31,8 @@ public:
|
||||
MOCK_METHOD1(DestroyWindow, WMError(uint32_t windowId));
|
||||
MOCK_METHOD2(SetWindowBackgroundBlur, WMError(uint32_t windowId, WindowBlurLevel level));
|
||||
MOCK_METHOD2(SetAlpha, WMError(uint32_t windowId, float alpha));
|
||||
MOCK_METHOD2(UpdateProperty, WMError(sptr<WindowProperty>& windowProperty, PropertyChangeAction action));
|
||||
MOCK_METHOD3(UpdateProperty, WMError(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState));
|
||||
MOCK_METHOD1(MaxmizeWindow, WMError(uint32_t windowId));
|
||||
};
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ HWTEST_F(WindowImplTest, SetSystemBarProperty02, Function | SmallTest | Level3)
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(1).WillOnce(Return(WMError::WM_ERROR_SAMGR));
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(1).WillOnce(Return(WMError::WM_ERROR_SAMGR));
|
||||
WindowType type = WindowType::WINDOW_TYPE_STATUS_BAR;
|
||||
const SystemBarProperty SYS_BAR_PROP(false, 0xE5222222, 0xE5333333);
|
||||
ASSERT_EQ(WMError::WM_ERROR_SAMGR, window->SetSystemBarProperty(type, SYS_BAR_PROP));
|
||||
@@ -590,7 +590,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType01, Function | SmallTest | Le
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
WindowType type = WindowType::WINDOW_TYPE_STATUS_BAR;
|
||||
const SystemBarProperty SYS_BAR_PROP(false, 0xE5222222, 0xE5333344);
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetSystemBarProperty(type, SYS_BAR_PROP));
|
||||
@@ -617,7 +617,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType02, Function | SmallTest | Le
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
const SystemBarProperty SYS_BAR_PROP(false, 0xE5222222, 0xE5333333);
|
||||
const SystemBarProperty DEFAULT_PROP;
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, SYS_BAR_PROP));
|
||||
@@ -644,7 +644,7 @@ HWTEST_F(WindowImplTest, GetSystemBarPropertyByType03, Function | SmallTest | Le
|
||||
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
const SystemBarProperty SYS_BAR_PROP(false, 0xE5222222, 0xE5333366);
|
||||
const SystemBarProperty DEFAULT_PROP;
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetSystemBarProperty(WindowType::WINDOW_TYPE_STATUS_BAR, SYS_BAR_PROP));
|
||||
@@ -698,7 +698,7 @@ HWTEST_F(WindowImplTest, Recover01, Function | SmallTest | Level3)
|
||||
window->SetWindowMode(WindowMode::WINDOW_MODE_FULLSCREEN);
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Show();
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
window->Recover();
|
||||
ASSERT_EQ(WindowMode::WINDOW_MODE_FLOATING, window->GetMode());
|
||||
EXPECT_CALL(m->Mock(), RemoveWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
@@ -1042,7 +1042,7 @@ HWTEST_F(WindowImplTest, SetTurnScreenOn02, Function | SmallTest | Level3)
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_FALSE(window->IsTurnScreenOn());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
.WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetTurnScreenOn(true));
|
||||
ASSERT_TRUE(window->IsTurnScreenOn());
|
||||
@@ -1096,7 +1096,7 @@ HWTEST_F(WindowImplTest, SetKeepScreenOn02, Function | SmallTest | Level3)
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_FALSE(window->IsKeepScreenOn());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
.WillOnce(Return(WMError::WM_OK));;
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetKeepScreenOn(true));
|
||||
ASSERT_TRUE(window->IsKeepScreenOn());
|
||||
@@ -1152,7 +1152,7 @@ HWTEST_F(WindowImplTest, SetBrightness02, Function | SmallTest | Level3)
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_EQ(UNDEFINED_BRIGHTNESS, window->GetBrightness());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
.WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetBrightness(MAXIMUM_BRIGHTNESS));
|
||||
ASSERT_EQ(MAXIMUM_BRIGHTNESS, window->GetBrightness());
|
||||
@@ -1234,7 +1234,7 @@ HWTEST_F(WindowImplTest, SetFocusable02, Function | SmallTest | Level3)
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_TRUE(window->GetFocusable());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
.WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetFocusable(false));
|
||||
ASSERT_FALSE(window->GetFocusable());
|
||||
@@ -1290,7 +1290,7 @@ HWTEST_F(WindowImplTest, SetTouchable02, Function | SmallTest | Level3)
|
||||
EXPECT_CALL(m->Mock(), AddWindow(_)).Times(1).WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->Show());
|
||||
ASSERT_TRUE(window->GetTouchable());
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
EXPECT_CALL(m->Mock(), UpdateProperty(_, _, _)).Times(2).WillOnce(Return(WMError::WM_OK))
|
||||
.WillOnce(Return(WMError::WM_OK));
|
||||
ASSERT_EQ(WMError::WM_OK, window->SetTouchable(false));
|
||||
ASSERT_FALSE(window->GetTouchable());
|
||||
|
||||
@@ -82,7 +82,8 @@ public:
|
||||
WMError ToggleShownStateForAllAppWindows() override;
|
||||
WMError MaxmizeWindow(uint32_t windowId) override;
|
||||
WMError SetWindowLayoutMode(WindowLayoutMode mode) override;
|
||||
WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action) override;
|
||||
WMError UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState) override;
|
||||
WMError GetAccessibilityWindowInfo(sptr<AccessibilityWindowInfo>& windowInfo) override;
|
||||
WMError HandleAddWindow(sptr<WindowProperty>& property);
|
||||
|
||||
|
||||
@@ -78,7 +78,8 @@ public:
|
||||
virtual WMError ToggleShownStateForAllAppWindows() = 0;
|
||||
virtual WMError MaxmizeWindow(uint32_t windowId) = 0;
|
||||
virtual WMError SetWindowLayoutMode(WindowLayoutMode mode) = 0;
|
||||
virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action) = 0;
|
||||
virtual WMError UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState = 0) = 0;
|
||||
virtual void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent) = 0;
|
||||
virtual void UnregisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
|
||||
@@ -45,7 +45,8 @@ public:
|
||||
WMError ToggleShownStateForAllAppWindows() override;
|
||||
WMError MaxmizeWindow(uint32_t windowId) override;
|
||||
WMError SetWindowLayoutMode(WindowLayoutMode mode) override;
|
||||
WMError UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action) override;
|
||||
WMError UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState) override;
|
||||
|
||||
void RegisterWindowManagerAgent(WindowManagerAgentType type,
|
||||
const sptr<IWindowManagerAgent>& windowManagerAgent) override;
|
||||
|
||||
@@ -544,7 +544,8 @@ WMError WindowManagerService::SetWindowLayoutMode(WindowLayoutMode mode)
|
||||
}).get();
|
||||
}
|
||||
|
||||
WMError WindowManagerService::UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action)
|
||||
WMError WindowManagerService::UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState)
|
||||
{
|
||||
if (windowProperty == nullptr) {
|
||||
WLOGFE("property is invalid");
|
||||
|
||||
@@ -476,7 +476,8 @@ WMError WindowManagerProxy::SetWindowLayoutMode(WindowLayoutMode mode)
|
||||
return static_cast<WMError>(ret);
|
||||
}
|
||||
|
||||
WMError WindowManagerProxy::UpdateProperty(sptr<WindowProperty>& windowProperty, PropertyChangeAction action)
|
||||
WMError WindowManagerProxy::UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
PropertyChangeAction action, uint64_t dirtyState)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
@@ -486,7 +487,7 @@ WMError WindowManagerProxy::UpdateProperty(sptr<WindowProperty>& windowProperty,
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
if (!data.WriteParcelable(windowProperty.GetRefPtr())) {
|
||||
if (!windowProperty->Write(data, dirtyState)) {
|
||||
WLOGFE("Write windowProperty failed");
|
||||
return WMError::WM_ERROR_IPC_FAILED;
|
||||
}
|
||||
|
||||
@@ -159,7 +159,8 @@ int32_t WindowManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
|
||||
break;
|
||||
}
|
||||
case WindowManagerMessage::TRANS_ID_UPDATE_PROPERTY: {
|
||||
sptr<WindowProperty> windowProperty = data.ReadStrongParcelable<WindowProperty>();
|
||||
sptr<WindowProperty> windowProperty = new WindowProperty();
|
||||
windowProperty->Read(data);
|
||||
PropertyChangeAction action = static_cast<PropertyChangeAction>(data.ReadUint32());
|
||||
WMError errCode = UpdateProperty(windowProperty, action);
|
||||
reply.WriteInt32(static_cast<int32_t>(errCode));
|
||||
|
||||
Reference in New Issue
Block a user