mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
@@ -542,12 +542,16 @@ public:
|
||||
|
||||
bool IsEmptyKeepAliveApp() const;
|
||||
|
||||
bool IsMainProcess() const;
|
||||
|
||||
void SetEmptyKeepAliveAppState(bool isEmptyKeepAliveApp);
|
||||
|
||||
void SetKeepAliveEnableState(bool isKeepAliveEnable);
|
||||
|
||||
void SetSingleton(bool isSingleton);
|
||||
|
||||
void SetMainProcess(bool isMainProcess);
|
||||
|
||||
void SetStageModelState(bool isStageBasedModel);
|
||||
|
||||
std::list<std::shared_ptr<ModuleRunningRecord>> GetAllModuleRecord() const;
|
||||
@@ -849,6 +853,7 @@ private:
|
||||
|
||||
bool isKeepAliveApp_ = false; // Only resident processes can be set to true, please choose carefully
|
||||
bool isEmptyKeepAliveApp_ = false; // Only empty resident processes can be set to true, please choose carefully
|
||||
bool isMainProcess_ = true; // Only MainProcess can be keepalive
|
||||
bool isSingleton_ = false;
|
||||
bool isStageBasedModel_ = false;
|
||||
ApplicationState curState_ = ApplicationState::APP_STATE_CREATE; // current state of this process
|
||||
|
||||
@@ -634,6 +634,7 @@ void AppMgrServiceInner::LoadAbilityNoAppRecord(const std::shared_ptr<AppRunning
|
||||
}
|
||||
if (hapModuleInfo.isStageBasedModel && !IsMainProcess(appInfo, hapModuleInfo)) {
|
||||
appRecord->SetEmptyKeepAliveAppState(false);
|
||||
appRecord->SetMainProcess(false);
|
||||
TAG_LOGI(AAFwkTag::APPMGR, "The process %{public}s will not keepalive", hapModuleInfo.process.c_str());
|
||||
}
|
||||
// As taskHandler_ is busy now, the task should be submit to other task queue.
|
||||
@@ -3775,6 +3776,7 @@ void AppMgrServiceInner::StartSpecifiedAbility(const AAFwk::Want &want, const Ap
|
||||
}
|
||||
if (hapModuleInfo.isStageBasedModel && !IsMainProcess(appInfo, hapModuleInfo)) {
|
||||
appRecord->SetEmptyKeepAliveAppState(false);
|
||||
appRecord->SetMainProcess(false);
|
||||
TAG_LOGD(AAFwkTag::APPMGR, "The process %{public}s will not keepalive", hapModuleInfo.process.c_str());
|
||||
}
|
||||
auto wantPtr = std::make_shared<AAFwk::Want>(want);
|
||||
|
||||
@@ -1370,7 +1370,7 @@ bool AppRunningRecord::IsTerminating()
|
||||
|
||||
bool AppRunningRecord::IsKeepAliveApp() const
|
||||
{
|
||||
return isKeepAliveApp_ && isSingleton_;
|
||||
return isKeepAliveApp_ && isSingleton_ && isMainProcess_;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetKeepAliveEnableState(bool isKeepAliveEnable)
|
||||
@@ -1388,6 +1388,16 @@ void AppRunningRecord::SetEmptyKeepAliveAppState(bool isEmptyKeepAliveApp)
|
||||
isEmptyKeepAliveApp_ = isEmptyKeepAliveApp;
|
||||
}
|
||||
|
||||
bool AppRunningRecord::IsMainProcess() const
|
||||
{
|
||||
return isMainProcess_;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetMainProcess(bool isMainProcess)
|
||||
{
|
||||
isMainProcess_ = isMainProcess;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetSingleton(bool isSingleton)
|
||||
{
|
||||
isSingleton_ = isSingleton;
|
||||
|
||||
Reference in New Issue
Block a user