mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-12-11 20:03:42 +00:00
get config
Signed-off-by: zhuhan <2281542033@qq.com> Change-Id: I8a0e547a5812cedce1c872f168ddd02830b2346d
This commit is contained in:
parent
8a3894b95e
commit
bf29297393
@ -676,6 +676,24 @@ void ApplicationContext::SwitchArea(int mode)
|
||||
}
|
||||
}
|
||||
|
||||
void ApplicationContext::SetConfiguration(const std::shared_ptr<AppExecFwk::Configuration> &config)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is null");
|
||||
return;
|
||||
}
|
||||
contextImpl_->SetConfiguration(config);
|
||||
}
|
||||
|
||||
void ApplicationContext::AppHasDarkRes(bool &darkRes)
|
||||
{
|
||||
if (contextImpl_ == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "context is null");
|
||||
return;
|
||||
}
|
||||
contextImpl_->AppHasDarkRes(darkRes);
|
||||
}
|
||||
|
||||
void ApplicationContext::SetColorMode(int32_t colorMode)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "colorMode:%{public}d.", colorMode);
|
||||
|
@ -1084,6 +1084,19 @@ void ContextImpl::SetConfiguration(const std::shared_ptr<AppExecFwk::Configurati
|
||||
config_ = config;
|
||||
}
|
||||
|
||||
void ContextImpl::AppHasDarkRes(bool &darkRes)
|
||||
{
|
||||
std::shared_ptr<Global::Resource::ResourceManager> currentResMgr = GetResourceManager();
|
||||
std::unique_ptr<Global::Resource::ResConfig> resConfig(Global::Resource::CreateResConfig());
|
||||
if (currentResMgr == nullptr || resConfig == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::APPKIT, "resMgr or resConfig is null");
|
||||
return;
|
||||
}
|
||||
currentResMgr->GetResConfig(*resConfig);
|
||||
darkRes = resConfig->GetAppDarkRes();
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "darkRes %{public}d", darkRes);
|
||||
}
|
||||
|
||||
void ContextImpl::KillProcessBySelf(const bool clearPageStack)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::APPKIT, "killProcessBySelf called clearPageStack is %{public}d.", clearPageStack);
|
||||
|
@ -558,6 +558,8 @@ void OHOSApplication::OnConfigurationUpdated(Configuration config)
|
||||
configuration_->RemoveItem(AAFwk::GlobalConfigurationKey::COLORMODE_IS_SET_BY_SA);
|
||||
configuration_->RemoveItem(AAFwk::GlobalConfigurationKey::COLORMODE_NEED_REMOVE_SET_BY_SA);
|
||||
}
|
||||
|
||||
abilityRuntimeContext_->SetConfiguration(configuration_);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -114,6 +114,8 @@ public:
|
||||
void ClearUpApplicationData();
|
||||
int GetArea() override;
|
||||
std::shared_ptr<AppExecFwk::Configuration> GetConfiguration() const override;
|
||||
void SetConfiguration(const std::shared_ptr<AppExecFwk::Configuration> &config);
|
||||
void AppHasDarkRes(bool &darkRes);
|
||||
std::string GetBaseDir() const override;
|
||||
Global::Resource::DeviceType GetDeviceType() const override;
|
||||
void KillProcessBySelf(const bool clearPageStack = true);
|
||||
|
@ -370,6 +370,8 @@ public:
|
||||
|
||||
void PrintTokenInfo() const;
|
||||
|
||||
void AppHasDarkRes(bool &darkRes);
|
||||
|
||||
static const int EL_DEFAULT = 1;
|
||||
|
||||
protected:
|
||||
|
Loading…
Reference in New Issue
Block a user