!9152 添加日志和修改appIndex判断

Merge pull request !9152 from 于文泽/index
This commit is contained in:
openharmony_ci 2024-07-22 06:30:11 +00:00 committed by Gitee
commit 53b48907e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 12 additions and 2 deletions

View File

@ -18,6 +18,7 @@ ohos_shared_library("autostartupcallback") {
include_dirs = [
"./",
"${ability_runtime_napi_path}/inner/napi_common/",
"${ability_runtime_utils_path}/global/constant",
]
sources = [

View File

@ -14,6 +14,8 @@
*/
#include "js_ability_auto_startup_manager_utils.h"
#include "global_constant.h"
#include "hilog_tag_wrapper.h"
#include "napi_common_util.h"
@ -127,7 +129,7 @@ napi_value CreateJsAutoStartupInfo(napi_env env, const AutoStartupInfo &info)
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Create js AutoStartupInfo failed.");
return nullptr;
}
if (info.appCloneIndex != -1) {
if (info.appCloneIndex >= 0 && info.appCloneIndex < GlobalConstant::MAX_APP_CLONE_INDEX) {
napi_value appCloneIndex = AppExecFwk::WrapInt32ToJS(env, info.appCloneIndex);
if (appCloneIndex == nullptr) {
TAG_LOGE(AAFwkTag::AUTO_STARTUP, "Convert ability type name failed.");

View File

@ -948,6 +948,8 @@ int UIAbilityLifecycleManager::NotifySCBPendingActivation(sptr<SessionInfo> &ses
(sessionInfo->want).GetIntParam(Want::PARAM_RESV_WINDOW_HEIGHT, 0),
(sessionInfo->want).GetIntParam(Want::PARAM_RESV_WINDOW_WIDTH, 0),
(sessionInfo->want).GetIntParam(Want::PARAM_RESV_WINDOW_MODE, 0));
TAG_LOGI(AAFwkTag::ABILITYMGR, "appCloneIndex: %{public}d.",
(sessionInfo->want).GetIntParam(Want::PARAM_APP_CLONE_INDEX_KEY, 0));
auto abilityRecord = GetAbilityRecordByToken(abilityRequest.callerToken);
if (abilityRecord != nullptr && !abilityRecord->GetRestartAppFlag()) {
auto callerSessionInfo = abilityRecord->GetSessionInfo();

View File

@ -50,6 +50,7 @@ bool StartAbilityUtils::GetAppIndex(const Want &want, sptr<IRemoteObject> caller
appIndex = abilityRecord->GetAppIndex();
return true;
}
TAG_LOGI(AAFwkTag::ABILITYMGR, "appCloneIndex: %{public}d.", want.GetIntParam(Want::PARAM_APP_CLONE_INDEX_KEY, 0));
return AbilityRuntime::StartupUtil::GetAppIndex(want, appIndex);
}

View File

@ -25,13 +25,17 @@ namespace OHOS::AbilityRuntime {
bool StartupUtil::GetAppIndex(const AAFwk::Want &want, int32_t &appIndex)
{
appIndex = want.GetIntParam(ServerConstant::DLP_INDEX, 0);
if (appIndex > GlobalConstant::MAX_APP_CLONE_INDEX) {
return true;
}
if (appIndex == 0) {
appIndex = want.GetIntParam(AAFwk::Want::PARAM_APP_CLONE_INDEX_KEY, 0);
if (appIndex < 0 || appIndex > GlobalConstant::MAX_APP_CLONE_INDEX) {
return false;
}
return true;
}
return true;
return false;
}
int32_t StartupUtil::BuildAbilityInfoFlag()