!10772 restartAbility新增want参数标识重启

Merge pull request !10772 from 张昊峥/add_want_restart_flag
This commit is contained in:
openharmony_ci 2024-09-26 07:52:26 +00:00 committed by Gitee
commit f16ae21ef6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 9 additions and 0 deletions

View File

@ -66,6 +66,7 @@ const int32_t AUTO_DISCONNECT_INFINITY = -1;
constexpr const char* FROZEN_WHITE_DIALOG = "com.huawei.hmos.huaweicast";
constexpr char BUNDLE_NAME_DIALOG[] = "com.ohos.amsdialog";
constexpr char ABILITY_NAME_ASSERT_FAULT_DIALOG[] = "AssertFaultDialog";
constexpr const char* WANT_PARAMS_APP_RESTART_FLAG = "ohos.aafwk.app.restart";
const std::string XIAOYI_BUNDLE_NAME = "com.huawei.hmos.vassistant";
@ -2355,6 +2356,8 @@ void AbilityConnectManager::RestartAbility(const std::shared_ptr<AbilityRecord>
return;
}
requestInfo.want.SetParam(WANT_PARAMS_APP_RESTART_FLAG, true);
// restart other resident ability
if (abilityRecord->CanRestartResident()) {
requestInfo.restartCount = abilityRecord->GetRestartCount();

View File

@ -160,6 +160,7 @@ constexpr size_t INDEX_TWO = 2;
constexpr size_t ARGC_THREE = 3;
constexpr static char WANT_PARAMS_VIEW_DATA_KEY[] = "ohos.ability.params.viewData";
constexpr const char* WANT_PARAMS_HOST_WINDOW_ID_KEY = "ohos.extra.param.key.hostwindowid";
constexpr const char* WANT_PARAMS_APP_RESTART_FLAG = "ohos.aafwk.app.restart";
constexpr int32_t FOUNDATION_UID = 5523;
constexpr const char* FRS_BUNDLE_NAME = "com.ohos.formrenderservice";
@ -8385,6 +8386,7 @@ void AbilityManagerService::UpdateCallerInfo(Want& want, const sptr<IRemoteObjec
want.SetParam(Want::PARAM_RESV_CALLER_UID, callerUid);
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
if (!abilityRecord) {
@ -8461,6 +8463,7 @@ void AbilityManagerService::UpdateAsCallerInfoFromToken(Want& want, sptr<IRemote
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
auto abilityRecord = Token::GetAbilityRecordByToken(asCallerSourceToken);
if (abilityRecord == nullptr) {
@ -8494,6 +8497,7 @@ void AbilityManagerService::UpdateAsCallerInfoFromCallerRecord(Want& want, sptr<
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);
want.RemoveParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
auto callerRecord = Token::GetAbilityRecordByToken(callerToken);
CHECK_POINTER(callerRecord);
auto sourceInfo = callerRecord->GetCallerInfo();
@ -8531,6 +8535,7 @@ bool AbilityManagerService::UpdateAsCallerInfoFromDialog(Want& want)
want.SetParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME, callerBundleName);
want.SetParam(Want::PARAM_RESV_CALLER_ABILITY_NAME, callerAbilityName);
want.RemoveParam(Want::PARAM_RESV_CALLER_NATIVE_NAME);
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
if (callerBundleName == "") {
want.SetParam(Want::PARAM_RESV_CALLER_NATIVE_NAME,
dialogCallerWant.GetStringParam(Want::PARAM_RESV_CALLER_NATIVE_NAME));
@ -8557,6 +8562,7 @@ void AbilityManagerService::UpdateCallerInfoFromToken(Want& want, const sptr<IRe
want.SetParam(Want::PARAM_RESV_CALLER_UID, callerUid);
want.RemoveParam(Want::PARAM_RESV_CALLER_PID);
want.SetParam(Want::PARAM_RESV_CALLER_PID, callerPid);
want.RemoveParam(WANT_PARAMS_APP_RESTART_FLAG);
std::string callerBundleName = abilityRecord->GetAbilityInfo().bundleName;
want.RemoveParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);