mirror of
https://github.com/openharmony/ability_ability_runtime.git
synced 2026-08-24 22:21:36 -04:00
@@ -1374,6 +1374,10 @@ void MainThread::HandleLaunchApplication(const AppLaunchData &appLaunchData, con
|
||||
options.uid = bundleInfo.applicationInfo.uid;
|
||||
options.apiTargetVersion = appInfo.apiTargetVersion;
|
||||
options.pkgContextInfoJsonStringMap = pkgContextInfoJsonStringMap;
|
||||
if (applicationInfo_->appProvisionType == Constants::APP_PROVISION_TYPE_DEBUG ) {
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "Start Mutile Thread Mode: %{public}d.", appLaunchData.GetMutileThread());
|
||||
options.isMultiThread = appLaunchData.GetMutileThread();
|
||||
}
|
||||
options.jitEnabled = appLaunchData.IsJITEnabled();
|
||||
AbilityRuntime::ChildProcessManager::GetInstance().SetForkProcessJITEnabled(appLaunchData.IsJITEnabled());
|
||||
if (!bundleInfo.hapModuleInfos.empty()) {
|
||||
|
||||
@@ -628,6 +628,8 @@ void JsRuntime::PostPreload(const Options& options)
|
||||
std::string sandBoxAnFilePath = SANDBOX_ARK_CACHE_PATH + options.arkNativeFilePath;
|
||||
postOption.SetAnDir(sandBoxAnFilePath);
|
||||
}
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "Start Mutile Thread Mode: %{public}d.", options.isMultiThread);
|
||||
postOption.SetMutileThreadCheck(options.isMultiThread);
|
||||
bool profileEnabled = OHOS::system::GetBoolParameter("ark.profile", false);
|
||||
postOption.SetEnableProfile(profileEnabled);
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "ASMM JIT Verify PostFork, jitEnabled: %{public}d", options.jitEnabled);
|
||||
@@ -803,6 +805,9 @@ bool JsRuntime::CreateJsEnv(const Options& options)
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "ASMM JIT Verify CreateJsEnv, jitEnabled: %{public}d", options.jitEnabled);
|
||||
pandaOption.SetEnableJIT(options.jitEnabled);
|
||||
|
||||
TAG_LOGD(AAFwkTag::JSRUNTIME, "Start Mutile Thread Mode: %{public}d.", options.isMultiThread);
|
||||
pandaOption.SetMutileThreadCheck(options.isMultiThread);
|
||||
|
||||
if (IsUseAbilityRuntime(options)) {
|
||||
// aot related
|
||||
bool aotEnabled = OHOS::system::GetBoolParameter("persist.ark.aot", true);
|
||||
|
||||
@@ -172,6 +172,16 @@ public:
|
||||
return perfCmd_;
|
||||
}
|
||||
|
||||
inline void SetMutileThread(const bool multiThread)
|
||||
{
|
||||
isMultiThread_ = multiThread;
|
||||
}
|
||||
|
||||
inline bool GetMutileThread() const
|
||||
{
|
||||
return isMultiThread_;
|
||||
}
|
||||
|
||||
inline void SetJITEnabled(const bool jitEnabled)
|
||||
{
|
||||
jitEnabled_ = jitEnabled;
|
||||
@@ -238,6 +248,7 @@ private:
|
||||
std::string perfCmd_;
|
||||
bool jitEnabled_ = false;
|
||||
bool isNativeStart_ = false;
|
||||
bool isMultiThread_ = false;
|
||||
std::string appRunningUniqueId_;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
|
||||
@@ -96,6 +96,12 @@ bool AppLaunchData::Marshalling(Parcel &parcel) const
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Marshalling, Failed to write app running unique id.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!parcel.WriteBool(isMultiThread_)) {
|
||||
TAG_LOGE(AAFwkTag::APPMGR, "Failed to write is multi thread flag.");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -140,6 +146,7 @@ bool AppLaunchData::ReadFromParcel(Parcel &parcel)
|
||||
jitEnabled_ = parcel.ReadBool();
|
||||
isNativeStart_ = parcel.ReadBool();
|
||||
appRunningUniqueId_ = parcel.ReadString();
|
||||
isMultiThread_ = parcel.ReadBool();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,6 +60,7 @@ public:
|
||||
bool isStageModel = true;
|
||||
bool isTestFramework = false;
|
||||
bool jitEnabled = false;
|
||||
bool isMultiThread = false;
|
||||
int32_t uid = -1;
|
||||
// ArkTsCard start
|
||||
bool isUnique = false;
|
||||
|
||||
@@ -69,6 +69,7 @@ using namespace OHOS::AAFwk::PermissionConstants;
|
||||
const std::string DEBUG_APP = "debugApp";
|
||||
const std::string NATIVE_DEBUG = "nativeDebug";
|
||||
const std::string PERF_CMD = "perfCmd";
|
||||
const std::string MULTI_THREAD = "multiThread";
|
||||
const std::string DMS_PROCESS_NAME = "distributedsched";
|
||||
const std::string DMS_MISSION_ID = "dmsMissionId";
|
||||
const std::string DMS_SRC_NETWORK_ID = "dmsSrcNetworkId";
|
||||
@@ -2497,6 +2498,9 @@ void AbilityRecord::SetWant(const Want &want)
|
||||
if (!perfCmd.empty()) {
|
||||
want_.SetParam(PERF_CMD, perfCmd);
|
||||
}
|
||||
if (multiThread) {
|
||||
want_.SetParam(MULTI_THREAD, true);
|
||||
}
|
||||
}
|
||||
|
||||
Want AbilityRecord::GetWant() const
|
||||
|
||||
@@ -593,6 +593,7 @@ public:
|
||||
bool IsDebugging() const;
|
||||
void SetNativeDebug(bool isNativeDebug);
|
||||
void SetPerfCmd(const std::string &perfCmd);
|
||||
void SetMultiThread(const bool multiThread);
|
||||
void AddRenderRecord(const std::shared_ptr<RenderRecord> &record);
|
||||
void RemoveRenderRecord(const std::shared_ptr<RenderRecord> &record);
|
||||
std::shared_ptr<RenderRecord> GetRenderRecordByPid(const pid_t pid);
|
||||
@@ -743,7 +744,7 @@ public:
|
||||
|
||||
void SetAssertionPauseFlag(bool flag);
|
||||
bool IsAssertionPause() const;
|
||||
|
||||
|
||||
void SetJITEnabled(const bool jitEnabled);
|
||||
bool IsJITEnabled() const;
|
||||
|
||||
@@ -896,6 +897,7 @@ private:
|
||||
bool isRestartApp_ = false; // Only app calling RestartApp can be set to true
|
||||
bool isAssertPause_ = false;
|
||||
bool isNativeStart_ = false;
|
||||
bool isMultiThread_ = false;
|
||||
};
|
||||
} // namespace AppExecFwk
|
||||
} // namespace OHOS
|
||||
|
||||
@@ -116,6 +116,7 @@ const std::string FUNC_NAME = "main";
|
||||
const std::string RENDER_PARAM = "invalidparam";
|
||||
const std::string COLD_START = "coldStart";
|
||||
const std::string PERF_CMD = "perfCmd";
|
||||
const std::string MULTI_THREAD = "multiThread";
|
||||
const std::string DEBUG_CMD = "debugCmd";
|
||||
const std::string ENTER_SANDBOX = "sandboxApp";
|
||||
const std::string DLP_PARAMS_INDEX = "ohos.dlp.params.index";
|
||||
@@ -1569,6 +1570,7 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(spt
|
||||
appRecord->SetDebugApp(true);
|
||||
}
|
||||
appRecord->SetPerfCmd(want->GetStringParam(PERF_CMD));
|
||||
appRecord->SetMultiThread(want->GetBoolParam(MULTI_THREAD, false));
|
||||
appRecord->SetAppIndex(want->GetIntParam(DLP_PARAMS_INDEX, 0));
|
||||
appRecord->SetSecurityFlag(want->GetBoolParam(DLP_PARAMS_SECURITY_FLAG, false));
|
||||
appRecord->SetRequestProcCode(want->GetIntParam(Want::PARAM_RESV_REQUEST_PROC_CODE, 0));
|
||||
@@ -3372,6 +3374,7 @@ void AppMgrServiceInner::StartSpecifiedAbility(const AAFwk::Want &want, const Ap
|
||||
appRecord->SetDebugApp(true);
|
||||
}
|
||||
appRecord->SetPerfCmd(wantPtr->GetStringParam(PERF_CMD));
|
||||
appRecord->SetMultiThread(wantPtr->GetBoolParam(MULTI_THREAD, false));
|
||||
}
|
||||
appRecord->SetProcessAndExtensionType(abilityInfoPtr);
|
||||
appRecord->SetTaskHandler(taskHandler_);
|
||||
|
||||
@@ -433,6 +433,7 @@ void AppRunningRecord::LaunchApplication(const Configuration &config)
|
||||
launchData.SetAppIndex(appIndex_);
|
||||
launchData.SetDebugApp(isDebugApp_);
|
||||
launchData.SetPerfCmd(perfCmd_);
|
||||
launchData.SetMutileThread(isMultiThread_);
|
||||
launchData.SetJITEnabled(jitEnabled_);
|
||||
launchData.SetNativeStart(isNativeStart_);
|
||||
launchData.SetAppRunningUniqueId(std::to_string(startTimeMillis_));
|
||||
@@ -1630,6 +1631,11 @@ void AppRunningRecord::SetPerfCmd(const std::string &perfCmd)
|
||||
perfCmd_ = perfCmd;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetMultiThread(const bool multiThread)
|
||||
{
|
||||
isMultiThread_ = multiThread;
|
||||
}
|
||||
|
||||
void AppRunningRecord::SetAppIndex(const int32_t appIndex)
|
||||
{
|
||||
appIndex_ = appIndex;
|
||||
|
||||
@@ -568,8 +568,10 @@ HWTEST_F(AbilityRecordTest, AaFwk_AbilityMS_Want, TestSize.Level1)
|
||||
{
|
||||
Want want;
|
||||
want.SetFlags(100);
|
||||
want.SetParam("multiThread", true);
|
||||
abilityRecord_->SetWant(want);
|
||||
EXPECT_EQ(want.GetFlags(), abilityRecord_->GetWant().GetFlags());
|
||||
EXPECT_EQ(want.GetBoolParam("multiThread",false), abilityRecord_->GetWant().GetBoolParam("multiThread",false));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1198,6 +1198,12 @@ HWTEST_F(AppMgrServiceInnerTest, CreateAppRunningRecord_001, TestSize.Level0)
|
||||
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
|
||||
EXPECT_EQ(appRecord5, nullptr);
|
||||
|
||||
appMgrServiceInner->appRunningManager_ = nullptr;
|
||||
want->SetParam("multiThread", false);
|
||||
std::shared_ptr<AppRunningRecord> appRecord6 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
|
||||
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
|
||||
EXPECT_EQ(appRecord6, nullptr);
|
||||
|
||||
TAG_LOGI(AAFwkTag::TEST, "CreateAppRunningRecord_001 end");
|
||||
}
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ const std::string HELP_MSG_START =
|
||||
"usage: aa start <options>\n"
|
||||
"options list:\n"
|
||||
" -h, --help list available commands\n"
|
||||
" [-d <device-id>] [-a <ability-name> -b <bundle-name>] [-m <module-name>] [-D] [-S] "
|
||||
" [-d <device-id>] [-a <ability-name> -b <bundle-name>] [-m <module-name>] [-p <perf-cmd>] [-D] [-S] [-N] [-R]"
|
||||
" [--ps <key> <string-value>] "
|
||||
" [--pi <key> <integer-value>] "
|
||||
" [--pb <key> <boolean-value>] "
|
||||
|
||||
@@ -47,7 +47,7 @@ constexpr int OPTION_PARAMETER_NULL_STRING = 260;
|
||||
|
||||
const std::string DEVELOPERMODE_STATE = "const.security.developermode.state";
|
||||
|
||||
const std::string SHORT_OPTIONS = "ch:d:a:b:e:t:p:s:m:A:U:CDSN";
|
||||
const std::string SHORT_OPTIONS = "ch:d:a:b:e:t:p:s:m:A:U:CDSNR";
|
||||
constexpr struct option LONG_OPTIONS[] = {
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"device", required_argument, nullptr, 'd'},
|
||||
@@ -59,6 +59,7 @@ constexpr struct option LONG_OPTIONS[] = {
|
||||
{"cold-start", no_argument, nullptr, 'C'},
|
||||
{"debug", no_argument, nullptr, 'D'},
|
||||
{"native-debug", no_argument, nullptr, 'N'},
|
||||
{"mutil-thread", no_argument, nullptr,'R'},
|
||||
{"action", required_argument, nullptr, 'A'},
|
||||
{"URI", required_argument, nullptr, 'U'},
|
||||
{"entity", required_argument, nullptr, 'e'},
|
||||
@@ -1398,6 +1399,7 @@ ErrCode AbilityManagerShellCommand::MakeWantFromCmd(Want& want, std::string& win
|
||||
bool isContinuation = false;
|
||||
bool isSandboxApp = false;
|
||||
bool isNativeDebug = false;
|
||||
bool isMultiThread = false;
|
||||
|
||||
while (true) {
|
||||
counter++;
|
||||
@@ -1796,6 +1798,10 @@ ErrCode AbilityManagerShellCommand::MakeWantFromCmd(Want& want, std::string& win
|
||||
isNativeDebug = true;
|
||||
break;
|
||||
}
|
||||
case 'R': {
|
||||
isMultiThread = true;
|
||||
TAG_LOGD(AAFwkTag::AA_TOOL, "isMultiThread");
|
||||
}
|
||||
case 0: {
|
||||
break;
|
||||
}
|
||||
@@ -1858,6 +1864,9 @@ ErrCode AbilityManagerShellCommand::MakeWantFromCmd(Want& want, std::string& win
|
||||
if (!typeVal.empty()) {
|
||||
want.SetType(typeVal);
|
||||
}
|
||||
if (isMultiThread) {
|
||||
want.SetParam("multiThread", isMultiThread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user