diff --git a/frameworks/kits/ability/ability_runtime/include/ability_context.h b/frameworks/kits/ability/ability_runtime/include/ability_context.h index e98ba6e7c5..86592c74ab 100644 --- a/frameworks/kits/ability/ability_runtime/include/ability_context.h +++ b/frameworks/kits/ability/ability_runtime/include/ability_context.h @@ -133,6 +133,14 @@ public: */ virtual void* GetContentStorage() = 0; + /** + * @brief Set mission label of this ability. + * + * @param label the label of this ability. + * @return Returns ERR_OK if success. + */ + virtual ErrCode SetMissionLabel(const std::string &label) = 0; + using SelfType = AbilityContext; static const size_t CONTEXT_TYPE_ID; diff --git a/frameworks/kits/ability/ability_runtime/include/ability_context_impl.h b/frameworks/kits/ability/ability_runtime/include/ability_context_impl.h old mode 100755 new mode 100644 index 1a12d57bbf..a3676d50ff --- a/frameworks/kits/ability/ability_runtime/include/ability_context_impl.h +++ b/frameworks/kits/ability/ability_runtime/include/ability_context_impl.h @@ -60,6 +60,14 @@ public: void RequestPermissionsFromUser(const std::vector &permissions, int requestCode) override; ErrCode RestoreWindowStage(void* contentStorage) override; + /** + * @brief Set mission label of this ability. + * + * @param label the label of this ability. + * @return Returns ERR_OK if success. + */ + ErrCode SetMissionLabel(const std::string &label) override; + void SetStageContext(const std::shared_ptr &stageContext); /** diff --git a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp old mode 100755 new mode 100644 index e31aa1de2f..4c9b1ff53e --- a/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp +++ b/frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp @@ -218,5 +218,15 @@ ErrCode AbilityContextImpl::RestoreWindowStage(void* contentStorage) contentStorage_ = contentStorage; return err; } + +ErrCode AbilityContextImpl::SetMissionLabel(const std::string &label) +{ + HILOG_INFO("%{public}s begin. label = %{public}s", __func__, label.c_str()); + ErrCode err = AAFwk::AbilityManagerClient::GetInstance()->SetMissionLabel(token_, label); + if (err != ERR_OK) { + HILOG_ERROR("AbilityContextImpl::SetMissionLabel is failed %{public}d", err); + } + return err; +} } // namespace AbilityRuntime } // namespace OHOS \ No newline at end of file diff --git a/frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h b/frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h old mode 100755 new mode 100644 index 78df691c0b..d4b019efdb --- a/frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h +++ b/frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h @@ -46,6 +46,7 @@ public: static NativeValue* TerminateSelfWithResult(NativeEngine* engine, NativeCallbackInfo* info); static NativeValue* RequestPermissionsFromUser(NativeEngine* engine, NativeCallbackInfo* info); static NativeValue* RestoreWindowStage(NativeEngine* engine, NativeCallbackInfo* info); + static NativeValue* SetMissionLabel(NativeEngine* engine, NativeCallbackInfo* info); std::shared_ptr GetAbilityContext() { @@ -61,6 +62,7 @@ private: NativeValue* OnTerminateSelf(NativeEngine& engine, NativeCallbackInfo& info); NativeValue* OnRequestPermissionsFromUser(NativeEngine& engine, NativeCallbackInfo& info); NativeValue* OnRestoreWindowStage(NativeEngine& engine, NativeCallbackInfo& info); + NativeValue* OnSetMissionLabel(NativeEngine& engine, NativeCallbackInfo& info); static bool UnWrapWant(NativeEngine& engine, NativeValue* argv, AAFwk::Want& want); static NativeValue* WrapWant(NativeEngine& engine, const AAFwk::Want& want); diff --git a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp old mode 100755 new mode 100644 index d49efb0f92..b402fc7d70 --- a/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp +++ b/frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp @@ -93,6 +93,12 @@ NativeValue* JsAbilityContext::RestoreWindowStage(NativeEngine* engine, NativeCa return (me != nullptr) ? me->OnRestoreWindowStage(*engine, *info) : nullptr; } +NativeValue* JsAbilityContext::SetMissionLabel(NativeEngine* engine, NativeCallbackInfo* info) +{ + JsAbilityContext* me = CheckParamsAndGetThis(engine, info); + return (me != nullptr) ? me->OnSetMissionLabel(*engine, *info) : nullptr; +} + NativeValue* JsAbilityContext::OnStartAbility(NativeEngine& engine, NativeCallbackInfo& info) { HILOG_INFO("OnStartAbility is called"); @@ -441,6 +447,45 @@ NativeValue* JsAbilityContext::OnRestoreWindowStage(NativeEngine& engine, Native return engine.CreateUndefined(); } +NativeValue* JsAbilityContext::OnSetMissionLabel(NativeEngine& engine, NativeCallbackInfo& info) +{ + HILOG_INFO("OnSetMissionLabel is called, argc = %{public}d", static_cast(info.argc)); + + if (info.argc < ARGC_ONE) { + HILOG_ERROR("OnSetMissionLabel, Not enough params"); + return engine.CreateUndefined(); + } + + std::string label; + if (!ConvertFromJsValue(engine, info.argv[0], label)) { + HILOG_ERROR("OnSetMissionLabel, parse label failed."); + return engine.CreateUndefined(); + } + + AsyncTask::CompleteCallback complete = + [weak = context_, label](NativeEngine& engine, AsyncTask& task, int32_t status) { + auto context = weak.lock(); + if (!context) { + HILOG_WARN("context is released"); + task.Reject(engine, CreateJsError(engine, 1, "Context is released")); + return; + } + + auto errcode = context->SetMissionLabel(label); + if (errcode == 0) { + task.Resolve(engine, engine.CreateUndefined()); + } else { + task.Reject(engine, CreateJsError(engine, errcode, "SetMissionLabel failed.")); + } + }; + + NativeValue* lastParam = (info.argc == ARGC_ONE) ? nullptr : info.argv[1]; + NativeValue* result = nullptr; + AsyncTask::Schedule( + engine, CreateAsyncTaskWithLastParam(engine, lastParam, nullptr, std::move(complete), &result)); + return result; +} + bool JsAbilityContext::UnWrapWant(NativeEngine& engine, NativeValue* argv, AAFwk::Want& want) { if (argv == nullptr) { @@ -520,6 +565,7 @@ NativeValue* CreateJsAbilityContext(NativeEngine& engine, std::shared_ptr &token, const std::string &label)); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); diff --git a/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h b/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h index d7ca064ee1..e19907d167 100644 --- a/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h +++ b/frameworks/kits/test/mock/AMS/mock_ability_manager_service.h @@ -113,6 +113,7 @@ public: MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); diff --git a/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h b/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h old mode 100755 new mode 100644 index 29a5882053..f47bcdf3b4 --- a/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h +++ b/frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h @@ -108,6 +108,7 @@ public: MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); diff --git a/interfaces/innerkits/ability_manager/include/ability_manager_client.h b/interfaces/innerkits/ability_manager/include/ability_manager_client.h index a38b5f6097..cc53df4dfe 100644 --- a/interfaces/innerkits/ability_manager/include/ability_manager_client.h +++ b/interfaces/innerkits/ability_manager/include/ability_manager_client.h @@ -643,6 +643,15 @@ public: * @return ErrCode Returns ERR_OK on success, others on failure. */ ErrCode RegisterSnapshotHandler(const sptr& handler); + + /** + * Set mission label of this ability. + * + * @param abilityToken Indidate token of ability. + * @param label Indidate the label showed of the ability in recent missions. + * @return Returns ERR_OK on success, others on failure. + */ + ErrCode SetMissionLabel(const sptr &abilityToken, const std::string &label); private: static std::mutex mutex_; static std::shared_ptr instance_; diff --git a/interfaces/innerkits/ability_manager/include/ability_manager_interface.h b/interfaces/innerkits/ability_manager/include/ability_manager_interface.h old mode 100755 new mode 100644 index 115d7da1a4..cece1ddfc1 --- a/interfaces/innerkits/ability_manager/include/ability_manager_interface.h +++ b/interfaces/innerkits/ability_manager/include/ability_manager_interface.h @@ -549,6 +549,8 @@ public: virtual int StopUser(int userId, const sptr &callback) = 0; + virtual int SetMissionLabel(const sptr &abilityToken, const std::string &label) = 0; + virtual int GetAbilityRunningInfos(std::vector &info) = 0; virtual int GetExtensionRunningInfos(int upperLimit, std::vector &info) = 0; @@ -757,6 +759,9 @@ public: // ipc id for get stability test flag (52) IS_USER_A_STABILITY_TEST, + // ipc id for set mission label (53) + SET_MISSION_LABEL, + // ipc id 1001-2000 for DMS // ipc id for starting ability (1001) START_ABILITY = 1001, diff --git a/services/abilitymgr/include/ability_manager_proxy.h b/services/abilitymgr/include/ability_manager_proxy.h old mode 100755 new mode 100644 index 0eb8688c87..41f29337ee --- a/services/abilitymgr/include/ability_manager_proxy.h +++ b/services/abilitymgr/include/ability_manager_proxy.h @@ -525,6 +525,8 @@ public: virtual int StopUser(int userId, const sptr &callback) override; + virtual int SetMissionLabel(const sptr &abilityToken, const std::string &label) override; + virtual int GetAbilityRunningInfos(std::vector &info) override; virtual int GetExtensionRunningInfos(int upperLimit, std::vector &info) override; diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 34fa037234..23043b47d4 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -713,6 +713,8 @@ public: virtual int StopUser(int userId, const sptr &callback) override; + virtual int SetMissionLabel(const sptr &abilityToken, const std::string &label) override; + void ClearUserData(int32_t userId); virtual int RegisterSnapshotHandler(const sptr& handler) override; diff --git a/services/abilitymgr/include/ability_manager_stub.h b/services/abilitymgr/include/ability_manager_stub.h old mode 100755 new mode 100644 index cf7d2ee33a..0ae6f7aa5a --- a/services/abilitymgr/include/ability_manager_stub.h +++ b/services/abilitymgr/include/ability_manager_stub.h @@ -125,6 +125,7 @@ private: int MoveMissionToFrontInner(MessageParcel &data, MessageParcel &reply); int StartUserInner(MessageParcel &data, MessageParcel &reply); int StopUserInner(MessageParcel &data, MessageParcel &reply); + int SetMissionLabelInner(MessageParcel &data, MessageParcel &reply); int GetAbilityRunningInfosInner(MessageParcel &data, MessageParcel &reply); int GetExtensionRunningInfosInner(MessageParcel &data, MessageParcel &reply); int GetProcessRunningInfosInner(MessageParcel &data, MessageParcel &reply); diff --git a/services/abilitymgr/include/mission_info_mgr.h b/services/abilitymgr/include/mission_info_mgr.h index 790e05fad5..f3757a4e46 100644 --- a/services/abilitymgr/include/mission_info_mgr.h +++ b/services/abilitymgr/include/mission_info_mgr.h @@ -116,6 +116,15 @@ public: */ bool DeleteAllMissionInfos(const std::shared_ptr &listenerController); + /** + * @brief Update mission label. + * + * @param missionId indicates this mission id. + * @param label indicates this mission label. + * @return 0 if success. + */ + int UpdateMissionLabel(int32_t missionId, const std::string& label); + /** * @brief dump mission info * diff --git a/services/abilitymgr/include/mission_list_manager.h b/services/abilitymgr/include/mission_list_manager.h index 7e4ab02102..beb3215a5a 100755 --- a/services/abilitymgr/include/mission_list_manager.h +++ b/services/abilitymgr/include/mission_list_manager.h @@ -226,6 +226,15 @@ public: */ sptr GetAbilityTokenByMissionId(int32_t missionId); + /** + * Set mission label of this ability. + * + * @param abilityToken target ability token. + * @param label target label. + * @return Retun 0 if success. + */ + int SetMissionLabel(const sptr &abilityToken, const std::string &label); + /** * @brief dump all abilities * diff --git a/services/abilitymgr/src/ability_manager_client.cpp b/services/abilitymgr/src/ability_manager_client.cpp index 704e52b82d..84904078f3 100644 --- a/services/abilitymgr/src/ability_manager_client.cpp +++ b/services/abilitymgr/src/ability_manager_client.cpp @@ -825,5 +825,12 @@ ErrCode AbilityManagerClient::GetMissionSnapshot(const std::string& deviceId, in auto abms = iface_cast(remoteObject_); return abms->GetMissionSnapshot(deviceId, missionId, snapshot); } + +ErrCode AbilityManagerClient::SetMissionLabel(const sptr &token, const std::string& label) +{ + CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED); + auto abms = iface_cast(remoteObject_); + return abms->SetMissionLabel(token, label); +} } // namespace AAFwk } // namespace AAFwk diff --git a/services/abilitymgr/src/ability_manager_proxy.cpp b/services/abilitymgr/src/ability_manager_proxy.cpp old mode 100755 new mode 100644 index c534c655a4..a93b50e557 --- a/services/abilitymgr/src/ability_manager_proxy.cpp +++ b/services/abilitymgr/src/ability_manager_proxy.cpp @@ -1983,6 +1983,30 @@ int AbilityManagerProxy::StopUser(int userId, const sptr &cal return reply.ReadInt32(); } +int AbilityManagerProxy::SetMissionLabel(const sptr &token, const std::string &label) +{ + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (!WriteInterfaceToken(data)) { + return INNER_ERR; + } + if (!data.WriteRemoteObject(token)) { + HILOG_ERROR("SetMissionLabel write token failed."); + return ERR_INVALID_VALUE; + } + if (!data.WriteString16(Str8ToStr16(label))) { + HILOG_ERROR("SetMissionLabel write label failed."); + return ERR_INVALID_VALUE; + } + auto error = Remote()->SendRequest(IAbilityManager::SET_MISSION_LABEL, data, reply, option); + if (error != NO_ERROR) { + HILOG_ERROR("SetMissionLabel Send request error: %{public}d", error); + return error; + } + return reply.ReadInt32(); +} + int AbilityManagerProxy::GetAbilityRunningInfos(std::vector &info) { MessageParcel data; diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index e6edfd14e1..1a608ffe5d 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -2734,6 +2734,16 @@ void AbilityManagerService::StartingSettingsDataAbility() (void)AcquireDataAbility(uri, true, nullptr); } +int AbilityManagerService::SetMissionLabel(const sptr &token, const std::string &label) +{ + HILOG_DEBUG("%{public}s", __func__); + auto missionListManager = currentMissionListManager_; + if (missionListManager) { + missionListManager->SetMissionLabel(token, label); + } + return 0; +} + int AbilityManagerService::StartUser(int userId) { HILOG_DEBUG("%{public}s", __func__); diff --git a/services/abilitymgr/src/ability_manager_stub.cpp b/services/abilitymgr/src/ability_manager_stub.cpp old mode 100755 new mode 100644 index 7f7a834b26..983dc9de90 --- a/services/abilitymgr/src/ability_manager_stub.cpp +++ b/services/abilitymgr/src/ability_manager_stub.cpp @@ -123,6 +123,7 @@ void AbilityManagerStub::SecondStepInit() requestFuncMap_[CLEAN_MISSION] = &AbilityManagerStub::CleanMissionInner; requestFuncMap_[CLEAN_ALL_MISSIONS] = &AbilityManagerStub::CleanAllMissionsInner; requestFuncMap_[MOVE_MISSION_TO_FRONT] = &AbilityManagerStub::MoveMissionToFrontInner; + requestFuncMap_[SET_MISSION_LABEL] = &AbilityManagerStub::SetMissionLabelInner; requestFuncMap_[START_USER] = &AbilityManagerStub::StartUserInner; requestFuncMap_[STOP_USER] = &AbilityManagerStub::StopUserInner; requestFuncMap_[GET_ABILITY_RUNNING_INFO] = &AbilityManagerStub::GetAbilityRunningInfosInner; @@ -1129,6 +1130,23 @@ int AbilityManagerStub::StopUserInner(MessageParcel &data, MessageParcel &reply) return NO_ERROR; } +int AbilityManagerStub::SetMissionLabelInner(MessageParcel &data, MessageParcel &reply) +{ + sptr token = data.ReadParcelable(); + if (!token) { + HILOG_ERROR("SetMissionLabelInner read ability token failed."); + return ERR_NULL_OBJECT; + } + + std::string label = Str16ToStr8(data.ReadString16()); + int result = SetMissionLabel(token, label); + if (!reply.WriteInt32(result)) { + HILOG_ERROR("SetMissionLabel failed."); + return ERR_INVALID_VALUE; + } + return NO_ERROR; +} + int AbilityManagerStub::GetAbilityRunningInfosInner(MessageParcel &data, MessageParcel &reply) { std::vector abilityRunningInfos; diff --git a/services/abilitymgr/src/mission_info_mgr.cpp b/services/abilitymgr/src/mission_info_mgr.cpp index 564b57bad0..2a9edef992 100644 --- a/services/abilitymgr/src/mission_info_mgr.cpp +++ b/services/abilitymgr/src/mission_info_mgr.cpp @@ -277,6 +277,30 @@ void MissionInfoMgr::UpdateMissionTimeStamp(int32_t missionId, const std::string (void)AddMissionInfo(updateInfo); } +int MissionInfoMgr::UpdateMissionLabel(int32_t missionId, const std::string& label) +{ + if (!taskDataPersistenceMgr_) { + HILOG_ERROR("task data persist not init."); + return -1; + } + auto it = find_if(missionInfoList_.begin(), missionInfoList_.end(), [missionId](const InnerMissionInfo &info) { + return missionId == info.missionInfo.id; + }); + if (it == missionInfoList_.end()) { + HILOG_ERROR("UpdateMissionLabel failed, missionId %{public}d not exists", missionId); + return -1; + } + + InnerMissionInfo updateInfo = *it; + updateInfo.missionInfo.label = label; + + if (!taskDataPersistenceMgr_->SaveMissionInfo(updateInfo)) { + HILOG_ERROR("save mission info failed."); + return -1; + } + return 0; +} + bool MissionInfoMgr::LoadAllMissionInfo() { if (!taskDataPersistenceMgr_) { diff --git a/services/abilitymgr/src/mission_list_manager.cpp b/services/abilitymgr/src/mission_list_manager.cpp index f5dac5dac5..7411c78338 100644 --- a/services/abilitymgr/src/mission_list_manager.cpp +++ b/services/abilitymgr/src/mission_list_manager.cpp @@ -301,11 +301,11 @@ void MissionListManager::GetTargetMissionAndAbility(const AbilityRequest &abilit info.isSingletonMode = isSingleton; info.missionInfo.runningState = 0; info.missionInfo.time = Time2str(time(0)); - info.missionInfo.label = abilityRequest.appInfo.label; info.missionInfo.iconPath = abilityRequest.appInfo.iconPath; info.missionInfo.want = abilityRequest.want; if (!findReusedMissionInfo) { + info.missionInfo.label = abilityRequest.appInfo.label; if (!DelayedSingleton::GetInstance()->GenerateMissionId(info.missionInfo.id)) { HILOG_DEBUG("failed to generate mission id."); return; @@ -1433,6 +1433,23 @@ void MissionListManager::BackToLauncher() launcherRootAbility->ProcessForegroundAbility(); } +int MissionListManager::SetMissionLabel(const sptr &token, const std::string &label) +{ + if (!token) { + HILOG_INFO("SetMissionLabel token is nullptr."); + return -1; + } + + std::lock_guard guard(managerLock_); + auto missionId = GetMissionIdByAbilityToken(token); + if (missionId <= 0) { + HILOG_INFO("SetMissionLabel find mission failed."); + return -1; + } + + return DelayedSingleton::GetInstance()->UpdateMissionLabel(missionId, label); +} + void MissionListManager::Dump(std::vector &info) { std::lock_guard guard(managerLock_); diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h old mode 100755 new mode 100644 index d71472f320..a294347aa6 --- a/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h @@ -378,6 +378,7 @@ public: MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector &info)); diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h index a304bfb43c..8678d40692 100755 --- a/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_stub_test/ability_manager_stub_impl_mock.h @@ -46,6 +46,7 @@ public: MOCK_METHOD2(GetPendingRequestWant, int(const sptr &target, std::shared_ptr &want)); MOCK_METHOD1(GetSystemMemoryAttr, void(AppExecFwk::SystemMemoryAttr &memoryInfo)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD3(StartContinuation, int(const Want &want, const sptr &abilityToken, int32_t status)); MOCK_METHOD2(NotifyContinuationResult, int(int32_t missionId, const int32_t result)); diff --git a/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h b/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h old mode 100755 new mode 100644 index 6e32c942a3..569f5dee3a --- a/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h +++ b/services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h @@ -98,6 +98,7 @@ public: MOCK_METHOD1(TerminateAbilityTest, void(int id)); MOCK_METHOD1(MoveMissionToEnd, int(int id)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info)); MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector &info)); diff --git a/services/formmgr/test/mock/include/mock_ability_manager.h b/services/formmgr/test/mock/include/mock_ability_manager.h index e26c55d423..b1b6a98d97 100644 --- a/services/formmgr/test/mock/include/mock_ability_manager.h +++ b/services/formmgr/test/mock/include/mock_ability_manager.h @@ -319,6 +319,12 @@ public: { return 0; } + + virtual int SetMissionLabel(const sptr &token, + const std::string &lable) override + { + return 0; + } }; class MockAbilityMgrStub : public IRemoteStub { @@ -689,6 +695,12 @@ public: return 0; } + virtual int SetMissionLabel(const sptr &token, + const std::string &lable) override + { + return 0; + } + virtual int MoveMissionToFront(int32_t missionId) override { return 0; diff --git a/services/test/mock/include/mock_ability_mgr_service.h b/services/test/mock/include/mock_ability_mgr_service.h old mode 100755 new mode 100644 index 56569fc427..0dd3c7ffec --- a/services/test/mock/include/mock_ability_mgr_service.h +++ b/services/test/mock/include/mock_ability_mgr_service.h @@ -105,6 +105,7 @@ public: MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD1(ClearUpApplicationData, int(const std::string &)); MOCK_METHOD2(GetWantSenderInfo, int(const sptr &target, std::shared_ptr &info)); diff --git a/tools/test/mock/mock_ability_manager_stub.h b/tools/test/mock/mock_ability_manager_stub.h old mode 100755 new mode 100644 index 76fcc7be4d..300df1c96f --- a/tools/test/mock/mock_ability_manager_stub.h +++ b/tools/test/mock/mock_ability_manager_stub.h @@ -131,6 +131,7 @@ public: MOCK_METHOD1(CleanMission, int(int32_t missionId)); MOCK_METHOD0(CleanAllMissions, int()); MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId)); + MOCK_METHOD2(SetMissionLabel, int(const sptr &token, const std::string &label)); MOCK_METHOD1(ClearUpApplicationData, int(const std::string &)); MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector &info));