回退 'Pull Request !11663 : 增加UpgradeApp维测'

This commit is contained in:
jerry 2024-11-21 03:29:05 +00:00 committed by Gitee
parent 9c6b32b3e3
commit d2b92148f8
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 11 additions and 16 deletions

View File

@ -6679,8 +6679,7 @@ int32_t AbilityManagerService::UninstallAppInner(const std::string &bundleName,
CHECK_POINTER_AND_RETURN(subManagersHelper_, ERR_NULL_OBJECT);
subManagersHelper_->UninstallApp(bundleName, uid);
std::string killReason = isUpgrade ? "UpgradeApp" : "UninstallApp";
int ret = DelayedSingleton<AppScheduler>::GetInstance()->KillApplicationByUid(bundleName, uid, killReason);
int ret = DelayedSingleton<AppScheduler>::GetInstance()->KillApplicationByUid(bundleName, uid, "UninstallApp");
if (ret != ERR_OK) {
return UNINSTALL_APP_FAILED;
}

View File

@ -1009,14 +1009,14 @@ public:
return delayConfiguration_;
}
inline void SetKillReason(std::string killReason)
inline void SetClearSession(bool isClearSession)
{
killReason_ = killReason;
isClearSession_ = isClearSession;
}
inline std::string GetKillReason() const
inline bool IsClearSession() const
{
return killReason_;
return isClearSession_;
}
void AddAppLifecycleEvent(const std::string &msg);
@ -1185,10 +1185,10 @@ private:
bool hasUIAbilityLaunched_ = false;
bool isKia_ = false;
bool isNeedPreloadModule_ = false;
bool isClearSession_ = false;
std::shared_ptr<Configuration> delayConfiguration_ = std::make_shared<Configuration>();
bool isAllowedNWebPreload_ = false;
bool isUnSetPermission_ = false;
std::string killReason_ = "";
};
} // namespace AppExecFwk

View File

@ -1450,7 +1450,7 @@ void AppMgrServiceInner::ApplicationTerminated(const int32_t recordId)
auto uid = appRecord->GetUid();
bool foreground = appRecord->GetState() == ApplicationState::APP_STATE_FOREGROUND ||
appRecord->GetState() == ApplicationState::APP_STATE_FOCUS;
std::string killReason = appRecord->GetKillReason().empty() ? "Kill Reason:app exit" : appRecord->GetKillReason();
std::string killReason = appRecord->IsClearSession() ? "Kill Reason:ClearSession" : "Kill Reason:app exit";
auto result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT,
EVENT_KEY_PID, std::to_string(eventInfo.pid), EVENT_KEY_PROCESS_NAME, eventInfo.processName,
@ -1617,8 +1617,7 @@ int32_t AppMgrServiceInner::KillApplicationByUid(const std::string &bundleName,
int64_t startTime = SystemTimeMillisecond();
std::list<pid_t> pids;
TAG_LOGI(AAFwkTag::APPMGR, "uid value: %{public}d", uid);
KillProcessConfig config{false, false, reason};
if (!appRunningManager_->ProcessExitByBundleNameAndUid(bundleName, uid, pids, config)) {
if (!appRunningManager_->ProcessExitByBundleNameAndUid(bundleName, uid, pids)) {
TAG_LOGI(AAFwkTag::APPMGR, "unstart");
return result;
}
@ -2520,17 +2519,16 @@ int32_t AppMgrServiceInner::KillProcessByPidInner(const pid_t pid, const std::st
DelayedSingleton<CacheProcessManager>::GetInstance()->OnProcessKilled(appRecord);
eventInfo.pid = appRecord->GetPriorityObject()->GetPid();
eventInfo.processName = appRecord->GetProcessName();
std::string newReason = appRecord->GetKillReason().empty() ? killReason : appRecord->GetKillReason();
bool foreground = appRecord->GetState() == ApplicationState::APP_STATE_FOREGROUND ||
appRecord->GetState() == ApplicationState::APP_STATE_FOCUS;
AAFwk::EventReport::SendAppEvent(AAFwk::EventName::APP_TERMINATE, HiSysEventType::BEHAVIOR, eventInfo);
int result = HiSysEventWrite(OHOS::HiviewDFX::HiSysEvent::Domain::FRAMEWORK, "PROCESS_KILL",
OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, EVENT_KEY_PID, std::to_string(eventInfo.pid),
EVENT_KEY_PROCESS_NAME, eventInfo.processName, EVENT_KEY_MESSAGE, newReason,
EVENT_KEY_PROCESS_NAME, eventInfo.processName, EVENT_KEY_MESSAGE, killReason,
EVENT_KEY_FOREGROUND, foreground);
TAG_LOGW(AAFwkTag::APPMGR, "hisysevent write result=%{public}d, send event [FRAMEWORK,PROCESS_KILL], pid="
"%{public}d, processName=%{public}s, msg=%{public}s, FOREGROUND = %{public}d",
result, pid, eventInfo.processName.c_str(), newReason.c_str(), foreground);
result, pid, eventInfo.processName.c_str(), killReason.c_str(), foreground);
return ret;
}

View File

@ -365,7 +365,6 @@ bool AppRunningManager::ProcessExitByBundleNameAndUid(
KillingProcessManager::GetInstance().AddKillingCallerKey(callerKey);
}
appRecord->SetKilling();
appRecord->SetKillReason(config.reason);
appRecord->ScheduleProcessSecurityExit();
}
@ -689,8 +688,7 @@ void AppRunningManager::PrepareTerminate(const sptr<IRemoteObject> &token, bool
if (CheckAppRunningRecordIsLast(appRecord)) {
UnSetPolicy(appRecord);
}
std::string killReason = clearMissionFlag ? "Kill Reason:ClearSession" : "";
appRecord->SetKillReason(killReason);
appRecord->SetClearSession(clearMissionFlag);
}
}