mirror of
https://gitee.com/openharmony/window_window_manager
synced 2024-11-23 06:50:40 +00:00
startAbility支持supportWindowMode
Signed-off-by: 韦国宁 <weiguoning2@huawei.com>
This commit is contained in:
parent
709dad7016
commit
0c90e9e51c
@ -222,6 +222,12 @@ public:
|
||||
void SetAppInstanceKey(const std::string& appInstanceKey);
|
||||
std::string GetAppInstanceKey() const;
|
||||
|
||||
/**
|
||||
* PC Window
|
||||
*/
|
||||
void SetSupportWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportWindowModes);
|
||||
void GetSupportWindowModes(std::vector<AppExecFwk::SupportWindowMode>& supportWindowModes) const;
|
||||
|
||||
private:
|
||||
bool MarshallingTouchHotAreas(Parcel& parcel) const;
|
||||
static void UnmarshallingTouchHotAreas(Parcel& parcel, WindowSessionProperty* property);
|
||||
@ -372,6 +378,12 @@ private:
|
||||
* Multi Instance
|
||||
*/
|
||||
std::string appInstanceKey_;
|
||||
|
||||
/**
|
||||
* PC Window
|
||||
*/
|
||||
mutable std::mutex supportWindowModesMutex_;
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes_;
|
||||
};
|
||||
|
||||
struct FreeMultiWindowConfig : public Parcelable {
|
||||
|
@ -556,6 +556,18 @@ uint32_t WindowSessionProperty::GetWindowModeSupportType() const
|
||||
return windowModeSupportType_;
|
||||
}
|
||||
|
||||
void WindowSessionProperty::SetSupportWindowModes(const std::vector<AppExecFwk::SupportWindowMode>& supportWindowModes)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(supportWindowModesMutex_);
|
||||
supportWindowModes_ = supportWindowModes;
|
||||
}
|
||||
|
||||
void WindowSessionProperty::GetSupportWindowModes(std::vector<AppExecFwk::SupportWindowMode>& supportWindowModes) const
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(supportWindowModesMutex_);
|
||||
supportWindowModes = supportWindowModes_;
|
||||
}
|
||||
|
||||
void WindowSessionProperty::SetAnimationFlag(uint32_t animationFlag)
|
||||
{
|
||||
animationFlag_ = animationFlag;
|
||||
|
@ -389,7 +389,6 @@ struct SessionInfo {
|
||||
* PC Window
|
||||
*/
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
|
||||
uint32_t windowModeSupportType = 0;
|
||||
};
|
||||
|
||||
enum class SessionFlag : uint32_t {
|
||||
|
@ -3760,9 +3760,10 @@ static SessionInfo MakeSessionInfoDuringPendingActivation(const sptr<AAFwk::Sess
|
||||
info.isFoundationCall_ = isFoundationCall;
|
||||
if (session->IsPcOrPadEnableActivation()) {
|
||||
info.startWindowOption = abilitySessionInfo->startWindowOption;
|
||||
info.supportWindowModes.assign(abilitySessionInfo->supportWindowModes.begin(),
|
||||
abilitySessionInfo->supportWindowModes.end());
|
||||
info.windowModeSupportType = WindowHelper::ConvertSupportModesToSupportType(info.supportWindowModes);
|
||||
if (!abilitySessionInfo->supportWindowModes.size().empty()) {
|
||||
info.supportWindowModes.assign(abilitySessionInfo->supportWindowModes.begin(),
|
||||
abilitySessionInfo->supportWindowModes.end());
|
||||
}
|
||||
}
|
||||
if (info.want != nullptr) {
|
||||
info.windowMode = info.want->GetIntParam(AAFwk::Want::PARAM_RESV_WINDOW_MODE, 0);
|
||||
@ -3777,11 +3778,11 @@ static SessionInfo MakeSessionInfoDuringPendingActivation(const sptr<AAFwk::Sess
|
||||
"appIndex:%{public}d, affinity:%{public}s. callState:%{public}d, want persistentId:%{public}d, "
|
||||
"uiAbilityId:%{public}" PRIu64 ", windowMode:%{public}d, callerId:%{public}d, "
|
||||
"needClearInNotShowRecent:%{public}u, appInstanceKey: %{public}s, isFromIcon:%{public}d, "
|
||||
"supportWindowModes.size:%{public}zu, windowModeSupportType:%{public}u, specifiedId:%{public}d",
|
||||
"supportWindowModes.size:%{public}zu, specifiedId:%{public}d",
|
||||
info.bundleName_.c_str(), info.moduleName_.c_str(), info.abilityName_.c_str(), info.appIndex_,
|
||||
info.sessionAffinity.c_str(), info.callState_, info.persistentId_, info.uiAbilityId_, info.windowMode,
|
||||
info.callerPersistentId_, info.needClearInNotShowRecent_, info.appInstanceKey_.c_str(), info.isFromIcon_,
|
||||
info.supportWindowModes.size(), info.windowModeSupportType, info.specifiedId);
|
||||
info.supportWindowModes.size(), info.specifiedId);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
@ -1088,7 +1088,7 @@ void Session::InitSessionPropertyWhenConnect(const sptr<WindowSessionProperty>&
|
||||
property->SetWindowRect(rect);
|
||||
property->SetPersistentId(GetPersistentId());
|
||||
property->SetFullScreenStart(GetSessionInfo().fullScreenStart_);
|
||||
property->SetWindowModeSupportType(GetSessionInfo().windowModeSupportType);
|
||||
property->SetSupportWindowModes(GetSessionInfo().supportWindowModes);
|
||||
}
|
||||
if (sessionProperty && property) {
|
||||
property->SetRequestedOrientation(sessionProperty->GetRequestedOrientation());
|
||||
|
@ -300,7 +300,16 @@ WSError SessionProxy::Connect(const sptr<ISessionStage>& sessionStage, const spt
|
||||
}
|
||||
property->SetCollaboratorType(reply.ReadInt32());
|
||||
property->SetFullScreenStart(reply.ReadBool());
|
||||
property->SetWindowModeSupportType(reply.ReadUint32());
|
||||
uint32_t size = reply.ReadUint32();
|
||||
if (size > 0 && size <= WINDOW_SUPPORT_MODE_MAX_SIZE) {
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
|
||||
supportWindowModes.reserve(size);
|
||||
for (uint32_t i = 0; i < size; i++) {
|
||||
supportWindowModes.push_back(
|
||||
static_cast<AppExecFwk::SupportWindowMode>(reply.ReadInt32()));
|
||||
}
|
||||
property->SetSupportWindowModes(supportWindowModes);
|
||||
}
|
||||
property->SetCompatibleModeInPc(reply.ReadBool());
|
||||
property->SetCompatibleWindowSizeInPc(reply.ReadInt32(), reply.ReadInt32(),
|
||||
reply.ReadInt32(), reply.ReadInt32());
|
||||
|
@ -381,7 +381,17 @@ int SessionStub::HandleConnect(MessageParcel& data, MessageParcel& reply)
|
||||
reply.WriteUint32(winRect.height_);
|
||||
reply.WriteInt32(property->GetCollaboratorType());
|
||||
reply.WriteBool(property->GetFullScreenStart());
|
||||
reply.WriteUint32(property->GetWindowModeSupportType());
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
|
||||
property->GetSupportWindowModes(supportWindowModes);
|
||||
auto size = supportWindowModes.size();
|
||||
if (size > 0 && size <= WINDOW_SUPPORT_MODE_MAX_SIZE) {
|
||||
reply.WriteUint32(static_cast<uint32_t>(size));
|
||||
for (decltype(size) i = 0; i < size; i++) {
|
||||
reply.WriteInt32(static_cast<int32_t>(supportWindowModes[i]));
|
||||
}
|
||||
} else {
|
||||
reply.WriteUint32(0);
|
||||
}
|
||||
reply.WriteBool(property->GetCompatibleModeInPc());
|
||||
reply.WriteInt32(property->GetCompatibleInPcPortraitWidth());
|
||||
reply.WriteInt32(property->GetCompatibleInPcPortraitHeight());
|
||||
|
@ -873,14 +873,18 @@ void WindowSceneSessionImpl::GetConfigurationFromAbilityInfo()
|
||||
UpdateWindowSizeLimits();
|
||||
UpdateProperty(WSPropertyChangeAction::ACTION_UPDATE_WINDOW_LIMITS);
|
||||
// get support modes configuration
|
||||
uint32_t windowModeSupportType = property_->GetWindowModeSupportType();
|
||||
if (windowModeSupportType == 0) {
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "startAbility support window mode param is 0, get modes from ability info");
|
||||
uint32_t windowModeSupportType = 0;
|
||||
std::vector<AppExecFwk::SupportWindowMode> supportWindowModes;
|
||||
property_->GetSupportWindowModes(supportWindowModes);
|
||||
auto size = supportWindowModes.size();
|
||||
if (size > 0 && size <= WINDOW_SUPPORT_MODE_MAX_SIZE) {
|
||||
windowModeSupportType = WindowHelper::ConvertSupportModesToSupportType(supportWindowModes);
|
||||
} else {
|
||||
windowModeSupportType = WindowHelper::ConvertSupportModesToSupportType(abilityInfo->windowModes);
|
||||
if (windowModeSupportType == 0) {
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "mode config param is 0, all modes is supported");
|
||||
windowModeSupportType = WindowModeSupport::WINDOW_MODE_SUPPORT_ALL;
|
||||
}
|
||||
}
|
||||
if (windowModeSupportType == 0) {
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "mode config param is 0, all modes is supported");
|
||||
windowModeSupportType = WindowModeSupport::WINDOW_MODE_SUPPORT_ALL;
|
||||
}
|
||||
TLOGI(WmsLogTag::WMS_LAYOUT, "winId: %{public}u, windowModeSupportType: %{public}u",
|
||||
GetWindowId(), windowModeSupportType);
|
||||
|
Loading…
Reference in New Issue
Block a user