mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-25 12:23:20 -04:00
!9050 【Bug】修复设置debug等待模式场景,ServiceAbility启动不等待的现象
Merge pull request !9050 from xinking129/aa_debug_0618
This commit is contained in:
@@ -1054,8 +1054,7 @@ public:
|
||||
int requestCode,
|
||||
AbilityRequest &request,
|
||||
const sptr<IRemoteObject> &callerToken,
|
||||
int32_t userId,
|
||||
bool isNeedSetDebugApp = true);
|
||||
int32_t userId);
|
||||
|
||||
/**
|
||||
* Get mission id by target ability token.
|
||||
@@ -2148,9 +2147,6 @@ private:
|
||||
|
||||
void WaitBootAnimationStart();
|
||||
|
||||
void SetDebugAppByWaitingDebugFlag(
|
||||
const Want &want, Want &requestWant, const std::string &bundleName, bool isDebugApp);
|
||||
|
||||
int32_t SignRestartAppFlag(int32_t userId, const std::string &bundleName);
|
||||
int32_t CheckRestartAppWant(const AAFwk::Want &want);
|
||||
|
||||
|
||||
@@ -1057,6 +1057,8 @@ private:
|
||||
|
||||
void PublishFileOpenEvent(const Want &want);
|
||||
|
||||
static void SetDebugAppByWaitingDebugFlag(Want &requestWant, const std::string &bundleName, bool isDebugApp);
|
||||
|
||||
#ifdef SUPPORT_SCREEN
|
||||
std::shared_ptr<Want> GetWantFromMission() const;
|
||||
void SetShowWhenLocked(const AppExecFwk::AbilityInfo &abilityInfo, sptr<AbilityTransitionInfo> &info) const;
|
||||
|
||||
@@ -1015,7 +1015,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
|
||||
return ShowPickerDialog(want, validUserId, callerToken);
|
||||
}
|
||||
#endif
|
||||
result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId, false);
|
||||
result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId);
|
||||
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||
std::string callerBundleName = abilityRecord ? abilityRecord->GetAbilityInfo().bundleName : "";
|
||||
bool selfFreeInstallEnable = (result == RESOLVE_ABILITY_ERR && want.GetElement().GetModuleName() != "" &&
|
||||
@@ -1042,7 +1042,7 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
|
||||
}
|
||||
int32_t ret = freeInstallManager_->StartFreeInstall(localWant, validUserId, requestCode, callerToken, false);
|
||||
if (ret == ERR_OK) {
|
||||
result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId, false);
|
||||
result = GenerateAbilityRequest(want, requestCode, abilityRequest, callerToken, validUserId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1217,9 +1217,6 @@ int AbilityManagerService::StartAbilityInner(const Want &want, const sptr<IRemot
|
||||
return uiAbilityManager->NotifySCBToStartUIAbility(abilityRequest);
|
||||
}
|
||||
|
||||
SetDebugAppByWaitingDebugFlag(
|
||||
want, abilityRequest.want, abilityRequest.appInfo.bundleName, abilityRequest.appInfo.debug);
|
||||
|
||||
auto missionListManager = GetMissionListManagerByUserId(oriValidUserId);
|
||||
if (missionListManager == nullptr) {
|
||||
TAG_LOGE(AAFwkTag::ABILITYMGR, "missionListManager is nullptr. userId=%{public}d", validUserId);
|
||||
@@ -5663,7 +5660,7 @@ void AbilityManagerService::StartHighestPriorityAbility(int32_t userId, bool isB
|
||||
}
|
||||
|
||||
int AbilityManagerService::GenerateAbilityRequest(const Want &want, int requestCode, AbilityRequest &request,
|
||||
const sptr<IRemoteObject> &callerToken, int32_t userId, bool isNeedSetDebugApp)
|
||||
const sptr<IRemoteObject> &callerToken, int32_t userId)
|
||||
{
|
||||
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
|
||||
auto abilityRecord = Token::GetAbilityRecordByToken(callerToken);
|
||||
@@ -5743,9 +5740,7 @@ int AbilityManagerService::GenerateAbilityRequest(const Want &want, int requestC
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Set start recent.");
|
||||
request.startRecent = true;
|
||||
}
|
||||
if (isNeedSetDebugApp) {
|
||||
SetDebugAppByWaitingDebugFlag(want, request.want, request.appInfo.bundleName, request.appInfo.debug);
|
||||
}
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
@@ -5775,7 +5770,6 @@ int AbilityManagerService::GenerateExtensionAbilityRequest(
|
||||
}
|
||||
|
||||
auto result = InitialAbilityRequest(request, *abilityInfo);
|
||||
SetDebugAppByWaitingDebugFlag(want, request.want, request.appInfo.bundleName, request.appInfo.debug);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -10413,22 +10407,6 @@ int32_t AbilityManagerService::GetUIExtensionRootHostInfo(const sptr<IRemoteObje
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void AbilityManagerService::SetDebugAppByWaitingDebugFlag(
|
||||
const Want &want, Want &requestWant, const std::string &bundleName, bool isDebugApp)
|
||||
{
|
||||
if (!isDebugApp || !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Not meeting the set debugging conditions.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IN_PROCESS_CALL(DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->IsWaitingDebugApp(bundleName))) {
|
||||
(const_cast<Want &>(want)).SetParam(DEBUG_APP, true);
|
||||
requestWant.SetParam(DEBUG_APP, true);
|
||||
IN_PROCESS_CALL_WITHOUT_RET(
|
||||
DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->ClearNonPersistWaitingDebugFlag());
|
||||
}
|
||||
}
|
||||
|
||||
int32_t AbilityManagerService::RestartApp(const AAFwk::Want &want)
|
||||
{
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "call.");
|
||||
|
||||
@@ -96,6 +96,8 @@ const std::string UIEXTENSION_ABILITY_ID = "ability.want.params.uiExtensionAbili
|
||||
const std::string UIEXTENSION_ROOT_HOST_PID = "ability.want.params.uiExtensionRootHostPid";
|
||||
constexpr const char* PARAM_SEND_RESULT_CALLER_BUNDLENAME = "ohos.anco.param.sendResultCallderBundleName";
|
||||
constexpr const char* PARAM_SEND_RESULT_CALLER_TOKENID = "ohos.anco.param.sendResultCallerTokenId";
|
||||
// Developer mode param
|
||||
constexpr const char* DEVELOPER_MODE_STATE = "const.security.developermode.state";
|
||||
const int32_t SHELL_ASSISTANT_DIETYPE = 0;
|
||||
int64_t AbilityRecord::abilityRecordId = 0;
|
||||
const int32_t DEFAULT_USER_ID = 0;
|
||||
@@ -269,6 +271,11 @@ std::shared_ptr<AbilityRecord> AbilityRecord::CreateAbilityRecord(const AbilityR
|
||||
std::shared_ptr<AbilityRecord> abilityRecord = std::make_shared<AbilityRecord>(
|
||||
abilityRequest.want, abilityRequest.abilityInfo, abilityRequest.appInfo, abilityRequest.requestCode);
|
||||
CHECK_POINTER_AND_RETURN(abilityRecord, nullptr);
|
||||
|
||||
Want newWant = abilityRecord->GetWant();
|
||||
SetDebugAppByWaitingDebugFlag(newWant, abilityRequest.appInfo.bundleName, abilityRequest.appInfo.debug);
|
||||
abilityRecord->SetWant(newWant);
|
||||
|
||||
abilityRecord->SetUid(abilityRequest.uid);
|
||||
int32_t appIndex = 0;
|
||||
(void)AbilityRuntime::StartupUtil::GetAppIndex(abilityRequest.want, appIndex);
|
||||
@@ -3524,5 +3531,19 @@ void AbilityRecord::SetSpecifyTokenId(uint32_t specifyTokenId)
|
||||
{
|
||||
specifyTokenId_ = specifyTokenId;
|
||||
}
|
||||
|
||||
void AbilityRecord::SetDebugAppByWaitingDebugFlag(Want &requestWant, const std::string &bundleName, bool isDebugApp)
|
||||
{
|
||||
if (!isDebugApp || !system::GetBoolParameter(DEVELOPER_MODE_STATE, false)) {
|
||||
TAG_LOGD(AAFwkTag::ABILITYMGR, "Not meeting the set debugging conditions.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (IN_PROCESS_CALL(DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->IsWaitingDebugApp(bundleName))) {
|
||||
requestWant.SetParam(DEBUG_APP, true);
|
||||
IN_PROCESS_CALL_WITHOUT_RET(
|
||||
DelayedSingleton<AppExecFwk::AppMgrClient>::GetInstance()->ClearNonPersistWaitingDebugFlag());
|
||||
}
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace OHOS
|
||||
|
||||
Reference in New Issue
Block a user