!2606 支持ability释放窗口资源

Merge pull request !2606 from yihao lin/master
This commit is contained in:
openharmony_ci 2022-08-03 23:24:48 +00:00 committed by Gitee
commit 43808a43d7
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 10 additions and 5 deletions

View File

@ -748,7 +748,14 @@ void Ability::InitConfigurationProperties(const Configuration& changeConfigurati
* *
*/ */
void Ability::OnMemoryLevel(int level) void Ability::OnMemoryLevel(int level)
{} {
HILOG_INFO("%{public}s start.", __func__);
if (scene_ == nullptr) {
HILOG_DEBUG("WindowScene is null");
return;
}
scene_->NotifyMemoryLevel(level);
}
/** /**
* @brief This is like openFile, open a file that need to be able to return sub-sections of filesoften assets * @brief This is like openFile, open a file that need to be able to return sub-sections of filesoften assets

View File

@ -494,10 +494,8 @@ int32_t AppRunningManager::NotifyMemoryLevel(int32_t level)
std::lock_guard<std::recursive_mutex> guard(lock_); std::lock_guard<std::recursive_mutex> guard(lock_);
for (const auto &item : appRunningRecordMap_) { for (const auto &item : appRunningRecordMap_) {
const auto &appRecord = item.second; const auto &appRecord = item.second;
if (appRecord->GetState() == ApplicationState::APP_STATE_BACKGROUND) { HILOG_INFO("Notification app [%{public}s]", appRecord->GetName().c_str());
HILOG_INFO("Notification app [%{public}s]", appRecord->GetName().c_str()); appRecord->ScheduleMemoryLevel(level);
appRecord->ScheduleMemoryLevel(level);
}
} }
return ERR_OK; return ERR_OK;
} }