亮灭屏场景下调用AMS前后台切换接口并传入flag

Signed-off-by: chenqinxin <chenqinxin1@huawei.com>
Change-Id: Id2f483168cbad29581165d17662b4a836f6e06aa
This commit is contained in:
chenqinxin
2022-02-10 11:48:43 +08:00
parent f8d91966b5
commit 9df1dadd3e
6 changed files with 22 additions and 6 deletions
@@ -35,6 +35,7 @@ public:
private:
DisplayState displayState_ { DisplayState::UNKNOWN };
bool isKeyguardDrawn_ { false };
};
}
}
+7 -2
View File
@@ -40,8 +40,10 @@ bool DisplayPowerController::SetDisplayState(DisplayState state)
}
switch (state) {
case DisplayState::ON: {
// TODO: open vsync and SendSystemEvent to keyguard
displayState_ = state;
if (!isKeyguardDrawn_) {
DisplayManagerService::GetInstance().NotifyDisplayStateChange(DisplayStateChangeType::BEFORE_UNLOCK);
}
DisplayManagerAgentController::GetInstance().NotifyDisplayPowerEvent(DisplayPowerEvent::DISPLAY_ON,
EventStatus::BEGIN);
break;
@@ -73,9 +75,12 @@ void DisplayPowerController::NotifyDisplayEvent(DisplayEvent event)
DisplayManagerService::GetInstance().NotifyDisplayStateChange(DisplayStateChangeType::BEFORE_UNLOCK);
DisplayManagerAgentController::GetInstance().NotifyDisplayPowerEvent(DisplayPowerEvent::DESKTOP_READY,
EventStatus::BEGIN);
isKeyguardDrawn_ = false;
return;
}
// TODO: set displayState_ ON when keyguard is drawn
if (event == DisplayEvent::KEYGUARD_DRAWN) {
isKeyguardDrawn_ = true;
}
}
}
}
+10
View File
@@ -991,6 +991,11 @@ void WindowImpl::UpdateWindowState(WindowState state)
if (uiContent_ != nullptr) {
uiContent_->Background();
}
if (abilityContext_ != nullptr) {
WLOGFD("DoAbilityBackground KEYGUARD, id: %{public}d", GetWindowId());
AAFwk::AbilityManagerClient::GetInstance()->DoAbilityBackground(abilityContext_->GetToken(),
static_cast<uint32_t>(WindowStateChangeReason::KEYGUARD));
}
break;
}
case WindowState::STATE_UNFROZEN: {
@@ -998,6 +1003,11 @@ void WindowImpl::UpdateWindowState(WindowState state)
if (uiContent_ != nullptr) {
uiContent_->Foreground();
}
if (abilityContext_ != nullptr) {
WLOGFD("DoAbilityForeground KEYGUARD, id: %{public}d", GetWindowId());
AAFwk::AbilityManagerClient::GetInstance()->DoAbilityForeground(abilityContext_->GetToken(),
static_cast<uint32_t>(WindowStateChangeReason::KEYGUARD));
}
break;
}
default: {
+1 -1
View File
@@ -267,7 +267,7 @@ WMError WindowController::SetAlpha(uint32_t windowId, float alpha)
void WindowController::NotifyDisplayStateChange(DisplayStateChangeType type)
{
WLOGFI("DisplayStateChangeType:%{public}u", type);
WLOGFD("DisplayStateChangeType:%{public}u", type);
WindowState state;
WindowStateChangeReason reason;
switch (type) {
-1
View File
@@ -296,7 +296,6 @@ void WindowManagerService::OnWindowEvent(Event event, uint32_t windowId)
void WindowManagerService::NotifyDisplayStateChange(DisplayStateChangeType type)
{
WLOGFI("NotifyDisplayStateChange");
std::lock_guard<std::recursive_mutex> lock(mutex_);
return windowController_->NotifyDisplayStateChange(type);
}
+3 -2
View File
@@ -739,7 +739,8 @@ void WindowNodeContainer::MinimizeWindowFromAbility(const sptr<WindowNode>& node
WLOGFW("Target abilityToken is nullptr, windowId:%{public}u", node->GetWindowId());
return;
}
AAFwk::AbilityManagerClient::GetInstance()->MinimizeAbility(node->abilityToken_);
AAFwk::AbilityManagerClient::GetInstance()->DoAbilityBackground(node->abilityToken_,
static_cast<uint32_t>(WindowStateChangeReason::NORMAL));
}
WMError WindowNodeContainer::MinimizeAppNodeExceptOptions(const std::vector<uint32_t> &exceptionalIds,
@@ -757,7 +758,7 @@ WMError WindowNodeContainer::MinimizeAppNodeExceptOptions(const std::vector<uint
continue;
}
// minimize window
WLOGFI("Minimize with exceptional options, windowId:%{public}u", appNode->GetWindowId());
WLOGFI("minimize window, windowId:%{public}u", appNode->GetWindowId());
MinimizeWindowFromAbility(appNode);
}
return WMError::WM_OK;