Signed-off-by: brorZha <heaoan@h-partners.com>
This commit is contained in:
brorZha
2026-07-08 14:17:44 +08:00
parent dfbcbc4dac
commit ce15bf3bad
5 changed files with 28 additions and 8 deletions
+1
View File
@@ -40,6 +40,7 @@ enum class WindowStateChangeReason : uint32_t {
USER_SWITCH,
ABILITY_CALL,
ABILITY_HOOK,
PC_APP_IN_PAD,
};
enum class WindowUpdateReason : uint32_t {
@@ -1278,7 +1278,8 @@ private:
*/
WMError ShiftAppWindowPointerEventInner(
int32_t sourceWindowId, int32_t targetWindowId, DisplayId targetDisplayId, int32_t fingerId);
WSError StartOrMinimizePcAppInPadUIAbilityBySCB(const sptr<SceneSession>& sceneSession, bool isBackground);
WSError StartOrMinimizePcAppInPadUIAbilityBySCB(const sptr<SceneSession>& sceneSession, bool isBackground,
WindowStateChangeReason reason = WindowStateChangeReason::NORMAL);
/*
* Window Animation
@@ -2803,12 +2803,14 @@ void SceneSessionManager::SchedulePcAppInPadLifecycleByPersistentId(bool isBackg
if (!isPcAppInPad) {
return;
}
StartOrMinimizePcAppInPadUIAbilityBySCB(sceneSession, isBackground);
StartOrMinimizePcAppInPadUIAbilityBySCB(sceneSession, isBackground,
WindowStateChangeReason::PC_APP_IN_PAD);
};
return taskScheduler_->PostAsyncTask(task, __func__);
}
WSError SceneSessionManager::StartOrMinimizePcAppInPadUIAbilityBySCB(const sptr<SceneSession>& sceneSession, bool isBackground)
WSError SceneSessionManager::StartOrMinimizePcAppInPadUIAbilityBySCB(const sptr<SceneSession>& sceneSession, bool isBackground,
WindowStateChangeReason reason)
{
auto sessionState = sceneSession->GetSessionState();
auto isInvalidMainSession = sessionState == SessionState::STATE_DISCONNECT ||
@@ -2837,12 +2839,12 @@ WSError SceneSessionManager::StartOrMinimizePcAppInPadUIAbilityBySCB(const sptr<
}
} else {
TLOGI(WmsLogTag::WMS_LIFE,
"StartPcAppInPadUIAbilityBySCB with persistentId: %{public}d, type: %{public}d, state: %{public}d", persistentId,
sceneSession->GetWindowType(), sceneSession->GetSessionState());
"StartPcAppInPadUIAbilityBySCB with persistentId: %{public}d, type: %{public}d, state: %{public}d,"
"reason:%{public}u", persistentId,sceneSession->GetWindowType(), sceneSession->GetSessionState(), reason);
bool isColdStart = false;
abilitySessionInfo->isNewWant = false;
int32_t errCode = StartUIAbilityBySCBTimeoutCheck(sceneSession,
abilitySessionInfo, static_cast<uint32_t>(WindowStateChangeReason::NORMAL), isColdStart);
abilitySessionInfo, static_cast<uint32_t>(reason), isColdStart);
if (errCode != ERR_OK) {
TLOGE(WmsLogTag::WMS_LIFE, "start failed! errCode: %{public}d", errCode);
RecordLifeCycleExceptionEvent(sceneSession, errCode,
+1
View File
@@ -790,6 +790,7 @@ private:
void NotifyFreeMultiWindowModeResume();
std::string TransferLifeCycleEventToString(LifeCycleEvent type) const;
WindowLifeCycleInfo GetWindowLifecycleInfo() const;
bool isNeedWindowShow(uint32_t reason);
/**
* Window Transition Animation For PC
+17 -2
View File
@@ -2153,14 +2153,29 @@ WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation, bool w
return Show(reason, withAnimation, withFocus, false, requestId, scbRequestId);
}
WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation, bool withFocus, bool waitAttach,
int32_t requestId, int32_t scbRequestId)
WMError WindowSceneSessionImpl::isNeedWindowShow(uint32_t reason)
{
if (reason == static_cast<uint32_t>(WindowStateChangeReason::USER_SWITCH)) {
TLOGI(WmsLogTag::WMS_MULTI_USER, "Switch to current user, NotifyAfterForeground");
NotifyAfterForeground(true, false);
NotifyAfterDidForeground(reason);
RecordWindowLifecycleChange("user switch show");
return true;
}
if (reason == static_cast<uint32_t>(WindowStateChangeReason::PC_APP_IN_PAD)) {
TLOGI(WmsLogTag::WMS_MULTI, "id: %{public}d, PcAppInPad when unlock.", GetPersistentId());
NotifyAfterForeground(true, false);
NotifyAfterDidForeground(reason);
RecordWindowLifecycleChange("PcAppInPad when unlock");
return true;
}
return false;
}
WMError WindowSceneSessionImpl::Show(uint32_t reason, bool withAnimation, bool withFocus, bool waitAttach,
int32_t requestId, int32_t scbRequestId)
{
if (isNeedWindowShow(reason)) {
return WMError::WM_OK;
}
const auto type = GetType();