!44094 支持startAbility启动时定制启动页

Merge pull request !44094 from zzhcharmer/devUI
This commit is contained in:
openharmony_ci 2024-09-27 05:23:05 +00:00 committed by Gitee
commit 7e63c465c8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 26 additions and 2 deletions

View File

@ -17,8 +17,7 @@ import(
if (is_ohos_standard_system) {
config("window_scene_config") {
visibility = [ ":*" ]
defines = []
defines = [ "SUPPORT_GRAPHICS" ]
cflags = []
if (ace_engine_feature_asbng_path_enable) {
defines += [ "ATOMIC_SERVICE_ATTRIBUTION_ENABLE" ]

View File

@ -16,6 +16,7 @@
#include "core/components_ng/pattern/window_scene/scene/window_pattern.h"
#include "session_manager/include/scene_session_manager.h"
#include "start_window_option.h"
#include "ui/rs_surface_node.h"
#include "adapter/ohos/entrance/mmi_event_convertor.h"
@ -375,6 +376,22 @@ void WindowPattern::CreateASStartingWindow()
}
#endif
void WindowPattern::UpdateStartingWindowProperty(const Rosen::SessionInfo& sessionInfo,
Color &color, ImageSourceInfo &sourceInfo)
{
if (sessionInfo.startWindowOption == nullptr && !sessionInfo.startWindowOption->hasStartWindow) {
return;
}
TAG_LOGI(AceLogTag::ACE_WINDOW_SCENE, "Get starting window info from session info");
if (!sessionInfo.startWindowOption->startWindowBackgroundColor.empty()) {
Color::ParseColorString(sessionInfo.startWindowOption->startWindowBackgroundColor, color);
}
if (sessionInfo.startWindowOption->startWindowIcon != nullptr) {
auto pixelMap = PixelMap::CreatePixelMap(&(sessionInfo.startWindowOption->startWindowIcon));
sourceInfo = ImageSourceInfo(pixelMap);
}
}
void WindowPattern::CreateStartingWindow()
{
const auto& sessionInfo = session_->GetSessionInfo();
@ -400,6 +417,12 @@ void WindowPattern::CreateStartingWindow()
startingWindow_->GetRenderContext()->UpdateBackgroundColor(Color(backgroundColor));
imageLayoutProperty->UpdateImageSourceInfo(
ImageSourceInfo(startupPagePath, sessionInfo.bundleName_, sessionInfo.moduleName_));
auto sourceInfo = ImageSourceInfo(startupPagePath, sessionInfo.bundleName_, sessionInfo.moduleName_);
auto color = Color(backgroundColor);
UpdateStartingWindowProperty(sessionInfo, color, sourceInfo);
imageLayoutProperty->UpdateImageSourceInfo(sourceInfo);
startingWindow_->GetRenderContext()->UpdateBackgroundColor(color);
imageLayoutProperty->UpdateImageFit(ImageFit::NONE);
startingWindow_->MarkModifyDone();
}

View File

@ -106,6 +106,8 @@ private:
void FilterInvalidPointerItem(const std::shared_ptr<MMI::PointerEvent>& pointerEvent);
void UpdateSnapshotWindowProperty();
bool IsSnapshotSizeChanged();
void UpdateStartingWindowProperty(const Rosen::SessionInfo& sessionInfo,
Color &color, ImageSourceInfo &sourceInfo);
std::shared_ptr<Rosen::ILifecycleListener> lifecycleListener_;
RefPtr<TouchEventImpl> touchEvent_;