mirror of
https://gitee.com/openharmony/ability_ability_runtime
synced 2024-11-27 09:21:28 +00:00
Signed-off-by: caochunlei <caochunlei1@huawei.com>
This commit is contained in:
parent
1b05ac837a
commit
cca97af42f
@ -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;
|
||||
|
||||
|
8
frameworks/kits/ability/ability_runtime/include/ability_context_impl.h
Executable file → Normal file
8
frameworks/kits/ability/ability_runtime/include/ability_context_impl.h
Executable file → Normal file
@ -60,6 +60,14 @@ public:
|
||||
void RequestPermissionsFromUser(const std::vector<std::string> &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<AbilityRuntime::Context> &stageContext);
|
||||
|
||||
/**
|
||||
|
10
frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp
Executable file → Normal file
10
frameworks/kits/ability/ability_runtime/src/ability_context_impl.cpp
Executable file → Normal file
@ -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
|
2
frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h
Executable file → Normal file
2
frameworks/kits/ability/native/include/ability_runtime/js_ability_context.h
Executable file → Normal file
@ -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<AbilityContext> 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);
|
||||
|
46
frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp
Executable file → Normal file
46
frameworks/kits/ability/native/src/ability_runtime/js_ability_context.cpp
Executable file → Normal file
@ -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<JsAbilityContext>(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<int>(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<Abilit
|
||||
BindNativeFunction(engine, *object, "terminateSelfWithResult", JsAbilityContext::TerminateSelfWithResult);
|
||||
BindNativeFunction(engine, *object, "requestPermissionsFromUser", JsAbilityContext::RequestPermissionsFromUser);
|
||||
BindNativeFunction(engine, *object, "restoreWindowStage", JsAbilityContext::RestoreWindowStage);
|
||||
BindNativeFunction(engine, *object, "setMissionLabel", JsAbilityContext::SetMissionLabel);
|
||||
return objValue;
|
||||
}
|
||||
|
||||
|
1
frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h
Executable file → Normal file
1
frameworks/kits/ability/native/test/mock/include/mock_ability_manager_service.h
Executable file → Normal file
@ -133,6 +133,7 @@ public:
|
||||
MOCK_METHOD3(GetMissionInfo, int(const std::string& deviceId, int32_t missionId, MissionInfo &missionInfo));
|
||||
MOCK_METHOD1(CleanMission, int(int32_t missionId));
|
||||
MOCK_METHOD0(CleanAllMissions, int());
|
||||
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject> &token, const std::string &label));
|
||||
MOCK_METHOD1(MoveMissionToFront, int(int32_t missionId));
|
||||
|
||||
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
|
||||
|
@ -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<IRemoteObject> &token, const std::string &label));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
|
||||
|
1
frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h
Executable file → Normal file
1
frameworks/kits/test/mock/AMS/mock_serviceability_manager_service.h
Executable file → Normal file
@ -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<IRemoteObject> &token, const std::string &label));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
||||
|
@ -643,6 +643,15 @@ public:
|
||||
* @return ErrCode Returns ERR_OK on success, others on failure.
|
||||
*/
|
||||
ErrCode RegisterSnapshotHandler(const sptr<ISnapshotHandler>& 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<IRemoteObject> &abilityToken, const std::string &label);
|
||||
private:
|
||||
static std::mutex mutex_;
|
||||
static std::shared_ptr<AbilityManagerClient> instance_;
|
||||
|
5
interfaces/innerkits/ability_manager/include/ability_manager_interface.h
Executable file → Normal file
5
interfaces/innerkits/ability_manager/include/ability_manager_interface.h
Executable file → Normal file
@ -549,6 +549,8 @@ public:
|
||||
|
||||
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) = 0;
|
||||
|
||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) = 0;
|
||||
|
||||
virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) = 0;
|
||||
|
||||
virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &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,
|
||||
|
2
services/abilitymgr/include/ability_manager_proxy.h
Executable file → Normal file
2
services/abilitymgr/include/ability_manager_proxy.h
Executable file → Normal file
@ -525,6 +525,8 @@ public:
|
||||
|
||||
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override;
|
||||
|
||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) override;
|
||||
|
||||
virtual int GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info) override;
|
||||
|
||||
virtual int GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info) override;
|
||||
|
@ -713,6 +713,8 @@ public:
|
||||
|
||||
virtual int StopUser(int userId, const sptr<IStopUserCallback> &callback) override;
|
||||
|
||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &abilityToken, const std::string &label) override;
|
||||
|
||||
void ClearUserData(int32_t userId);
|
||||
|
||||
virtual int RegisterSnapshotHandler(const sptr<ISnapshotHandler>& handler) override;
|
||||
|
1
services/abilitymgr/include/ability_manager_stub.h
Executable file → Normal file
1
services/abilitymgr/include/ability_manager_stub.h
Executable file → Normal file
@ -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);
|
||||
|
@ -116,6 +116,15 @@ public:
|
||||
*/
|
||||
bool DeleteAllMissionInfos(const std::shared_ptr<MissionListenerController> &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
|
||||
*
|
||||
|
@ -226,6 +226,15 @@ public:
|
||||
*/
|
||||
sptr<IRemoteObject> 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<IRemoteObject> &abilityToken, const std::string &label);
|
||||
|
||||
/**
|
||||
* @brief dump all abilities
|
||||
*
|
||||
|
@ -825,5 +825,12 @@ ErrCode AbilityManagerClient::GetMissionSnapshot(const std::string& deviceId, in
|
||||
auto abms = iface_cast<IAbilityManager>(remoteObject_);
|
||||
return abms->GetMissionSnapshot(deviceId, missionId, snapshot);
|
||||
}
|
||||
|
||||
ErrCode AbilityManagerClient::SetMissionLabel(const sptr<IRemoteObject> &token, const std::string& label)
|
||||
{
|
||||
CHECK_REMOTE_OBJECT_AND_RETURN(remoteObject_, ABILITY_SERVICE_NOT_CONNECTED);
|
||||
auto abms = iface_cast<IAbilityManager>(remoteObject_);
|
||||
return abms->SetMissionLabel(token, label);
|
||||
}
|
||||
} // namespace AAFwk
|
||||
} // namespace AAFwk
|
||||
|
24
services/abilitymgr/src/ability_manager_proxy.cpp
Executable file → Normal file
24
services/abilitymgr/src/ability_manager_proxy.cpp
Executable file → Normal file
@ -1983,6 +1983,30 @@ int AbilityManagerProxy::StopUser(int userId, const sptr<IStopUserCallback> &cal
|
||||
return reply.ReadInt32();
|
||||
}
|
||||
|
||||
int AbilityManagerProxy::SetMissionLabel(const sptr<IRemoteObject> &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<AbilityRunningInfo> &info)
|
||||
{
|
||||
MessageParcel data;
|
||||
|
@ -2734,6 +2734,16 @@ void AbilityManagerService::StartingSettingsDataAbility()
|
||||
(void)AcquireDataAbility(uri, true, nullptr);
|
||||
}
|
||||
|
||||
int AbilityManagerService::SetMissionLabel(const sptr<IRemoteObject> &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__);
|
||||
|
18
services/abilitymgr/src/ability_manager_stub.cpp
Executable file → Normal file
18
services/abilitymgr/src/ability_manager_stub.cpp
Executable file → Normal file
@ -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<IRemoteObject> token = data.ReadParcelable<IRemoteObject>();
|
||||
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<AbilityRunningInfo> abilityRunningInfos;
|
||||
|
@ -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_) {
|
||||
|
@ -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<MissionInfoMgr>::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<IRemoteObject> &token, const std::string &label)
|
||||
{
|
||||
if (!token) {
|
||||
HILOG_INFO("SetMissionLabel token is nullptr.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
std::lock_guard<std::recursive_mutex> guard(managerLock_);
|
||||
auto missionId = GetMissionIdByAbilityToken(token);
|
||||
if (missionId <= 0) {
|
||||
HILOG_INFO("SetMissionLabel find mission failed.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return DelayedSingleton<MissionInfoMgr>::GetInstance()->UpdateMissionLabel(missionId, label);
|
||||
}
|
||||
|
||||
void MissionListManager::Dump(std::vector<std::string> &info)
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> guard(managerLock_);
|
||||
|
1
services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h
Executable file → Normal file
1
services/abilitymgr/test/unittest/phone/ability_manager_proxy_test/ability_manager_stub_mock.h
Executable file → Normal file
@ -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<IRemoteObject> &token, const std::string &label));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
|
||||
MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector<ExtensionRunningInfo> &info));
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
MOCK_METHOD2(GetPendingRequestWant, int(const sptr<IWantSender> &target, std::shared_ptr<Want> &want));
|
||||
MOCK_METHOD1(GetSystemMemoryAttr, void(AppExecFwk::SystemMemoryAttr &memoryInfo));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject> &token, const std::string &label));
|
||||
|
||||
MOCK_METHOD3(StartContinuation, int(const Want &want, const sptr<IRemoteObject> &abilityToken, int32_t status));
|
||||
MOCK_METHOD2(NotifyContinuationResult, int(int32_t missionId, const int32_t result));
|
||||
|
1
services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h
Executable file → Normal file
1
services/abilitymgr/test/unittest/phone/ability_manager_test/ability_manager_stub_mock.h
Executable file → Normal file
@ -98,6 +98,7 @@ public:
|
||||
MOCK_METHOD1(TerminateAbilityTest, void(int id));
|
||||
MOCK_METHOD1(MoveMissionToEnd, int(int id));
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
MOCK_METHOD2(SetMissionLabel, int(const sptr<IRemoteObject> &token, const std::string &label));
|
||||
|
||||
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
|
||||
MOCK_METHOD2(GetExtensionRunningInfos, int(int upperLimit, std::vector<ExtensionRunningInfo> &info));
|
||||
|
@ -319,6 +319,12 @@ public:
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &token,
|
||||
const std::string &lable) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
};
|
||||
|
||||
class MockAbilityMgrStub : public IRemoteStub<AAFwk::IAbilityManager> {
|
||||
@ -689,6 +695,12 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int SetMissionLabel(const sptr<IRemoteObject> &token,
|
||||
const std::string &lable) override
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int MoveMissionToFront(int32_t missionId) override
|
||||
{
|
||||
return 0;
|
||||
|
1
services/test/mock/include/mock_ability_mgr_service.h
Executable file → Normal file
1
services/test/mock/include/mock_ability_mgr_service.h
Executable file → Normal file
@ -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<IRemoteObject> &token, const std::string &label));
|
||||
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
|
||||
|
||||
MOCK_METHOD2(GetWantSenderInfo, int(const sptr<IWantSender> &target, std::shared_ptr<WantSenderInfo> &info));
|
||||
|
1
tools/test/mock/mock_ability_manager_stub.h
Executable file → Normal file
1
tools/test/mock/mock_ability_manager_stub.h
Executable file → Normal file
@ -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<IRemoteObject> &token, const std::string &label));
|
||||
MOCK_METHOD1(ClearUpApplicationData, int(const std::string &));
|
||||
|
||||
MOCK_METHOD1(GetAbilityRunningInfos, int(std::vector<AbilityRunningInfo> &info));
|
||||
|
Loading…
Reference in New Issue
Block a user