diff --git a/adapter/ohos/entrance/ui_content_impl.cpp b/adapter/ohos/entrance/ui_content_impl.cpp index 1cb7cc11..72bdacf4 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();