!1140 删除任务栈

Merge pull request !1140 from jerry/master
This commit is contained in:
openharmony_ci 2022-03-11 02:40:20 +00:00 committed by Gitee
commit 2defb32dd3
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
47 changed files with 9 additions and 629 deletions

View File

@ -143,11 +143,6 @@ int MockServiceAbilityManagerService::RemoveMission(int id)
return 0;
}
int MockServiceAbilityManagerService::RemoveStack(int id)
{
return 0;
}
int MockServiceAbilityManagerService::MoveMissionToEnd(const sptr<IRemoteObject> &token, const bool nonFirst)
{
return 0;

View File

@ -149,7 +149,6 @@ public:
int RemoveMission(int id) override;
int RemoveStack(int id) override;
int PowerOff() override;
int PowerOn() override;
int LockMission(int missionId) override

View File

@ -180,11 +180,6 @@ ErrCode AbilityManagerClient::RemoveMissions(std::vector<int> missionId)
return ret;
}
ErrCode AbilityManagerClient::RemoveStack(int id)
{
return ERR_OK;
}
ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)
{
return ERR_OK;

View File

@ -156,11 +156,6 @@ int MockAbilityManagerService::RemoveMission(int id)
return 0;
}
int MockAbilityManagerService::RemoveStack(int id)
{
return 0;
}
int MockAbilityManagerService::MoveMissionToTop(int32_t missionId)
{
return 0;

View File

@ -171,7 +171,6 @@ public:
int RemoveMission(int id) override;
int RemoveStack(int id) override;
sptr<IAbilityScheduler> AcquireDataAbility(
const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken) override
{

View File

@ -175,11 +175,6 @@ ErrCode AbilityManagerClient::RemoveMissions(std::vector<int> missionId)
return ret;
}
ErrCode AbilityManagerClient::RemoveStack(int id)
{
return ERR_OK;
}
ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)
{
return ERR_OK;

View File

@ -55,7 +55,6 @@ public:
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &));
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionPixelMap &));
MOCK_METHOD1(RemoveMission, int(int));
MOCK_METHOD1(RemoveStack, int(int));
MOCK_METHOD4(OnRemoteRequest, int(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option));
MOCK_METHOD1(MoveMissionToTop, int(int32_t));

View File

@ -190,11 +190,6 @@ int MockAbilityManagerService::RemoveMission(int id)
return 0;
}
int MockAbilityManagerService::RemoveStack(int id)
{
return 0;
}
sptr<IAbilityScheduler> MockAbilityManagerService::AcquireDataAbility(
const Uri &uri, bool tryBind, const sptr<IRemoteObject> &callerToken)
{

View File

@ -154,7 +154,6 @@ public:
int RemoveMission(int id) override;
int RemoveStack(int id) override;
int PowerOff() override;
int PowerOn() override;
int LockMission(int missionId) override

View File

@ -181,11 +181,6 @@ int MockServiceAbilityManagerService::RemoveMission(int id)
return 0;
}
int MockServiceAbilityManagerService::RemoveStack(int id)
{
return 0;
}
int MockServiceAbilityManagerService::MoveMissionToEnd(const sptr<IRemoteObject> &token, const bool nonFirst)
{
return 0;

View File

@ -148,7 +148,6 @@ public:
int RemoveMission(int id) override;
int RemoveStack(int id) override;
int PowerOff() override;
int PowerOn() override;
int LockMission(int missionId) override

View File

@ -318,14 +318,6 @@ public:
*/
ErrCode RemoveMissions(std::vector<int> missionId);
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @return Returns ERR_OK on success, others on failure.
*/
ErrCode RemoveStack(int id);
/**
* Kill the process immediately.
*

View File

@ -357,14 +357,6 @@ public:
*/
virtual int RemoveMission(int id) = 0;
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @return Returns ERR_OK on success, others on failure.
*/
virtual int RemoveStack(int id) = 0;
/**
* Kill the process immediately.
*

View File

@ -1361,124 +1361,6 @@ napi_value NAPI_RemoveMissions(napi_env env, napi_callback_info info)
return ((callBackMode) ? (nullptr) : (ret));
}
auto NAPI_ClearMissionsAsyncExecuteCallback = [](napi_env env, void *data) {
HILOG_INFO("clearMissions called(CallBack Mode)...");
AsyncClearMissionsCallbackInfo *async_callback_info = (AsyncClearMissionsCallbackInfo *)data;
async_callback_info->result = GetAbilityManagerInstance()->RemoveStack(NapiAbilityMgr::DEFAULT_STACK_ID);
};
auto NAPI_ClearMissionsAsyncCompleteCallback = [](napi_env env, napi_status status, void *data) {
HILOG_INFO("clearMissions compeleted(CallBack Mode)...");
AsyncClearMissionsCallbackInfo *async_callback_info = (AsyncClearMissionsCallbackInfo *)data;
napi_value result[NUMBER_OF_PARAMETERS_TWO] = {0};
napi_value callback = nullptr;
napi_value undefined = nullptr;
napi_value callResult = nullptr;
result[0] = GetCallbackErrorValue(async_callback_info->env, NapiAbilityMgr::BUSINESS_ERROR_CODE_OK);
napi_create_int32(async_callback_info->env, async_callback_info->result, &result[1]);
napi_get_undefined(env, &undefined);
napi_get_reference_value(env, async_callback_info->callback[0], &callback);
napi_call_function(env, undefined, callback, NUMBER_OF_PARAMETERS_TWO, &result[0], &callResult);
if (async_callback_info->callback[0] != nullptr) {
napi_delete_reference(env, async_callback_info->callback[0]);
}
napi_delete_async_work(env, async_callback_info->asyncWork);
delete async_callback_info;
};
auto NAPI_ClearMissionsPromiseCompleteCallback = [](napi_env env, napi_status status, void *data) {
HILOG_INFO("clearMissions compeleted(Promise Mode)...");
AsyncClearMissionsCallbackInfo *async_callback_info = (AsyncClearMissionsCallbackInfo *)data;
napi_value result = nullptr;
napi_create_int32(async_callback_info->env, async_callback_info->result, &result);
napi_resolve_deferred(async_callback_info->env, async_callback_info->deferred, result);
napi_delete_async_work(env, async_callback_info->asyncWork);
delete async_callback_info;
};
napi_value NAPI_ClearMissionsWrap(
napi_env env, napi_callback_info info, bool callBackMode, AsyncClearMissionsCallbackInfo &async_callback_info)
{
HILOG_INFO("NAPI_ClearMissions called...");
if (callBackMode) {
napi_value resourceName = nullptr;
napi_create_string_latin1(env, "NAPI_ClearMissionsCallBack", NAPI_AUTO_LENGTH, &resourceName);
napi_create_async_work(env,
nullptr,
resourceName,
NAPI_ClearMissionsAsyncExecuteCallback,
NAPI_ClearMissionsAsyncCompleteCallback,
(void *)&async_callback_info,
&async_callback_info.asyncWork);
NAPI_CALL(env, napi_queue_async_work(env, async_callback_info.asyncWork));
// create return
napi_value ret = 0;
NAPI_CALL(env, napi_create_int32(env, 0, &ret));
return ret;
} else {
napi_value resourceName = nullptr;
napi_create_string_latin1(env, "NAPI_ClearMissionsPromise", NAPI_AUTO_LENGTH, &resourceName);
napi_deferred deferred;
napi_value promise;
NAPI_CALL(env, napi_create_promise(env, &deferred, &promise));
async_callback_info.deferred = deferred;
napi_create_async_work(env,
nullptr,
resourceName,
NAPI_ClearMissionsAsyncExecuteCallback,
NAPI_ClearMissionsPromiseCompleteCallback,
(void *)&async_callback_info,
&async_callback_info.asyncWork);
napi_queue_async_work(env, async_callback_info.asyncWork);
return promise;
}
}
napi_value NAPI_ClearMissions(napi_env env, napi_callback_info info)
{
size_t argc = 1;
napi_value argv[1] = {};
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, NULL, NULL));
HILOG_INFO("argc = [%{public}zu]", argc);
bool callBackMode = false;
if (argc >= 1) {
napi_valuetype valuetype = napi_valuetype::napi_null;
NAPI_CALL(env, napi_typeof(env, argv[0], &valuetype));
NAPI_ASSERT(env, valuetype == napi_function, "Wrong argument type. Function expected.");
callBackMode = true;
}
AsyncClearMissionsCallbackInfo *async_callback_info = new (std::nothrow) AsyncClearMissionsCallbackInfo {
.env = env,
.asyncWork = nullptr,
.deferred = nullptr,
};
if (async_callback_info == nullptr) {
return nullptr;
}
if (callBackMode) {
napi_create_reference(env, argv[0], 1, &async_callback_info->callback[0]);
}
napi_value ret = NAPI_ClearMissionsWrap(env, info, callBackMode, *async_callback_info);
if (ret == nullptr) {
delete async_callback_info;
async_callback_info = nullptr;
}
return ((callBackMode) ? (nullptr) : (ret));
}
auto NAPI_MoveMissionToTopAsyncExecuteCallback = [](napi_env env, void *data) {
HILOG_INFO("moveMissionToTop called(CallBack Mode)...");
AsyncMoveMissionToTopCallbackInfo *async_callback_info = (AsyncMoveMissionToTopCallbackInfo *)data;

View File

@ -161,7 +161,6 @@ napi_value NAPI_QueryRecentAbilityMissionInfos(napi_env env, napi_callback_info
napi_value NAPI_GetPreviousAbilityMissionInfos(napi_env env, napi_callback_info info);
napi_value NAPI_RemoveMission(napi_env env, napi_callback_info info);
napi_value NAPI_RemoveMissions(napi_env env, napi_callback_info info);
napi_value NAPI_ClearMissions(napi_env env, napi_callback_info info);
napi_value NAPI_MoveMissionToTop(napi_env env, napi_callback_info info);
napi_value NAPI_KillProcessesByBundleName(napi_env env, napi_callback_info info);
napi_value NAPI_ClearUpApplicationData(napi_env env, napi_callback_info info);

View File

@ -49,7 +49,6 @@ static napi_value Init(napi_env env, napi_value exports)
DECLARE_NAPI_FUNCTION("removeRecentTask", NAPI_RemoveMission),
DECLARE_NAPI_FUNCTION("removeMissions", NAPI_RemoveMissions),
DECLARE_NAPI_FUNCTION("deleteMissions", NAPI_RemoveMissions),
DECLARE_NAPI_FUNCTION("clearMissions", NAPI_ClearMissions),
DECLARE_NAPI_FUNCTION("moveMissionToTop", NAPI_MoveMissionToTop),
DECLARE_NAPI_FUNCTION("killProcessesByBundleName", NAPI_KillProcessesByBundleName),
DECLARE_NAPI_FUNCTION("clearUpApplicationData", NAPI_ClearUpApplicationData),

View File

@ -320,14 +320,6 @@ public:
*/
virtual int RemoveMission(int id) override;
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @return Returns ERR_OK on success, others on failure.
*/
virtual int RemoveStack(int id) override;
/**
* Kill the process immediately.
*

View File

@ -447,14 +447,6 @@ public:
*/
virtual int RemoveMission(int id) override;
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @return Returns ERR_OK on success, others on failure.
*/
virtual int RemoveStack(int id) override;
/**
* Kill the process immediately.
*

View File

@ -69,7 +69,6 @@ private:
int GetAllStackInfoInner(MessageParcel &data, MessageParcel &reply);
int GetRecentMissionsInner(MessageParcel &data, MessageParcel &reply);
int RemoveMissionInner(MessageParcel &data, MessageParcel &reply);
int RemoveStackInner(MessageParcel &data, MessageParcel &reply);
int ScheduleCommandAbilityDoneInner(MessageParcel &data, MessageParcel &reply);
int GetMissionSnapshotInner(MessageParcel &data, MessageParcel &reply);
int AcquireDataAbilityInner(MessageParcel &data, MessageParcel &reply);

View File

@ -244,14 +244,6 @@ public:
*/
int RemoveMissionById(int missionId);
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @return Returns ERR_OK on success, others on failure.
*/
int RemoveStack(int stackId);
/**
* move the mission stack to the top.
*

View File

@ -343,13 +343,6 @@ ErrCode AbilityManagerClient::RemoveMissions(std::vector<int> missionId)
return error;
}
ErrCode AbilityManagerClient::RemoveStack(int id)
{
CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED);
sptr<IAbilityManager> abms = iface_cast<IAbilityManager>(remoteObject_);
return abms->RemoveStack(id);
}
#endif
ErrCode AbilityManagerClient::KillProcess(const std::string &bundleName)

View File

@ -842,28 +842,6 @@ int AbilityManagerProxy::RemoveMission(int id)
return reply.ReadInt32();
}
int AbilityManagerProxy::RemoveStack(int id)
{
int error;
MessageParcel data;
MessageParcel reply;
MessageOption option;
if (!WriteInterfaceToken(data)) {
return INNER_ERR;
}
if (!data.WriteInt32(id)) {
HILOG_ERROR("id write failed.");
return ERR_INVALID_VALUE;
}
error = Remote()->SendRequest(IAbilityManager::REMOVE_STACK, data, reply, option);
if (error != NO_ERROR) {
HILOG_ERROR("Send request error: %{public}d", error);
return error;
}
return reply.ReadInt32();
}
int AbilityManagerProxy::KillProcess(const std::string &bundleName)
{
MessageParcel data;

View File

@ -922,16 +922,6 @@ int AbilityManagerService::RemoveMission(int id)
}
return currentStackManager_->RemoveMissionById(id);
}
int AbilityManagerService::RemoveStack(int id)
{
HILOG_INFO("Remove stack.");
if (id < 0) {
HILOG_ERROR("Stack id is invalid.");
return ERR_INVALID_VALUE;
}
return currentStackManager_->RemoveStack(id);
}
#endif
int AbilityManagerService::ConnectAbility(

View File

@ -53,7 +53,6 @@ void AbilityManagerStub::FirstStepInit()
requestFuncMap_[LIST_STACK_INFO] = &AbilityManagerStub::GetAllStackInfoInner;
requestFuncMap_[GET_RECENT_MISSION] = &AbilityManagerStub::GetRecentMissionsInner;
requestFuncMap_[REMOVE_MISSION] = &AbilityManagerStub::RemoveMissionInner;
requestFuncMap_[REMOVE_STACK] = &AbilityManagerStub::RemoveStackInner;
requestFuncMap_[COMMAND_ABILITY_DONE] = &AbilityManagerStub::ScheduleCommandAbilityDoneInner;
requestFuncMap_[GET_MISSION_SNAPSHOT] = &AbilityManagerStub::GetMissionSnapshotInner;
requestFuncMap_[ACQUIRE_DATA_ABILITY] = &AbilityManagerStub::AcquireDataAbilityInner;
@ -313,17 +312,6 @@ int AbilityManagerStub::RemoveMissionInner(MessageParcel &data, MessageParcel &r
return NO_ERROR;
}
int AbilityManagerStub::RemoveStackInner(MessageParcel &data, MessageParcel &reply)
{
int id = data.ReadInt32();
int32_t result = RemoveStack(id);
if (!reply.WriteInt32(result)) {
HILOG_ERROR("remove stack error");
return ERR_INVALID_VALUE;
}
return NO_ERROR;
}
int AbilityManagerStub::ScheduleCommandAbilityDoneInner(MessageParcel &data, MessageParcel &reply)
{
auto token = data.ReadParcelable<IRemoteObject>();

View File

@ -765,23 +765,6 @@ int AbilityStackManager::RemoveMissionByIdLocked(int missionId)
return TerminateAbilityLocked(terminateLists);
}
int AbilityStackManager::RemoveStack(int stackId)
{
HILOG_DEBUG("stackId : %{public}d", stackId);
std::lock_guard<std::recursive_mutex> guard(stackLock_);
if (stackId < MIN_MISSION_STACK_ID) {
HILOG_ERROR("stackId:%{public}d is invalid.", stackId);
return ERR_INVALID_VALUE;
}
if (lockMissionContainer_ && lockMissionContainer_->IsLockedMissionState()) {
HILOG_ERROR("current is lock mission state, refusing to operate other mission.");
return ERR_INVALID_VALUE;
}
return RemoveStackLocked(stackId);
}
int AbilityStackManager::RemoveStackLocked(int stackId)
{
HILOG_DEBUG("stackId : %{public}d", stackId);

View File

@ -202,11 +202,6 @@ public:
return 0;
}
virtual int RemoveStack(int id)
{
return 0;
}
virtual int KillProcess(const std::string &bundleName)
{
return 0;

View File

@ -532,24 +532,6 @@ HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0023, TestSize.Level1)
EXPECT_EQ(IAbilityManager::REMOVE_MISSION, mock_->code_);
}
/*
* Feature: AbilityManagerService
* Function: RemoveStack
* SubFunction: NA
* FunctionPoints: AbilityManagerService RemoveStack
* EnvConditions: NA
* CaseDescription: Verify the normal conditions of RemoveStack
*/
HWTEST_F(AbilityManagerProxyTest, AbilityManagerProxy_0024, TestSize.Level1)
{
EXPECT_CALL(*mock_, SendRequest(_, _, _, _))
.Times(1)
.WillOnce(Invoke(mock_.GetRefPtr(), &AbilityManagerStubMock::InvokeSendRequest));
proxy_->RemoveStack(1);
EXPECT_EQ(IAbilityManager::REMOVE_STACK, mock_->code_);
}
/*
* Feature: AbilityManagerService
* Function: MoveMissionToTop

View File

@ -202,11 +202,6 @@ public:
return 0;
}
virtual int RemoveStack(int id)
{
return 0;
}
virtual int KillProcess(const std::string &bundleName)
{
return 0;

View File

@ -797,54 +797,6 @@ HWTEST_F(AbilityManagerServiceTest, Interface_018, TestSize.Level1)
EXPECT_EQ(info[0].topAbility.GetDeviceID(), want1.GetElement().GetDeviceID());
}
/*
* Feature: AbilityManagerService
* Function: RemoveStack
* SubFunction: NA
* FunctionPoints: AbilityManagerService RemoveStack
* EnvConditions: NA
* CaseDescription: 1.stackid < 0, RemoveStack failed
* 2.stackid no exist, RemoveStack failed
* 3.don't allow remove luncher mission stack
*/
HWTEST_F(AbilityManagerServiceTest, Interface_019, TestSize.Level1)
{
EXPECT_EQ(abilityMs_->RemoveStack(-1), OHOS::ERR_INVALID_VALUE);
EXPECT_EQ(abilityMs_->RemoveStack(INT_MAX), REMOVE_STACK_ID_NOT_EXIST);
EXPECT_EQ(abilityMs_->RemoveStack(0), REMOVE_STACK_LAUNCHER_DENIED);
}
/*
* Feature: AbilityManagerService
* Function: RemoveStack
* SubFunction: NA
* FunctionPoints: AbilityManagerService RemoveStack
* EnvConditions: NA
* CaseDescription: remove default stack success
*/
HWTEST_F(AbilityManagerServiceTest, Interface_020, TestSize.Level1)
{
Want want;
ElementName element("device", "com.ix.music", "MusicAbility");
want.SetElement(element);
auto result = StartAbility(want);
WaitUntilTaskFinished();
EXPECT_EQ(OHOS::ERR_OK, result);
auto stackManage = abilityMs_->GetStackManager();
stackManage->GetCurrentTopAbility()->SetAbilityState(OHOS::AAFwk::AbilityState::ACTIVE);
Want want1;
ElementName element1("device", "com.ix.music", "MusicAbility");
want1.SetElement(element1);
auto result1 = StartAbility(want);
WaitUntilTaskFinished();
EXPECT_EQ(OHOS::ERR_OK, result1);
EXPECT_EQ(stackManage->GetCurrentMissionStack()->GetMissionRecordCount(), 1);
EXPECT_EQ(abilityMs_->RemoveStack(1), ERR_OK);
}
/*
* Feature: AbilityManagerService
* Function: ConnectAbility

View File

@ -215,11 +215,6 @@ public:
return 0;
}
virtual int RemoveStack(int id)
{
return 0;
}
virtual int KillProcess(const std::string &bundleName)
{
return 0;

View File

@ -62,7 +62,6 @@ public:
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &));
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionSnapshotInfo &));
MOCK_METHOD1(RemoveMission, int(int));
MOCK_METHOD1(RemoveStack, int(int));
MOCK_METHOD1(MoveMissionToTop, int(int32_t));
MOCK_METHOD1(KillProcess, int(const std::string &));
MOCK_METHOD2(UninstallApp, int(const std::string &, int32_t));

View File

@ -1585,76 +1585,11 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_044, TestSize.
/*
* Feature: AbilityStackManager
* Function: RemoveStack
* Function: StartAbility
* SubFunction: NA
* FunctionPoints: RemoveStack
* FunctionPoints: StartAbility
* EnvConditions: NA
* CaseDescription: Failed to verify RemoveStack
*/
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_045, TestSize.Level1)
{
stackManager_->Init();
auto result = stackManager_->StartAbility(launcherAbilityRequest_);
EXPECT_EQ(ERR_OK, result);
auto firstTopAbility = stackManager_->GetCurrentTopAbility();
firstTopAbility->SetAbilityState(OHOS::AAFwk::ACTIVE);
result = stackManager_->StartAbility(musicAbilityRequest_);
EXPECT_EQ(ERR_OK, result);
auto secondTopAbility = stackManager_->GetCurrentTopAbility();
secondTopAbility->SetAbilityState(OHOS::AAFwk::ACTIVE);
result = stackManager_->RemoveStack(-1);
EXPECT_EQ(ERR_INVALID_VALUE, result);
result = stackManager_->RemoveStack(10);
EXPECT_EQ(REMOVE_STACK_ID_NOT_EXIST, result);
result = stackManager_->RemoveStack(0);
EXPECT_EQ(REMOVE_STACK_LAUNCHER_DENIED, result);
stackManager_->missionStackList_.clear();
result = stackManager_->RemoveStack(1);
EXPECT_EQ(MISSION_STACK_LIST_IS_EMPTY, result);
}
/*
* Feature: AbilityStackManager
* Function: RemoveStack
* SubFunction: NA
* FunctionPoints: RemoveStack
* EnvConditions: NA
* CaseDescription: Succeeded to verify RemoveStack
*/
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_046, TestSize.Level1)
{
stackManager_->Init();
auto result = stackManager_->StartAbility(launcherAbilityRequest_);
EXPECT_EQ(ERR_OK, result);
auto firstTopAbility = stackManager_->GetCurrentTopAbility();
firstTopAbility->SetAbilityState(OHOS::AAFwk::ACTIVE);
result = stackManager_->StartAbility(musicAbilityRequest_);
EXPECT_EQ(ERR_OK, result);
auto secondTopAbility = stackManager_->GetCurrentTopAbility();
secondTopAbility->SetAbilityState(OHOS::AAFwk::ACTIVE);
result = stackManager_->StartAbility(launcherAbilityRequest_);
EXPECT_EQ(ERR_OK, result);
auto topAbility = stackManager_->GetCurrentTopAbility();
topAbility->SetAbilityState(OHOS::AAFwk::ACTIVE);
result = stackManager_->RemoveStack(1);
EXPECT_EQ(ERR_OK, result);
}
/*
* Feature: AbilityStackManager
* Function: RemoveStack
* SubFunction: NA
* FunctionPoints: RemoveStack
* EnvConditions: NA
* CaseDescription: Succeeded to verify RemoveStack
* CaseDescription: Succeeded to verify StartAbility
*/
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_047, TestSize.Level1)
{
@ -1675,11 +1610,11 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_047, TestSize.
/*
* Feature: AbilityStackManager
* Function: RemoveStack
* Function: StartAbility
* SubFunction: NA
* FunctionPoints: RemoveStack
* FunctionPoints: StartAbility
* EnvConditions: NA
* CaseDescription: Succeeded to verify RemoveStack
* CaseDescription: Succeeded to verify StartAbility
*/
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_048, TestSize.Level1)
{
@ -1740,11 +1675,11 @@ HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_048, TestSize.
/*
* Feature: AbilityStackManager
* Function: RemoveStack
* Function: StartAbility
* SubFunction: NA
* FunctionPoints: RemoveStack
* FunctionPoints: StartAbility
* EnvConditions: NA
* CaseDescription: Succeeded to verify RemoveStack
* CaseDescription: Succeeded to verify StartAbility
*/
HWTEST_F(AbilityStackManagerTest, ability_stack_manager_operating_049, TestSize.Level1)
{

View File

@ -223,10 +223,6 @@ public:
{
return 0;
}
virtual int RemoveStack(int id)
{
return 0;
}
virtual int KillProcess(const std::string &bundleName)
{
return 0;
@ -606,10 +602,6 @@ public:
{
return 0;
}
virtual int RemoveStack(int id)
{
return 0;
}
virtual int KillProcess(const std::string &bundleName)
{
return 0;

View File

@ -142,10 +142,6 @@ public:
{
return 0;
}
virtual int RemoveStack(int id) override
{
return 0;
}
virtual int KillProcess(const std::string &bundleName) override
{
return 0;

View File

@ -53,7 +53,6 @@ public:
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<RecentMissionInfo> &));
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionPixelMap &));
MOCK_METHOD1(RemoveMission, int(int));
MOCK_METHOD1(RemoveStack, int(int));
MOCK_METHOD1(MoveMissionToTop, int(int32_t));
MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr<IRemoteObject> &token));
MOCK_METHOD1(KillProcess, int(const std::string &));

View File

@ -61,7 +61,6 @@ public:
MOCK_METHOD3(GetRecentMissions, int(const int32_t, const int32_t, std::vector<AbilityMissionInfo> &));
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t, MissionPixelMap &));
MOCK_METHOD1(RemoveMission, int(int));
MOCK_METHOD1(RemoveStack, int(int));
MOCK_METHOD1(MoveMissionToTop, int(int32_t));
MOCK_METHOD1(GetMissionIdByToken, int32_t(const sptr<IRemoteObject> &token));
MOCK_METHOD1(KillProcess, int(const std::string &));

View File

@ -3487,60 +3487,6 @@ HWTEST_F(AbilityStackModuleTest, ability_stack_test_068, TestSize.Level1)
EXPECT_EQ(stackManager_->GetCurrentTopAbility(), topAbilityRecordMusic);
}
/*
* Feature: AaFwk
* Function:RemoveStack
* SubFunction:Remove Stack
* FunctionPoints:
* EnvConditions: NA
* CaseDescription:Remove Stack
*/
HWTEST_F(AbilityStackModuleTest, ability_stack_test_069, TestSize.Level1)
{
stackManager_->isMultiWinMoving_ = false;
// start launcher
auto worldAbilityRequest = GenerateAbilityRequest("device", "WorldAbility", "world", "com.ix.hiworld");
auto ref = stackManager_->StartAbility(worldAbilityRequest);
EXPECT_EQ(ERR_OK, ref);
auto abilityRecordWorld = stackManager_->GetCurrentTopAbility();
EXPECT_TRUE(abilityRecordWorld);
abilityRecordWorld->SetAbilityState(OHOS::AAFwk::ACTIVE);
auto musicTopAbilityRequest = GenerateAbilityRequest("device", "MusicTopAbility", "musicTop", "com.ix.hiTopMusic");
ref = stackManager_->StartAbility(musicTopAbilityRequest);
EXPECT_EQ(ERR_OK, ref);
auto topAbilityRecordMusic = stackManager_->GetCurrentTopAbility();
EXPECT_TRUE(topAbilityRecordMusic);
topAbilityRecordMusic->SetAbilityState(OHOS::AAFwk::ACTIVE);
std::shared_ptr<MissionStack> targetStack = stackManager_->GetTargetMissionStack(musicTopAbilityRequest);
EXPECT_EQ(stackManager_->currentMissionStack_, targetStack);
// start split ability
auto radioAbilityRequest = GenerateAbilityRequest("device", "RadioAbility", "radio", "com.ix.hiRadio");
auto abilityStartSetting = AbilityStartSetting::GetEmptySetting();
EXPECT_TRUE(abilityStartSetting);
abilityStartSetting->AddProperty(AbilityStartSetting::WINDOW_MODE_KEY,
std::to_string(AbilityWindowConfiguration::MULTI_WINDOW_DISPLAY_SECONDARY));
radioAbilityRequest.startSetting = abilityStartSetting;
ref = stackManager_->StartAbility(radioAbilityRequest);
EXPECT_EQ(ERR_OK, ref);
auto topAbilityRecordRadio = stackManager_->GetCurrentTopAbility();
EXPECT_TRUE(topAbilityRecordRadio);
topAbilityRecordRadio->SetAbilityState(OHOS::AAFwk::ACTIVE);
auto topMissionRecordRadio = stackManager_->GetTopMissionRecord();
EXPECT_TRUE(topMissionRecordRadio);
#ifdef SUPPORT_GRAPHICS
EXPECT_EQ(stackManager_->curSysWindowMode_, SystemWindowMode::SPLITSCREEN_WINDOW_MODE);
#endif
auto stackId = topMissionRecordRadio->GetMissionStack()->GetMissionStackId();
stackManager_->RemoveStack(stackId);
EXPECT_EQ(stackManager_->GetCurrentTopAbility(), abilityRecordWorld);
}
/*
* Feature: AaFwk
* Function:OnTimeOut

View File

@ -517,32 +517,6 @@ HWTEST_F(IpcAbilityMgrModuleTest, AbilityMgrService_IPC_016, TestSize.Level1)
GTEST_LOG_(INFO) << "IpcAbilityMgrModuleTest AbilityMgrService_IPC_016 end";
}
/*
* Feature: AAFwk
* Function: AbilityManagerService
* SubFunction: IPC of client and server
* FunctionPoints: RemoveStack
* EnvConditions: NA
* CaseDescription: verify RemoveStack IPC between client and server.
*/
HWTEST_F(IpcAbilityMgrModuleTest, AbilityMgrService_IPC_017, TestSize.Level1)
{
GTEST_LOG_(INFO) << "IpcAbilityMgrModuleTest AbilityMgrService_IPC_017 start";
for (int i = 0; i < COUNT; i++) {
sptr<MockAbilityMgrService> mockAbilityMgr(new MockAbilityMgrService());
sptr<IAbilityManager> abilityMgrClient = iface_cast<IAbilityManager>(mockAbilityMgr);
EXPECT_CALL(*mockAbilityMgr, RemoveStack(_))
.Times(1)
.WillOnce(InvokeWithoutArgs(mockAbilityMgr.GetRefPtr(), &MockAbilityMgrService::Post));
abilityMgrClient->RemoveStack(1);
mockAbilityMgr->Wait();
}
GTEST_LOG_(INFO) << "IpcAbilityMgrModuleTest AbilityMgrService_IPC_017 end";
}
/*
* Feature: AAFwk
* Function: AbilityManagerService

View File

@ -126,7 +126,6 @@ void AmsAppProcessManageTest::SetUp(void)
void AmsAppProcessManageTest::TearDown(void)
{
GTEST_LOG_(INFO) << "void AmsAppProcessManageTest::TearDown(void)";
STAbilityUtil::RemoveStack(1, abilityMs_, WAIT_TIME, WAIT_LAUNCHER_OK);
std::vector<std::string> vecBundleName;
for (const auto &suffix : bundleNameSuffix) {
vecBundleName.push_back(bundleNameBase + suffix);

View File

@ -148,7 +148,6 @@ void ActsAmsKitTest::SetUp(void)
void ActsAmsKitTest::TearDown(void)
{
STAbilityUtil::RemoveStack(1, abilityMs, WAIT_TIME, WAIT_LAUNCHER_OK);
CleanMsg();
}
@ -2023,59 +2022,3 @@ HWTEST_F(ActsAmsKitTest, AMS_Page_Application_2600, Function | MediumTest | Leve
}
}
}
/**
* @tc.number : AMS_Page_Application_2700
* @tc.name : OHOSApplicationApi::Lifecycle callback function
* @tc.desc : 1.Control the life cycle of the ability
* 2.Application registration capability life cycle callback
* 3.The callback function corresponding to the registered class will be called
*/
HWTEST_F(ActsAmsKitTest, AMS_Page_Application_2700, Function | MediumTest | Level1)
{
for (int i = 1; i <= stLevel_.AMSLevel; i++) {
MAP_STR_STR params;
params["targetBundle"] = bundleName2;
params["targetAbility"] = thirdAbilityName;
Want want = STAbilityUtil::MakeWant("device", sixthAbilityName, bundleName2, params);
STAbilityUtil::StartAbility(want, abilityMs);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityActive, 0), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityInactive, 0), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, thirdAbilityName + g_onAbilityStart, 0), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, thirdAbilityName + g_onAbilityActive, 0), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityBackground, 0), 0);
CleanMsg();
STAbilityUtil::RemoveStack(1, abilityMs, WAIT_TIME, WAIT_LAUNCHER_OK);
}
}
/**
* @tc.number : AMS_Page_Application_2800
* @tc.name : OHOSApplicationApi::Lifecycle callback function
* @tc.desc : 1.Control the life cycle of the ability
* 2.Application registration capability life cycle callback
* 3.The callback function corresponding to the registered class will be called
*/
HWTEST_F(ActsAmsKitTest, AMS_Page_Application_2800, Function | MediumTest | Level1)
{
for (int i = 1; i <= stLevel_.AMSLevel; i++) {
MAP_STR_STR params;
int onStopWantCount = 1;
params["targetBundle"] = bundleName3;
params["targetAbility"] = abilityNameBase;
Want want = STAbilityUtil::MakeWant("device", sixthAbilityName, bundleName2, params);
STAbilityUtil::StartAbility(want, abilityMs);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityActive, 0), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityInactive, 0), 0);
EXPECT_EQ(
STAbilityUtil::WaitCompleted(abilityEvent, abilityNameBase + g_abilityStateOnActive, onStopWantCount), 0);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityBackground, 0), 0);
STAbilityUtil::StopAbility(terminatePageAbility, 0, abilityNameBase);
EXPECT_EQ(STAbilityUtil::WaitCompleted(abilityEvent, sixthAbilityName + g_onAbilityActive, 0), 0);
EXPECT_EQ(
STAbilityUtil::WaitCompleted(abilityEvent, abilityNameBase + g_abilityStateOnStop, onStopWantCount), 0);
CleanMsg();
STAbilityUtil::RemoveStack(1, abilityMs, WAIT_TIME, WAIT_LAUNCHER_OK);
}
}

View File

@ -177,7 +177,6 @@ void AmsPageAbilityTest::SetUp(void)
void AmsPageAbilityTest::TearDown(void)
{
GTEST_LOG_(INFO) << "void AmsPageAbilityTest::TearDown(void)";
STAbilityUtil::RemoveStack(1, abilityMs_, WAIT_TIME, WAIT_LAUNCHER_OK);
std::vector<std::string> vecBundleName;
for (const auto &suffix : bundleNameSuffix) {
vecBundleName.push_back(bundleNameBase + suffix);

View File

@ -159,7 +159,6 @@ void AmsPowerTest::SetUp(void)
void AmsPowerTest::TearDown(void)
{
GTEST_LOG_(INFO) << "void AmsPowerTest::TearDown(void)";
STAbilityUtil::RemoveStack(1, abilityMs_, WAIT_TIME, WAIT_LAUNCHER_OK);
std::vector<std::string> vecBundleName;
for (const auto &suffix : bundleNameSuffix) {
vecBundleName.push_back(bundleNameBase + suffix);

View File

@ -272,17 +272,6 @@ public:
*/
static ErrCode StopServiceAbility(const AAFwk::Want &want, unsigned int usec = 0);
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @param {sptr<AAFwk::IAbilityManager>} abilityMs : Ability Manager Service ptr
* @param {time_t} delay : Waiting time for ability to GetAppProcessInfo (milliseconds)
* @return Returns ERR_OK on success, others on failure.
*/
static int RemoveStack(int id, sptr<AAFwk::IAbilityManager> &abilityMs, const time_t &backHmoeDelay = 0,
const time_t &removeDelay = 0);
/**
*
* @param {string} bundleFilePath : Hap File Name

View File

@ -368,22 +368,6 @@ void STAbilityUtil::PullOperatorFromVector(StOperator &ParentOperator, std::vect
}
}
int STAbilityUtil::RemoveStack(
int id, sptr<AAFwk::IAbilityManager> &abilityMs, const time_t &backHmoeDelay, const time_t &removeDelay)
{
Want wantEntity;
wantEntity.AddEntity(Want::FLAG_HOME_INTENT_FROM_SYSTEM);
StartAbility(wantEntity, abilityMs);
std::this_thread::sleep_for(std::chrono::milliseconds(backHmoeDelay));
if (!abilityMs) {
HILOG_INFO("RemoveStack abilityMs nullptr");
return OHOS::ERR_INVALID_VALUE;
}
int result = abilityMs->RemoveStack(id);
std::this_thread::sleep_for(std::chrono::milliseconds(removeDelay));
return result;
}
InstallToolStatusReceiver::InstallToolStatusReceiver()
{
std::cout << "create status receiver instance" << std::endl;

View File

@ -258,17 +258,6 @@ public:
*/
static ErrCode StopServiceAbility(const AAFwk::Want &want, unsigned int usec = 0);
/**
* Remove the specified mission stack by stack id
*
* @param id.
* @param {sptr<AAFwk::IAbilityManager>} abilityMs : Ability Manager Service ptr
* @param {time_t} delay : Waiting time for ability to GetAppProcessInfo (milliseconds)
* @return Returns ERR_OK on success, others on failure.
*/
static int RemoveStack(int id, sptr<AAFwk::IAbilityManager> &abilityMs, const time_t &backHmoeDelay = 0,
const time_t &removeDelay = 0);
/**
*
* @param {string} bundleFilePath : Hap File Name

View File

@ -315,22 +315,6 @@ void SystemTestFormUtil::CleanMsg(FormEvent &event)
return event.Clean();
}
int SystemTestFormUtil::RemoveStack(
int id, sptr<AAFwk::IAbilityManager> &abilityMs, const time_t &backHmoeDelay, const time_t &removeDelay)
{
Want wantEntity;
wantEntity.AddEntity(Want::FLAG_HOME_INTENT_FROM_SYSTEM);
StartAbility(wantEntity, abilityMs);
std::this_thread::sleep_for(std::chrono::milliseconds(backHmoeDelay));
if (!abilityMs) {
HILOG_INFO("RemoveStack abilityMs nullptr");
return OHOS::ERR_INVALID_VALUE;
}
int result = abilityMs->RemoveStack(id);
std::this_thread::sleep_for(std::chrono::milliseconds(removeDelay));
return result;
}
const std::string MSG_SUCCESS = "[SUCCESS]";
void SystemTestFormUtil::Install(const std::string &bundleFilePath, const InstallFlag installFlag)
{

View File

@ -83,7 +83,6 @@ public:
MOCK_METHOD2(GetMissionSnapshot, int(const int32_t missionId, MissionPixelMap &missionPixelMap));
MOCK_METHOD1(MoveMissionToTop, int(int32_t missionId));
MOCK_METHOD1(RemoveMission, int(int id));
MOCK_METHOD1(RemoveStack, int(int id));
MOCK_METHOD1(KillProcess, int(const std::string &bundleName));
MOCK_METHOD2(UninstallApp, int(const std::string &bundleName, int32_t uid));