From b24f031558212044f984ff134a0f3d5fceee9a10 Mon Sep 17 00:00:00 2001 From: yangzk Date: Wed, 7 Dec 2022 17:06:31 +0800 Subject: [PATCH] =?UTF-8?q?fixed=20c3f276d=20from=20https://gitee.com/yzkp?= =?UTF-8?q?/ability=5Fability=5Flite/pulls/322=20IssueNo:=20#I654I5=20Desc?= =?UTF-8?q?ription:=20=E5=90=8C=E6=AD=A5=E4=BB=A3=E7=A0=81=E5=88=B0OH=20Si?= =?UTF-8?q?g:=20SIG=5FApplicationFramework=20Feature=20or=20Bugfix:=20Bugf?= =?UTF-8?q?ix=20Binary=20Source:=20No?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: yangzk Change-Id: I1d351937a62b968e160a4344971a27c3f27e8521 --- .../abilitymgr_lite/src/ability_service.cpp | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/services/abilitymgr_lite/src/ability_service.cpp b/services/abilitymgr_lite/src/ability_service.cpp index f8fbb4c..df7b81a 100644 --- a/services/abilitymgr_lite/src/ability_service.cpp +++ b/services/abilitymgr_lite/src/ability_service.cpp @@ -49,14 +49,6 @@ constexpr uint16_t LAUNCHER_TOKEN = 0; constexpr int32_t QUEUE_LENGTH = 32; constexpr int32_t APP_TASK_PRI = 25; -AbilityService::LifecycleFuncStr AbilityService::lifecycleFuncList_[] = { - {STATE_UNINITIALIZED, &AbilityService::OnDestroyDone}, - {STATE_INITIAL, nullptr}, - {STATE_INACTIVE, nullptr}, - {STATE_ACTIVE, &AbilityService::OnActiveDone}, - {STATE_BACKGROUND, &AbilityService::OnBackgroundDone}, -}; - AbilityService::AbilityService() { } @@ -688,9 +680,21 @@ void AbilityService::SchedulerAbilityLifecycle(SliteAbility *ability, const Want int32_t AbilityService::SchedulerLifecycleDone(uint64_t token, int32_t state) { - for (auto temp : lifecycleFuncList_) { - if (state == temp.state && temp.func_ptr != nullptr) { - (this->*temp.func_ptr)(token); + switch (state) { + case STATE_ACTIVE: { + OnActiveDone(token); + break; + } + case STATE_BACKGROUND: { + OnBackgroundDone(token); + break; + } + case STATE_UNINITIALIZED: { + OnDestroyDone(token); + break; + } + default: { + break; } } return ERR_OK; -- Gitee