Signed-off-by: sodanotgreen <limengzheng@huawei.com>
This commit is contained in:
sodanotgreen
2024-06-17 12:04:59 +08:00
parent 0d8aabc2c1
commit dd09a34bbc
9 changed files with 16 additions and 20 deletions
@@ -465,14 +465,14 @@ void AppRecovery::DeleteInValidMissionFileById(std::string fileDir, int32_t miss
void AppRecovery::ClearPageStack(std::string bundleName)
{
TAG_LOGI(AAFwkTag::RECOVERY, "AppRecovery ClearPageStack");
TAG_LOGI(AAFwkTag::RECOVERY, "AppRecovery ClearPageStack %{public}s", bundleName.c_str());
DeleteInValidMissionFiles();
std::shared_ptr<AAFwk::AbilityManagerClient> abilityMgr = AAFwk::AbilityManagerClient::GetInstance();
if (abilityMgr == nullptr) {
TAG_LOGE(AAFwkTag::RECOVERY, "AppRecovery ClearPageStack. abilityMgr client is not exist.");
return;
}
abilityMgr->ScheduleClearRecoveryPageStack(bundleName);
abilityMgr->ScheduleClearRecoveryPageStack();
}
bool AppRecovery::GetMissionIds(std::string path, std::vector<int32_t> &missionIds)
@@ -1184,7 +1184,7 @@ public:
*
* @param bundleName application bundleName.
*/
void ScheduleClearRecoveryPageStack(const std::string& bundleName);
void ScheduleClearRecoveryPageStack();
/**
* @brief Add free install observer.
@@ -1148,7 +1148,7 @@ public:
virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
const Want *want = nullptr) {};
virtual void ScheduleClearRecoveryPageStack(const std::string& bundleName) {};
virtual void ScheduleClearRecoveryPageStack() {};
/**
* Called to verify that the MissionId is valid.
@@ -907,7 +907,7 @@ public:
virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
const Want *want = nullptr) override;
virtual void ScheduleClearRecoveryPageStack(const std::string& bundleName) override;
virtual void ScheduleClearRecoveryPageStack() override;
/**
* Called to verify that the MissionId is valid.
@@ -1319,7 +1319,7 @@ public:
virtual void ScheduleRecoverAbility(const sptr<IRemoteObject> &token, int32_t reason,
const Want *want = nullptr) override;
virtual void ScheduleClearRecoveryPageStack(const std::string& bundleName) override;
virtual void ScheduleClearRecoveryPageStack() override;
/**
* Called to verify that the MissionId is valid.
@@ -1397,11 +1397,11 @@ void AbilityManagerClient::ScheduleRecoverAbility(sptr<IRemoteObject> token, int
return abms->ScheduleRecoverAbility(token, reason, want);
}
void AbilityManagerClient::ScheduleClearRecoveryPageStack(const std::string& bundleName)
void AbilityManagerClient::ScheduleClearRecoveryPageStack()
{
auto abms = GetAbilityManager();
CHECK_POINTER_RETURN(abms);
return abms->ScheduleClearRecoveryPageStack(bundleName);
return abms->ScheduleClearRecoveryPageStack();
}
#ifdef ABILITY_COMMAND_FOR_TEST
@@ -1739,7 +1739,7 @@ int AbilityManagerProxy::KillProcess(const std::string &bundleName, const bool c
return reply.ReadInt32();
}
void AbilityManagerProxy::ScheduleClearRecoveryPageStack(const std::string &bundleName)
void AbilityManagerProxy::ScheduleClearRecoveryPageStack()
{
MessageParcel data;
MessageParcel reply;
@@ -1749,10 +1749,6 @@ void AbilityManagerProxy::ScheduleClearRecoveryPageStack(const std::string &bund
TAG_LOGE(AAFwkTag::ABILITYMGR, "ScheduleClearRecoveryPageStack WriteInterfaceToken failed.");
return;
}
if (!data.WriteString16(Str8ToStr16(bundleName))) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "bundleName write failed.");
return;
}
int error = SendRequest(AbilityManagerInterfaceCode::CLEAR_RECOVERY_PAGE_STACK, data, reply, option);
if (error != NO_ERROR) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "Send request error: %{public}d", error);
@@ -7167,9 +7167,14 @@ void AbilityManagerService::EnableRecoverAbility(const sptr<IRemoteObject>& toke
}
}
void AbilityManagerService::ScheduleClearRecoveryPageStack(const std::string& bundleName)
void AbilityManagerService::ScheduleClearRecoveryPageStack()
{
int32_t callerUid = IPCSkeleton::GetCallingUid();
std::string bundleName;
if (IN_PROCESS_CALL(bms->GetNameForUid(uid, bundleName)) != ERR_OK) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "VerifyPermission failed to get bundle name by uid");
return CHECK_PERMISSION_FAILED;
}
TAG_LOGI(AAFwkTag::ABILITYMGR, "ScheduleClearRecoveryPageStack bundleName = %{public}s, callerUid = %{public}d",
bundleName.c_str(), callerUid);
(void)DelayedSingleton<AbilityRuntime::AppExitReasonDataManager>::GetInstance()->
@@ -2350,12 +2350,7 @@ int AbilityManagerStub::EnableRecoverAbilityInner(MessageParcel &data, MessagePa
int AbilityManagerStub::ScheduleClearRecoveryPageStackInner(MessageParcel &data, MessageParcel &reply)
{
std::string bundleName = Str16ToStr8(data.ReadString16());
if (bundleName.empty()) {
TAG_LOGE(AAFwkTag::ABILITYMGR, "ScheduleClearRecoveryPageStackInner read bundleName failed.");
return ERR_NULL_OBJECT;
}
ScheduleClearRecoveryPageStack(bundleName);
ScheduleClearRecoveryPageStack();
return NO_ERROR;
}