Expose ability record id to outside

Signed-off-by: wangzhen <wangzhen346@huawei.com>
Change-Id: Ib2923a130829f6c30b3a594607d47f035c036c3f
This commit is contained in:
wangzhen 2024-03-17 18:23:38 +08:00
parent 5a8a853e28
commit 6afafdc511
79 changed files with 501 additions and 431 deletions

View File

@ -327,6 +327,17 @@ sptr<IRemoteObject> AbilityContextImpl::GetSessionToken()
return sessionToken_.promote();
}
void AbilityContextImpl::SetAbilityRecordId(int32_t abilityRecordId)
{
HILOG_INFO("abilityRecordId: %{public}d.", abilityRecordId);
abilityRecordId_ = abilityRecordId;
}
int32_t AbilityContextImpl::GetAbilityRecordId()
{
return abilityRecordId_;
}
void AbilityContextImpl::OnAbilityResult(int requestCode, int resultCode, const AAFwk::Want& resultData)
{
HILOG_DEBUG("Start calling OnAbilityResult.");

View File

@ -90,13 +90,13 @@ std::shared_ptr<AppExecFwk::ContextDeal> UIAbilityThread::CreateAndInitContextDe
HILOG_ERROR("ContextDeal is nullptr.");
return contextDeal;
}
auto abilityInfo = abilityRecord->GetAbilityInfo();
if (abilityInfo == nullptr) {
HILOG_ERROR("ContextDeal is nullptr.");
return nullptr;
}
contextDeal->SetAbilityInfo(abilityInfo);
contextDeal->SetApplicationInfo(application->GetApplicationInfo());
abilityObject->SetProcessInfo(application->GetProcessInfo());
@ -137,6 +137,7 @@ void UIAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplication>
HILOG_ERROR("Ability is nullptr.");
return;
}
ability->SetAbilityRecordId(abilityRecord->GetAbilityRecordId());
currentAbility_.reset(ability);
token_ = abilityRecord->GetToken();
abilityRecord->SetEventHandler(abilityHandler_);
@ -148,8 +149,8 @@ void UIAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplication>
ability->AttachBaseContext(contextDeal);
// new hap requires
ability->AttachAbilityContext(
BuildAbilityContext(abilityRecord->GetAbilityInfo(), application, token_, stageContext));
ability->AttachAbilityContext(BuildAbilityContext(abilityRecord->GetAbilityInfo(),
application, token_, stageContext, abilityRecord->GetAbilityRecordId()));
AttachInner(application, abilityRecord, stageContext);
}
@ -209,7 +210,7 @@ void UIAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplication>
HILOG_ERROR("Ability is nullptr.");
return;
}
ability->SetAbilityRecordId(abilityRecord->GetAbilityRecordId());
currentAbility_.reset(ability);
token_ = abilityRecord->GetToken();
abilityRecord->SetEventHandler(abilityHandler_);
@ -221,8 +222,8 @@ void UIAbilityThread::Attach(const std::shared_ptr<AppExecFwk::OHOSApplication>
ability->AttachBaseContext(contextDeal);
// new hap requires
ability->AttachAbilityContext(
BuildAbilityContext(abilityRecord->GetAbilityInfo(), application, token_, stageContext));
ability->AttachAbilityContext(BuildAbilityContext(abilityRecord->GetAbilityInfo(),
application, token_, stageContext, abilityRecord->GetAbilityRecordId()));
AttachInner(application, abilityRecord, stageContext);
HILOG_DEBUG("End.");
@ -505,7 +506,7 @@ void UIAbilityThread::NotifyMemoryLevel(int32_t level)
std::shared_ptr<AbilityContext> UIAbilityThread::BuildAbilityContext(
const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo,
const std::shared_ptr<AppExecFwk::OHOSApplication> &application, const sptr<IRemoteObject> &token,
const std::shared_ptr<Context> &stageContext)
const std::shared_ptr<Context> &stageContext, int32_t abilityRecordId)
{
auto abilityContextImpl = std::make_shared<AbilityContextImpl>();
if (abilityContextImpl == nullptr) {
@ -516,6 +517,7 @@ std::shared_ptr<AbilityContext> UIAbilityThread::BuildAbilityContext(
abilityContextImpl->SetToken(token);
abilityContextImpl->SetAbilityInfo(abilityInfo);
abilityContextImpl->SetConfiguration(application->GetConfiguration());
abilityContextImpl->SetAbilityRecordId(abilityRecordId);
return abilityContextImpl;
}

View File

@ -735,7 +735,7 @@ void MainThread::ScheduleAbilityStage(const HapModuleInfo &abilityStage)
}
void MainThread::ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
const std::shared_ptr<AAFwk::Want> &want)
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
HILOG_DEBUG("ability %{public}s, type is %{public}d.", info.name.c_str(), info.type);
@ -743,8 +743,9 @@ void MainThread::ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemo
AAFwk::Want newWant(*want);
newWant.CloseAllFd();
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>(info);
std::shared_ptr<AbilityLocalRecord> abilityRecord = std::make_shared<AbilityLocalRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityLocalRecord>(abilityInfo, token);
abilityRecord->SetWant(want);
abilityRecord->SetAbilityRecordId(abilityRecordId);
FreezeUtil::LifecycleFlow flow = { token, FreezeUtil::TimeoutState::LOAD };
std::string entry = std::to_string(AbilityRuntime::TimeUtil::SystemTimeMillisecond()) +

View File

@ -60,6 +60,7 @@ struct AbilityStateData : public Parcelable {
std::string callerBundleName;
std::string callerAbilityName;
bool isAtomicService = false;
int32_t abilityRecordId = 0;
};
} // namespace AppExecFwk
} // namespace OHOS

View File

@ -45,7 +45,7 @@ public:
*/
virtual void LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want) = 0;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) {};
/**
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.

View File

@ -38,7 +38,7 @@ public:
*/
virtual void LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want) override;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
/**
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.
@ -116,7 +116,7 @@ public:
* @return ERR_OK, return back success, others fail.
*/
virtual int32_t KillProcessWithAccount(const std::string &bundleName, const int accountId) override;
/**
* UpdateApplicationInfoInstalled, call UpdateApplicationInfoInstalled() through proxy object,
* update the application info after new module installed.

View File

@ -61,8 +61,9 @@ public:
* @param want Want.
* @return Returns RESULT_OK on success, others on failure.
*/
virtual AppMgrResultCode LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want);
virtual AppMgrResultCode LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want,
int32_t abilityRecordId);
/**
* Terminate ability.

View File

@ -135,7 +135,7 @@ public:
virtual void ScheduleAbilityStage(const HapModuleInfo &) = 0;
virtual void ScheduleLaunchAbility(const AbilityInfo &, const sptr<IRemoteObject> &,
const std::shared_ptr<AAFwk::Want> &want) = 0;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) = 0;
/**
* ScheduleCleanAbility, call ScheduleCleanAbility() through proxy project,

View File

@ -136,7 +136,7 @@ public:
* @return
*/
virtual void ScheduleLaunchAbility(const AbilityInfo &, const sptr<IRemoteObject> &,
const std::shared_ptr<AAFwk::Want> &want) override;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
/**
* ScheduleCleanAbility, call ScheduleCleanAbility() through proxy project,

View File

@ -63,7 +63,7 @@ bool AbilityStateData::Marshalling(Parcel &parcel) const
if (!parcel.WriteString(callerAbilityName)) {
return false;
}
if (!parcel.WriteBool(isAtomicService)) {
if (!parcel.WriteBool(isAtomicService) || !parcel.WriteInt32(abilityRecordId)) {
return false;
}
return true;
@ -95,6 +95,7 @@ bool AbilityStateData::ReadFromParcel(Parcel &parcel)
callerAbilityName = parcel.ReadString();
isAtomicService = parcel.ReadBool();
abilityRecordId = parcel.ReadInt32();
return true;
}

View File

@ -34,10 +34,27 @@ bool AmsMgrProxy::WriteInterfaceToken(MessageParcel &data)
}
return true;
}
namespace {
bool WriteTokenObject(MessageParcel &data, sptr<IRemoteObject> token)
{
if (token) {
if (!data.WriteBool(true) || !data.WriteRemoteObject(token)) {
HILOG_ERROR("Failed to write flag or token");
return false;
}
} else {
if (!data.WriteBool(false)) {
HILOG_ERROR("Failed to write flag");
return false;
}
}
return true;
}
}
void AmsMgrProxy::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want)
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId)
{
HILOG_DEBUG("start");
if (!abilityInfo || !appInfo) {
@ -52,28 +69,11 @@ void AmsMgrProxy::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemo
return;
}
if (token) {
if (!data.WriteBool(true) || !data.WriteRemoteObject(token)) {
HILOG_ERROR("Failed to write flag and token");
return;
}
} else {
if (!data.WriteBool(false)) {
HILOG_ERROR("Failed to write flag");
return;
}
if (!WriteTokenObject(data, token)) {
return;
}
if (preToken) {
if (!data.WriteBool(true) || !data.WriteRemoteObject(preToken)) {
HILOG_ERROR("Failed to write flag and preToken");
return;
}
} else {
if (!data.WriteBool(false)) {
HILOG_ERROR("Failed to write flag");
return;
}
if (!WriteTokenObject(data, preToken)) {
return;
}
data.WriteParcelable(abilityInfo.get());
@ -82,6 +82,10 @@ void AmsMgrProxy::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemo
HILOG_ERROR("Write data want failed.");
return;
}
if (!data.WriteInt32(abilityRecordId)) {
HILOG_ERROR("Write data abilityRecordId failed.");
return;
}
int32_t ret = SendTransactCmd(static_cast<uint32_t>(IAmsMgr::Message::LOAD_ABILITY), data, reply, option);
if (ret != NO_ERROR) {
@ -786,7 +790,7 @@ int32_t AmsMgrProxy::RegisterAbilityDebugResponse(const sptr<IAbilityDebugRespon
HILOG_ERROR("Write interface token failed.");
return ERR_INVALID_DATA;
}
if (response == nullptr || !data.WriteRemoteObject(response->AsObject())) {
HILOG_ERROR("Failed to write remote object.");
return ERR_INVALID_DATA;

View File

@ -153,8 +153,9 @@ ErrCode AmsMgrStub::HandleLoadAbility(MessageParcel &data, MessageParcel &reply)
HILOG_ERROR("ReadParcelable want failed");
return ERR_APPEXECFWK_PARCEL_ERROR;
}
int32_t abilityRecordId = data.ReadInt32();
LoadAbility(token, preToke, abilityInfo, appInfo, want);
LoadAbility(token, preToke, abilityInfo, appInfo, want, abilityRecordId);
return NO_ERROR;
}

View File

@ -127,8 +127,9 @@ AppMgrClient::AppMgrClient()
AppMgrClient::~AppMgrClient()
{}
AppMgrResultCode AppMgrClient::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want)
AppMgrResultCode AppMgrClient::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AbilityInfo &abilityInfo, const ApplicationInfo &appInfo, const AAFwk::Want &want,
int32_t abilityRecordId)
{
sptr<IAppMgr> service = iface_cast<IAppMgr>(mgrHolder_->GetRemoteObject());
if (service != nullptr) {
@ -138,7 +139,7 @@ AppMgrResultCode AppMgrClient::LoadAbility(const sptr<IRemoteObject> &token, con
std::shared_ptr<AbilityInfo> abilityInfoPtr = std::make_shared<AbilityInfo>(abilityInfo);
std::shared_ptr<ApplicationInfo> appInfoPtr = std::make_shared<ApplicationInfo>(appInfo);
std::shared_ptr<AAFwk::Want> wantPtr = std::make_shared<AAFwk::Want>(want);
amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr, wantPtr);
amsService->LoadAbility(token, preToken, abilityInfoPtr, appInfoPtr, wantPtr, abilityRecordId);
return AppMgrResultCode::RESULT_OK;
}
}

View File

@ -187,7 +187,8 @@ int32_t AppSchedulerHost::HandleScheduleLaunchAbility(MessageParcel &data, Messa
}
std::shared_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>());
ScheduleLaunchAbility(*abilityInfo, token, want);
auto abilityRecordId = data.ReadInt32();
ScheduleLaunchAbility(*abilityInfo, token, want, abilityRecordId);
return NO_ERROR;
}

View File

@ -179,7 +179,7 @@ void AppSchedulerProxy::ScheduleMemoryCommon(const int32_t level, const uint32_t
}
void AppSchedulerProxy::ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
const std::shared_ptr<AAFwk::Want> &want)
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId)
{
MessageParcel data;
MessageParcel reply;
@ -205,6 +205,10 @@ void AppSchedulerProxy::ScheduleLaunchAbility(const AbilityInfo &info, const spt
HILOG_ERROR("write want fail.");
return;
}
if (!data.WriteInt32(abilityRecordId)) {
HILOG_ERROR("write ability record id fail.");
return;
}
int32_t ret = SendTransactCmd(
static_cast<uint32_t>(IAppScheduler::Message::SCHEDULE_LAUNCH_ABILITY_TRANSACTION), data, reply, option);
if (ret != NO_ERROR) {

View File

@ -166,7 +166,7 @@ public:
virtual void OnAbilityResult(int requestCode, int resultCode, const AAFwk::Want &resultData) = 0;
virtual ErrCode RequestModalUIExtension(const AAFwk::Want& want) = 0;
virtual ErrCode OpenAtomicService(AAFwk::Want& want, const AAFwk::StartOptions &options, int requestCode,
RuntimeTask &&task) = 0;
@ -279,6 +279,8 @@ public:
virtual void RegisterAbilityCallback(std::weak_ptr<AppExecFwk::IAbilityCallback> abilityCallback) = 0;
virtual void SetWeakSessionToken(const wptr<IRemoteObject>& sessionToken) = 0;
virtual void SetAbilityRecordId(int32_t abilityRecordId) = 0;
virtual int32_t GetAbilityRecordId() = 0;
/**
* @brief Requests dialogService from the system.

View File

@ -189,6 +189,8 @@ public:
}
void SetWeakSessionToken(const wptr<IRemoteObject>& sessionToken) override;
void SetAbilityRecordId(int32_t abilityRecordId) override;
int32_t GetAbilityRecordId() override;
void SetTerminating(bool state) override
{
@ -200,7 +202,7 @@ public:
ErrCode ReportDrawnCompleted() override;
ErrCode GetMissionId(int32_t &missionId) override;
/**
* @brief Set mission continue state of this ability.
*
@ -284,6 +286,7 @@ private:
std::weak_ptr<AppExecFwk::IAbilityCallback> abilityCallback_;
bool isTerminating_ = false;
int32_t missionId_ = -1;
int32_t abilityRecordId_ = 0;
std::mutex sessionTokenMutex_;
wptr<IRemoteObject> sessionToken_;
std::mutex uiExtensionMutex_;

View File

@ -174,6 +174,15 @@ public:
*/
void StartAbilities(const std::vector<AAFwk::Want> &wants) override;
void SetAbilityRecordId(int32_t abilityRecordId)
{
abilityRecordId_ = abilityRecordId;
}
int32_t GetAbilityRecordId() const
{
return abilityRecordId_;
}
friend DataAbilityHelper;
friend OHOS::DataShare::DataShareHelper;
static int ABILITY_CONTEXT_DEFAULT_REQUEST_CODE;
@ -192,6 +201,7 @@ protected:
std::map<sptr<AAFwk::IAbilityConnection>, sptr<IRemoteObject>> abilityConnectionMap_;
std::mutex sessionTokenMutex_;
sptr<IRemoteObject> sessionToken_;
int32_t abilityRecordId_ = 0;
private:
/**

View File

@ -86,6 +86,15 @@ public:
*/
const sptr<IRemoteObject> &GetToken();
int32_t GetAbilityRecordId() const
{
return abilityRecordId_;
}
void SetAbilityRecordId(int32_t abilityRecordId)
{
abilityRecordId_ = abilityRecordId;
}
/**
* @description: Obtains the information based on ability thread.
* @return return AbilityThread Pointer
@ -105,6 +114,7 @@ public:
private:
std::shared_ptr<AbilityInfo> abilityInfo_ = nullptr;
sptr<IRemoteObject> token_;
int32_t abilityRecordId_ = 0;
std::shared_ptr<EventRunner> runner_ = nullptr;
std::shared_ptr<EventHandler> handler_ = nullptr;
std::shared_ptr<AbilityImpl> abilityImpl_ = nullptr; // store abilityImpl

View File

@ -157,6 +157,13 @@ public:
void HandleExecuteInsightIntentBackground(const AAFwk::Want &want, bool onlyExecuteIntent = false);
void SetAbilityRecordId(int32_t abilityRecordId)
{
if (ability_ != nullptr) {
ability_->SetAbilityRecordId(abilityRecordId);
}
}
#ifdef SUPPORT_GRAPHICS
public:

View File

@ -166,7 +166,7 @@ private:
std::shared_ptr<AbilityContext> BuildAbilityContext(
const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo,
const std::shared_ptr<AppExecFwk::OHOSApplication> &application, const sptr<IRemoteObject> &token,
const std::shared_ptr<AbilityRuntime::Context> &stageContext);
const std::shared_ptr<AbilityRuntime::Context> &stageContext, int32_t abilityRecordId);
void HandleAbilityTransaction(const Want &want, const LifeCycleStateInfo &lifeCycleStateInfo,
sptr<AAFwk::SessionInfo> sessionInfo = nullptr);
void HandleShareData(const int32_t &requestCode);

View File

@ -212,7 +212,7 @@ public:
void ScheduleAbilityStage(const HapModuleInfo &abilityStage) override;
void ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
const std::shared_ptr<AAFwk::Want> &want) override;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
/**
*
@ -645,7 +645,7 @@ private:
std::vector<std::pair<std::string, std::string>> &fileMap);
void GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &hspList, AppLibPathMap &appLibPaths);
void SetAppDebug(uint32_t modeFlag, bool isDebug);
/**
* @brief Whether MainThread is started by ChildProcessManager.
*

View File

@ -127,9 +127,9 @@ public:
* @param want ability want
* @return true on success ,false on failure.
*/
int LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
int LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo,
const Want &want);
const Want &want, int32_t abilityRecordId);
/**
* terminate ability with token.
@ -362,14 +362,14 @@ public:
* @return Returns ERR_OK on success, others on failure.
*/
int32_t RegisterAppDebugListener(const sptr<AppExecFwk::IAppDebugListener> &listener);
/**
* @brief Unregister app debug listener.
* @param listener App debug listener.
* @return Returns ERR_OK on success, others on failure.
*/
int32_t UnregisterAppDebugListener(const sptr<AppExecFwk::IAppDebugListener> &listener);
/**
* @brief Attach app debug.
* @param bundleName The application bundle name.

View File

@ -1170,7 +1170,7 @@ void AbilityConnectManager::LoadAbility(const std::shared_ptr<AbilityRecord> &ab
}
DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
token, perToken, abilityRecord->GetAbilityInfo(), abilityRecord->GetApplicationInfo(),
abilityRecord->GetWant());
abilityRecord->GetWant(), abilityRecord->GetRecordId());
}
void AbilityConnectManager::PostRestartResidentTask(const AbilityRequest &abilityRequest)

View File

@ -369,7 +369,7 @@ int AbilityRecord::LoadAbility()
want_.SetParam("ohos.ability.launch.reason", static_cast<int>(lifeCycleStateInfo_.launchParam.launchReason));
want_.SetParam(WANT_PARAMS_ATTACHE_TO_PARENT, CheckNeedAttachToParent());
auto result = DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
token_, callerToken_, abilityInfo_, applicationInfo_, want_);
token_, callerToken_, abilityInfo_, applicationInfo_, want_, recordId_);
want_.RemoveParam(ABILITY_OWNER_USERID);
want_.RemoveParam(WANT_PARAMS_ATTACHE_TO_PARENT);

View File

@ -79,8 +79,9 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback> &callback)
return true;
}
int AppScheduler::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo, const Want &want)
int AppScheduler::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AppExecFwk::AbilityInfo &abilityInfo, const AppExecFwk::ApplicationInfo &applicationInfo,
const Want &want, int32_t abilityRecordId)
{
HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__);
HILOG_DEBUG("called");
@ -88,7 +89,7 @@ int AppScheduler::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemo
/* because the errcode type of AppMgr Client API will be changed to int,
* so must to covert the return result */
int ret = static_cast<int>(IN_PROCESS_CALL(
appMgrClient_->LoadAbility(token, preToken, abilityInfo, applicationInfo, want)));
appMgrClient_->LoadAbility(token, preToken, abilityInfo, applicationInfo, want, abilityRecordId)));
if (ret != ERR_OK) {
HILOG_ERROR("AppScheduler fail to LoadAbility. ret %d", ret);
return INNER_ERR;

View File

@ -28,7 +28,8 @@ namespace OHOS {
namespace AppExecFwk {
class AbilityRunningRecord {
public:
AbilityRunningRecord(const std::shared_ptr<AbilityInfo> &info, const sptr<IRemoteObject> &token);
AbilityRunningRecord(std::shared_ptr<AbilityInfo> info, sptr<IRemoteObject> token,
int32_t abilityRecordId);
virtual ~AbilityRunningRecord();
/**
@ -74,6 +75,10 @@ public:
* @return Returns the ability token.
*/
const sptr<IRemoteObject> &GetToken() const;
int32_t GetAbilityRecordId() const
{
return abilityRecordId_;
}
/**
* @brief Setting id for ability record.
@ -202,6 +207,7 @@ private:
std::shared_ptr<AbilityInfo> info_;
std::shared_ptr<AAFwk::Want> want_ = nullptr;
sptr<IRemoteObject> token_;
int32_t abilityRecordId_ = 0;
sptr<IRemoteObject> preToken_;
int32_t ownerUserId_ = -1;
bool isSingleUser_ = false;

View File

@ -52,7 +52,7 @@ public:
*/
virtual void LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want) override;
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
/**
* TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability.

View File

@ -90,9 +90,9 @@ public:
*
* @return
*/
virtual void LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want);
virtual void LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId);
/**
* TerminateAbility, terminate the token ability.
@ -365,14 +365,15 @@ public:
int32_t StartNativeProcessForDebugger(const AAFwk::Want &want) const;
std::shared_ptr<AppRunningRecord> CreateAppRunningRecord(
const sptr<IRemoteObject> &token,
const sptr<IRemoteObject> &preToken,
const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AbilityInfo> &abilityInfo,
sptr<IRemoteObject> token,
sptr<IRemoteObject> preToken,
std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AbilityInfo> abilityInfo,
const std::string &processName,
const BundleInfo &bundleInfo,
const HapModuleInfo &hapModuleInfo,
const std::shared_ptr<AAFwk::Want> &want);
std::shared_ptr<AAFwk::Want> want,
int32_t abilityRecordId);
/**
* OnStop, Application management service stopped.
@ -982,9 +983,9 @@ private:
*
* @return
*/
void StartAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<AppRunningRecord> &appRecord,
const HapModuleInfo &hapModuleInfo, const std::shared_ptr<AAFwk::Want> &want);
void StartAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AppRunningRecord> appRecord,
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId);
int32_t StartPerfProcess(const std::shared_ptr<AppRunningRecord> &appRecord, const std::string& perfCmd,
const std::string& debugCmd, bool isSandboxApp) const;

View File

@ -291,9 +291,9 @@ public:
*/
sptr<IAppScheduler> GetApplicationClient() const;
void AddModule(const std::shared_ptr<ApplicationInfo> &appInfo, const std::shared_ptr<AbilityInfo> &abilityInfo,
const sptr<IRemoteObject> &token, const HapModuleInfo &hapModuleInfo,
const std::shared_ptr<AAFwk::Want> &want);
void AddModule(std::shared_ptr<ApplicationInfo> appInfo, std::shared_ptr<AbilityInfo> abilityInfo,
sptr<IRemoteObject> token, const HapModuleInfo &hapModuleInfo,
std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId);
void AddModules(const std::shared_ptr<ApplicationInfo> &appInfo, const std::vector<HapModuleInfo> &moduleInfos);

View File

@ -74,8 +74,8 @@ public:
*/
std::shared_ptr<AbilityRunningRecord> GetAbilityRunningRecordByToken(const sptr<IRemoteObject> &token) const;
std::shared_ptr<AbilityRunningRecord> AddAbility(const sptr<IRemoteObject> &token,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<AAFwk::Want> &want);
std::shared_ptr<AbilityRunningRecord> AddAbility(sptr<IRemoteObject> token,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId);
bool IsLastAbilityRecord(const sptr<IRemoteObject> &token);
@ -157,7 +157,7 @@ public:
const std::shared_ptr<ApplicationInfo> GetAppInfo();
bool RemoveTerminateAbilityTimeoutTask(const sptr<IRemoteObject>& token) const;
bool IsAbilitiesBackgrounded();
private:

View File

@ -17,8 +17,9 @@
namespace OHOS {
namespace AppExecFwk {
AbilityRunningRecord::AbilityRunningRecord(const std::shared_ptr<AbilityInfo> &info, const sptr<IRemoteObject> &token)
: info_(info), token_(token)
AbilityRunningRecord::AbilityRunningRecord(std::shared_ptr<AbilityInfo> info,
sptr<IRemoteObject> token, int32_t abilityRecordId)
: info_(info), token_(token), abilityRecordId_(abilityRecordId)
{}
AbilityRunningRecord::~AbilityRunningRecord()

View File

@ -57,7 +57,7 @@ AmsMgrScheduler::~AmsMgrScheduler()
void AmsMgrScheduler::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want)
const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId)
{
if (!abilityInfo || !appInfo) {
HILOG_ERROR("param error");
@ -75,7 +75,8 @@ void AmsMgrScheduler::LoadAbility(const sptr<IRemoteObject> &token, const sptr<I
PerfProfile::GetInstance().SetAbilityLoadStartTime(GetTickCount());
HILOG_INFO("SubmitLoadTask: %{public}s-%{public}s", abilityInfo->bundleName.c_str(), abilityInfo->name.c_str());
std::function<void()> loadAbilityFunc =
std::bind(&AppMgrServiceInner::LoadAbility, amsMgrServiceInner_, token, preToken, abilityInfo, appInfo, want);
std::bind(&AppMgrServiceInner::LoadAbility, amsMgrServiceInner_, token, preToken, abilityInfo,
appInfo, want, abilityRecordId);
amsHandler_->SubmitTask(loadAbilityFunc, AAFwk::TaskAttribute{
.taskName_ = TASK_LOAD_ABILITY,

View File

@ -80,7 +80,7 @@ void AppLifeCycleDeal::LaunchAbility(const std::shared_ptr<AbilityRunningRecord>
}
HILOG_DEBUG("Launch ability.");
appThread->ScheduleLaunchAbility(*abilityInfo, ability->GetToken(),
ability->GetWant());
ability->GetWant(), ability->GetAbilityRecordId());
} else {
HILOG_WARN("LoadLifecycle.");
}

View File

@ -283,9 +283,9 @@ void AppMgrServiceInner::StartSpecifiedProcess(const AAFwk::Want &want, const Ap
}
}
void AppMgrServiceInner::LoadAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AAFwk::Want> &want)
void AppMgrServiceInner::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId)
{
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
HILOG_INFO("name:%{public}s.", abilityInfo->name.c_str());
@ -343,7 +343,7 @@ void AppMgrServiceInner::LoadAbility(const sptr<IRemoteObject> &token, const spt
bundleInfo.name, appInfo->uid, AbilityRuntime::RunningStatus::APP_RUNNING_START);
}
appRecord = CreateAppRunningRecord(token, preToken, appInfo, abilityInfo,
processName, bundleInfo, hapModuleInfo, want);
processName, bundleInfo, hapModuleInfo, want, abilityRecordId);
if (!appRecord) {
HILOG_ERROR("CreateAppRunningRecord failed, appRecord is nullptr");
return;
@ -388,7 +388,7 @@ void AppMgrServiceInner::LoadAbility(const sptr<IRemoteObject> &token, const spt
appRecord->SetRequestProcCode(requestProcCode);
DelayedSingleton<AppStateObserverManager>::GetInstance()->OnProcessReused(appRecord);
}
StartAbility(token, preToken, abilityInfo, appRecord, hapModuleInfo, want);
StartAbility(token, preToken, abilityInfo, appRecord, hapModuleInfo, want, abilityRecordId);
}
PerfProfile::GetInstance().SetAbilityLoadEndTime(GetTickCount());
PerfProfile::GetInstance().Dump();
@ -1465,10 +1465,10 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::GetAppRunningRecordByPid(c
return appRunningManager_->GetAppRunningRecordByPid(pid);
}
std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(const sptr<IRemoteObject> &token,
const sptr<IRemoteObject> &preToken, const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::string &processName, const BundleInfo &bundleInfo,
const HapModuleInfo &hapModuleInfo, const std::shared_ptr<AAFwk::Want> &want)
std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(sptr<IRemoteObject> token,
sptr<IRemoteObject> preToken, std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AbilityInfo> abilityInfo, const std::string &processName, const BundleInfo &bundleInfo,
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId)
{
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
if (!appRunningManager_) {
@ -1486,7 +1486,7 @@ std::shared_ptr<AppRunningRecord> AppMgrServiceInner::CreateAppRunningRecord(con
appRecord->SetKeepAliveAppState(isKeepAlive, false);
appRecord->SetTaskHandler(taskHandler_);
appRecord->SetEventHandler(eventHandler_);
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, want);
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, want, abilityRecordId);
if (want) {
appRecord->SetDebugApp(want->GetBoolParam(DEBUG_APP, false));
appRecord->SetNativeDebug(want->GetBoolParam("nativeDebug", false));
@ -1770,9 +1770,9 @@ void AppMgrServiceInner::KillProcessesByUserId(int32_t userId)
}
}
void AppMgrServiceInner::StartAbility(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &preToken,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<AppRunningRecord> &appRecord,
const HapModuleInfo &hapModuleInfo, const std::shared_ptr<AAFwk::Want> &want)
void AppMgrServiceInner::StartAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AppRunningRecord> appRecord,
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId)
{
HITRACE_METER_NAME(HITRACE_TAG_APP, __PRETTY_FUNCTION__);
HILOG_DEBUG("start ability");
@ -1803,7 +1803,7 @@ void AppMgrServiceInner::StartAbility(const sptr<IRemoteObject> &token, const sp
}
auto appInfo = std::make_shared<ApplicationInfo>(abilityInfo->applicationInfo);
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, want);
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, want, abilityRecordId);
auto moduleRecord = appRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
if (!moduleRecord) {
HILOG_ERROR("add moduleRecord failed");

View File

@ -664,13 +664,13 @@ void AppRunningRecord::AddModules(
}
for (auto &iter : moduleInfos) {
AddModule(appInfo, nullptr, nullptr, iter, nullptr);
AddModule(appInfo, nullptr, nullptr, iter, nullptr, 0);
}
}
void AppRunningRecord::AddModule(const std::shared_ptr<ApplicationInfo> &appInfo,
const std::shared_ptr<AbilityInfo> &abilityInfo, const sptr<IRemoteObject> &token,
const HapModuleInfo &hapModuleInfo, const std::shared_ptr<AAFwk::Want> &want)
void AppRunningRecord::AddModule(std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AbilityInfo> abilityInfo, sptr<IRemoteObject> token,
const HapModuleInfo &hapModuleInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId)
{
HILOG_DEBUG("called");
@ -712,7 +712,7 @@ void AppRunningRecord::AddModule(const std::shared_ptr<ApplicationInfo> &appInfo
HILOG_ERROR("abilityInfo or token is nullptr");
return;
}
moduleRecord->AddAbility(token, abilityInfo, want);
moduleRecord->AddAbility(token, abilityInfo, want, abilityRecordId);
return;
}
@ -753,6 +753,7 @@ void AppRunningRecord::StateChangedNotifyObserver(
abilityStateData.token = ability->GetToken();
abilityStateData.abilityType = static_cast<int32_t>(ability->GetAbilityInfo()->type);
abilityStateData.isFocused = ability->GetFocusFlag();
abilityStateData.abilityRecordId = ability->GetAbilityRecordId();
if (ability->GetWant() != nullptr) {
abilityStateData.callerAbilityName = ability->GetWant()->GetStringParam(Want::PARAM_RESV_CALLER_ABILITY_NAME);
abilityStateData.callerBundleName = ability->GetWant()->GetStringParam(Want::PARAM_RESV_CALLER_BUNDLE_NAME);

View File

@ -66,8 +66,8 @@ std::shared_ptr<AbilityRunningRecord> ModuleRunningRecord::GetAbilityRunningReco
return nullptr;
}
std::shared_ptr<AbilityRunningRecord> ModuleRunningRecord::AddAbility(const sptr<IRemoteObject> &token,
const std::shared_ptr<AbilityInfo> &abilityInfo, const std::shared_ptr<AAFwk::Want> &want)
std::shared_ptr<AbilityRunningRecord> ModuleRunningRecord::AddAbility(sptr<IRemoteObject> token,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId)
{
HILOG_DEBUG("Add ability.");
if (!token || !abilityInfo) {
@ -78,7 +78,7 @@ std::shared_ptr<AbilityRunningRecord> ModuleRunningRecord::AddAbility(const sptr
HILOG_ERROR("AbilityRecord already exists and no need to add");
return nullptr;
}
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, abilityRecordId);
abilityRecord->SetWant(want);
if (appInfo_) {
abilityRecord->SetIsSingleUser(appInfo_->singleton);

View File

@ -29,10 +29,10 @@ namespace OHOS {
namespace AppExecFwk {
class MockAppMgrService : public AppMgrStub {
public:
MOCK_METHOD5(LoadAbility,
MOCK_METHOD6(LoadAbility,
void(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
const std::shared_ptr<AAFwk::Want>& want));
const std::shared_ptr<AAFwk::Want>& want, int32_t abilityRecordId));
MOCK_METHOD2(TerminateAbility, void(const sptr<IRemoteObject>& token, bool isClearMissionFlag));
MOCK_METHOD2(UpdateAbilityState, void(const sptr<IRemoteObject>& token, const AbilityState state));
MOCK_METHOD1(SetAppFreezingTime, void(int time));
@ -81,7 +81,7 @@ public:
MOCK_METHOD1(RegisterRenderStateObserver, int32_t(const sptr<IRenderStateObserver> &observer));
MOCK_METHOD1(UnregisterRenderStateObserver, int32_t(const sptr<IRenderStateObserver> &observer));
MOCK_METHOD2(UpdateRenderState, int32_t(pid_t renderPid, int32_t state));
void AttachApplication(const sptr<IRemoteObject>& app)
{
GTEST_LOG_(INFO) << "MockAppMgrService::AttachApplication called";
@ -254,7 +254,7 @@ public:
const std::shared_ptr<AAFwk::Want>& want)
{
if (Appthread_ != nullptr) {
Appthread_->ScheduleLaunchAbility(abilityinf, token, want);
Appthread_->ScheduleLaunchAbility(abilityinf, token, want, 0);
}
}

View File

@ -30,10 +30,10 @@ public:
virtual ~MockAppMgrServiceInner()
{}
MOCK_METHOD5(LoadAbility,
void(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
const std::shared_ptr<AAFwk::Want>& want));
MOCK_METHOD6(LoadAbility,
void(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId));
MOCK_METHOD2(AttachApplication, void(const pid_t pid, const sptr<IAppScheduler>& app));
MOCK_METHOD1(ApplicationForegrounded, void(const int32_t recordId));
MOCK_METHOD1(ApplicationBackgrounded, void(const int32_t recordId));

View File

@ -28,8 +28,9 @@ public:
{}
~MockAppMgrClient()
{}
MOCK_METHOD5(LoadAbility, AppMgrResultCode(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want));
MOCK_METHOD6(LoadAbility, AppMgrResultCode(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want,
int32_t abilityRecordId));
MOCK_METHOD1(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&));
MOCK_METHOD2(UpdateAbilityState, AppMgrResultCode(const sptr<IRemoteObject>& token, const AbilityState state));

View File

@ -28,8 +28,8 @@ public:
MockAppMgrClient() {};
virtual ~MockAppMgrClient() {};
virtual AppMgrResultCode LoadAbility(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want)
virtual AppMgrResultCode LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want, int32_t)
{
HILOG_INFO("MockAppMgrClient LoadAbility enter.");
token_ = token;

View File

@ -42,8 +42,8 @@ public:
* @param appInfo, Application information.
* @return Returns RESULT_OK on success, others on failure.
*/
virtual AppMgrResultCode LoadAbility(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want);
virtual AppMgrResultCode LoadAbility(sptr<IRemoteObject>& token, sptr<IRemoteObject> preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want, int32_t);
/**
* Terminate ability.

View File

@ -38,8 +38,9 @@ void AppMgrClient::GetRunningProcessInfoByToken(const sptr<IRemoteObject>& token
void AppMgrClient::GetRunningProcessInfoByPid(const pid_t pid, OHOS::AppExecFwk::RunningProcessInfo& info) const {}
AppMgrResultCode AppMgrClient::LoadAbility(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want)
AppMgrResultCode AppMgrClient::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AbilityInfo& abilityInfo, const ApplicationInfo& appInfo, const AAFwk::Want& want,
int32_t abilityRecordId)
{
return AppMgrResultCode::RESULT_OK;
}

View File

@ -41,9 +41,9 @@ bool AppScheduler::Init(const std::weak_ptr<AppStateCallback>& callback)
return true;
}
int AppScheduler::LoadAbility(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
int AppScheduler::LoadAbility(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
const AppExecFwk::AbilityInfo& abilityInfo, const AppExecFwk::ApplicationInfo& applicationInfo,
const AAFwk::Want& want)
const AAFwk::Want& want, int32_t abilityRecordId)
{
HILOG_INFO("Test AppScheduler::LoadAbility()");
if (applicationInfo.bundleName.find("com.ix.First.Test") != std::string::npos) {
@ -199,7 +199,7 @@ int32_t AppScheduler::UnregisterAppDebugListener(const sptr<AppExecFwk::IAppDebu
{
return 0;
}
int32_t AppScheduler::AttachAppDebug(const std::string &bundleName)
{
return 0;

View File

@ -23,10 +23,10 @@ namespace OHOS {
namespace AppExecFwk {
class MockAmsMgrScheduler : public AmsMgrStub {
public:
MOCK_METHOD5(LoadAbility,
MOCK_METHOD6(LoadAbility,
void(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
const std::shared_ptr<AAFwk::Want>& want));
const std::shared_ptr<AAFwk::Want>& want, int32_t abilityRecordId));
MOCK_METHOD5(AbilityBehaviorAnalysis,
void(const sptr<OHOS::IRemoteObject>& token, const sptr<OHOS::IRemoteObject>& preToken,
const int32_t visibility, const int32_t perceptibility, const int32_t connectionState));
@ -67,7 +67,7 @@ public:
AppProcessData appProcessData;
callback->OnAppStateChanged(appProcessData);
}
MOCK_METHOD1(SetCurrentUserId, void(const int32_t userId));
MOCK_METHOD4(SendRequest, int(uint32_t, MessageParcel&, MessageParcel&, MessageOption&));

View File

@ -25,10 +25,10 @@ namespace OHOS {
namespace AppExecFwk {
class MockAppMgrService : public AppMgrStub {
public:
MOCK_METHOD5(LoadAbility,
MOCK_METHOD6(LoadAbility,
void(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
const std::shared_ptr<AAFwk::Want>& want));
const std::shared_ptr<AAFwk::Want>& want, int32_t abilityRecordId));
MOCK_METHOD2(TerminateAbility, void(const sptr<IRemoteObject>& token, bool clearMissionFlag));
MOCK_METHOD2(UpdateAbilityState, void(const sptr<IRemoteObject>& token, const AbilityState state));
MOCK_METHOD1(AttachApplication, void(const sptr<IRemoteObject>& app));

View File

@ -30,10 +30,10 @@ public:
virtual ~MockAppMgrServiceInner()
{}
MOCK_METHOD5(LoadAbility,
void(const sptr<IRemoteObject>& token, const sptr<IRemoteObject>& preToken,
const std::shared_ptr<AbilityInfo>& abilityInfo, const std::shared_ptr<ApplicationInfo>& appInfo,
const std::shared_ptr<AAFwk::Want>& want));
MOCK_METHOD6(LoadAbility,
void(sptr<IRemoteObject> token, sptr<IRemoteObject> preToken,
std::shared_ptr<AbilityInfo> abilityInfo, std::shared_ptr<ApplicationInfo> appInfo,
std::shared_ptr<AAFwk::Want> want, int32_t abilityRecordId));
MOCK_METHOD2(AttachApplication, void(const pid_t pid, const sptr<IAppScheduler>& app));
MOCK_METHOD1(ApplicationForegrounded, void(const int32_t recordId));
MOCK_METHOD1(ApplicationBackgrounded, void(const int32_t recordId));

View File

@ -33,8 +33,8 @@ public:
MOCK_METHOD0(ScheduleBackgroundApplication, void());
MOCK_METHOD1(ScheduleTerminateApplication, void(bool));
MOCK_METHOD2(ScheduleLaunchApplication, void(const AppLaunchData&, const Configuration& config));
MOCK_METHOD3(ScheduleLaunchAbility, void(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&));
MOCK_METHOD4(ScheduleLaunchAbility, void(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&, int32_t));
MOCK_METHOD1(ScheduleCleanAbility, void(const sptr<IRemoteObject>&));
MOCK_METHOD1(ScheduleProfileChanged, void(const Profile&));
MOCK_METHOD1(ScheduleConfigurationUpdated, void(const Configuration& config));

View File

@ -32,8 +32,8 @@ public:
MOCK_METHOD1(ScheduleMemoryLevel, void(int32_t level));
MOCK_METHOD2(ScheduleHeapMemory, void(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo));
MOCK_METHOD2(ScheduleLaunchApplication, void(const AppLaunchData&, const Configuration& config));
MOCK_METHOD3(ScheduleLaunchAbility, void(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&));
MOCK_METHOD4(ScheduleLaunchAbility, void(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&, int32_t));
MOCK_METHOD1(ScheduleCleanAbility, void(const sptr<IRemoteObject>&));
MOCK_METHOD1(ScheduleProfileChanged, void(const Profile&));
MOCK_METHOD1(ScheduleConfigurationUpdated, void(const Configuration&));

View File

@ -138,7 +138,7 @@ HWTEST_F(AppkitNativeModuleTestThird, App_CleanAbility_0100, Function | MediumTe
AbilityInfo abilityinf;
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr, 0);
WaitUntilTaskDone(mockHandler_);
mockAppMgr->ScheduleCleanAbility(token);
@ -236,7 +236,7 @@ HWTEST_F(AppkitNativeModuleTestThird, App_CleanAbility_0400, Function | MediumTe
AbilityInfo abilityinf;
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr, 0);
WaitUntilTaskDone(mockHandler_);
mockAppMgr->ScheduleCleanAbility(nullptr);
@ -275,7 +275,7 @@ HWTEST_F(AppkitNativeModuleTestThird, App_CleanAbility_0500, Function | MediumTe
AbilityInfo abilityinf;
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr, 0);
WaitUntilTaskDone(mockHandler_);
sptr<IRemoteObject> tokenOhter = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleCleanAbility(tokenOhter);

View File

@ -219,7 +219,7 @@ HWTEST_F(AppkitNativeModuleTestSecond, App_LaunchAblity_0100, Function | MediumT
AbilityInfo abilityinf;
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr, 0);
runner_->Stop();
OHOS::DelayedSingleton<SysMrgClient>::GetInstance()->UnregisterSystemAbility(APP_MGR_SERVICE_ID);
@ -243,7 +243,7 @@ HWTEST_F(AppkitNativeModuleTestSecond, App_LaunchAblity_0200, Function | MediumT
AbilityInfo abilityinf;
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, token, nullptr, 0);
runner_->Stop();
OHOS::DelayedSingleton<SysMrgClient>::GetInstance()->UnregisterSystemAbility(APP_MGR_SERVICE_ID);
@ -279,7 +279,7 @@ HWTEST_F(AppkitNativeModuleTestSecond, App_LaunchAblity_0300, Function | MediumT
usleep(USleepTime);
AbilityInfo abilityinf;
mockAppMgr->ScheduleLaunchAbility(abilityinf, nullptr, nullptr);
mockAppMgr->ScheduleLaunchAbility(abilityinf, nullptr, nullptr, 0);
runner_->Stop();
OHOS::DelayedSingleton<SysMrgClient>::GetInstance()->UnregisterSystemAbility(APP_MGR_SERVICE_ID);

View File

@ -105,7 +105,7 @@ public:
appLaunchTime++;
}
void ScheduleLaunchAbility(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&) override
const std::shared_ptr<AAFwk::Want>&, int32_t) override
{
scheduled_ |= LAUNCH_ABILITY_SCHEDULED;
abilityLaunchTime++;
@ -269,10 +269,10 @@ HWTEST_F(AmsAbilityRunningRecordModuleTest, AddAbilityRunningRecord_002, TestSiz
sptr<IRemoteObject> token = new MockAbilityToken();
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "Module";
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName,
hapModuleInfo.moduleName);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr, 0);
EXPECT_TRUE(caseAbilityRunningRecord == nullptr);
caseAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
EXPECT_EQ(caseAbilityRunningRecord, appRunningRecord->GetAbilityRunningRecordByToken(token));
@ -303,10 +303,10 @@ HWTEST_F(AmsAbilityRunningRecordModuleTest, UpdateAbilityRunningRecord_001, Test
sptr<IRemoteObject> token = new MockAbilityToken();
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "Module";
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName,
hapModuleInfo.moduleName);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr, 0);
EXPECT_TRUE(caseAbilityRunningRecord == nullptr);
caseAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
EXPECT_EQ(caseAbilityRunningRecord, appRunningRecord->GetAbilityRunningRecordByToken(token));
@ -348,10 +348,10 @@ HWTEST_F(AmsAbilityRunningRecordModuleTest, UpdateAbilityRunningRecord_002, Test
sptr<IRemoteObject> token = new MockAbilityToken();
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "Module";
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName,
hapModuleInfo.moduleName);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr, 0);
EXPECT_TRUE(caseAbilityRunningRecord == nullptr);
caseAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
EXPECT_EQ(caseAbilityRunningRecord, appRunningRecord->GetAbilityRunningRecordByToken(token));
@ -383,10 +383,10 @@ HWTEST_F(AmsAbilityRunningRecordModuleTest, UpdateAbilityRunningRecord_003, Test
sptr<IRemoteObject> token = new MockAbilityToken();
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "Module";
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, caseAbilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName,
hapModuleInfo.moduleName);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr);
auto caseAbilityRunningRecord = moduleRecord->AddAbility(token, caseAbilityInfo, nullptr, 0);
EXPECT_TRUE(caseAbilityRunningRecord == nullptr);
caseAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
EXPECT_EQ(caseAbilityRunningRecord, appRunningRecord->GetAbilityRunningRecordByToken(token));

View File

@ -177,10 +177,10 @@ std::shared_ptr<AppRunningRecord> AmsAppLifeCycleModuleTest::StartProcessAndLoad
if (!testProcessInfo.isStart) {
StartAppProcess(testProcessInfo.pid);
} else {
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
}
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -211,7 +211,7 @@ void AmsAppLifeCycleModuleTest::ChangeAbilityStateAfterAppStart(
const sptr<MockAppScheduler>& mockAppScheduler, const pid_t& pid) const
{
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
serviceInner_->AttachApplication(pid, client);
@ -358,7 +358,7 @@ void AmsAppLifeCycleModuleTest::CreateAppRecentList(const int32_t appNum)
EXPECT_CALL(*mockAppStateCallbackStub_, OnAppStateChanged(_)).Times(1);
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockedSpawnClient));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
}
return;
}
@ -1033,7 +1033,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_01, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -1089,7 +1089,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_02, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -1145,7 +1145,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_03, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -1201,7 +1201,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_04, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -1257,7 +1257,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_05, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
@ -1315,7 +1315,7 @@ HWTEST_F(AmsAppLifeCycleModuleTest, AbilityBehaviorAnalysis_06, TestSize.Level1)
serviceInner_->SetBundleManager(bundleMgr.GetRefPtr());
StartAppProcess(pid);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(serviceInner_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));

View File

@ -59,7 +59,7 @@ public:
void ScheduleLaunchApplication(const AppLaunchData&, const Configuration&) override
{}
void ScheduleLaunchAbility(const AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&) override
const std::shared_ptr<AAFwk::Want>&, int32_t) override
{}
void ScheduleCleanAbility(const sptr<IRemoteObject>&) override
{}

View File

@ -155,7 +155,7 @@ HWTEST_F(AmsAppRecentListModuleTest, Create_Recent_List_001, TestSize.Level1)
MockAppSpawnClient* mockedSpawnClient = new MockAppSpawnClient();
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockedSpawnClient));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(INDEX_NUM_10, static_cast<int32_t>(serviceInner_->GetRecentAppList().size()));
HILOG_INFO("Create_Recent_List_001 end");
}

View File

@ -200,7 +200,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_001, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -259,7 +259,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_002, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -320,7 +320,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_003, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -361,7 +361,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_003, TestSize.Level
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo2, appInfo2, bundleInfo2, hapModuleInfo2));
sptr<MockAbilityToken> mockToken = new (std::nothrow) MockAbilityToken();
auto record2 = service_->CreateAppRunningRecord(
mockToken, nullptr, appInfo2, abilityInfo2, processName2, bundleInfo2, hapModuleInfo2, nullptr);
mockToken, nullptr, appInfo2, abilityInfo2, processName2, bundleInfo2, hapModuleInfo2, nullptr, 0);
record2->SetUid(uid);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -399,7 +399,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_004, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -456,7 +456,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_005, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
pid_t pid = 16738;
record->GetPriorityObject()->SetPid(pid);
@ -517,7 +517,7 @@ HWTEST_F(AppRunningProcessesInfoModuleTest, ApplicationStart_006, TestSize.Level
HapModuleInfo hapModuleInfo;
EXPECT_FALSE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(uid);
pid_t pid = 16739;
record->GetPriorityObject()->SetPid(pid);

View File

@ -197,7 +197,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, ApplicationStart_001, TestSize.Level1)
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(0);
EXPECT_TRUE(record != nullptr) << ",create apprunningrecord fail!";
@ -261,7 +261,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, MultiApplicationStart_002, TestSize.Leve
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
@ -307,7 +307,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, ScheduleTrimMemory_003, TestSize.Level1)
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
// LaunchApplication
@ -357,7 +357,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, LowMemoryWarning_004, TestSize.Level1)
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
// LaunchApplication
@ -409,7 +409,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, ApplicationStartAndQuit_005, TestSize.Le
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
// LaunchApplication
@ -479,7 +479,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, ApplicationStatusChange_006, TestSize.Le
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
// LaunchApplication
@ -540,7 +540,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, StartSpecifiedAbility_001, TestSize.Leve
HapModuleInfo hapModuleInfo;
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
// LaunchApplication
@ -587,7 +587,7 @@ HWTEST_F(AmsAppRunningRecordModuleTest, StartSpecifiedAbility_002, TestSize.Leve
hapModuleInfo.moduleName = "moduleName1";
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr) << "create apprunningrecord fail!";
auto abilityInfo1 = std::make_shared<AbilityInfo>();

View File

@ -136,10 +136,10 @@ TestApplicationPreRunningRecord AmsAppServiceFlowModuleTest::TestCreateApplicati
appInfo->name, appName, appInfo->uid, bundleInfo);
if (!appRecord) {
appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, appName, bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, appName, bundleInfo, hapModuleInfo, nullptr, 0);
appRecord->GetPriorityObject()->SetPid(TestApplicationPreRunningRecord::g_pid++);
} else {
serviceInner_->StartAbility(token, nullptr, abilityInfo, appRecord, hapModuleInfo, nullptr);
serviceInner_->StartAbility(token, nullptr, abilityInfo, appRecord, hapModuleInfo, nullptr, 0);
}
EXPECT_TRUE(appRecord);

View File

@ -25,8 +25,8 @@ class MockAppMgrClient : public AppMgrClient {
public:
MockAppMgrClient();
~MockAppMgrClient();
MOCK_METHOD5(LoadAbility, AppMgrResultCode(const sptr<IRemoteObject>&, const sptr<IRemoteObject>&,
const AbilityInfo&, const ApplicationInfo&, const AAFwk::Want&));
MOCK_METHOD6(LoadAbility, AppMgrResultCode(sptr<IRemoteObject>, sptr<IRemoteObject>,
const AbilityInfo&, const ApplicationInfo&, const AAFwk::Want&, int32_t));
MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool));
MOCK_METHOD2(UpdateAbilityState, AppMgrResultCode(const sptr<IRemoteObject>& token, const AbilityState state));
MOCK_METHOD1(KillApplication, AppMgrResultCode(const std::string&));

View File

@ -35,8 +35,8 @@ public:
MOCK_METHOD0(ScheduleBackgroundApplication, void());
MOCK_METHOD1(ScheduleTerminateApplication, void(bool));
MOCK_METHOD2(ScheduleLaunchApplication, void(const AppExecFwk::AppLaunchData&, const Configuration& config));
MOCK_METHOD3(ScheduleLaunchAbility, void(const AppExecFwk::AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&));
MOCK_METHOD4(ScheduleLaunchAbility, void(const AppExecFwk::AbilityInfo&, const sptr<IRemoteObject>&,
const std::shared_ptr<AAFwk::Want>&, int32_t));
MOCK_METHOD1(ScheduleCleanAbility, void(const sptr<IRemoteObject>&));
MOCK_METHOD1(ScheduleProfileChanged, void(const AppExecFwk::Profile&));
MOCK_METHOD1(ScheduleConfigurationUpdated, void(const AppExecFwk::Configuration& config));

View File

@ -195,7 +195,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_001, TestSize.Level1)
{
std::string abilityName = "MusicAbility";
std::string bundleName = "com.ix.hiMusic";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(1);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
@ -224,7 +224,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_002, TestSize.Level1)
{
std::string abilityName = "EnterAbility";
std::string bundleName = "com.ohos.camera";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(1);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -252,7 +252,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_003, TestSize.Level1)
{
std::string abilityName = "com.ohos.launcher.MainAbility";
std::string bundleName = "com.ohos.launcher";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(1);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -280,7 +280,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_004, TestSize.Level1)
{
std::string abilityName = "MusicAbility";
std::string bundleName = "com.ix.hiMusic";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(2);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(2);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -320,7 +320,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_005, TestSize.Level1)
{
std::string abilityName = "EnterAbility";
std::string bundleName = "com.ohos.photos";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(2);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(2);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -356,7 +356,7 @@ HWTEST_F(RunningInfosModuleTest, GetAbilityRunningInfos_006, TestSize.Level1)
{
std::string abilityName = "com.ohos.launcher.MainAbility";
std::string bundleName = "com.ohos.launcher";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(2);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(2);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -396,7 +396,7 @@ HWTEST_F(RunningInfosModuleTest, GetExtensionRunningInfos_001, TestSize.Level1)
{
std::string abilityName = "hiExtension";
std::string bundleName = "com.ix.hiExtension";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(1);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -424,7 +424,7 @@ HWTEST_F(RunningInfosModuleTest, GetExtensionRunningInfos_002, TestSize.Level1)
{
std::string abilityName = "hiExtension";
std::string bundleName = "com.ix.hiExtension";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(2);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(2);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);
@ -458,7 +458,7 @@ HWTEST_F(RunningInfosModuleTest, GetProcessRunningInfos_001, TestSize.Level1)
{
std::string abilityName = "hiExtension";
std::string bundleName = "com.ix.hiExtension";
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _)).Times(1);
EXPECT_CALL(*mockAppMgrClient_, LoadAbility(_, _, _, _, _, _)).Times(1);
Want want = CreateWant(abilityName, bundleName);
auto result = abilityMgrServ_->StartAbility(want);
EXPECT_EQ(OHOS::ERR_OK, result);

View File

@ -149,9 +149,6 @@ HWTEST_F(AbilityServiceExtensionTest, OnConfigurationUpdated_0100, TestSize.Leve
applicationContext->AttachContextImpl(contextImpl);
application->SetApplicationContext(applicationContext);
std::shared_ptr<AbilityLocalRecord> record = std::make_shared<AbilityLocalRecord>(abilityInfo, token);
std::shared_ptr<AbilityHandler> handler = std::make_shared<AbilityHandler>(nullptr);
ServiceExtension* serviceExtension = ServiceExtension::Create(nullptr);
EXPECT_NE(serviceExtension, nullptr);

View File

@ -124,7 +124,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, CreateAbilityRunningRecord_001, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -153,7 +153,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, CreateAbilityRunningRecord_002, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, nullptr, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, nullptr, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -183,14 +183,14 @@ HWTEST_F(AmsAbilityRunningRecordTest, CreateAbilityRunningRecord_003, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecordFirst = moduleRecord->GetAbilityRunningRecordByToken(token);
EXPECT_TRUE(abilityRunningRecordFirst != nullptr);
EXPECT_EQ(abilityRunningRecordFirst, appRunningRecord->GetAbilityRunningRecordByToken(token));
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecordSecond = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -219,7 +219,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_001, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -262,7 +262,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_002, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -296,7 +296,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_003, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -336,7 +336,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_004, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
@ -375,12 +375,12 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_005, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr, 0);
moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto anotherAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(anotherToken);
@ -420,12 +420,12 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_006, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr, 0);
moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto anotherAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(anotherToken);
@ -470,12 +470,12 @@ HWTEST_F(AmsAbilityRunningRecordTest, UpdateAbilityRunningRecord_007, TestSize.L
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, anotherAbilityInfo, anotherToken, hapModuleInfo, nullptr, 0);
moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto anotherAbilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(anotherToken);
@ -511,7 +511,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, IsSameState_001, TestSize.Level1)
abilityInfo->name = GetTestAbilityName();
sptr<IRemoteObject> token = new MockAbilityToken();
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord =
std::make_shared<AbilityRunningRecord>(abilityInfo, token);
std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
abilityRunningRecord->SetState(AbilityState::ABILITY_STATE_FOREGROUND);
EXPECT_EQ(false, abilityRunningRecord->IsSameState(AbilityState::ABILITY_STATE_BACKGROUND));
@ -542,7 +542,7 @@ HWTEST_F(AmsAbilityRunningRecordTest, SetGetAbilityRecord_001, TestSize.Level1)
auto appInfo = std::make_shared<ApplicationInfo>();
appInfo->name = GetTestAppName();
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRunningRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto moduleRecord = appRunningRecord->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRunningRecord = moduleRecord->GetAbilityRunningRecordByToken(token);

View File

@ -173,7 +173,7 @@ sptr<IRemoteObject> AppDeathRecipientTest::GetApp(int32_t pid, int size)
std::shared_ptr<MockAppSpawnClient> mockClientstr(mockClientPtr);
appMgrServiceInner_->SetAppSpawnClient(mockClientstr);
appMgrServiceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
appMgrServiceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
auto appRecord = GetAppRunningRecordByIndex(pid);

View File

@ -128,7 +128,7 @@ std::shared_ptr<AppRunningRecord> AmsAppLifeCycleTest::StartProcessAndLoadAbilit
serviceInner_->SetAppSpawnClient(mockClientPtr);
serviceInner_->LoadAbility(token, preToken, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, preToken, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
auto record = serviceInner_->appRunningManager_->CheckAppRunningRecordIsExist(
@ -194,7 +194,7 @@ TestApplicationPreRecord AmsAppLifeCycleTest::CreateTestApplicationRecord(
bundleInfo.appId = "com.ohos.test.helloworld_code123";
std::shared_ptr<AppRunningRecord> appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, "com.ohos.test.helloworld", bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, "com.ohos.test.helloworld", bundleInfo, hapModuleInfo, nullptr, 0);
appRecord->SetTaskHandler(taskHandler_);
appRecord->SetEventHandler(eventHandler_);
@ -222,7 +222,7 @@ std::shared_ptr<AppRunningRecord> AmsAppLifeCycleTest::CreateTestApplicationAndS
bundleInfo.appId = "com.ohos.test.helloworld_code123";
std::shared_ptr<AppRunningRecord> appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, "AmsAppLifeCycleTest", bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, "AmsAppLifeCycleTest", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_NE(appRecord, nullptr);
appRecord->SetTaskHandler(taskHandler_);
@ -292,7 +292,7 @@ std::shared_ptr<AbilityRunningRecord> AmsAppLifeCycleTest::AddNewAbility(
{
auto newAbilityInfo = GetAbilityInfoByIndex(index);
sptr<IRemoteObject> newToken = new (std::nothrow) MockAbilityToken();
serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, GetApplication(), nullptr);
serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, GetApplication(), nullptr, 0);
auto newAbilityRecord = appRecord->GetAbilityRunningRecordByToken(newToken);
EXPECT_NE(newAbilityRecord, nullptr);
return newAbilityRecord;
@ -306,7 +306,7 @@ std::shared_ptr<AbilityRunningRecord> AmsAppLifeCycleTest::AddNewAbility(
auto app = GetApplication();
app->uid = uid;
sptr<IRemoteObject> newToken = new (std::nothrow) MockAbilityToken();
serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, app, nullptr);
serviceInner_->LoadAbility(newToken, nullptr, newAbilityInfo, app, nullptr, 0);
auto newAbilityRecord = appRecord->GetAbilityRunningRecordByToken(newToken);
EXPECT_NE(newAbilityRecord, nullptr);
return newAbilityRecord;
@ -388,7 +388,7 @@ HWTEST_F(AmsAppLifeCycleTest, Init_001, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
serviceInner_->AttachApplication(NEW_PID, client);
EXPECT_NE(record->GetApplicationClient(), nullptr);
@ -415,7 +415,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_001, TestSize.Level1)
AbilityState abilityState = abilityRecord->GetState();
ApplicationState appState = appRecord->GetState();
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(abilityState, abilityRecord->GetState());
EXPECT_EQ(appState, appRecord->GetState());
}
@ -441,7 +441,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_002, TestSize.Level1)
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
serviceInner_->AttachApplication(NEW_PID, client);
EXPECT_EQ(AbilityState::ABILITY_STATE_READY, abilityRecord->GetState());
@ -475,7 +475,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_004, TestSize.Level1)
{
TestApplicationPreRecord testAppRecord = PrepareLoadTestAbilityAndApp(ApplicationState::APP_STATE_READY);
testAppRecord.appRecord_->LaunchPendingAbilities();
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _, _)).Times(1);
auto newAbilityRecord = AddNewAbility(testAppRecord.appRecord_, "1");
EXPECT_EQ(AbilityState::ABILITY_STATE_READY, newAbilityRecord->GetState());
EXPECT_EQ(ApplicationState::APP_STATE_READY, testAppRecord.appRecord_->GetState());
@ -492,7 +492,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_005, TestSize.Level1)
{
TestApplicationPreRecord testAppRecord = PrepareLoadTestAbilityAndApp(ApplicationState::APP_STATE_FOREGROUND);
testAppRecord.appRecord_->LaunchPendingAbilities();
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _, _)).Times(1);
auto newAbilityRecord = AddNewAbility(testAppRecord.appRecord_, "1");
EXPECT_EQ(AbilityState::ABILITY_STATE_READY, newAbilityRecord->GetState());
EXPECT_EQ(ApplicationState::APP_STATE_FOREGROUND, testAppRecord.appRecord_->GetState());
@ -509,7 +509,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_006, TestSize.Level1)
{
TestApplicationPreRecord testAppRecord = PrepareLoadTestAbilityAndApp(ApplicationState::APP_STATE_BACKGROUND);
testAppRecord.appRecord_->LaunchPendingAbilities();
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _, _)).Times(1);
auto newAbilityRecord = AddNewAbility(testAppRecord.appRecord_, "1");
EXPECT_EQ(AbilityState::ABILITY_STATE_READY, newAbilityRecord->GetState());
EXPECT_EQ(ApplicationState::APP_STATE_BACKGROUND, testAppRecord.appRecord_->GetState());
@ -994,7 +994,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_042, TestSize.Level1)
auto testAppRecord =
CreateTestApplicationRecord(AbilityState::ABILITY_STATE_FOREGROUND, ApplicationState::APP_STATE_FOREGROUND);
testAppRecord.appRecord_->LaunchPendingAbilities();
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _, _)).Times(1);
auto newAbilityRecord = AddNewAbility(testAppRecord.appRecord_, "1", -1);
newAbilityRecord->SetState(AbilityState::ABILITY_STATE_BACKGROUND);
@ -1046,7 +1046,7 @@ HWTEST_F(AmsAppLifeCycleTest, Schedule_044, TestSize.Level1)
auto testAppRecord =
CreateTestApplicationRecord(AbilityState::ABILITY_STATE_BACKGROUND, ApplicationState::APP_STATE_BACKGROUND);
testAppRecord.appRecord_->LaunchPendingAbilities();
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*(testAppRecord.mockAppScheduler_), ScheduleLaunchAbility(_, _, _, _)).Times(1);
auto newAbilityRecord = AddNewAbility(testAppRecord.appRecord_, "1", -1);
newAbilityRecord->SetState(AbilityState::ABILITY_STATE_BACKGROUND);
@ -1301,7 +1301,7 @@ HWTEST_F(AmsAppLifeCycleTest, Stop_001, TestSize.Level1)
EXPECT_NE(abilityRecord, nullptr);
AbilityState abilityState = abilityRecord->GetState();
ApplicationState appState = appRecord->GetState();
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(abilityState, abilityRecord->GetState());
EXPECT_EQ(appState, appRecord->GetState());
@ -1360,7 +1360,7 @@ HWTEST_F(AmsAppLifeCycleTest, Stop_003, TestSize.Level1)
EXPECT_NE(abilityRecord, nullptr);
AbilityState abilityState = abilityRecord->GetState();
ApplicationState appState = appRecord->GetState();
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(abilityState, abilityRecord->GetState());
EXPECT_EQ(appState, appRecord->GetState());
@ -1413,7 +1413,7 @@ HWTEST_F(AmsAppLifeCycleTest, KillApplication_002, TestSize.Level1)
serviceInner_->SetAppSpawnClient(mockClientPtr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
auto appRecord = serviceInner_->appRunningManager_->CheckAppRunningRecordIsExist(
@ -1791,16 +1791,16 @@ HWTEST_F(AmsAppLifeCycleTest, CreateAppRunningRecord_001, TestSize.Level1)
bundleInfo.appId = "com.ohos.test.helloworld_code123";
std::shared_ptr<AppRunningRecord> appRecord = serviceInner_->CreateAppRunningRecord(
nullptr, nullptr, appInfo, abilityInfo, "test_app", bundleInfo, hapModuleInfo, nullptr);
nullptr, nullptr, appInfo, abilityInfo, "test_app", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(appRecord);
appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, nullptr, abilityInfo, "test_app", bundleInfo, hapModuleInfo, nullptr);
token, nullptr, nullptr, abilityInfo, "test_app", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_FALSE(appRecord);
appRecord = serviceInner_->CreateAppRunningRecord(token, nullptr, appInfo, nullptr, "test_app", bundleInfo,
hapModuleInfo, nullptr);
hapModuleInfo, nullptr, 0);
EXPECT_TRUE(appRecord);
appRecord = serviceInner_->CreateAppRunningRecord(token, nullptr, appInfo, abilityInfo, "", bundleInfo,
hapModuleInfo, nullptr);
hapModuleInfo, nullptr, 0);
EXPECT_FALSE(appRecord);
}
@ -1823,7 +1823,7 @@ HWTEST_F(AmsAppLifeCycleTest, CheckAppRunningRecordIsExist_001, TestSize.Level1)
bundleInfo.appId = "com.ohos.test.helloworld_code123";
std::shared_ptr<AppRunningRecord> appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, appInfo->name, bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, appInfo->name, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(appRecord);
auto appRecordProc = serviceInner_->appRunningManager_->CheckAppRunningRecordIsExist(

View File

@ -121,14 +121,14 @@ HWTEST_F(AmsAppMgrClientTest, AppMgrClient_001, TestSize.Level1)
sptr<IAmsMgr> amsMgrScheduler(new MockAmsMgrScheduler());
EXPECT_CALL(*(static_cast<MockAmsMgrScheduler*>(amsMgrScheduler.GetRefPtr())),
LoadAbility(_, _, _, _, _)).Times(1);
LoadAbility(_, _, _, _, _, _)).Times(1);
EXPECT_CALL(*(static_cast<MockAppMgrService*>((iface_cast<IAppMgr>(client_->GetRemoteObject())).GetRefPtr())),
GetAmsMgr())
.Times(1)
.WillOnce(Return(amsMgrScheduler));
EXPECT_EQ(AppMgrResultCode::RESULT_OK, client_->LoadAbility(token_, preToken_, abilityInfo, appInfo, want));
EXPECT_EQ(AppMgrResultCode::RESULT_OK, client_->LoadAbility(token_, preToken_, abilityInfo, appInfo, want, 0));
HILOG_INFO("ams_app_mgr_client_test_001 end");
}
@ -148,7 +148,7 @@ HWTEST_F(AmsAppMgrClientTest, AppMgrClient_002, TestSize.Level1)
Want want;
EXPECT_EQ(
AppMgrResultCode::ERROR_SERVICE_NOT_CONNECTED, client_->LoadAbility(token_, preToken_, abilityInfo,
appInfo, want));
appInfo, want, 0));
HILOG_INFO("ams_app_mgr_client_test_002 end");
}

View File

@ -184,7 +184,7 @@ std::shared_ptr<AppRunningRecord> AmsAppRunningRecordTest::StartLoadAbility(cons
service_->SetAppSpawnClient(mockClientPtr);
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(newPid), Return(ERR_OK)));
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
@ -221,7 +221,7 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
EXPECT_EQ(record->GetName(), GetTestAppName());
@ -257,11 +257,11 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_002, TestSize.Level1)
// Create
sptr<IRemoteObject> token = GetMockToken();
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(1010);
// Get
auto record1 = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record1 != nullptr);
EXPECT_EQ(record1->GetName(), GetTestAppName());
EXPECT_EQ(record1->GetProcessName(), GetTestProcessName());
@ -291,7 +291,7 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_003, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
record->SetUid(1010);
auto anotherAbilityInfo = std::make_shared<AbilityInfo>();
@ -305,7 +305,7 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_003, TestSize.Level1)
GetTestProcessName(),
bundleInfo,
hapModuleInfo,
nullptr);
nullptr, 0);
EXPECT_EQ(record1->GetName(), GetTestAppName());
EXPECT_EQ(record1->GetProcessName(), GetTestProcessName());
@ -335,7 +335,7 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_004, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
// Create
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, nullptr, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, nullptr, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record == nullptr);
}
@ -359,7 +359,7 @@ HWTEST_F(AmsAppRunningRecordTest, CreateAppRunningRecord_005, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
// Create
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, nullptr, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, nullptr, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
}
@ -490,12 +490,12 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbility_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
auto record = GetTestAppRunningRecord();
EXPECT_TRUE(record);
record->AddModule(appInfo, nullptr, GetMockToken(), hapModuleInfo, nullptr);
record->AddModule(appInfo, nullptr, GetMockToken(), hapModuleInfo, nullptr, 0);
auto moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRecord = moduleRecord->GetAbilityRunningRecordByToken(GetMockToken());
EXPECT_EQ(nullptr, abilityRecord);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(1);
record->LaunchAbility(abilityRecord);
std::string deviceName = "device";
@ -514,22 +514,22 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbility_001, TestSize.Level1)
std::shared_ptr<AbilityInfo> abilityInfo_sptr = std::make_shared<AbilityInfo>(abilityInfo);
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord =
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, nullptr);
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, nullptr, 0);
EXPECT_NE(nullptr, abilityRunningRecord);
EXPECT_EQ(nullptr, abilityRunningRecord->GetToken());
record->LaunchAbility(abilityRunningRecord);
sptr<IRemoteObject> token = new MockAbilityToken();
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord1 =
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, token);
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, token, 0);
EXPECT_NE(nullptr, abilityRunningRecord1);
EXPECT_NE(nullptr, abilityRunningRecord1->GetToken());
record->LaunchAbility(abilityRunningRecord1);
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord2 =
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, GetMockToken());
std::make_shared<AbilityRunningRecord>(abilityInfo_sptr, GetMockToken(), 0);
EXPECT_NE(nullptr, abilityRunningRecord2);
record->AddModule(appInfo, abilityInfo_sptr, GetMockToken(), hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo_sptr, GetMockToken(), hapModuleInfo, nullptr, 0);
record->LaunchAbility(abilityRunningRecord2);
record->appLifeCycleDeal_ = nullptr;
@ -554,13 +554,13 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbility_002, TestSize.Level1)
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
auto record = GetTestAppRunningRecord();
record->AddModule(appInfo, abilityInfo, GetMockToken(), hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, GetMockToken(), hapModuleInfo, nullptr, 0);
auto moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRecord = moduleRecord->GetAbilityRunningRecordByToken(GetMockToken());
EXPECT_TRUE(abilityRecord);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(1);
record->LaunchAbility(abilityRecord);
@ -749,7 +749,7 @@ HWTEST_F(AmsAppRunningRecordTest, DeleteAppRunningRecord_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetState(ApplicationState::APP_STATE_BACKGROUND);
record->SetApplicationClient(GetMockedAppSchedulerClient());
@ -969,10 +969,10 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_001, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(1);
record->SetApplicationClient(GetMockedAppSchedulerClient());
service_->LaunchApplication(record);
EXPECT_EQ(record->GetState(), ApplicationState::APP_STATE_READY);
@ -1010,24 +1010,24 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_002, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr, 0);
auto moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord);
auto abilityRecord2 = moduleRecord->GetAbilityRunningRecordByToken(token2);
EXPECT_TRUE(abilityRecord2 != nullptr);
sptr<IRemoteObject> token3 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo3, token3, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo3, token3, hapModuleInfo, nullptr, 0);
auto moduleRecord3 = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord3);
auto abilityRecord3 = moduleRecord3->GetAbilityRunningRecordByToken(token3);
EXPECT_TRUE(abilityRecord3 != nullptr);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(EXPECT_ABILITY_LAUNCH_TIME);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(EXPECT_ABILITY_LAUNCH_TIME);
record->SetApplicationClient(GetMockedAppSchedulerClient());
service_->LaunchApplication(record);
EXPECT_EQ(record->GetState(), ApplicationState::APP_STATE_READY);
@ -1058,12 +1058,12 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_003, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
record->SetState(ApplicationState::APP_STATE_READY);
record->SetApplicationClient(GetMockedAppSchedulerClient());
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(0);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(0);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(0);
service_->LaunchApplication(record);
EXPECT_EQ(record->GetState(), ApplicationState::APP_STATE_READY);
HILOG_INFO("AmsAppRunningRecordTest LaunchAbilityForApp_003 end");
@ -1102,17 +1102,17 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_004, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(1);
record->SetApplicationClient(GetMockedAppSchedulerClient());
service_->LaunchApplication(record);
EXPECT_EQ(record->GetState(), ApplicationState::APP_STATE_READY);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(0);
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo, nullptr);
service_->LoadAbility(token2, nullptr, abilityInfo2, appInfo, nullptr, 0);
HILOG_INFO("AmsAppRunningRecordTest LaunchAbilityForApp_004 end");
}
@ -1147,23 +1147,23 @@ HWTEST_F(AmsAppRunningRecordTest, LaunchAbilityForApp_005, TestSize.Level1)
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr, 0);
auto moduleRecord2 = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord2);
auto abilityRecord2 = moduleRecord2->GetAbilityRunningRecordByToken(token2);
abilityRecord2->SetState(AbilityState::ABILITY_STATE_READY);
sptr<IRemoteObject> token3 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo3, token3, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo3, token3, hapModuleInfo, nullptr, 0);
auto moduleRecord3 = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord3);
auto abilityRecord3 = moduleRecord3->GetAbilityRunningRecordByToken(token3);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchApplication(_, _)).Times(1);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _)).Times(EXPECT_ABILITY_LAUNCH_TIME);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleLaunchAbility(_, _, _, _)).Times(EXPECT_ABILITY_LAUNCH_TIME);
record->SetApplicationClient(GetMockedAppSchedulerClient());
service_->LaunchApplication(record);
EXPECT_EQ(record->GetState(), ApplicationState::APP_STATE_READY);
@ -1214,7 +1214,7 @@ HWTEST_F(AmsAppRunningRecordTest, TerminateAbility_002, TestSize.Level1)
appInfo->bundleName = GetTestAppName();
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_CALL(*mockAppSchedulerClient_, ScheduleCleanAbility(_)).Times(0);
record->TerminateAbility(GetMockToken(), false);
@ -1282,7 +1282,7 @@ HWTEST_F(AmsAppRunningRecordTest, SetUid_GetUid_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetUid(102);
@ -1317,7 +1317,7 @@ HWTEST_F(AmsAppRunningRecordTest, OnAbilityStateChanged_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
auto moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord != nullptr);
auto abilityRecord = record->GetAbilityRunningRecordByToken(GetMockToken());
@ -1371,7 +1371,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddModule_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo0, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo0, nullptr);
GetMockToken(), nullptr, appInfo0, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo0, nullptr, 0);
EXPECT_TRUE(record != nullptr);
auto moduleRecordList = record->GetAllModuleRecord();
EXPECT_TRUE(moduleRecordList.size() == 1);
@ -1380,20 +1380,20 @@ HWTEST_F(AmsAppRunningRecordTest, AddModule_001, TestSize.Level1)
record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(!moduleRecord);
record->AddModule(nullptr, nullptr, nullptr, hapModuleInfo, nullptr);
record->AddModule(appInfo, nullptr, nullptr, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, nullptr, hapModuleInfo, nullptr);
record->AddModule(appInfo, nullptr, token2, hapModuleInfo, nullptr);
record->AddModule(nullptr, nullptr, nullptr, hapModuleInfo, nullptr, 0);
record->AddModule(appInfo, nullptr, nullptr, hapModuleInfo, nullptr, 0);
record->AddModule(appInfo, abilityInfo, nullptr, hapModuleInfo, nullptr, 0);
record->AddModule(appInfo, nullptr, token2, hapModuleInfo, nullptr, 0);
moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_FALSE(!moduleRecord);
record->AddModule(appInfo, abilityInfo, token2, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, token2, hapModuleInfo, nullptr, 0);
auto abilityInfo2 = std::make_shared<AbilityInfo>();
abilityInfo2->name = GetTestAbilityName() + "_1";
abilityInfo2->applicationName = GetTestAppName();
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
moduleRecordList = record->GetAllModuleRecord();
EXPECT_TRUE(moduleRecordList.size() == 2);
@ -1422,7 +1422,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddModule_002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
@ -1433,7 +1433,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddModule_002, TestSize.Level1)
abilityInfo2->name = GetTestAbilityName() + "_1";
abilityInfo2->applicationName = GetTestAppName();
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr, 0);
moduleRecordList = record->GetAllModuleRecord();
EXPECT_TRUE(moduleRecordList.size() == 1);
@ -1477,12 +1477,12 @@ HWTEST_F(AmsAppRunningRecordTest, GetModuleRecordByModuleName_001, TestSize.Leve
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo1, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo1, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
EXPECT_TRUE(record->hapModules_.size() == 1);
moduleRecord = record->GetModuleRecordByModuleName(appInfo->bundleName, hapModuleInfo.moduleName);
EXPECT_TRUE(moduleRecord == nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
EXPECT_TRUE(record->hapModules_.size() == 2);
std::string moduleName1 = "module123";
@ -1516,7 +1516,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetAbilities_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
@ -1524,7 +1524,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetAbilities_001, TestSize.Level1)
abilityInfo2->name = GetTestAbilityName() + "_1";
abilityInfo2->applicationName = GetTestAppName();
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo, nullptr, 0);
auto abilities = record->GetAbilities();
EXPECT_TRUE(abilities.size() == 2);
@ -1552,7 +1552,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetAbilities_002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
@ -1562,7 +1562,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetAbilities_002, TestSize.Level1)
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
auto abilities = record->GetAbilities();
EXPECT_TRUE(abilities.size() == 2);
@ -1591,7 +1591,7 @@ HWTEST_F(AmsAppRunningRecordTest, RemoveModuleRecord_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
@ -1601,7 +1601,7 @@ HWTEST_F(AmsAppRunningRecordTest, RemoveModuleRecord_001, TestSize.Level1)
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
std::shared_ptr<ModuleRunningRecord> moduleRecord0;
record->RemoveModuleRecord(moduleRecord0);
@ -1798,7 +1798,7 @@ HWTEST_F(AmsAppRunningRecordTest, StartSpecifiedAbility_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
EXPECT_EQ(record->GetName(), GetTestAppName());
@ -1830,7 +1830,7 @@ HWTEST_F(AmsAppRunningRecordTest, StartSpecifiedAbility_002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
EXPECT_EQ(record->GetName(), GetTestAppName());
@ -1869,7 +1869,7 @@ HWTEST_F(AmsAppRunningRecordTest, Specified_LaunchApplication_001, TestSize.Leve
EXPECT_TRUE(service_ != nullptr);
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
record->SetApplicationClient(GetMockedAppSchedulerClient());
record->isSpecifiedAbility_ = true;
@ -2277,17 +2277,17 @@ HWTEST_F(AmsAppRunningRecordTest, GetAbilityRunningRecord_002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
sptr<IRemoteObject> token = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
auto abilityInfo1 = std::make_shared<AbilityInfo>();
abilityInfo1->name = GetTestAbilityName() + "_1";
abilityInfo1->applicationName = GetTestAppName();
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "";
sptr<IRemoteObject> token1 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo1, token1, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo1, token1, hapModuleInfo1, nullptr, 0);
auto moduleRecordList = record->GetAllModuleRecord();
EXPECT_TRUE(moduleRecordList.size() == 2);
@ -2321,7 +2321,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddAbilityStage_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->AddAbilityStage();
@ -2339,7 +2339,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddAbilityStage_001, TestSize.Level1)
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
record->mainBundleName_ = bundleName;
record->AddAbilityStage();
HILOG_INFO("AmsAppRunningRecordTest AddAbilityStage_001 end");
@ -2369,7 +2369,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddAbilityStageBySpecifiedAbility_001, TestSiz
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->AddAbilityStageBySpecifiedAbility(bundleName1);
@ -2392,7 +2392,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddAbilityStageBySpecifiedAbility_001, TestSiz
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token2 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr);
record->AddModule(appInfo, abilityInfo2, token2, hapModuleInfo1, nullptr, 0);
record->appLifeCycleDeal_ = std::make_shared<AppLifeCycleDeal>();
record->AddAbilityStageBySpecifiedAbility(bundleName);
@ -2423,7 +2423,7 @@ HWTEST_F(AmsAppRunningRecordTest, AddAbilityStageDone_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->AddAbilityStageDone();
@ -2487,12 +2487,12 @@ HWTEST_F(AmsAppRunningRecordTest, GetModuleRunningRecordByToken_001, TestSize.Le
HapModuleInfo hapModuleInfo1;
hapModuleInfo1.moduleName = "module123";
sptr<IRemoteObject> token1 = new (std::nothrow) MockAbilityToken();
record->AddModule(appInfo1, abilityInfo1, token1, hapModuleInfo1, nullptr);
record->AddModule(appInfo1, abilityInfo1, token1, hapModuleInfo1, nullptr, 0);
EXPECT_TRUE(record->hapModules_.size() == 1);
moduleRecord = record->GetModuleRunningRecordByToken(token);
EXPECT_TRUE(moduleRecord == nullptr);
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record->hapModules_.size() == 2);
moduleRecord = record->GetModuleRunningRecordByToken(token);
EXPECT_TRUE(moduleRecord != nullptr);
@ -2537,8 +2537,8 @@ HWTEST_F(AmsAppRunningRecordTest, GetModuleRunningRecordByTerminateLists_001, Te
moduleRecord = record->GetModuleRunningRecordByTerminateLists(token);
EXPECT_TRUE(moduleRecord == nullptr);
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
record->AddModule(appInfo1, abilityInfo1, token1, hapModuleInfo, nullptr);
record->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
record->AddModule(appInfo1, abilityInfo1, token1, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record->hapModules_.size() == 2);
moduleRecord = record->GetModuleRunningRecordByTerminateLists(token);
EXPECT_TRUE(moduleRecord == nullptr);
@ -2546,7 +2546,7 @@ HWTEST_F(AmsAppRunningRecordTest, GetModuleRunningRecordByTerminateLists_001, Te
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecords = record->hapModules_[appInfo->bundleName];
EXPECT_TRUE(moduleRecords.size() == 1);
std::shared_ptr<ModuleRunningRecord> moduleRecord1 = moduleRecords.front();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRecord1->terminateAbilities_.emplace(token, abilityRecord);
moduleRecord = record->GetModuleRunningRecordByTerminateLists(token);
@ -2578,7 +2578,7 @@ HWTEST_F(AmsAppRunningRecordTest, UpdateAbilityFocusState_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
auto abilityRecord = record->GetAbilityRunningRecordByToken(GetMockToken());
@ -2673,14 +2673,14 @@ HWTEST_F(AmsAppRunningRecordTest, CanRestartResidentProc_003, TestSize.Level1)
auto abilityInfo = std::make_shared<AbilityInfo>();
abilityInfo->name = GetTestAbilityName();
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord =
std::make_shared<AbilityRunningRecord>(abilityInfo, token);
std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord1 =
std::make_shared<AbilityRunningRecord>(nullptr, token);
std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
auto abilityInfo1 = std::make_shared<AbilityInfo>();
abilityInfo1->name = GetTestAbilityName();
abilityInfo1->type = AbilityType::EXTENSION;
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord2 =
std::make_shared<AbilityRunningRecord>(abilityInfo1, token);
std::make_shared<AbilityRunningRecord>(abilityInfo1, token, 0);
record->StateChangedNotifyObserver(abilityRunningRecord, 0, false, false);
record->StateChangedNotifyObserver(abilityRunningRecord1, 0, true, false);
record->StateChangedNotifyObserver(abilityRunningRecord, 0, true, false);
@ -2693,7 +2693,7 @@ HWTEST_F(AmsAppRunningRecordTest, CanRestartResidentProc_003, TestSize.Level1)
auto record3 = GetTestAppRunningRecord();
record3->AbilityForeground(abilityRecord3);
abilityRecord3 = std::make_shared<AbilityRunningRecord>(abilityInfo3, token3);
abilityRecord3 = std::make_shared<AbilityRunningRecord>(abilityInfo3, token3, 0);
record3->AbilityForeground(abilityRecord3);
abilityRecord3->SetState(AbilityState::ABILITY_STATE_READY);
@ -2715,7 +2715,7 @@ HWTEST_F(AmsAppRunningRecordTest, CanRestartResidentProc_003, TestSize.Level1)
auto record4 = GetTestAppRunningRecord();
record4->AbilityBackground(abilityRecord4);
abilityRecord4 = std::make_shared<AbilityRunningRecord>(abilityInfo4, token4);
abilityRecord4 = std::make_shared<AbilityRunningRecord>(abilityInfo4, token4, 0);
record4->AbilityBackground(abilityRecord4);
abilityRecord4->SetState(AbilityState::ABILITY_STATE_BACKGROUND);
@ -2728,7 +2728,7 @@ HWTEST_F(AmsAppRunningRecordTest, CanRestartResidentProc_003, TestSize.Level1)
auto record5 = GetTestAppRunningRecord();
record5->AbilityFocused(abilityRecord5);
abilityRecord5 = std::make_shared<AbilityRunningRecord>(abilityInfo5, token5);
abilityRecord5 = std::make_shared<AbilityRunningRecord>(abilityInfo5, token5, 0);
record5->AbilityFocused(abilityRecord5);
auto abilityInfo6 = std::make_shared<AbilityInfo>();
@ -2738,7 +2738,7 @@ HWTEST_F(AmsAppRunningRecordTest, CanRestartResidentProc_003, TestSize.Level1)
auto record6 = GetTestAppRunningRecord();
record6->AbilityUnfocused(abilityRecord6);
abilityRecord6 = std::make_shared<AbilityRunningRecord>(abilityInfo6, token6);
abilityRecord6 = std::make_shared<AbilityRunningRecord>(abilityInfo6, token6, 0);
record6->AbilityUnfocused(abilityRecord6);
std::shared_ptr<AppRunningRecord> record7 = GetTestAppRunningRecord();
@ -2782,7 +2782,7 @@ HWTEST_F(AmsAppRunningRecordTest, IsUIExtension_001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
EXPECT_EQ(AAFwk::UIExtensionUtils::IsUIExtension(record->extensionType_), false);
@ -2818,7 +2818,7 @@ HWTEST_F(AmsAppRunningRecordTest, IsUIExtension_002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
EXPECT_EQ(AAFwk::UIExtensionUtils::IsUIExtension(record->extensionType_), true);
@ -2924,7 +2924,7 @@ HWTEST_F(AmsAppRunningRecordTest, IsAbilitiesBackgrounded_001, TestSize.Level1)
EXPECT_NE(moduleRecord, nullptr);
// 3. create AbilityRecord with AbilityInfo, add the record into ModuleRunningRecord
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, GetMockToken());
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, GetMockToken(), 0);
EXPECT_NE(abilityRecord, nullptr);
moduleRecord->abilities_.emplace(GetMockToken(), abilityRecord);
@ -2961,7 +2961,7 @@ HWTEST_F(AmsAppRunningRecordTest, IsAbilitytiesBackground_001, TestSize.Level1)
EXPECT_NE(abilityInfo, nullptr);
abilityInfo->name = GetTestAbilityName();
abilityInfo->type = AbilityType::PAGE;
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, GetMockToken());
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, GetMockToken(), 0);
EXPECT_NE(abilityRecord, nullptr);
std::shared_ptr<ModuleRunningRecord> moduleRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);;

View File

@ -142,14 +142,14 @@ TestApplicationPreRecord AmsWorkFlowTest::CreateTestApplicationRecord(const std:
appInfo->name, appInfo->name, appInfo->uid, bundleInfo);
if (!appRecord) {
appRecord = serviceInner_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, appInfo->name, bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, appInfo->name, bundleInfo, hapModuleInfo, nullptr, 0);
serviceInner_->StartProcess(abilityInfo->applicationName,
appInfo->name,
false, appRecord,
abilityInfo->applicationInfo.uid,
bundleInfo, abilityInfo->applicationInfo.bundleName, 0);
} else {
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr);
appRecord->AddModule(appInfo, abilityInfo, token, hapModuleInfo, nullptr, 0);
}
EXPECT_NE(appRecord, nullptr);

View File

@ -113,9 +113,9 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_001, TestSize.Level1)
std::shared_ptr<ApplicationInfo> applicationInfo = std::make_shared<ApplicationInfo>();
applicationInfo->name = GetTestAppName();
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _))
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _, _))
.WillOnce(InvokeWithoutArgs(mockAppMgrServiceInner.get(), &MockAppMgrServiceInner::Post));
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, applicationInfo, nullptr);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, applicationInfo, nullptr, 0);
mockAppMgrServiceInner->Wait();
HILOG_DEBUG("AmsMgrScheduler_001 end.");
@ -147,12 +147,12 @@ HWTEST_F(AmsMgrSchedulerTest, AmsMgrScheduler_002, TestSize.Level1)
applicationInfo->name = GetTestAppName();
// check token parameter
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0);
amsMgrScheduler->LoadAbility(token, preToken, nullptr, applicationInfo, nullptr);
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _, _)).Times(0);
amsMgrScheduler->LoadAbility(token, preToken, nullptr, applicationInfo, nullptr, 0);
// check pretoken parameter
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _)).Times(0);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, nullptr, nullptr);
EXPECT_CALL(*mockAppMgrServiceInner, LoadAbility(_, _, _, _, _, _)).Times(0);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, nullptr, nullptr, 0);
HILOG_DEBUG("AmsMgrScheduler_002 end.");
}
@ -432,7 +432,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_001, TestSize.Level0)
std::shared_ptr<AbilityInfo> abilityInfo = nullptr;
std::shared_ptr<ApplicationInfo> appInfo = nullptr;
std::shared_ptr<Want> want = nullptr;
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want, 0);
}
/*
@ -452,7 +452,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_002, TestSize.Level0)
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ApplicationInfo> appInfo = nullptr;
std::shared_ptr<Want> want = nullptr;
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want, 0);
}
/*
@ -472,7 +472,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_003, TestSize.Level0)
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<Want> want = nullptr;
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want, 0);
}
/*
@ -494,7 +494,7 @@ HWTEST_F(AmsMgrSchedulerTest, LoadAbility_004, TestSize.Level0)
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<Want> want = nullptr;
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want);
amsMgrScheduler->LoadAbility(token, preToken, abilityInfo, appInfo, want, 0);
}
/*

View File

@ -154,7 +154,7 @@ void AmsRecentAppListTest::StartProcessSuccess(const int32_t index) const
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK)));
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockClientPtr));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
return;
}
@ -206,7 +206,7 @@ HWTEST_F(AmsRecentAppListTest, Create_002, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).WillOnce(Return(ERR_APPEXECFWK_ASSEMBLE_START_MSG_FAILED));
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockClientPtr));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_TRUE(serviceInner_->GetRecentAppList().empty());
}
@ -237,11 +237,11 @@ HWTEST_F(AmsRecentAppListTest, Create_003, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK)));
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockClientPtr));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(INDEX_NUM_1, static_cast<int32_t>(serviceInner_->GetRecentAppList().size()));
// Load ability1, start process 1 again.
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(INDEX_NUM_1, static_cast<int32_t>(serviceInner_->GetRecentAppList().size()));
}
@ -460,7 +460,7 @@ HWTEST_F(AmsRecentAppListTest, PushAppFront_001, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(pid), Return(ERR_OK)));
serviceInner_->SetAppSpawnClient(std::unique_ptr<MockAppSpawnClient>(mockClientPtr));
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
serviceInner_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(INDEX_NUM_1, static_cast<int32_t>(serviceInner_->GetRecentAppList().size()));
auto appRecord = GetAppRunningRecordByIndex(INDEX_NUM_1);
serviceInner_->PushAppFront(appRecord->GetRecordId());

View File

@ -140,7 +140,7 @@ std::shared_ptr<AppRunningRecord> AmsServiceLoadAbilityProcessTest::StartLoadAbi
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(newPid), Return(ERR_OK)));
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, preToken, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, preToken, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
@ -297,7 +297,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_003, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(nullptr, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(nullptr, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)0);
@ -329,7 +329,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_004, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)0);
HILOG_INFO("AmsServiceLoadAbilityProcessTest LoadAbility_004 end");
@ -359,7 +359,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_005, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)0);
HILOG_INFO("AmsServiceLoadAbilityProcessTest LoadAbility_005 end");
@ -390,7 +390,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_006, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)0);
HILOG_INFO("AmsServiceLoadAbilityProcessTest LoadAbility_006 end");
@ -440,7 +440,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_007, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(recordMap.size(), (uint32_t)1);
auto record2 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
@ -502,7 +502,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LoadAbility_008, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(0);
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token2, preToken, abilityInfo2, appInfo, nullptr);
service_->LoadAbility(token2, preToken, abilityInfo2, appInfo, nullptr, 0);
EXPECT_EQ(recordMap.size(), (uint32_t)1);
auto record2 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
@ -544,7 +544,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, RequestProcess_001, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(PID), Return(ERR_OK)));
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)1);
@ -586,7 +586,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, RequestProcess_002, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(Return(ERR_APPEXECFWK_INVALID_PID));
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
const auto& recordMap = service_->appRunningManager_->GetAppRunningRecordMap();
EXPECT_EQ(recordMap.size(), (uint32_t)0);
@ -620,7 +620,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, SavePid_001, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(PID), Return(ERR_OK)));
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
@ -655,7 +655,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, SavePid_002, TestSize.Level1)
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(Return(ERR_APPEXECFWK_INVALID_PID));
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
@ -755,7 +755,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, LaunchMode_002, TestSize.Level1)
sptr<IRemoteObject> token2 = new MockAbilityToken();
sptr<IRemoteObject> preToken = token;
service_->SetAppSpawnClient(mockClientPtr);
service_->LoadAbility(token2, preToken, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token2, preToken, abilityInfo, appInfo, nullptr, 0);
EXPECT_EQ(recordMap.size(), (uint32_t)1);
auto record2 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
@ -816,11 +816,11 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_001, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(token2, token, abilityInfo2, record, hapModuleInfo, nullptr);
service_->StartAbility(token2, token, abilityInfo2, record, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
const auto& abilityMap1 = record1->GetAbilities();
@ -882,11 +882,11 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_002, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(0);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(0);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(token2, token, abilityInfo2, nullptr, hapModuleInfo, nullptr);
service_->StartAbility(token2, token, abilityInfo2, nullptr, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
const auto& abilityMap1 = record1->GetAbilities();
@ -949,10 +949,10 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_003, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(0);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(0);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(token2, token, abilityInfo2, nullptr, hapModuleInfo, nullptr);
service_->StartAbility(token2, token, abilityInfo2, nullptr, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
const auto& abilityMap1 = record1->GetAbilities();
@ -1008,10 +1008,10 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_004, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(0);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(0);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(nullptr, token, abilityInfo2, nullptr, hapModuleInfo, nullptr);
service_->StartAbility(nullptr, token, abilityInfo2, nullptr, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
@ -1071,10 +1071,10 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_005, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(1);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(1);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(token2, nullptr, abilityInfo2, record, hapModuleInfo, nullptr);
service_->StartAbility(token2, nullptr, abilityInfo2, record, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
const auto& abilityMap1 = record1->GetAbilities();
@ -1133,10 +1133,10 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartAbility_006, TestSize.Level1)
sptr<MockAppScheduler> mockAppScheduler = new MockAppScheduler();
sptr<IAppScheduler> client = iface_cast<IAppScheduler>(mockAppScheduler.GetRefPtr());
record->SetApplicationClient(client);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _)).Times(0);
EXPECT_CALL(*mockAppScheduler, ScheduleLaunchAbility(_, _, _, _)).Times(0);
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
service_->StartAbility(nullptr, token, abilityInfo2, nullptr, hapModuleInfo, nullptr);
service_->StartAbility(nullptr, token, abilityInfo2, nullptr, hapModuleInfo, nullptr, 0);
auto record1 = service_->appRunningManager_->CheckAppRunningRecordIsExist(
appInfo->name, GetTestAppName(), appInfo->uid, bundleInfo);
const auto& abilityMap1 = record1->GetAbilities();
@ -1176,7 +1176,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartProcess001, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr, 0);
service_->StartProcess(abilityInfo->applicationName,
GetTestAppName(),
@ -1226,7 +1226,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartProcess002, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr, 0);
service_->SetAppSpawnClient(nullptr);
service_->StartProcess(abilityInfo->applicationName,
@ -1271,7 +1271,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartProcess003, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr, 0);
service_->StartProcess(abilityInfo->applicationName,
GetTestAppName(),
@ -1322,7 +1322,7 @@ HWTEST_F(AmsServiceLoadAbilityProcessTest, StartProcess004, TestSize.Level1)
hapModuleInfo.moduleName = "module789";
std::shared_ptr<AppRunningRecord> record = service_->CreateAppRunningRecord(
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr);
token, nullptr, appInfo, abilityInfo, GetTestAppName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_NE(record, nullptr);
CHECK_POINTER_IS_NULLPTR(record);

View File

@ -151,7 +151,7 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_003, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
@ -178,12 +178,12 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_004, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecord;
EXPECT_TRUE(appMgrServiceInner->SendProcessStartEvent(appRecord));
HILOG_INFO("SendProcessStartEvent_004 end");
@ -208,12 +208,12 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_005, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecord;
appRecord->SetCallerTokenId(IPCSkeleton::GetCallingTokenID());
EXPECT_TRUE(appMgrServiceInner->SendProcessStartEvent(appRecord));
@ -239,12 +239,12 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_006, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecord;
appRecord->SetCallerTokenId(IPCSkeleton::GetCallingTokenID());
appRecord->SetCallerUid(IPCSkeleton::GetCallingUid());
@ -271,12 +271,12 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_007, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecord;
appRecord->SetCallerTokenId(IPCSkeleton::GetCallingTokenID());
appRecord->SetCallerUid(IPCSkeleton::GetCallingUid());
@ -314,12 +314,12 @@ HWTEST_F(AppMgrServiceInnerTest, SendProcessStartEvent_008, TestSize.Level1)
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
std::shared_ptr<ModuleRunningRecord> moduleRunningRecord = std::make_shared<ModuleRunningRecord>(appInfo, nullptr);
std::shared_ptr<AbilityRunningRecord> abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token);
auto abilityRecordEmpty = std::make_shared<AbilityRunningRecord>(nullptr, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecordEmpty;
std::vector<std::shared_ptr<ModuleRunningRecord>> moduleRecordList = { moduleRunningRecord };
appRecord->hapModules_["moduleRecordList"] = moduleRecordList;
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
moduleRunningRecord->abilities_[token] = abilityRecord;
appRecord->SetCallerTokenId(IPCSkeleton::GetCallingTokenID());
appRecord->SetCallerUid(IPCSkeleton::GetCallingUid());

View File

@ -385,18 +385,18 @@ HWTEST_F(AppMgrServiceInnerTest, LoadAbility_001, TestSize.Level0)
EXPECT_NE(appMgrServiceInner, nullptr);
appMgrServiceInner->appRunningManager_ = nullptr;
appMgrServiceInner->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr);
appMgrServiceInner->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr, 0);
auto appMgrServiceInner1 = std::make_shared<AppMgrServiceInner>();
EXPECT_NE(appMgrServiceInner1, nullptr);
appMgrServiceInner1->remoteClientManager_->SetBundleManagerHelper(nullptr);
appMgrServiceInner1->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr);
appMgrServiceInner1->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr, 0);
auto appMgrServiceInner2 = std::make_shared<AppMgrServiceInner>();
EXPECT_NE(appMgrServiceInner2, nullptr);
appMgrServiceInner2->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr);
appMgrServiceInner2->LoadAbility(token, nullptr, abilityInfo_, applicationInfo_, nullptr, 0);
HILOG_INFO("LoadAbility_001 end");
}
@ -1144,56 +1144,56 @@ HWTEST_F(AppMgrServiceInnerTest, CreateAppRunningRecord_001, TestSize.Level0)
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(nullptr, nullptr,
nullptr, nullptr, "", bundleInfo, hapModuleInfo, nullptr);
nullptr, nullptr, "", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_EQ(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
nullptr, nullptr, "", bundleInfo, hapModuleInfo, nullptr);
nullptr, nullptr, "", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_EQ(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, nullptr, "", bundleInfo, hapModuleInfo, nullptr);
applicationInfo_, nullptr, "", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_EQ(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, "", bundleInfo, hapModuleInfo, nullptr);
applicationInfo_, abilityInfo_, "", bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_EQ(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_NE(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_NE(appRecord, nullptr);
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_NE(appRecord, nullptr);
std::shared_ptr<AppRunningRecord> appRecord1 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
nullptr, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
nullptr, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_EQ(appRecord1, nullptr);
std::shared_ptr<AppRunningRecord> appRecord2 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord2, nullptr);
want = std::make_shared<Want>();
const std::string COLD_START = "coldStart";
want->SetParam(COLD_START, true);
std::shared_ptr<AppRunningRecord> appRecord3 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord3, nullptr);
want->SetParam(COLD_START, false);
std::shared_ptr<AppRunningRecord> appRecord4 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord4, nullptr);
appMgrServiceInner->appRunningManager_ = nullptr;
std::shared_ptr<AppRunningRecord> appRecord5 = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_EQ(appRecord5, nullptr);
HILOG_INFO("CreateAppRunningRecord_001 end");
@ -1246,13 +1246,13 @@ HWTEST_F(AppMgrServiceInnerTest, UpdateAbilityState_001, TestSize.Level0)
std::shared_ptr<AAFwk::Want> want;
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, nullptr, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, nullptr, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->UpdateAbilityState(token, AbilityState::ABILITY_STATE_CREATE);
OHOS::sptr<IRemoteObject> token1 = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
std::shared_ptr<AppRunningRecord> appRecord1 = appMgrServiceInner->CreateAppRunningRecord(token1, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord1, nullptr);
appMgrServiceInner->UpdateAbilityState(token1, AbilityState::ABILITY_STATE_READY);
@ -1278,7 +1278,7 @@ HWTEST_F(AppMgrServiceInnerTest, UpdateAbilityState_001, TestSize.Level0)
OHOS::sptr<IRemoteObject> token2 = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
abilityInfo_->type = AbilityType::SERVICE;
std::shared_ptr<AppRunningRecord> appRecord2 = appMgrServiceInner->CreateAppRunningRecord(token2, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord2, nullptr);
appMgrServiceInner->UpdateAbilityState(token2, AbilityState::ABILITY_STATE_CREATE);
@ -1324,7 +1324,7 @@ HWTEST_F(AppMgrServiceInnerTest, UpdateExtensionState_001, TestSize.Level0)
std::shared_ptr<AAFwk::Want> want;
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->UpdateExtensionState(token, ExtensionState::EXTENSION_STATE_CREATE);
@ -1485,7 +1485,7 @@ HWTEST_F(AppMgrServiceInnerTest, AbilityBehaviorAnalysis_001, TestSize.Level0)
std::shared_ptr<AAFwk::Want> want;
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->AbilityBehaviorAnalysis(token, nullptr, 0, 0, 0);
@ -1517,7 +1517,7 @@ HWTEST_F(AppMgrServiceInnerTest, KillProcessByAbilityToken_001, TestSize.Level0)
std::shared_ptr<AAFwk::Want> want;
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->KillProcessByAbilityToken(token);
@ -1562,27 +1562,27 @@ HWTEST_F(AppMgrServiceInnerTest, StartAbility_001, TestSize.Level0)
HapModuleInfo hapModuleInfo;
std::shared_ptr<AAFwk::Want> want;
std::shared_ptr<AppRunningRecord> appRecord;
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, nullptr, hapModuleInfo, nullptr);
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, appRecord, hapModuleInfo, nullptr);
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, nullptr, hapModuleInfo, nullptr, 0);
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, appRecord, hapModuleInfo, nullptr, 0);
appMgrServiceInner->StartAbility(nullptr, nullptr, abilityInfo_, appRecord, hapModuleInfo, want, 0);
OHOS::sptr<IRemoteObject> token = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
OHOS::sptr<IRemoteObject> preToken = sptr<IRemoteObject>(new (std::nothrow) MockAbilityToken());
appMgrServiceInner->StartAbility(token, nullptr, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(nullptr, preToken, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(token, nullptr, abilityInfo_, appRecord, hapModuleInfo, want, 0);
appMgrServiceInner->StartAbility(nullptr, preToken, abilityInfo_, appRecord, hapModuleInfo, want, 0);
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want, 0);
BundleInfo bundleInfo;
std::string processName = "test_processName";
appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->StartAbility(token, nullptr, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(token, nullptr, abilityInfo_, appRecord, hapModuleInfo, want, 0);
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want, 0);
abilityInfo_->applicationInfo.name = "hiservcie";
abilityInfo_->applicationInfo.bundleName = "com.ix.hiservcie";
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want);
appMgrServiceInner->StartAbility(token, preToken, abilityInfo_, appRecord, hapModuleInfo, want, 0);
HILOG_INFO("StartAbility_001 end");
}
@ -1630,7 +1630,7 @@ HWTEST_F(AppMgrServiceInnerTest, AbilityTerminated_001, TestSize.Level0)
std::shared_ptr<AAFwk::Want> want;
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
appMgrServiceInner->AbilityTerminated(token);
@ -1708,7 +1708,7 @@ HWTEST_F(AppMgrServiceInnerTest, OnAbilityStateChanged_001, TestSize.Level0)
sptr<IRemoteObject> token = new MockAbilityToken();
std::shared_ptr<AbilityRunningRecord> abilityRunningRecord =
std::make_shared<AbilityRunningRecord>(abilityInfo_, token);
std::make_shared<AbilityRunningRecord>(abilityInfo_, token, 0);
appMgrServiceInner->OnAbilityStateChanged(abilityRunningRecord, AbilityState::ABILITY_STATE_CREATE);
sptr<MockAppStateCallback> mockCallback(new MockAppStateCallback());
@ -2476,7 +2476,7 @@ HWTEST_F(AppMgrServiceInnerTest, FinishUserTest_001, TestSize.Level0)
sptr<IRemoteObject> token = new MockAbilityToken();
std::string processName = "test_processName";
std::shared_ptr<AppRunningRecord> appRecord = appMgrServiceInner->CreateAppRunningRecord(token, nullptr,
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want);
applicationInfo_, abilityInfo_, processName, bundleInfo, hapModuleInfo, want, 0);
EXPECT_NE(appRecord, nullptr);
pid = appRecord->GetPriorityObject()->GetPid();
appMgrServiceInner->FinishUserTest(msg, 0, bundleName, pid);

View File

@ -171,7 +171,7 @@ std::shared_ptr<AppRunningRecord> AppRunningProcessesInfoTest::GetTestAppRunning
abilityInfo->name = GetTestAbilityName();
HapModuleInfo hapModuleInfo;
hapModuleInfo.moduleName = "module789";
testAppRecord_->AddModule(appInfo, abilityInfo, GetMockToken(), hapModuleInfo, nullptr);
testAppRecord_->AddModule(appInfo, abilityInfo, GetMockToken(), hapModuleInfo, nullptr, 0);
}
return testAppRecord_;
}
@ -184,7 +184,7 @@ std::shared_ptr<AppRunningRecord> AppRunningProcessesInfoTest::StartLoadAbility(
service_->SetAppSpawnClient(mockClientPtr);
EXPECT_CALL(*mockClientPtr, StartProcess(_, _)).Times(1).WillOnce(DoAll(SetArgReferee<1>(newPid), Return(ERR_OK)));
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr);
service_->LoadAbility(token, nullptr, abilityInfo, appInfo, nullptr, 0);
BundleInfo bundleInfo;
bundleInfo.appId = "com.ohos.test.helloworld_code123";
@ -221,7 +221,7 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_001, TestSize.Level
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetState(ApplicationState::APP_STATE_FOREGROUND);
record->SetApplicationClient(GetMockedAppSchedulerClient());
@ -253,7 +253,7 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_002, TestSize.Level
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo, appInfo, bundleInfo, hapModuleInfo));
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetUid(uid);
@ -315,7 +315,7 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_003, TestSize.Level
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetUid(uid);
@ -358,8 +358,8 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_003, TestSize.Level
EXPECT_TRUE(service_->GetBundleAndHapInfo(*abilityInfo2, appInfo2, bundleInfo2, hapModuleInfo2));
EXPECT_TRUE(service_ != nullptr);
auto mock_token = new (std::nothrow) MockAbilityToken();
auto record2 = service_->CreateAppRunningRecord(
mock_token, nullptr, appInfo2, abilityInfo2, GetTestProcessName() + "2", bundleInfo2, hapModuleInfo2, nullptr);
auto record2 = service_->CreateAppRunningRecord(mock_token, nullptr, appInfo2, abilityInfo2,
GetTestProcessName() + "2", bundleInfo2, hapModuleInfo2, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record2->SetUid(uid);
@ -393,7 +393,7 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_004, TestSize.Level
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetState(ApplicationState::APP_STATE_BACKGROUND);
record->SetApplicationClient(GetMockedAppSchedulerClient());
@ -423,7 +423,7 @@ HWTEST_F(AppRunningProcessesInfoTest, UpdateAppRunningRecord_005, TestSize.Level
hapModuleInfo.moduleName = "module789";
EXPECT_TRUE(service_ != nullptr);
auto record = service_->CreateAppRunningRecord(
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr);
GetMockToken(), nullptr, appInfo, abilityInfo, GetTestProcessName(), bundleInfo, hapModuleInfo, nullptr, 0);
EXPECT_TRUE(record != nullptr);
record->SetState(ApplicationState::APP_STATE_BACKGROUND);
record->SetApplicationClient(GetMockedAppSchedulerClient());

View File

@ -199,7 +199,7 @@ HWTEST_F(AppRunningRecordTest, AppRunningRecord_AddChildProcessRecord_0100, Test
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, RECORD_ID, "com.example.child");
EXPECT_NE(appRecord, nullptr);
auto childRecord = std::make_shared<ChildProcessRecord>(101, "./ets/AProcess.ts", appRecord);
pid_t childPid = 201;
childRecord->pid_ = childPid;
@ -221,7 +221,7 @@ HWTEST_F(AppRunningRecordTest, AppRunningRecord_RemoveChildProcessRecord_0100, T
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, RECORD_ID, "com.example.child");
EXPECT_NE(appRecord, nullptr);
auto childRecord = std::make_shared<ChildProcessRecord>(101, "./ets/AProcess.ts", appRecord);
pid_t childPid = 201;
childRecord->pid_ = childPid;
@ -244,7 +244,7 @@ HWTEST_F(AppRunningRecordTest, AppRunningRecord_GetChildProcessRecordByPid_0100,
std::shared_ptr<ApplicationInfo> appInfo = std::make_shared<ApplicationInfo>();
auto appRecord = std::make_shared<AppRunningRecord>(appInfo, RECORD_ID, "com.example.child");
EXPECT_NE(appRecord, nullptr);
auto childRecord = std::make_shared<ChildProcessRecord>(101, "./ets/AProcess.ts", appRecord);
pid_t childPid = 201;
childRecord->pid_ = childPid;
@ -288,7 +288,7 @@ HWTEST_F(AppRunningRecordTest, GetSplitModeAndFloatingMode_001, TestSize.Level1)
std::shared_ptr<AbilityInfo> abilityInfo = std::make_shared<AbilityInfo>();
sptr<IRemoteObject> token = nullptr;
std::shared_ptr<AbilityRunningRecord> abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token);
auto abilityRecord = std::make_shared<AbilityRunningRecord>(abilityInfo, token, 0);
std::shared_ptr<AAFwk::Want> want = std::make_shared<AAFwk::Want>();
want->SetParam(AAFwk::Want::PARAM_RESV_WINDOW_MODE,

View File

@ -30,8 +30,8 @@ public:
{}
MOCK_METHOD0(ConnectAppMgrService, AppMgrResultCode());
MOCK_METHOD1(RegisterAppStateCallback, AppMgrResultCode(const sptr<IAppStateCallback> &callback));
MOCK_METHOD5(LoadAbility, AppMgrResultCode(const sptr<IRemoteObject>&, const sptr<IRemoteObject>&,
const AbilityInfo&, const ApplicationInfo&, const AAFwk::Want&));
MOCK_METHOD6(LoadAbility, AppMgrResultCode(sptr<IRemoteObject>, sptr<IRemoteObject>,
const AbilityInfo&, const ApplicationInfo&, const AAFwk::Want&, int32_t));
MOCK_METHOD2(TerminateAbility, AppMgrResultCode(const sptr<IRemoteObject>&, bool));
MOCK_METHOD2(UpdateExtensionState, AppMgrResultCode(const sptr<IRemoteObject> &token, const ExtensionState state));
MOCK_METHOD2(UpdateApplicationInfoInstalled, AppMgrResultCode(const std::string &bundleName, const int uid));

View File

@ -230,7 +230,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level1)
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = nullptr;
EXPECT_NE((int)ERR_OK,
DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
token, pretoken, record->GetAbilityInfo(), record->GetApplicationInfo(), record->GetWant()));
token, pretoken, record->GetAbilityInfo(), record->GetApplicationInfo(), record->GetWant(), 0));
}
/*
@ -243,7 +243,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_oprator_004, TestSize.Level1)
*/
HWTEST_F(AppSchedulerTest, AppScheduler_LoadAbility_001, TestSize.Level1)
{
EXPECT_CALL(*clientMock_, LoadAbility(_, _, _, _, _)).Times(1)
EXPECT_CALL(*clientMock_, LoadAbility(_, _, _, _, _, _)).Times(1)
.WillOnce(Return(AppMgrResultCode::ERROR_SERVICE_NOT_READY));
sptr<IRemoteObject> token;
sptr<IRemoteObject> preToken;
@ -252,7 +252,7 @@ HWTEST_F(AppSchedulerTest, AppScheduler_LoadAbility_001, TestSize.Level1)
Want want;
DelayedSingleton<AppScheduler>::GetInstance()->appMgrClient_ = std::move(clientMock_);
int res = DelayedSingleton<AppScheduler>::GetInstance()->LoadAbility(
token, preToken, abilityInfo, applicationInfo, want);
token, preToken, abilityInfo, applicationInfo, want, 0);
EXPECT_EQ(res, INNER_ERR);
}

View File

@ -404,7 +404,7 @@ HWTEST_F(MainThreadTest, GetMainHandler_0100, TestSize.Level1)
AbilityInfo info;
sptr<IRemoteObject> Token = nullptr;
std::shared_ptr<AAFwk::Want> want = std::make_shared<AAFwk::Want>();
mainThread_->ScheduleLaunchAbility(info, Token, want);
mainThread_->ScheduleLaunchAbility(info, Token, want, 0);
mainThread_->ScheduleCleanAbility(Token);
Profile profile;
mainThread_->ScheduleProfileChanged(profile);
@ -1837,7 +1837,7 @@ HWTEST_F(MainThreadTest, PostTask_0100, TestSize.Level1)
AbilityInfo abilityInfo = {};
sptr<IRemoteObject> token = nullptr;
std::shared_ptr<AAFwk::Want> want = std::make_shared<AAFwk::Want>();
mainThread_->ScheduleLaunchAbility(abilityInfo, token, want);
mainThread_->ScheduleLaunchAbility(abilityInfo, token, want, 0);
mainThread_->ScheduleCleanAbility(token);
Profile profile = {};
mainThread_->ScheduleProfileChanged(profile);

View File

@ -780,7 +780,7 @@ HWTEST_F(UIAbilityThreadTest, AbilityRuntime_BuildAbilityContext_0100, Function
EXPECT_NE(abilityInfo, nullptr);
EXPECT_NE(application, nullptr);
EXPECT_NE(token, nullptr);
abilitythread->BuildAbilityContext(abilityInfo, application, token, nullptr);
abilitythread->BuildAbilityContext(abilityInfo, application, token, nullptr, 0);
GTEST_LOG_(INFO) << "AbilityRuntime_BuildAbilityContext_0100 end";
}