windowscene前后台切换增加入参

Signed-off-by: chenqinxin <chenqinxin1@huawei.com>
Change-Id: If2ac37772fd8a826072159d813538ef1db456afc
This commit is contained in:
chenqinxin
2022-02-08 10:27:14 +08:00
parent fb77af58c2
commit b4afec80f7
4 changed files with 32 additions and 7 deletions
+1 -1
View File
@@ -68,8 +68,8 @@ DisplayState DisplayPowerController::GetDisplayState(DisplayId displayId)
void DisplayPowerController::NotifyDisplayEvent(DisplayEvent event)
{
WLOGFI("DisplayEvent:%{public}u", event);
if (event == DisplayEvent::UNLOCK) {
WLOGFI("DisplayEvent UNLOCK");
DisplayManagerService::GetInstance().NotifyDisplayStateChange(DisplayStateChangeType::BEFORE_UNLOCK);
DisplayManagerAgentController::GetInstance().NotifyDisplayPowerEvent(DisplayPowerEvent::DESKTOP_READY,
EventStatus::BEGIN);
+2 -2
View File
@@ -43,8 +43,8 @@ public:
const sptr<Window>& GetMainWindow() const;
WMError GoForeground();
WMError GoBackground() const;
WMError GoForeground(uint32_t reason = 0);
WMError GoBackground(uint32_t reason = 0);
WMError RequestFocus() const;
void UpdateConfiguration(const std::shared_ptr<AppExecFwk::Configuration>& configuration);
+1
View File
@@ -32,6 +32,7 @@ enum class WindowState : uint32_t {
};
enum class WindowStateChangeReason : uint32_t {
NORMAL,
KEYGUARD,
};
}
+28 -4
View File
@@ -83,20 +83,44 @@ const sptr<Window>& WindowScene::GetMainWindow() const
return mainWindow_;
}
WMError WindowScene::GoForeground()
WMError WindowScene::GoForeground(uint32_t reason)
{
WLOGFI("GoForeground reason:%{public}u", reason);
if (mainWindow_ == nullptr) {
return WMError::WM_ERROR_NULLPTR;
}
return mainWindow_->Show();
auto changeReason = static_cast<WindowStateChangeReason>(reason);
switch (changeReason) {
case WindowStateChangeReason::NORMAL: {
return mainWindow_->Show();
}
case WindowStateChangeReason::KEYGUARD: {
return WMError::WM_OK;
}
default: {
return WMError::WM_ERROR_INVALID_PARAM;
}
}
}
WMError WindowScene::GoBackground() const
WMError WindowScene::GoBackground(uint32_t reason)
{
WLOGFI("GoBackground reason:%{public}u", reason);
if (mainWindow_ == nullptr) {
return WMError::WM_ERROR_NULLPTR;
}
return mainWindow_->Hide();
auto changeReason = static_cast<WindowStateChangeReason>(reason);
switch (changeReason) {
case WindowStateChangeReason::NORMAL: {
return mainWindow_->Hide();
}
case WindowStateChangeReason::KEYGUARD: {
return WMError::WM_OK;
}
default: {
return WMError::WM_ERROR_INVALID_PARAM;
}
}
}
WMError WindowScene::SetSystemBarProperty(WindowType type, const SystemBarProperty& property) const