123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_ADAPTER_OHOS_CPP_ACE_CONTAINER_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_ADAPTER_OHOS_CPP_ACE_CONTAINER_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <cstddef> 2023b3eb3cSopenharmony_ci#include <list> 2123b3eb3cSopenharmony_ci#include <memory> 2223b3eb3cSopenharmony_ci#include <mutex> 2323b3eb3cSopenharmony_ci 2423b3eb3cSopenharmony_ci#include "display_manager.h" 2523b3eb3cSopenharmony_ci#include "dm_common.h" 2623b3eb3cSopenharmony_ci#include "interfaces/inner_api/ace/arkui_rect.h" 2723b3eb3cSopenharmony_ci#include "native_engine/native_reference.h" 2823b3eb3cSopenharmony_ci#include "native_engine/native_value.h" 2923b3eb3cSopenharmony_ci 3023b3eb3cSopenharmony_ci#include "adapter/ohos/entrance/ace_ability.h" 3123b3eb3cSopenharmony_ci#include "adapter/ohos/entrance/platform_event_callback.h" 3223b3eb3cSopenharmony_ci#include "base/memory/ace_type.h" 3323b3eb3cSopenharmony_ci#include "base/resource/asset_manager.h" 3423b3eb3cSopenharmony_ci#include "base/thread/task_executor.h" 3523b3eb3cSopenharmony_ci#include "base/utils/noncopyable.h" 3623b3eb3cSopenharmony_ci#include "base/utils/utils.h" 3723b3eb3cSopenharmony_ci#include "base/view_data/view_data_wrap.h" 3823b3eb3cSopenharmony_ci#include "base/view_data/hint_to_type_wrap.h" 3923b3eb3cSopenharmony_ci#include "core/common/ace_view.h" 4023b3eb3cSopenharmony_ci#include "core/common/container.h" 4123b3eb3cSopenharmony_ci#include "core/common/display_info.h" 4223b3eb3cSopenharmony_ci#include "core/common/font_manager.h" 4323b3eb3cSopenharmony_ci#include "core/common/js_message_dispatcher.h" 4423b3eb3cSopenharmony_ci#include "core/common/render_boundary_manager.h" 4523b3eb3cSopenharmony_ci#include "core/common/resource/resource_configuration.h" 4623b3eb3cSopenharmony_ci#include "core/common/router_recover_record.h" 4723b3eb3cSopenharmony_ci#include "core/components/common/layout/constants.h" 4823b3eb3cSopenharmony_ci#include "core/pipeline/pipeline_context.h" 4923b3eb3cSopenharmony_ci 5023b3eb3cSopenharmony_cinamespace OHOS::Accessibility { 5123b3eb3cSopenharmony_ciclass AccessibilityElementInfo; 5223b3eb3cSopenharmony_ci} 5323b3eb3cSopenharmony_ci 5423b3eb3cSopenharmony_cinamespace OHOS::Ace { 5523b3eb3cSopenharmony_ciclass FontManager; 5623b3eb3cSopenharmony_ci} 5723b3eb3cSopenharmony_ci 5823b3eb3cSopenharmony_cinamespace OHOS::Ace::Platform { 5923b3eb3cSopenharmony_ciusing UIEnvCallback = std::function<void(const OHOS::Ace::RefPtr<OHOS::Ace::PipelineContext>& context)>; 6023b3eb3cSopenharmony_ciusing SharePanelCallback = std::function<void(const std::string& bundleName, const std::string& abilityName)>; 6123b3eb3cSopenharmony_ci 6223b3eb3cSopenharmony_cistruct ParsedConfig { 6323b3eb3cSopenharmony_ci std::string colorMode; 6423b3eb3cSopenharmony_ci std::string deviceAccess; 6523b3eb3cSopenharmony_ci std::string languageTag; 6623b3eb3cSopenharmony_ci std::string direction; 6723b3eb3cSopenharmony_ci std::string densitydpi; 6823b3eb3cSopenharmony_ci std::string themeTag; 6923b3eb3cSopenharmony_ci std::string fontFamily; 7023b3eb3cSopenharmony_ci std::string fontScale; 7123b3eb3cSopenharmony_ci std::string fontWeightScale; 7223b3eb3cSopenharmony_ci std::string colorModeIsSetByApp; 7323b3eb3cSopenharmony_ci std::string mcc; 7423b3eb3cSopenharmony_ci std::string mnc; 7523b3eb3cSopenharmony_ci std::string preferredLanguage; 7623b3eb3cSopenharmony_ci bool IsValid() const 7723b3eb3cSopenharmony_ci { 7823b3eb3cSopenharmony_ci return !(colorMode.empty() && deviceAccess.empty() && languageTag.empty() && direction.empty() && 7923b3eb3cSopenharmony_ci densitydpi.empty() && themeTag.empty() && fontScale.empty() && fontWeightScale.empty() && 8023b3eb3cSopenharmony_ci colorModeIsSetByApp.empty() && mcc.empty() && mnc.empty() && fontFamily.empty() && 8123b3eb3cSopenharmony_ci preferredLanguage.empty()); 8223b3eb3cSopenharmony_ci } 8323b3eb3cSopenharmony_ci}; 8423b3eb3cSopenharmony_ci 8523b3eb3cSopenharmony_ciusing ConfigurationChangedCallback = std::function<void(const ParsedConfig& config, const std::string& configuration)>; 8623b3eb3cSopenharmony_ci 8723b3eb3cSopenharmony_ciclass ACE_FORCE_EXPORT AceContainer : public Container, public JsMessageDispatcher { 8823b3eb3cSopenharmony_ci DECLARE_ACE_TYPE(AceContainer, Container, JsMessageDispatcher); 8923b3eb3cSopenharmony_ci 9023b3eb3cSopenharmony_cipublic: 9123b3eb3cSopenharmony_ci AceContainer(int32_t instanceId, FrontendType type, std::shared_ptr<OHOS::AppExecFwk::Ability> aceAbility, 9223b3eb3cSopenharmony_ci std::unique_ptr<PlatformEventCallback> callback, bool useCurrentEventRunner = false, 9323b3eb3cSopenharmony_ci bool useNewPipeline = false); 9423b3eb3cSopenharmony_ci AceContainer(int32_t instanceId, FrontendType type, std::weak_ptr<OHOS::AbilityRuntime::Context> runtimeContext, 9523b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo, std::unique_ptr<PlatformEventCallback> callback, 9623b3eb3cSopenharmony_ci bool useCurrentEventRunner = false, bool isSubContainer = false, bool useNewPipeline = false); 9723b3eb3cSopenharmony_ci 9823b3eb3cSopenharmony_ci AceContainer(int32_t instanceId, FrontendType type, std::weak_ptr<OHOS::AbilityRuntime::Context> runtimeContext, 9923b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo, std::unique_ptr<PlatformEventCallback> callback, 10023b3eb3cSopenharmony_ci std::shared_ptr<TaskWrapper> taskWrapper, bool useCurrentEventRunner = false, bool isSubContainer = false, 10123b3eb3cSopenharmony_ci bool useNewPipeline = false); 10223b3eb3cSopenharmony_ci 10323b3eb3cSopenharmony_ci ~AceContainer() override; 10423b3eb3cSopenharmony_ci 10523b3eb3cSopenharmony_ci bool UpdatePopupUIExtension(const RefPtr<NG::FrameNode>& node, 10623b3eb3cSopenharmony_ci uint32_t autoFillSessionId, bool isNative = true) override; 10723b3eb3cSopenharmony_ci 10823b3eb3cSopenharmony_ci bool ClosePopupUIExtension(uint32_t autoFillSessionId) override; 10923b3eb3cSopenharmony_ci 11023b3eb3cSopenharmony_ci void Initialize() override; 11123b3eb3cSopenharmony_ci 11223b3eb3cSopenharmony_ci void Destroy() override; 11323b3eb3cSopenharmony_ci 11423b3eb3cSopenharmony_ci bool IsKeyboard() override; 11523b3eb3cSopenharmony_ci 11623b3eb3cSopenharmony_ci void DestroyView() override; 11723b3eb3cSopenharmony_ci 11823b3eb3cSopenharmony_ci static bool Register(); 11923b3eb3cSopenharmony_ci 12023b3eb3cSopenharmony_ci int32_t GetInstanceId() const override 12123b3eb3cSopenharmony_ci { 12223b3eb3cSopenharmony_ci if (aceView_) { 12323b3eb3cSopenharmony_ci return aceView_->GetInstanceId(); 12423b3eb3cSopenharmony_ci } 12523b3eb3cSopenharmony_ci return -1; 12623b3eb3cSopenharmony_ci } 12723b3eb3cSopenharmony_ci 12823b3eb3cSopenharmony_ci RefPtr<Frontend> GetFrontend() const override 12923b3eb3cSopenharmony_ci { 13023b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(frontendMutex_); 13123b3eb3cSopenharmony_ci return frontend_; 13223b3eb3cSopenharmony_ci } 13323b3eb3cSopenharmony_ci 13423b3eb3cSopenharmony_ci void SetCardFrontend(WeakPtr<Frontend> frontend, int64_t cardId) override 13523b3eb3cSopenharmony_ci { 13623b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(cardFrontMutex_); 13723b3eb3cSopenharmony_ci cardFrontendMap_.try_emplace(cardId, frontend); 13823b3eb3cSopenharmony_ci } 13923b3eb3cSopenharmony_ci 14023b3eb3cSopenharmony_ci WeakPtr<Frontend> GetCardFrontend(int64_t cardId) const override 14123b3eb3cSopenharmony_ci { 14223b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(cardFrontMutex_); 14323b3eb3cSopenharmony_ci auto it = cardFrontendMap_.find(cardId); 14423b3eb3cSopenharmony_ci if (it != cardFrontendMap_.end()) { 14523b3eb3cSopenharmony_ci return it->second; 14623b3eb3cSopenharmony_ci } 14723b3eb3cSopenharmony_ci return nullptr; 14823b3eb3cSopenharmony_ci } 14923b3eb3cSopenharmony_ci 15023b3eb3cSopenharmony_ci void SetCardPipeline(WeakPtr<PipelineBase> pipeline, int64_t cardId) override 15123b3eb3cSopenharmony_ci { 15223b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(cardPipelineMutex_); 15323b3eb3cSopenharmony_ci cardPipelineMap_.try_emplace(cardId, pipeline); 15423b3eb3cSopenharmony_ci } 15523b3eb3cSopenharmony_ci 15623b3eb3cSopenharmony_ci WeakPtr<PipelineBase> GetCardPipeline(int64_t cardId) const override 15723b3eb3cSopenharmony_ci { 15823b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(cardPipelineMutex_); 15923b3eb3cSopenharmony_ci auto it = cardPipelineMap_.find(cardId); 16023b3eb3cSopenharmony_ci if (it == cardPipelineMap_.end()) { 16123b3eb3cSopenharmony_ci return nullptr; 16223b3eb3cSopenharmony_ci } 16323b3eb3cSopenharmony_ci return it->second; 16423b3eb3cSopenharmony_ci } 16523b3eb3cSopenharmony_ci 16623b3eb3cSopenharmony_ci RefPtr<TaskExecutor> GetTaskExecutor() const override 16723b3eb3cSopenharmony_ci { 16823b3eb3cSopenharmony_ci return taskExecutor_; 16923b3eb3cSopenharmony_ci } 17023b3eb3cSopenharmony_ci 17123b3eb3cSopenharmony_ci void SetAssetManager(const RefPtr<AssetManager>& assetManager) 17223b3eb3cSopenharmony_ci { 17323b3eb3cSopenharmony_ci assetManager_ = assetManager; 17423b3eb3cSopenharmony_ci if (frontend_) { 17523b3eb3cSopenharmony_ci frontend_->SetAssetManager(assetManager); 17623b3eb3cSopenharmony_ci } 17723b3eb3cSopenharmony_ci } 17823b3eb3cSopenharmony_ci 17923b3eb3cSopenharmony_ci RefPtr<AssetManager> GetAssetManager() const override 18023b3eb3cSopenharmony_ci { 18123b3eb3cSopenharmony_ci return assetManager_; 18223b3eb3cSopenharmony_ci } 18323b3eb3cSopenharmony_ci 18423b3eb3cSopenharmony_ci RefPtr<PlatformResRegister> GetPlatformResRegister() const override 18523b3eb3cSopenharmony_ci { 18623b3eb3cSopenharmony_ci return resRegister_; 18723b3eb3cSopenharmony_ci } 18823b3eb3cSopenharmony_ci 18923b3eb3cSopenharmony_ci RefPtr<PipelineBase> GetPipelineContext() const override 19023b3eb3cSopenharmony_ci { 19123b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(pipelineMutex_); 19223b3eb3cSopenharmony_ci return pipelineContext_; 19323b3eb3cSopenharmony_ci } 19423b3eb3cSopenharmony_ci 19523b3eb3cSopenharmony_ci int32_t GetViewWidth() const override 19623b3eb3cSopenharmony_ci { 19723b3eb3cSopenharmony_ci return aceView_ ? aceView_->GetWidth() : 0; 19823b3eb3cSopenharmony_ci } 19923b3eb3cSopenharmony_ci 20023b3eb3cSopenharmony_ci int32_t GetViewHeight() const override 20123b3eb3cSopenharmony_ci { 20223b3eb3cSopenharmony_ci return aceView_ ? aceView_->GetHeight() : 0; 20323b3eb3cSopenharmony_ci } 20423b3eb3cSopenharmony_ci 20523b3eb3cSopenharmony_ci int32_t GetViewPosX() const override 20623b3eb3cSopenharmony_ci { 20723b3eb3cSopenharmony_ci return aceView_ ? aceView_->GetPosX() : 0; 20823b3eb3cSopenharmony_ci } 20923b3eb3cSopenharmony_ci 21023b3eb3cSopenharmony_ci int32_t GetViewPosY() const override 21123b3eb3cSopenharmony_ci { 21223b3eb3cSopenharmony_ci return aceView_ ? aceView_->GetPosY() : 0; 21323b3eb3cSopenharmony_ci } 21423b3eb3cSopenharmony_ci 21523b3eb3cSopenharmony_ci RefPtr<AceView> GetAceView() const override 21623b3eb3cSopenharmony_ci { 21723b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(viewMutex_); 21823b3eb3cSopenharmony_ci return aceView_; 21923b3eb3cSopenharmony_ci } 22023b3eb3cSopenharmony_ci 22123b3eb3cSopenharmony_ci void* GetView() const override 22223b3eb3cSopenharmony_ci { 22323b3eb3cSopenharmony_ci std::lock_guard<std::mutex> lock(viewMutex_); 22423b3eb3cSopenharmony_ci return static_cast<void*>(AceType::RawPtr(aceView_)); 22523b3eb3cSopenharmony_ci } 22623b3eb3cSopenharmony_ci 22723b3eb3cSopenharmony_ci void SetWindowModal(WindowModal windowModal) 22823b3eb3cSopenharmony_ci { 22923b3eb3cSopenharmony_ci windowModal_ = windowModal; 23023b3eb3cSopenharmony_ci } 23123b3eb3cSopenharmony_ci 23223b3eb3cSopenharmony_ci void SetInstallationFree(bool installationFree) 23323b3eb3cSopenharmony_ci { 23423b3eb3cSopenharmony_ci installationFree_ = installationFree; 23523b3eb3cSopenharmony_ci } 23623b3eb3cSopenharmony_ci 23723b3eb3cSopenharmony_ci void SetSharePanelCallback(SharePanelCallback&& callback) 23823b3eb3cSopenharmony_ci { 23923b3eb3cSopenharmony_ci sharePanelCallback_ = std::move(callback); 24023b3eb3cSopenharmony_ci } 24123b3eb3cSopenharmony_ci 24223b3eb3cSopenharmony_ci void SetColorScheme(ColorScheme colorScheme) 24323b3eb3cSopenharmony_ci { 24423b3eb3cSopenharmony_ci colorScheme_ = colorScheme; 24523b3eb3cSopenharmony_ci } 24623b3eb3cSopenharmony_ci 24723b3eb3cSopenharmony_ci ResourceConfiguration GetResourceConfiguration() const 24823b3eb3cSopenharmony_ci { 24923b3eb3cSopenharmony_ci return resourceInfo_.GetResourceConfiguration(); 25023b3eb3cSopenharmony_ci } 25123b3eb3cSopenharmony_ci 25223b3eb3cSopenharmony_ci void SetResourceConfiguration(const ResourceConfiguration& config) 25323b3eb3cSopenharmony_ci { 25423b3eb3cSopenharmony_ci resourceInfo_.SetResourceConfiguration(config); 25523b3eb3cSopenharmony_ci } 25623b3eb3cSopenharmony_ci 25723b3eb3cSopenharmony_ci std::string GetPackagePathStr() const 25823b3eb3cSopenharmony_ci { 25923b3eb3cSopenharmony_ci return resourceInfo_.GetPackagePath(); 26023b3eb3cSopenharmony_ci } 26123b3eb3cSopenharmony_ci 26223b3eb3cSopenharmony_ci void SetPackagePathStr(const std::string& packagePath) 26323b3eb3cSopenharmony_ci { 26423b3eb3cSopenharmony_ci resourceInfo_.SetPackagePath(packagePath); 26523b3eb3cSopenharmony_ci } 26623b3eb3cSopenharmony_ci 26723b3eb3cSopenharmony_ci std::string GetHapPath() const override 26823b3eb3cSopenharmony_ci { 26923b3eb3cSopenharmony_ci return resourceInfo_.GetHapPath(); 27023b3eb3cSopenharmony_ci } 27123b3eb3cSopenharmony_ci 27223b3eb3cSopenharmony_ci const ResourceInfo& GetResourceInfo() const 27323b3eb3cSopenharmony_ci { 27423b3eb3cSopenharmony_ci return resourceInfo_; 27523b3eb3cSopenharmony_ci } 27623b3eb3cSopenharmony_ci 27723b3eb3cSopenharmony_ci void SetOrientation(Orientation orientation) override 27823b3eb3cSopenharmony_ci { 27923b3eb3cSopenharmony_ci CHECK_NULL_VOID(uiWindow_); 28023b3eb3cSopenharmony_ci auto dmOrientation = static_cast<Rosen::Orientation>(static_cast<uint32_t>(orientation)); 28123b3eb3cSopenharmony_ci uiWindow_->SetRequestedOrientation(dmOrientation); 28223b3eb3cSopenharmony_ci } 28323b3eb3cSopenharmony_ci 28423b3eb3cSopenharmony_ci Orientation GetOrientation() override 28523b3eb3cSopenharmony_ci { 28623b3eb3cSopenharmony_ci CHECK_NULL_RETURN(uiWindow_, Orientation::UNSPECIFIED); 28723b3eb3cSopenharmony_ci auto dmOrientation = uiWindow_->GetRequestedOrientation(); 28823b3eb3cSopenharmony_ci return static_cast<Orientation>(static_cast<uint32_t>(dmOrientation)); 28923b3eb3cSopenharmony_ci } 29023b3eb3cSopenharmony_ci 29123b3eb3cSopenharmony_ci void SetHapPath(const std::string& hapPath); 29223b3eb3cSopenharmony_ci 29323b3eb3cSopenharmony_ci void Dispatch( 29423b3eb3cSopenharmony_ci const std::string& group, std::vector<uint8_t>&& data, int32_t id, bool replyToComponent) const override; 29523b3eb3cSopenharmony_ci 29623b3eb3cSopenharmony_ci void DispatchSync( 29723b3eb3cSopenharmony_ci const std::string& group, std::vector<uint8_t>&& data, uint8_t** resData, int64_t& position) const override 29823b3eb3cSopenharmony_ci {} 29923b3eb3cSopenharmony_ci 30023b3eb3cSopenharmony_ci void DispatchPluginError(int32_t callbackId, int32_t errorCode, std::string&& errorMessage) const override; 30123b3eb3cSopenharmony_ci 30223b3eb3cSopenharmony_ci bool Dump(const std::vector<std::string>& params, std::vector<std::string>& info) override; 30323b3eb3cSopenharmony_ci 30423b3eb3cSopenharmony_ci bool DumpInfo(const std::vector<std::string>& params); 30523b3eb3cSopenharmony_ci 30623b3eb3cSopenharmony_ci bool OnDumpInfo(const std::vector<std::string>& params); 30723b3eb3cSopenharmony_ci 30823b3eb3cSopenharmony_ci void TriggerGarbageCollection() override; 30923b3eb3cSopenharmony_ci 31023b3eb3cSopenharmony_ci void DumpHeapSnapshot(bool isPrivate) override; 31123b3eb3cSopenharmony_ci 31223b3eb3cSopenharmony_ci void DestroyHeapProfiler() override; 31323b3eb3cSopenharmony_ci 31423b3eb3cSopenharmony_ci void ForceFullGC() override; 31523b3eb3cSopenharmony_ci 31623b3eb3cSopenharmony_ci void SetLocalStorage(NativeReference* storage, const std::shared_ptr<OHOS::AbilityRuntime::Context>& context); 31723b3eb3cSopenharmony_ci 31823b3eb3cSopenharmony_ci void CheckAndSetFontFamily() override; 31923b3eb3cSopenharmony_ci 32023b3eb3cSopenharmony_ci void OnFinish() 32123b3eb3cSopenharmony_ci { 32223b3eb3cSopenharmony_ci if (platformEventCallback_) { 32323b3eb3cSopenharmony_ci platformEventCallback_->OnFinish(); 32423b3eb3cSopenharmony_ci } 32523b3eb3cSopenharmony_ci } 32623b3eb3cSopenharmony_ci 32723b3eb3cSopenharmony_ci void OnStartAbility(const std::string& address) 32823b3eb3cSopenharmony_ci { 32923b3eb3cSopenharmony_ci if (platformEventCallback_) { 33023b3eb3cSopenharmony_ci platformEventCallback_->OnStartAbility(address); 33123b3eb3cSopenharmony_ci } 33223b3eb3cSopenharmony_ci } 33323b3eb3cSopenharmony_ci 33423b3eb3cSopenharmony_ci int32_t GeneratePageId() 33523b3eb3cSopenharmony_ci { 33623b3eb3cSopenharmony_ci return pageId_++; 33723b3eb3cSopenharmony_ci } 33823b3eb3cSopenharmony_ci 33923b3eb3cSopenharmony_ci std::string GetHostClassName() const override 34023b3eb3cSopenharmony_ci { 34123b3eb3cSopenharmony_ci return ""; 34223b3eb3cSopenharmony_ci } 34323b3eb3cSopenharmony_ci 34423b3eb3cSopenharmony_ci void SetSharedRuntime(void* runtime) override 34523b3eb3cSopenharmony_ci { 34623b3eb3cSopenharmony_ci sharedRuntime_ = runtime; 34723b3eb3cSopenharmony_ci } 34823b3eb3cSopenharmony_ci 34923b3eb3cSopenharmony_ci void SetPageProfile(const std::string& pageProfile) 35023b3eb3cSopenharmony_ci { 35123b3eb3cSopenharmony_ci pageProfile_ = pageProfile; 35223b3eb3cSopenharmony_ci } 35323b3eb3cSopenharmony_ci 35423b3eb3cSopenharmony_ci bool IsSubContainer() const override 35523b3eb3cSopenharmony_ci { 35623b3eb3cSopenharmony_ci return isSubContainer_; 35723b3eb3cSopenharmony_ci } 35823b3eb3cSopenharmony_ci 35923b3eb3cSopenharmony_ci bool IsFormRender() const override 36023b3eb3cSopenharmony_ci { 36123b3eb3cSopenharmony_ci return isFormRender_; 36223b3eb3cSopenharmony_ci } 36323b3eb3cSopenharmony_ci 36423b3eb3cSopenharmony_ci void* GetSharedRuntime() override 36523b3eb3cSopenharmony_ci { 36623b3eb3cSopenharmony_ci return sharedRuntime_; 36723b3eb3cSopenharmony_ci } 36823b3eb3cSopenharmony_ci 36923b3eb3cSopenharmony_ci void SetParentId(int32_t parentId) 37023b3eb3cSopenharmony_ci { 37123b3eb3cSopenharmony_ci parentId_ = parentId; 37223b3eb3cSopenharmony_ci } 37323b3eb3cSopenharmony_ci 37423b3eb3cSopenharmony_ci void SetWindowScale(float windowScale) override 37523b3eb3cSopenharmony_ci { 37623b3eb3cSopenharmony_ci windowScale_ = windowScale; 37723b3eb3cSopenharmony_ci } 37823b3eb3cSopenharmony_ci 37923b3eb3cSopenharmony_ci float GetWindowScale() const override 38023b3eb3cSopenharmony_ci { 38123b3eb3cSopenharmony_ci return windowScale_; 38223b3eb3cSopenharmony_ci } 38323b3eb3cSopenharmony_ci 38423b3eb3cSopenharmony_ci double GetWindowDensity() const 38523b3eb3cSopenharmony_ci { 38623b3eb3cSopenharmony_ci if (!uiWindow_) { 38723b3eb3cSopenharmony_ci return 1.0; 38823b3eb3cSopenharmony_ci } 38923b3eb3cSopenharmony_ci return static_cast<double>(uiWindow_->GetVirtualPixelRatio()); 39023b3eb3cSopenharmony_ci } 39123b3eb3cSopenharmony_ci 39223b3eb3cSopenharmony_ci int32_t GetParentId() const 39323b3eb3cSopenharmony_ci { 39423b3eb3cSopenharmony_ci return parentId_; 39523b3eb3cSopenharmony_ci } 39623b3eb3cSopenharmony_ci 39723b3eb3cSopenharmony_ci void SetFocusWindowId(uint32_t focusWindowId) 39823b3eb3cSopenharmony_ci { 39923b3eb3cSopenharmony_ci if (pipelineContext_) { 40023b3eb3cSopenharmony_ci pipelineContext_->SetFocusWindowId(focusWindowId); 40123b3eb3cSopenharmony_ci } 40223b3eb3cSopenharmony_ci } 40323b3eb3cSopenharmony_ci 40423b3eb3cSopenharmony_ci void SetRealHostWindowId(uint32_t realHostWindowId) 40523b3eb3cSopenharmony_ci { 40623b3eb3cSopenharmony_ci if (pipelineContext_) { 40723b3eb3cSopenharmony_ci pipelineContext_->SetRealHostWindowId(realHostWindowId); 40823b3eb3cSopenharmony_ci } 40923b3eb3cSopenharmony_ci } 41023b3eb3cSopenharmony_ci 41123b3eb3cSopenharmony_ci bool IsUseCustomBg() const 41223b3eb3cSopenharmony_ci { 41323b3eb3cSopenharmony_ci return isUseCustomBg_; 41423b3eb3cSopenharmony_ci } 41523b3eb3cSopenharmony_ci 41623b3eb3cSopenharmony_ci void SetIsUseCustomBg(bool isUseCustomBg) 41723b3eb3cSopenharmony_ci { 41823b3eb3cSopenharmony_ci isUseCustomBg_ = isUseCustomBg; 41923b3eb3cSopenharmony_ci } 42023b3eb3cSopenharmony_ci 42123b3eb3cSopenharmony_ci bool IsTransparentBg() const; 42223b3eb3cSopenharmony_ci 42323b3eb3cSopenharmony_ci static void CreateContainer(int32_t instanceId, FrontendType type, const std::string& instanceName, 42423b3eb3cSopenharmony_ci std::shared_ptr<OHOS::AppExecFwk::Ability> aceAbility, std::unique_ptr<PlatformEventCallback> callback, 42523b3eb3cSopenharmony_ci bool useCurrentEventRunner = false, bool useNewPipeline = false); 42623b3eb3cSopenharmony_ci 42723b3eb3cSopenharmony_ci static void DestroyContainer(int32_t instanceId, const std::function<void()>& destroyCallback = nullptr); 42823b3eb3cSopenharmony_ci static UIContentErrorCode RunPage( 42923b3eb3cSopenharmony_ci int32_t instanceId, const std::string& content, const std::string& params, bool isNamedRouter = false); 43023b3eb3cSopenharmony_ci static UIContentErrorCode RunPage( 43123b3eb3cSopenharmony_ci int32_t instanceId, const std::shared_ptr<std::vector<uint8_t>>& content, const std::string& params); 43223b3eb3cSopenharmony_ci static bool PushPage(int32_t instanceId, const std::string& content, const std::string& params); 43323b3eb3cSopenharmony_ci static bool RunDynamicPage( 43423b3eb3cSopenharmony_ci int32_t instanceId, const std::string& content, const std::string& params, const std::string& entryPoint); 43523b3eb3cSopenharmony_ci static bool OnBackPressed(int32_t instanceId); 43623b3eb3cSopenharmony_ci static void OnShow(int32_t instanceId); 43723b3eb3cSopenharmony_ci static void OnHide(int32_t instanceId); 43823b3eb3cSopenharmony_ci static void OnActive(int32_t instanceId); 43923b3eb3cSopenharmony_ci static void OnInactive(int32_t instanceId); 44023b3eb3cSopenharmony_ci static void OnNewWant(int32_t instanceId, const std::string& data); 44123b3eb3cSopenharmony_ci static bool OnStartContinuation(int32_t instanceId); 44223b3eb3cSopenharmony_ci static std::string OnSaveData(int32_t instanceId); 44323b3eb3cSopenharmony_ci static bool OnRestoreData(int32_t instanceId, const std::string& data); 44423b3eb3cSopenharmony_ci static void OnCompleteContinuation(int32_t instanceId, int result); 44523b3eb3cSopenharmony_ci static void OnRemoteTerminated(int32_t instanceId); 44623b3eb3cSopenharmony_ci static void OnConfigurationUpdated(int32_t instanceId, const std::string& configuration); 44723b3eb3cSopenharmony_ci static void OnNewRequest(int32_t instanceId, const std::string& data); 44823b3eb3cSopenharmony_ci static void AddAssetPath(int32_t instanceId, const std::string& packagePath, const std::string& hapPath, 44923b3eb3cSopenharmony_ci const std::vector<std::string>& paths); 45023b3eb3cSopenharmony_ci static void AddLibPath(int32_t instanceId, const std::vector<std::string>& libPath); 45123b3eb3cSopenharmony_ci static void SetView(const RefPtr<AceView>& view, double density, int32_t width, int32_t height, 45223b3eb3cSopenharmony_ci sptr<OHOS::Rosen::Window> rsWindow, UIEnvCallback callback = nullptr); 45323b3eb3cSopenharmony_ci static UIContentErrorCode SetViewNew( 45423b3eb3cSopenharmony_ci const RefPtr<AceView>& view, double density, float width, float height, sptr<OHOS::Rosen::Window> rsWindow); 45523b3eb3cSopenharmony_ci static void SetUIWindow(int32_t instanceId, sptr<OHOS::Rosen::Window> uiWindow); 45623b3eb3cSopenharmony_ci static sptr<OHOS::Rosen::Window> GetUIWindow(int32_t instanceId); 45723b3eb3cSopenharmony_ci static OHOS::AppExecFwk::Ability* GetAbility(int32_t instanceId); 45823b3eb3cSopenharmony_ci static OHOS::AbilityRuntime::Context* GetRuntimeContext(int32_t instanceId); 45923b3eb3cSopenharmony_ci static void SetWindowStyle(int32_t instanceId, WindowModal windowModal, ColorScheme colorScheme); 46023b3eb3cSopenharmony_ci static std::pair<RouterRecoverRecord, UIContentErrorCode> RestoreRouterStack( 46123b3eb3cSopenharmony_ci int32_t instanceId, const std::string& contentInfo, ContentInfoType type); 46223b3eb3cSopenharmony_ci static std::string GetContentInfo(int32_t instanceId, ContentInfoType type); 46323b3eb3cSopenharmony_ci 46423b3eb3cSopenharmony_ci static RefPtr<AceContainer> GetContainer(int32_t instanceId); 46523b3eb3cSopenharmony_ci static bool UpdatePage(int32_t instanceId, int32_t pageId, const std::string& content); 46623b3eb3cSopenharmony_ci static bool RemoveOverlayBySubwindowManager(int32_t instanceId); 46723b3eb3cSopenharmony_ci 46823b3eb3cSopenharmony_ci // ArkTsCard 46923b3eb3cSopenharmony_ci static std::shared_ptr<Rosen::RSSurfaceNode> GetFormSurfaceNode(int32_t instanceId); 47023b3eb3cSopenharmony_ci 47123b3eb3cSopenharmony_ci void SetWindowName(const std::string& name) 47223b3eb3cSopenharmony_ci { 47323b3eb3cSopenharmony_ci windowName_ = name; 47423b3eb3cSopenharmony_ci } 47523b3eb3cSopenharmony_ci 47623b3eb3cSopenharmony_ci std::string& GetWindowName() 47723b3eb3cSopenharmony_ci { 47823b3eb3cSopenharmony_ci return windowName_; 47923b3eb3cSopenharmony_ci } 48023b3eb3cSopenharmony_ci 48123b3eb3cSopenharmony_ci void SetWindowId(uint32_t windowId) override 48223b3eb3cSopenharmony_ci { 48323b3eb3cSopenharmony_ci windowId_ = windowId; 48423b3eb3cSopenharmony_ci } 48523b3eb3cSopenharmony_ci 48623b3eb3cSopenharmony_ci uint32_t GetWindowId() const override 48723b3eb3cSopenharmony_ci { 48823b3eb3cSopenharmony_ci return windowId_; 48923b3eb3cSopenharmony_ci } 49023b3eb3cSopenharmony_ci 49123b3eb3cSopenharmony_ci bool WindowIsShow() const override 49223b3eb3cSopenharmony_ci { 49323b3eb3cSopenharmony_ci if (!uiWindow_) { 49423b3eb3cSopenharmony_ci return false; 49523b3eb3cSopenharmony_ci } 49623b3eb3cSopenharmony_ci return uiWindow_->GetWindowState() == Rosen::WindowState::STATE_SHOWN; 49723b3eb3cSopenharmony_ci } 49823b3eb3cSopenharmony_ci 49923b3eb3cSopenharmony_ci void SetWindowPos(int32_t left, int32_t top); 50023b3eb3cSopenharmony_ci 50123b3eb3cSopenharmony_ci void SetIsSubContainer(bool isSubContainer) 50223b3eb3cSopenharmony_ci { 50323b3eb3cSopenharmony_ci isSubContainer_ = isSubContainer; 50423b3eb3cSopenharmony_ci } 50523b3eb3cSopenharmony_ci 50623b3eb3cSopenharmony_ci void SetIsFormRender(bool isFormRender) override 50723b3eb3cSopenharmony_ci { 50823b3eb3cSopenharmony_ci isFormRender_ = isFormRender; 50923b3eb3cSopenharmony_ci } 51023b3eb3cSopenharmony_ci 51123b3eb3cSopenharmony_ci void InitializeSubContainer(int32_t parentContainerId); 51223b3eb3cSopenharmony_ci static void SetDialogCallback(int32_t instanceId, FrontendDialogCallback callback); 51323b3eb3cSopenharmony_ci 51423b3eb3cSopenharmony_ci std::shared_ptr<OHOS::AbilityRuntime::Context> GetAbilityContextByModule( 51523b3eb3cSopenharmony_ci const std::string& bundle, const std::string& module); 51623b3eb3cSopenharmony_ci 51723b3eb3cSopenharmony_ci void UpdateConfiguration(const ParsedConfig& parsedConfig, const std::string& configuration); 51823b3eb3cSopenharmony_ci 51923b3eb3cSopenharmony_ci void NotifyConfigurationChange( 52023b3eb3cSopenharmony_ci bool needReloadTransition, const ConfigurationChange& configurationChange = { false, false }) override; 52123b3eb3cSopenharmony_ci 52223b3eb3cSopenharmony_ci void AddOnConfigurationChange(int32_t instanceId, ConfigurationChangedCallback &&callback) 52323b3eb3cSopenharmony_ci { 52423b3eb3cSopenharmony_ci configurationChangedCallbacks_.emplace(instanceId, std::move(callback)); 52523b3eb3cSopenharmony_ci } 52623b3eb3cSopenharmony_ci 52723b3eb3cSopenharmony_ci void RemoveOnConfigurationChange(int32_t instanceId) 52823b3eb3cSopenharmony_ci { 52923b3eb3cSopenharmony_ci configurationChangedCallbacks_.erase(instanceId_); 53023b3eb3cSopenharmony_ci } 53123b3eb3cSopenharmony_ci 53223b3eb3cSopenharmony_ci void HotReload() override; 53323b3eb3cSopenharmony_ci 53423b3eb3cSopenharmony_ci bool IsUseStageModel() const override 53523b3eb3cSopenharmony_ci { 53623b3eb3cSopenharmony_ci return useStageModel_; 53723b3eb3cSopenharmony_ci } 53823b3eb3cSopenharmony_ci 53923b3eb3cSopenharmony_ci void GetCardFrontendMap(std::unordered_map<int64_t, WeakPtr<Frontend>>& cardFrontendMap) const override 54023b3eb3cSopenharmony_ci { 54123b3eb3cSopenharmony_ci cardFrontendMap = cardFrontendMap_; 54223b3eb3cSopenharmony_ci } 54323b3eb3cSopenharmony_ci 54423b3eb3cSopenharmony_ci void SetToken(sptr<IRemoteObject>& token); 54523b3eb3cSopenharmony_ci sptr<IRemoteObject> GetToken(); 54623b3eb3cSopenharmony_ci void SetParentToken(sptr<IRemoteObject>& token); 54723b3eb3cSopenharmony_ci sptr<IRemoteObject> GetParentToken(); 54823b3eb3cSopenharmony_ci uint32_t GetParentWindowType() const; 54923b3eb3cSopenharmony_ci uint32_t GetWindowType() const; 55023b3eb3cSopenharmony_ci 55123b3eb3cSopenharmony_ci std::string GetWebHapPath() const override 55223b3eb3cSopenharmony_ci { 55323b3eb3cSopenharmony_ci return webHapPath_; 55423b3eb3cSopenharmony_ci } 55523b3eb3cSopenharmony_ci 55623b3eb3cSopenharmony_ci NG::SafeAreaInsets GetViewSafeAreaByType(OHOS::Rosen::AvoidAreaType type); 55723b3eb3cSopenharmony_ci 55823b3eb3cSopenharmony_ci NG::SafeAreaInsets GetKeyboardSafeArea() override; 55923b3eb3cSopenharmony_ci 56023b3eb3cSopenharmony_ci Rect GetSessionAvoidAreaByType(uint32_t safeAreaType) override; 56123b3eb3cSopenharmony_ci 56223b3eb3cSopenharmony_ci Rosen::AvoidArea GetAvoidAreaByType(Rosen::AvoidAreaType type); 56323b3eb3cSopenharmony_ci 56423b3eb3cSopenharmony_ci // ArkTSCard 56523b3eb3cSopenharmony_ci void UpdateFormData(const std::string& data); 56623b3eb3cSopenharmony_ci void UpdateFormSharedImage(const std::map<std::string, sptr<OHOS::AppExecFwk::FormAshmem>>& imageDataMap); 56723b3eb3cSopenharmony_ci void UpdateResource(); 56823b3eb3cSopenharmony_ci 56923b3eb3cSopenharmony_ci void GetNamesOfSharedImage(std::vector<std::string>& picNameArray); 57023b3eb3cSopenharmony_ci void UpdateSharedImage(std::vector<std::string>& picNameArray, std::vector<int32_t>& byteLenArray, 57123b3eb3cSopenharmony_ci std::vector<int32_t>& fileDescriptorArray); 57223b3eb3cSopenharmony_ci void GetImageDataFromAshmem( 57323b3eb3cSopenharmony_ci const std::string& picName, Ashmem& ashmem, const RefPtr<PipelineBase>& pipelineContext, int len); 57423b3eb3cSopenharmony_ci 57523b3eb3cSopenharmony_ci bool IsLauncherContainer() override; 57623b3eb3cSopenharmony_ci bool IsScenceBoardWindow() override; 57723b3eb3cSopenharmony_ci bool IsUIExtensionWindow() override; 57823b3eb3cSopenharmony_ci bool IsSceneBoardEnabled() override; 57923b3eb3cSopenharmony_ci bool IsMainWindow() const override; 58023b3eb3cSopenharmony_ci bool IsSubWindow() const override; 58123b3eb3cSopenharmony_ci bool IsDialogWindow() const override; 58223b3eb3cSopenharmony_ci bool IsSystemWindow() const override; 58323b3eb3cSopenharmony_ci bool IsHostMainWindow() const override; 58423b3eb3cSopenharmony_ci bool IsHostSubWindow() const override; 58523b3eb3cSopenharmony_ci bool IsHostDialogWindow() const override; 58623b3eb3cSopenharmony_ci bool IsHostSystemWindow() const override; 58723b3eb3cSopenharmony_ci bool IsHostSceneBoardWindow() const override; 58823b3eb3cSopenharmony_ci uint32_t GetParentMainWindowId(uint32_t currentWindowId) const override; 58923b3eb3cSopenharmony_ci 59023b3eb3cSopenharmony_ci void SetCurPointerEvent(const std::shared_ptr<MMI::PointerEvent>& currentEvent); 59123b3eb3cSopenharmony_ci bool GetCurPointerEventInfo(int32_t& pointerId, int32_t& globalX, int32_t& globalY, int32_t& sourceType, 59223b3eb3cSopenharmony_ci int32_t& sourceTool, StopDragCallback&& stopDragCallback) override; 59323b3eb3cSopenharmony_ci 59423b3eb3cSopenharmony_ci bool GetCurPointerEventSourceType(int32_t& sourceType) override; 59523b3eb3cSopenharmony_ci 59623b3eb3cSopenharmony_ci bool RequestAutoFill(const RefPtr<NG::FrameNode>& node, AceAutoFillType autoFillType, 59723b3eb3cSopenharmony_ci bool isNewPassWord, bool& isPopup, uint32_t& autoFillSessionId, bool isNative = true) override; 59823b3eb3cSopenharmony_ci bool IsNeedToCreatePopupWindow(const AceAutoFillType& autoFillType) override; 59923b3eb3cSopenharmony_ci bool RequestAutoSave(const RefPtr<NG::FrameNode>& node, const std::function<void()>& onFinish, 60023b3eb3cSopenharmony_ci const std::function<void()>& onUIExtNodeBindingCompleted, bool isNative = true, 60123b3eb3cSopenharmony_ci int32_t instanceId = -1) override; 60223b3eb3cSopenharmony_ci std::shared_ptr<NavigationController> GetNavigationController(const std::string& navigationId) override; 60323b3eb3cSopenharmony_ci void OverwritePageNodeInfo(const RefPtr<NG::FrameNode>& frameNode, AbilityBase::ViewData& viewData); 60423b3eb3cSopenharmony_ci HintToTypeWrap PlaceHolderToType(const std::string& onePlaceHolder) override; 60523b3eb3cSopenharmony_ci 60623b3eb3cSopenharmony_ci void SearchElementInfoByAccessibilityIdNG( 60723b3eb3cSopenharmony_ci int64_t elementId, int32_t mode, int64_t baseParent, 60823b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& output); 60923b3eb3cSopenharmony_ci 61023b3eb3cSopenharmony_ci void SearchElementInfosByTextNG( 61123b3eb3cSopenharmony_ci int64_t elementId, const std::string& text, int64_t baseParent, 61223b3eb3cSopenharmony_ci std::list<Accessibility::AccessibilityElementInfo>& output); 61323b3eb3cSopenharmony_ci 61423b3eb3cSopenharmony_ci void FindFocusedElementInfoNG( 61523b3eb3cSopenharmony_ci int64_t elementId, int32_t focusType, int64_t baseParent, 61623b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& output); 61723b3eb3cSopenharmony_ci 61823b3eb3cSopenharmony_ci void FocusMoveSearchNG( 61923b3eb3cSopenharmony_ci int64_t elementId, int32_t direction, int64_t baseParent, 62023b3eb3cSopenharmony_ci Accessibility::AccessibilityElementInfo& output); 62123b3eb3cSopenharmony_ci 62223b3eb3cSopenharmony_ci bool NotifyExecuteAction( 62323b3eb3cSopenharmony_ci int64_t elementId, const std::map<std::string, std::string>& actionArguments, 62423b3eb3cSopenharmony_ci int32_t action, int64_t offset); 62523b3eb3cSopenharmony_ci 62623b3eb3cSopenharmony_ci void HandleAccessibilityHoverEvent(float pointX, float pointY, int32_t sourceType, 62723b3eb3cSopenharmony_ci int32_t eventType, int64_t timeMs); 62823b3eb3cSopenharmony_ci 62923b3eb3cSopenharmony_ci void TerminateUIExtension() override; 63023b3eb3cSopenharmony_ci 63123b3eb3cSopenharmony_ci void SetUIExtensionSubWindow(bool isUIExtensionSubWindow) 63223b3eb3cSopenharmony_ci { 63323b3eb3cSopenharmony_ci isUIExtensionSubWindow_ = isUIExtensionSubWindow; 63423b3eb3cSopenharmony_ci } 63523b3eb3cSopenharmony_ci 63623b3eb3cSopenharmony_ci bool IsUIExtensionSubWindow() 63723b3eb3cSopenharmony_ci { 63823b3eb3cSopenharmony_ci return isUIExtensionSubWindow_; 63923b3eb3cSopenharmony_ci } 64023b3eb3cSopenharmony_ci 64123b3eb3cSopenharmony_ci void SetUIExtensionAbilityProcess(bool isUIExtensionAbilityProcess) 64223b3eb3cSopenharmony_ci { 64323b3eb3cSopenharmony_ci isUIExtensionAbilityProcess_ = isUIExtensionAbilityProcess; 64423b3eb3cSopenharmony_ci } 64523b3eb3cSopenharmony_ci 64623b3eb3cSopenharmony_ci bool IsUIExtensionAbilityProcess() 64723b3eb3cSopenharmony_ci { 64823b3eb3cSopenharmony_ci return isUIExtensionAbilityProcess_; 64923b3eb3cSopenharmony_ci } 65023b3eb3cSopenharmony_ci 65123b3eb3cSopenharmony_ci void SetUIExtensionAbilityHost(bool isUIExtensionAbilityHost) 65223b3eb3cSopenharmony_ci { 65323b3eb3cSopenharmony_ci isUIExtensionAbilityHost_ = isUIExtensionAbilityHost; 65423b3eb3cSopenharmony_ci } 65523b3eb3cSopenharmony_ci 65623b3eb3cSopenharmony_ci bool IsUIExtensionAbilityHost() 65723b3eb3cSopenharmony_ci { 65823b3eb3cSopenharmony_ci return isUIExtensionAbilityHost_; 65923b3eb3cSopenharmony_ci } 66023b3eb3cSopenharmony_ci 66123b3eb3cSopenharmony_ci void RecordResAdapter(const std::string& key) 66223b3eb3cSopenharmony_ci { 66323b3eb3cSopenharmony_ci resAdapterRecord_.emplace(key); 66423b3eb3cSopenharmony_ci } 66523b3eb3cSopenharmony_ci 66623b3eb3cSopenharmony_ci std::vector<Ace::RectF> GetOverlayNodePositions(); 66723b3eb3cSopenharmony_ci 66823b3eb3cSopenharmony_ci void RegisterOverlayNodePositionsUpdateCallback( 66923b3eb3cSopenharmony_ci const std::function<void(std::vector<Ace::RectF>)>&& callback); 67023b3eb3cSopenharmony_ci 67123b3eb3cSopenharmony_ci OHOS::Rosen::WMError RegisterAvoidAreaChangeListener(sptr<OHOS::Rosen::IAvoidAreaChangedListener>& listener); 67223b3eb3cSopenharmony_ci OHOS::Rosen::WMError UnregisterAvoidAreaChangeListener(sptr<OHOS::Rosen::IAvoidAreaChangedListener>& listener); 67323b3eb3cSopenharmony_ci 67423b3eb3cSopenharmony_ci bool NeedFullUpdate(uint32_t limitKey); 67523b3eb3cSopenharmony_ci void NotifyDensityUpdate(); 67623b3eb3cSopenharmony_ci void NotifyDirectionUpdate(); 67723b3eb3cSopenharmony_ci 67823b3eb3cSopenharmony_ci void SetRegisterComponents(const std::vector<std::string>& registerComponents) 67923b3eb3cSopenharmony_ci { 68023b3eb3cSopenharmony_ci registerComponents_ = registerComponents; 68123b3eb3cSopenharmony_ci } 68223b3eb3cSopenharmony_ci 68323b3eb3cSopenharmony_ci std::vector<std::string> GetRegisterComponents() override 68423b3eb3cSopenharmony_ci { 68523b3eb3cSopenharmony_ci return registerComponents_; 68623b3eb3cSopenharmony_ci } 68723b3eb3cSopenharmony_ci void RenderLayoutBoundary(bool isDebugBoundary); 68823b3eb3cSopenharmony_ci void AddWatchSystemParameter(); 68923b3eb3cSopenharmony_ci void RemoveWatchSystemParameter(); 69023b3eb3cSopenharmony_ci 69123b3eb3cSopenharmony_ci const std::vector<std::string>& GetUieParams() const 69223b3eb3cSopenharmony_ci { 69323b3eb3cSopenharmony_ci return paramUie_; 69423b3eb3cSopenharmony_ci } 69523b3eb3cSopenharmony_ci 69623b3eb3cSopenharmony_ci void UpdateResourceOrientation(int32_t orientation); 69723b3eb3cSopenharmony_ci void UpdateResourceDensity(double density); 69823b3eb3cSopenharmony_ci 69923b3eb3cSopenharmony_ci bool IsFreeMultiWindow() const override 70023b3eb3cSopenharmony_ci { 70123b3eb3cSopenharmony_ci CHECK_NULL_RETURN(uiWindow_, false); 70223b3eb3cSopenharmony_ci return uiWindow_->GetFreeMultiWindowModeEnabledState(); 70323b3eb3cSopenharmony_ci } 70423b3eb3cSopenharmony_ci Rect GetUIExtensionHostWindowRect(int32_t instanceId) override 70523b3eb3cSopenharmony_ci { 70623b3eb3cSopenharmony_ci CHECK_NULL_RETURN(IsUIExtensionWindow(), Rect()); 70723b3eb3cSopenharmony_ci auto rect = uiWindow_->GetHostWindowRect(instanceId); 70823b3eb3cSopenharmony_ci return Rect(rect.posX_, rect.posY_, rect.width_, rect.height_); 70923b3eb3cSopenharmony_ci } 71023b3eb3cSopenharmony_ci 71123b3eb3cSopenharmony_ciprivate: 71223b3eb3cSopenharmony_ci virtual bool MaybeRelease() override; 71323b3eb3cSopenharmony_ci void InitializeFrontend(); 71423b3eb3cSopenharmony_ci void InitializeCallback(); 71523b3eb3cSopenharmony_ci void InitializeTask(std::shared_ptr<TaskWrapper> taskWrapper = nullptr); 71623b3eb3cSopenharmony_ci void InitWindowCallback(); 71723b3eb3cSopenharmony_ci 71823b3eb3cSopenharmony_ci void AttachView(std::shared_ptr<Window> window, const RefPtr<AceView>& view, double density, float width, 71923b3eb3cSopenharmony_ci float height, uint32_t windowId, UIEnvCallback callback = nullptr); 72023b3eb3cSopenharmony_ci void SetUIWindowInner(sptr<OHOS::Rosen::Window> uiWindow); 72123b3eb3cSopenharmony_ci sptr<OHOS::Rosen::Window> GetUIWindowInner() const; 72223b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AppExecFwk::Ability> GetAbilityInner() const; 72323b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AbilityRuntime::Context> GetRuntimeContextInner() const; 72423b3eb3cSopenharmony_ci 72523b3eb3cSopenharmony_ci void RegisterStopDragCallback(int32_t pointerId, StopDragCallback&& stopDragCallback); 72623b3eb3cSopenharmony_ci void SetFontScaleAndWeightScale(const ParsedConfig& parsedConfig, ConfigurationChange& configurationChange); 72723b3eb3cSopenharmony_ci void ReleaseResourceAdapter(); 72823b3eb3cSopenharmony_ci void FillAutoFillViewData(const RefPtr<NG::FrameNode> &node, RefPtr<ViewDataWrap> &viewDataWrap); 72923b3eb3cSopenharmony_ci 73023b3eb3cSopenharmony_ci void NotifyConfigToSubContainers(const ParsedConfig& parsedConfig, const std::string& configuration); 73123b3eb3cSopenharmony_ci void ProcessThemeUpdate(const ParsedConfig& parsedConfig, ConfigurationChange& configurationChange); 73223b3eb3cSopenharmony_ci DeviceOrientation ProcessDirectionUpdate( 73323b3eb3cSopenharmony_ci const ParsedConfig& parsedConfig, ConfigurationChange& configurationChange); 73423b3eb3cSopenharmony_ci void InitDragEventCallback(); 73523b3eb3cSopenharmony_ci int32_t instanceId_ = 0; 73623b3eb3cSopenharmony_ci RefPtr<AceView> aceView_; 73723b3eb3cSopenharmony_ci RefPtr<TaskExecutor> taskExecutor_; 73823b3eb3cSopenharmony_ci RefPtr<AssetManager> assetManager_; 73923b3eb3cSopenharmony_ci RefPtr<PlatformResRegister> resRegister_; 74023b3eb3cSopenharmony_ci RefPtr<PipelineBase> pipelineContext_; 74123b3eb3cSopenharmony_ci RefPtr<Frontend> frontend_; 74223b3eb3cSopenharmony_ci std::unordered_map<int64_t, WeakPtr<Frontend>> cardFrontendMap_; 74323b3eb3cSopenharmony_ci std::unordered_map<int64_t, WeakPtr<PipelineBase>> cardPipelineMap_; 74423b3eb3cSopenharmony_ci 74523b3eb3cSopenharmony_ci FrontendType type_ = FrontendType::JS; 74623b3eb3cSopenharmony_ci std::unique_ptr<PlatformEventCallback> platformEventCallback_; 74723b3eb3cSopenharmony_ci WindowModal windowModal_ { WindowModal::NORMAL }; 74823b3eb3cSopenharmony_ci ColorScheme colorScheme_ { ColorScheme::FIRST_VALUE }; 74923b3eb3cSopenharmony_ci ResourceInfo resourceInfo_; 75023b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AppExecFwk::Ability> aceAbility_; 75123b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AbilityRuntime::Context> runtimeContext_; 75223b3eb3cSopenharmony_ci std::weak_ptr<OHOS::AppExecFwk::AbilityInfo> abilityInfo_; 75323b3eb3cSopenharmony_ci void* sharedRuntime_ = nullptr; 75423b3eb3cSopenharmony_ci std::string pageProfile_; 75523b3eb3cSopenharmony_ci int32_t pageId_ = 0; 75623b3eb3cSopenharmony_ci bool useCurrentEventRunner_ = false; 75723b3eb3cSopenharmony_ci sptr<OHOS::Rosen::Window> uiWindow_ = nullptr; 75823b3eb3cSopenharmony_ci std::string windowName_; 75923b3eb3cSopenharmony_ci uint32_t windowId_ = OHOS::Rosen::INVALID_WINDOW_ID; 76023b3eb3cSopenharmony_ci float windowScale_ = 1.0f; 76123b3eb3cSopenharmony_ci sptr<IRemoteObject> token_; 76223b3eb3cSopenharmony_ci sptr<IRemoteObject> parentToken_; 76323b3eb3cSopenharmony_ci 76423b3eb3cSopenharmony_ci bool isSubContainer_ = false; 76523b3eb3cSopenharmony_ci bool isFormRender_ = false; 76623b3eb3cSopenharmony_ci int32_t parentId_ = 0; 76723b3eb3cSopenharmony_ci bool useStageModel_ = false; 76823b3eb3cSopenharmony_ci bool isUIExtensionSubWindow_ = false; 76923b3eb3cSopenharmony_ci bool isUIExtensionAbilityProcess_ = false; 77023b3eb3cSopenharmony_ci bool isUIExtensionAbilityHost_ = false; 77123b3eb3cSopenharmony_ci bool isUseCustomBg_ = false; 77223b3eb3cSopenharmony_ci 77323b3eb3cSopenharmony_ci DeviceOrientation orientation_ = DeviceOrientation::ORIENTATION_UNDEFINED; 77423b3eb3cSopenharmony_ci 77523b3eb3cSopenharmony_ci // for other AceContainer subscribe configuration from host AceContaier 77623b3eb3cSopenharmony_ci // key is instanceId, value is callback function 77723b3eb3cSopenharmony_ci std::unordered_map<int32_t, ConfigurationChangedCallback> configurationChangedCallbacks_; 77823b3eb3cSopenharmony_ci std::vector<std::string> registerComponents_; 77923b3eb3cSopenharmony_ci 78023b3eb3cSopenharmony_ci std::unordered_set<std::string> resAdapterRecord_; 78123b3eb3cSopenharmony_ci 78223b3eb3cSopenharmony_ci mutable std::mutex frontendMutex_; 78323b3eb3cSopenharmony_ci mutable std::mutex pipelineMutex_; 78423b3eb3cSopenharmony_ci mutable std::mutex destructMutex_; 78523b3eb3cSopenharmony_ci mutable std::mutex viewMutex_; 78623b3eb3cSopenharmony_ci 78723b3eb3cSopenharmony_ci mutable std::mutex cardFrontMutex_; 78823b3eb3cSopenharmony_ci mutable std::mutex cardPipelineMutex_; 78923b3eb3cSopenharmony_ci mutable std::mutex cardTokensMutex_; 79023b3eb3cSopenharmony_ci 79123b3eb3cSopenharmony_ci std::string webHapPath_; 79223b3eb3cSopenharmony_ci 79323b3eb3cSopenharmony_ci bool installationFree_ = false; 79423b3eb3cSopenharmony_ci SharePanelCallback sharePanelCallback_ = nullptr; 79523b3eb3cSopenharmony_ci 79623b3eb3cSopenharmony_ci std::atomic_flag isDumping_ = ATOMIC_FLAG_INIT; 79723b3eb3cSopenharmony_ci 79823b3eb3cSopenharmony_ci // For custom drag event 79923b3eb3cSopenharmony_ci std::mutex pointerEventMutex_; 80023b3eb3cSopenharmony_ci std::shared_ptr<MMI::PointerEvent> currentPointerEvent_; 80123b3eb3cSopenharmony_ci std::unordered_map<int32_t, std::list<StopDragCallback>> stopDragCallbackMap_; 80223b3eb3cSopenharmony_ci std::map<int32_t, std::shared_ptr<MMI::PointerEvent>> currentEvents_; 80323b3eb3cSopenharmony_ci ACE_DISALLOW_COPY_AND_MOVE(AceContainer); 80423b3eb3cSopenharmony_ci RefPtr<RenderBoundaryManager> renderBoundaryManager_ = Referenced::MakeRefPtr<RenderBoundaryManager>(); 80523b3eb3cSopenharmony_ci 80623b3eb3cSopenharmony_ci // for Ui Extension dump param get 80723b3eb3cSopenharmony_ci std::vector<std::string> paramUie_; 80823b3eb3cSopenharmony_ci}; 80923b3eb3cSopenharmony_ci 81023b3eb3cSopenharmony_ci} // namespace OHOS::Ace::Platform 81123b3eb3cSopenharmony_ci 81223b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_ADAPTER_OHOS_CPP_ACE_CONTAINER_H 813