From aa25a3d8c8ffdf4ddfbd7e88423a86cdc85618bd Mon Sep 17 00:00:00 2001 From: yangfan Date: Wed, 6 Apr 2022 15:11:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0stage=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E4=B8=8BminsdkVersion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangfan Change-Id: Ia5676be807dbad4a9d59de7c8f71cc70f3f20ab8 --- adapter/ohos/entrance/ui_content_impl.cpp | 8 ++++++++ .../frontend_delegate_declarative.cpp | 4 +++- frameworks/bridge/js_frontend/frontend_delegate_impl.cpp | 4 +++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/adapter/ohos/entrance/ui_content_impl.cpp b/adapter/ohos/entrance/ui_content_impl.cpp index b032ac33..a2b16df3 100644 --- a/adapter/ohos/entrance/ui_content_impl.cpp +++ b/adapter/ohos/entrance/ui_content_impl.cpp @@ -475,6 +475,14 @@ void UIContentImpl::CommonInitialize(OHOS::Rosen::Window* window, const std::str Platform::AceContainer::SetView(flutterAceView, density, 0, 0, window_->GetWindowId(), callback); Platform::FlutterAceView::SurfaceChanged(flutterAceView, 0, 0, deviceHeight >= deviceWidth ? 0 : 1); auto nativeEngine = reinterpret_cast(runtime_); + // Set sdk version in module json mode + if (isModelJson) { + auto pipeline = container->GetPipelineContext(); + if (pipeline && appInfo) { + LOGI("SetMinPlatformVersion code is %{public}d", appInfo->minCompatibleVersionCode); + pipeline->SetMinPlatformVersion(appInfo->minCompatibleVersionCode); + } + } if (!storage) { container->SetLocalStorage(nullptr, context->GetBindingObject()->Get()); } else { diff --git a/frameworks/bridge/declarative_frontend/frontend_delegate_declarative.cpp b/frameworks/bridge/declarative_frontend/frontend_delegate_declarative.cpp index 91a7b747..22807c74 100644 --- a/frameworks/bridge/declarative_frontend/frontend_delegate_declarative.cpp +++ b/frameworks/bridge/declarative_frontend/frontend_delegate_declarative.cpp @@ -1306,7 +1306,9 @@ void FrontendDelegateDeclarative::LoadPage( page->FlushCommands(); // just make sure the pipelineContext is created. auto pipeline = delegate->pipelineContextHolder_.Get(); - pipeline->SetMinPlatformVersion(delegate->GetMinPlatformVersion()); + if (delegate->GetMinPlatformVersion() > 0) { + pipeline->SetMinPlatformVersion(delegate->GetMinPlatformVersion()); + } delegate->taskExecutor_->PostTask( [weak, page] { auto delegate = weak.Upgrade(); diff --git a/frameworks/bridge/js_frontend/frontend_delegate_impl.cpp b/frameworks/bridge/js_frontend/frontend_delegate_impl.cpp index 728da49f..abf2f1cd 100644 --- a/frameworks/bridge/js_frontend/frontend_delegate_impl.cpp +++ b/frameworks/bridge/js_frontend/frontend_delegate_impl.cpp @@ -1144,7 +1144,9 @@ void FrontendDelegateImpl::LoadPage(int32_t pageId, const std::string& url, bool LOGE("the pipeline context is nullptr"); return; } - pipelineContext->SetMinPlatformVersion(delegate->GetMinPlatformVersion()); + if (delegate->GetMinPlatformVersion() > 0) { + pipelineContext->SetMinPlatformVersion(delegate->GetMinPlatformVersion()); + } delegate->taskExecutor_->PostTask( [weak, page] { auto delegate = weak.Upgrade();