!2325 应用选择器MT问题修改

Merge pull request !2325 from 徐承桦/master
This commit is contained in:
openharmony_ci 2022-07-08 06:52:57 +00:00 committed by Gitee
commit 8cf074c0e1
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 18 additions and 9 deletions

View File

@ -250,11 +250,7 @@ enum {
*/
ERR_AAFWK_PARCEL_FAIL,
/**
* Result(2097199) for type is empty.
*/
ERR_WANT_NO_TYPE,
/**
* Result(2097200) for implicit start ability is failed.
* Result(2097199) for for implicit start ability is failed.
*/
ERR_IMPLICIT_START_ABILITY_FAIL,
};

View File

@ -36,6 +36,7 @@ namespace {
const std::string EVENT_CLOSE_CODE = "EVENT_CLOSE";
const std::string EVENT_MULT_APP_CHOOSE = "EVENT_MULT_APP_CHOOSE";
const std::string EVENT_MULT_APP_CLOSE = "EVENT_MULT_APP_CLOSE";
const std::string EVENT_TIPS_APP = "EVENT_TIPS_APP";
}
std::shared_ptr<UIServiceMgrClient> UIServiceMgrClient::GetInstance()
@ -103,6 +104,12 @@ ErrCode UIServiceMgrClient::ShowDialog(const std::string& name, const std::strin
return ERR_OK;
}
if (code_ == EVENT_TIPS_APP) {
params_ = params;
callback(0, EVENT_CLOSE_CODE, "");
return ERR_OK;
}
return 0;
}

View File

@ -36,6 +36,7 @@ using namespace OHOS::AppExecFwk;
namespace {
const std::string EVENT_MULT_APP_CHOOSE = "EVENT_MULT_APP_CHOOSE";
const std::string EVENT_MULT_APP_CLOSE = "EVENT_MULT_APP_CLOSE";
const std::string EVENT_TIPS_APP = "EVENT_TIPS_APP";
const std::string ACTION_VIEW = "ohos.want.action.viewData";
const std::string WANT_TYPE = "image/png";
const int32_t MOCK_MAIN_USER_ID = 100;
@ -107,6 +108,11 @@ void StartAbilityImplicitModuleTest::OnStartAms()
abilityMs_->iBundleManager_ = new BundleMgrService();
EXPECT_TRUE(abilityMs_->iBundleManager_);
abilityMs_->implicitStartProcessor_ = std::make_shared<ImplicitStartProcessor>();
EXPECT_TRUE(abilityMs_->implicitStartProcessor_);
abilityMs_->implicitStartProcessor_->iBundleManager_ = new BundleMgrService();
EXPECT_TRUE(abilityMs_->implicitStartProcessor_->iBundleManager_);
DelayedSingleton<SystemDialogScheduler>::GetInstance()->SetDeviceType("phone");
abilityMs_->InitMissionListManager(userId, true);
abilityMs_->SwitchManagers(0, false);
@ -250,13 +256,13 @@ HWTEST_F(StartAbilityImplicitModuleTest, StartAbility_004, TestSize.Level1)
want.SetType(WANT_TYPE);
want.SetParam("numMock", 0);
Ace::UIServiceMgrClient::GetInstance()->SetDialogCheckState(EVENT_MULT_APP_CHOOSE);
Ace::UIServiceMgrClient::GetInstance()->SetDialogCheckState(EVENT_TIPS_APP);
abilityMs_->StartAbility(want, MOCK_MAIN_USER_ID);
auto params = Ace::UIServiceMgrClient::GetInstance()->GetParams();
auto isCallBack = Ace::UIServiceMgrClient::GetInstance()->IsCallBack();
EXPECT_TRUE(params.empty());
EXPECT_TRUE(!isCallBack);
EXPECT_TRUE(!params.empty());
EXPECT_TRUE(isCallBack);
auto abilityRecord = abilityMs_->currentMissionListManager_->GetCurrentTopAbilityLocked();
EXPECT_TRUE(abilityRecord == nullptr);
@ -281,7 +287,7 @@ HWTEST_F(StartAbilityImplicitModuleTest, StartAbility_005, TestSize.Level1)
Ace::UIServiceMgrClient::GetInstance()->SetDialogCheckState(EVENT_MULT_APP_CHOOSE);
auto ret = abilityMs_->StartAbility(want, MOCK_MAIN_USER_ID);
EXPECT_EQ(ret, ERR_WANT_NO_TYPE);
EXPECT_EQ(ret, ERR_OK);
}
}
}