diff --git a/frameworks/native/ability/native/dialog_request_callback/dialog_request_callback_stub.cpp b/frameworks/native/ability/native/dialog_request_callback/dialog_request_callback_stub.cpp index b020836115..519f851adb 100755 --- a/frameworks/native/ability/native/dialog_request_callback/dialog_request_callback_stub.cpp +++ b/frameworks/native/ability/native/dialog_request_callback/dialog_request_callback_stub.cpp @@ -23,10 +23,7 @@ namespace OHOS { namespace AbilityRuntime { DialogRequestCallbackStub::DialogRequestCallbackStub() -{ - vecMemberFunc_.resize(IDialogRequestCallback::CODE_MAX); - vecMemberFunc_[CODE_SEND_RESULT] = &DialogRequestCallbackStub::SendResultInner; -} +{} int DialogRequestCallbackStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) @@ -38,9 +35,8 @@ int DialogRequestCallbackStub::OnRemoteRequest( return ERR_INVALID_STATE; } - if (code < IDialogRequestCallback::CODE_MAX) { - auto memberFunc = vecMemberFunc_[code]; - return (this->*memberFunc)(data, reply); + if (code == CODE_SEND_RESULT) { + return SendResultInner(data, reply); } return IPCObjectStub::OnRemoteRequest(code, data, reply, option); diff --git a/frameworks/native/ability/native/free_install_observer_stub.cpp b/frameworks/native/ability/native/free_install_observer_stub.cpp index dbcc61039d..68a4d08c19 100644 --- a/frameworks/native/ability/native/free_install_observer_stub.cpp +++ b/frameworks/native/ability/native/free_install_observer_stub.cpp @@ -23,15 +23,10 @@ namespace OHOS { namespace AbilityRuntime { FreeInstallObserverStub::FreeInstallObserverStub() -{ - memberFuncMap_[IFreeInstallObserver::ON_INSTALL_FINISHED] = - &FreeInstallObserverStub::OnInstallFinishedInner; -} +{} FreeInstallObserverStub::~FreeInstallObserverStub() -{ - memberFuncMap_.clear(); -} +{} int FreeInstallObserverStub::OnInstallFinishedInner(MessageParcel &data, MessageParcel &reply) { @@ -54,12 +49,8 @@ int FreeInstallObserverStub::OnRemoteRequest( return ERR_INVALID_STATE; } - auto itFunc = memberFuncMap_.find(code); - if (itFunc != memberFuncMap_.end()) { - auto memberFunc = itFunc->second; - if (memberFunc != nullptr) { - return (this->*memberFunc)(data, reply); - } + if (code == IFreeInstallObserver::ON_INSTALL_FINISHED) { + return OnInstallFinishedInner(data, reply); } return IPCObjectStub::OnRemoteRequest(code, data, reply, option); diff --git a/interfaces/inner_api/ability_manager/include/ability_manager_errors.h b/interfaces/inner_api/ability_manager/include/ability_manager_errors.h index 3eacb1691d..531e2a7c6b 100644 --- a/interfaces/inner_api/ability_manager/include/ability_manager_errors.h +++ b/interfaces/inner_api/ability_manager/include/ability_manager_errors.h @@ -549,6 +549,11 @@ enum { * Native error(2097258) for target bundle not exist. */ ERR_BUNDLE_NOT_EXIST, + + /** + * Native error(3000000) for target bundle not exist. + */ + ERR_CODE_NOT_EXIST = 3000000, }; enum { diff --git a/interfaces/kits/native/ability/native/dialog_request_callback/dialog_request_callback_stub.h b/interfaces/kits/native/ability/native/dialog_request_callback/dialog_request_callback_stub.h index 68bec89043..e421e8bacf 100755 --- a/interfaces/kits/native/ability/native/dialog_request_callback/dialog_request_callback_stub.h +++ b/interfaces/kits/native/ability/native/dialog_request_callback/dialog_request_callback_stub.h @@ -41,9 +41,6 @@ private: DISALLOW_COPY_AND_MOVE(DialogRequestCallbackStub); int SendResultInner(MessageParcel &data, MessageParcel &reply); - - using StubFunc = int (DialogRequestCallbackStub::*)(MessageParcel &data, MessageParcel &reply); - std::vector vecMemberFunc_; }; } // namespace AbilityRuntime } // namespace OHOS diff --git a/interfaces/kits/native/ability/native/free_install_observer_stub.h b/interfaces/kits/native/ability/native/free_install_observer_stub.h index fb8d4887f9..d1a4c6701a 100644 --- a/interfaces/kits/native/ability/native/free_install_observer_stub.h +++ b/interfaces/kits/native/ability/native/free_install_observer_stub.h @@ -35,8 +35,6 @@ public: private: DISALLOW_COPY_AND_MOVE(FreeInstallObserverStub); int OnInstallFinishedInner(MessageParcel &data, MessageParcel &reply); - using FreeInstallObserverFunc = int32_t (FreeInstallObserverStub::*)(MessageParcel &data, MessageParcel &reply); - std::map memberFuncMap_; }; } // namespace AbilityRuntime } // namespace OHOS diff --git a/services/abilitymgr/include/ability_manager_service.h b/services/abilitymgr/include/ability_manager_service.h index 315d2efda7..b5fb6e0399 100644 --- a/services/abilitymgr/include/ability_manager_service.h +++ b/services/abilitymgr/include/ability_manager_service.h @@ -1836,14 +1836,12 @@ private: void DataDumpStateInner(const std::string &args, std::vector &info); void DumpMissionListInner(const std::string &args, std::vector &info); void DumpMissionInfosInner(const std::string &args, std::vector &info); - void DumpFuncInit(); bool JudgeMultiUserConcurrency(const int32_t userId); /** * dumpsys info * */ - void DumpSysFuncInit(); void DumpSysInner( const std::string &args, std::vector &info, bool isClient, bool isUserID, int userId); void DumpSysMissionListInner( @@ -1919,13 +1917,6 @@ private: int VerifyAccountPermission(int32_t userId); - using DumpFuncType = void (AbilityManagerService::*)(const std::string &args, std::vector &info); - std::map dumpFuncMap_; - - using DumpSysFuncType = void (AbilityManagerService::*)( - const std::string& args, std::vector& state, bool isClient, bool isUserID, int UserID); - std::map dumpsysFuncMap_; - int CheckStaticCfgPermissionForAbility(const AppExecFwk::AbilityInfo &abilityInfo, uint32_t tokenId); int CheckStaticCfgPermissionForSkill(const AppExecFwk::AbilityRequest &abilityRequest, uint32_t tokenId); diff --git a/services/abilitymgr/include/ability_manager_stub.h b/services/abilitymgr/include/ability_manager_stub.h index 3389fe8ba6..b2e56e3768 100644 --- a/services/abilitymgr/include/ability_manager_stub.h +++ b/services/abilitymgr/include/ability_manager_stub.h @@ -66,11 +66,6 @@ public: virtual int GetConnectionData(std::vector &connectionData); private: - void FirstStepInit(); - void SecondStepInit(); - void ThirdStepInit(); - void FourthStepInit(); - void FifthStepInit(); int TerminateAbilityInner(MessageParcel &data, MessageParcel &reply); int TerminateUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply); int CloseUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply); @@ -218,9 +213,6 @@ private: int FreeInstallAbilityFromRemoteInner(MessageParcel &data, MessageParcel &reply); int AddFreeInstallObserverInner(MessageParcel &data, MessageParcel &reply); - using RequestFuncType = int (AbilityManagerStub::*)(MessageParcel &data, MessageParcel &reply); - std::map requestFuncMap_; - #ifdef ABILITY_COMMAND_FOR_TEST int BlockAmsServiceInner(MessageParcel &data, MessageParcel &reply); int BlockAbilityInner(MessageParcel &data, MessageParcel &reply); @@ -302,6 +294,50 @@ private: int32_t GetAbilityStateByPersistentIdInner(MessageParcel &data, MessageParcel &reply); int32_t TransferAbilityResultForExtensionInner(MessageParcel &data, MessageParcel &reply); int32_t NotifyFrozenProcessByRSSInner(MessageParcel &data, MessageParcel &reply); + int OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerFourth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerFifth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSixth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSeventh(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerEighth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerNinth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerTenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerEleventh(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInner(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerTwelveth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerThirteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerFourteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerFifteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSixteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSeventeenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerEighteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerNineteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int HandleOnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); + int HandleOnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option); }; } // namespace AAFwk } // namespace OHOS diff --git a/services/abilitymgr/include/ability_scheduler_stub.h b/services/abilitymgr/include/ability_scheduler_stub.h index 40291b9e25..50e26ca37b 100644 --- a/services/abilitymgr/include/ability_scheduler_stub.h +++ b/services/abilitymgr/include/ability_scheduler_stub.h @@ -75,8 +75,14 @@ private: int ShareDataInner(MessageParcel &data, MessageParcel &reply); int CreateModalUIExtensionInner(MessageParcel &data, MessageParcel &reply); int UpdateSessionTokenInner(MessageParcel &data, MessageParcel &reply); - using RequestFuncType = int (AbilitySchedulerStub::*)(MessageParcel &data, MessageParcel &reply); - std::map requestFuncMap_; + int OnRemoteRequestInner( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerFirst( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerSecond( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); + int OnRemoteRequestInnerThird( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option); }; /** diff --git a/services/abilitymgr/src/ability_manager_service.cpp b/services/abilitymgr/src/ability_manager_service.cpp index 9a447f9ee4..370aac8f2c 100644 --- a/services/abilitymgr/src/ability_manager_service.cpp +++ b/services/abilitymgr/src/ability_manager_service.cpp @@ -340,10 +340,7 @@ AbilityManagerService::AbilityManagerService() : SystemAbility(ABILITY_MGR_SERVICE_ID, true), state_(ServiceRunningState::STATE_NOT_START), bundleMgrHelper_(nullptr) -{ - DumpFuncInit(); - DumpSysFuncInit(); -} +{} AbilityManagerService::~AbilityManagerService() {} @@ -4776,29 +4773,6 @@ int AbilityManagerService::AttachAbilityThread( } } -void AbilityManagerService::DumpFuncInit() -{ - dumpFuncMap_[KEY_DUMP_SERVICE] = &AbilityManagerService::DumpStateInner; - dumpFuncMap_[KEY_DUMP_DATA] = &AbilityManagerService::DataDumpStateInner; - - dumpFuncMap_[KEY_DUMP_ALL] = &AbilityManagerService::DumpInner; - dumpFuncMap_[KEY_DUMP_MISSION] = &AbilityManagerService::DumpMissionInner; - dumpFuncMap_[KEY_DUMP_MISSION_LIST] = &AbilityManagerService::DumpMissionListInner; - dumpFuncMap_[KEY_DUMP_MISSION_INFOS] = &AbilityManagerService::DumpMissionInfosInner; -} - -void AbilityManagerService::DumpSysFuncInit() -{ - dumpsysFuncMap_[KEY_DUMPSYS_ALL] = &AbilityManagerService::DumpSysInner; - dumpsysFuncMap_[KEY_DUMPSYS_SERVICE] = &AbilityManagerService::DumpSysStateInner; - dumpsysFuncMap_[KEY_DUMPSYS_PENDING] = &AbilityManagerService::DumpSysPendingInner; - dumpsysFuncMap_[KEY_DUMPSYS_PROCESS] = &AbilityManagerService::DumpSysProcess; - dumpsysFuncMap_[KEY_DUMPSYS_DATA] = &AbilityManagerService::DataDumpSysStateInner; - - dumpsysFuncMap_[KEY_DUMPSYS_MISSION_LIST] = &AbilityManagerService::DumpSysMissionListInner; - dumpsysFuncMap_[KEY_DUMPSYS_ABILITY] = &AbilityManagerService::DumpSysAbilityInner; -} - void AbilityManagerService::DumpSysInner( const std::string& args, std::vector& info, bool isClient, bool isUserID, int userId) { @@ -5271,15 +5245,29 @@ void AbilityManagerService::DumpState(const std::string &args, std::vectorsecond; - auto itFunc = dumpFuncMap_.find(key); - if (itFunc != dumpFuncMap_.end()) { - auto dumpFunc = itFunc->second; - if (dumpFunc != nullptr) { - (this->*dumpFunc)(args, info); - return; - } + switch (key) { + case KEY_DUMP_SERVICE: + DumpStateInner(args, info); + break; + case KEY_DUMP_DATA: + DataDumpStateInner(args, info); + break; + case KEY_DUMP_ALL: + DumpInner(args, info); + break; + case KEY_DUMP_MISSION: + DumpMissionInner(args, info); + break; + case KEY_DUMP_MISSION_LIST: + DumpMissionListInner(args, info); + break; + case KEY_DUMP_MISSION_INFOS: + DumpMissionInfosInner(args, info); + break; + default: + info.push_back("error: invalid argument, please see 'ability dump -h'."); + break; } - info.push_back("error: invalid argument, please see 'ability dump -h'."); } void AbilityManagerService::DumpSysState( @@ -5302,15 +5290,32 @@ void AbilityManagerService::DumpSysState( return; } DumpsysKey key = it->second; - auto itFunc = dumpsysFuncMap_.find(key); - if (itFunc != dumpsysFuncMap_.end()) { - auto dumpsysFunc = itFunc->second; - if (dumpsysFunc != nullptr) { - (this->*dumpsysFunc)(args, info, isClient, isUserID, userId); - return; - } + switch (key) { + case KEY_DUMPSYS_ALL: + DumpSysInner(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_SERVICE: + DumpSysStateInner(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_PENDING: + DumpSysPendingInner(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_PROCESS: + DumpSysProcess(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_DATA: + DataDumpSysStateInner(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_MISSION_LIST: + DumpSysMissionListInner(args, info, isClient, isUserID, userId); + break; + case KEY_DUMPSYS_ABILITY: + DumpSysAbilityInner(args, info, isClient, isUserID, userId); + break; + default: + info.push_back("error: invalid argument, please see 'ability dump -h'."); + break; } - info.push_back("error: invalid argument, please see 'ability dump -h'."); } int AbilityManagerService::AbilityTransitionDone(const sptr &token, int state, const PacMap &saveData) diff --git a/services/abilitymgr/src/ability_manager_stub.cpp b/services/abilitymgr/src/ability_manager_stub.cpp index ebd09d89d8..ad1bb836bf 100644 --- a/services/abilitymgr/src/ability_manager_stub.cpp +++ b/services/abilitymgr/src/ability_manager_stub.cpp @@ -41,414 +41,812 @@ constexpr int32_t CYCLE_LIMIT = 1000; constexpr int32_t MAX_KILL_PROCESS_PID_COUNT = 100; } // namespace AbilityManagerStub::AbilityManagerStub() -{ - FirstStepInit(); - SecondStepInit(); - ThirdStepInit(); - FourthStepInit(); - FifthStepInit(); -} +{} AbilityManagerStub::~AbilityManagerStub() +{} + +int AbilityManagerStub::OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_.clear(); + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_ABILITY) { + return TerminateAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_ABILITY) { + return MinimizeAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ATTACH_ABILITY_THREAD) { + return AttachAbilityThreadInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_TRANSITION_DONE) { + return AbilityTransitionDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY_DONE) { + return ScheduleConnectAbilityDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DISCONNECT_ABILITY_DONE) { + return ScheduleDisconnectAbilityDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::COMMAND_ABILITY_DONE) { + return ScheduleCommandAbilityDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::COMMAND_ABILITY_WINDOW_DONE) { + return ScheduleCommandAbilityWindowDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ACQUIRE_DATA_ABILITY) { + return AcquireDataAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::RELEASE_DATA_ABILITY) { + return ReleaseDataAbilityInner(data, reply); + } + return ERR_CODE_NOT_EXIST; } -void AbilityManagerStub::FirstStepInit() +int AbilityManagerStub::OnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::TERMINATE_ABILITY)] = - &AbilityManagerStub::TerminateAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MINIMIZE_ABILITY)] = - &AbilityManagerStub::MinimizeAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ATTACH_ABILITY_THREAD)] = - &AbilityManagerStub::AttachAbilityThreadInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ABILITY_TRANSITION_DONE)] = - &AbilityManagerStub::AbilityTransitionDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONNECT_ABILITY_DONE)] = - &AbilityManagerStub::ScheduleConnectAbilityDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DISCONNECT_ABILITY_DONE)] = - &AbilityManagerStub::ScheduleDisconnectAbilityDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::COMMAND_ABILITY_DONE)] = - &AbilityManagerStub::ScheduleCommandAbilityDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::COMMAND_ABILITY_WINDOW_DONE)] = - &AbilityManagerStub::ScheduleCommandAbilityWindowDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ACQUIRE_DATA_ABILITY)] = - &AbilityManagerStub::AcquireDataAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::RELEASE_DATA_ABILITY)] = - &AbilityManagerStub::ReleaseDataAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::KILL_PROCESS)] = - &AbilityManagerStub::KillProcessInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNINSTALL_APP)] = - &AbilityManagerStub::UninstallAppInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UPGRADE_APP)] = - &AbilityManagerStub::UpgradeAppInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY)] = - &AbilityManagerStub::StartAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_ADD_CALLER)] = - &AbilityManagerStub::StartAbilityAddCallerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_WITH_SPECIFY_TOKENID)] = - &AbilityManagerStub::StartAbilityInnerSpecifyTokenId; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_BY_TOKEN)] = - &AbilityManagerStub::StartAbilityAsCallerByTokenInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_FOR_OPTIONS)] = - &AbilityManagerStub::StartAbilityAsCallerForOptionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_ADD_CALLER)] = - &AbilityManagerStub::StartAbilityByUIContentSessionAddCallerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_FOR_OPTIONS)] = - &AbilityManagerStub::StartAbilityByUIContentSessionForOptionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_BY_INSIGHT_INTENT)] = - &AbilityManagerStub::StartAbilityByInsightIntentInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONNECT_ABILITY)] = - &AbilityManagerStub::ConnectAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DISCONNECT_ABILITY)] = - &AbilityManagerStub::DisconnectAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::STOP_SERVICE_ABILITY)] = - &AbilityManagerStub::StopServiceAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DUMP_STATE)] = - &AbilityManagerStub::DumpStateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DUMPSYS_STATE)] = - &AbilityManagerStub::DumpSysStateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_FOR_SETTINGS)] = - &AbilityManagerStub::StartAbilityForSettingsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONTINUE_MISSION)] = - &AbilityManagerStub::ContinueMissionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME)] = - &AbilityManagerStub::ContinueMissionOfBundleNameInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONTINUE_ABILITY)] = - &AbilityManagerStub::ContinueAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_CONTINUATION)] = - &AbilityManagerStub::StartContinuationInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::NOTIFY_COMPLETE_CONTINUATION)] = - &AbilityManagerStub::NotifyCompleteContinuationInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::NOTIFY_CONTINUATION_RESULT)] = - &AbilityManagerStub::NotifyContinuationResultInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SEND_RESULT_TO_ABILITY)] = - &AbilityManagerStub::SendResultToAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_REMOTE_MISSION_LISTENER)] = - &AbilityManagerStub::RegisterRemoteMissionListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_REMOTE_ON_LISTENER)] = - &AbilityManagerStub::RegisterRemoteOnListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_REMOTE_OFF_LISTENER)] = - &AbilityManagerStub::RegisterRemoteOffListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_REMOTE_MISSION_LISTENER)] = - &AbilityManagerStub::UnRegisterRemoteMissionListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_FOR_OPTIONS)] = - &AbilityManagerStub::StartAbilityForOptionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_SYNC_MISSIONS)] = - &AbilityManagerStub::StartSyncRemoteMissionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::STOP_SYNC_MISSIONS)] = - &AbilityManagerStub::StopSyncRemoteMissionsInner; + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::KILL_PROCESS) { + return KillProcessInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNINSTALL_APP) { + return UninstallAppInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UPGRADE_APP) { + return UpgradeAppInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY) { + return StartAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_ADD_CALLER) { + return StartAbilityAddCallerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_WITH_SPECIFY_TOKENID) { + return StartAbilityInnerSpecifyTokenId(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_BY_TOKEN) { + return StartAbilityAsCallerByTokenInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_FOR_OPTIONS) { + return StartAbilityAsCallerForOptionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_ADD_CALLER) { + return StartAbilityByUIContentSessionAddCallerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_FOR_OPTIONS) { + return StartAbilityByUIContentSessionForOptionsInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_BY_INSIGHT_INTENT) { + return StartAbilityByInsightIntentInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY) { + return ConnectAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DISCONNECT_ABILITY) { + return DisconnectAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::STOP_SERVICE_ABILITY) { + return StopServiceAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DUMP_STATE) { + return DumpStateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DUMPSYS_STATE) { + return DumpSysStateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_SETTINGS) { + return StartAbilityForSettingsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_MISSION) { + return ContinueMissionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME) { + return ContinueMissionOfBundleNameInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_ABILITY) { + return ContinueAbilityInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerFourth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::START_CONTINUATION) { + return StartContinuationInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_COMPLETE_CONTINUATION) { + return NotifyCompleteContinuationInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_CONTINUATION_RESULT) { + return NotifyContinuationResultInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SEND_RESULT_TO_ABILITY) { + return SendResultToAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_MISSION_LISTENER) { + return RegisterRemoteMissionListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_ON_LISTENER) { + return RegisterRemoteOnListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_OFF_LISTENER) { + return RegisterRemoteOffListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_REMOTE_MISSION_LISTENER) { + return UnRegisterRemoteMissionListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_OPTIONS) { + return StartAbilityForOptionsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_SYNC_MISSIONS) { + return StartSyncRemoteMissionsInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerFifth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::STOP_SYNC_MISSIONS) { + return StopSyncRemoteMissionsInner(data, reply); + } #ifdef ABILITY_COMMAND_FOR_TEST - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::FORCE_TIMEOUT)] = - &AbilityManagerStub::ForceTimeoutForTestInner; + if (interfaceCode == AbilityManagerInterfaceCode::FORCE_TIMEOUT) { + return ForceTimeoutForTestInner(data, reply); + } #endif - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::FREE_INSTALL_ABILITY_FROM_REMOTE)] = - &AbilityManagerStub::FreeInstallAbilityFromRemoteInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ADD_FREE_INSTALL_OBSERVER)] = - &AbilityManagerStub::AddFreeInstallObserverInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONNECT_ABILITY_WITH_TYPE)] = - &AbilityManagerStub::ConnectAbilityWithTypeInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ABILITY_RECOVERY)] = - &AbilityManagerStub::ScheduleRecoverAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ABILITY_RECOVERY_ENABLE)] = - &AbilityManagerStub::EnableRecoverAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CLEAR_RECOVERY_PAGE_STACK)] = - &AbilityManagerStub::ScheduleClearRecoveryPageStackInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MINIMIZE_UI_ABILITY_BY_SCB)] = - &AbilityManagerStub::MinimizeUIAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CLOSE_UI_ABILITY_BY_SCB)] = - &AbilityManagerStub::CloseUIAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_COLLABORATOR)] = - &AbilityManagerStub::RegisterIAbilityManagerCollaboratorInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_COLLABORATOR)] = - &AbilityManagerStub::UnregisterIAbilityManagerCollaboratorInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_APP_DEBUG_LISTENER)] = - &AbilityManagerStub::RegisterAppDebugListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_APP_DEBUG_LISTENER)] = - &AbilityManagerStub::UnregisterAppDebugListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ATTACH_APP_DEBUG)] = - &AbilityManagerStub::AttachAppDebugInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DETACH_APP_DEBUG)] = - &AbilityManagerStub::DetachAppDebugInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::IS_ABILITY_CONTROLLER_START)] = - &AbilityManagerStub::IsAbilityControllerStartInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::EXECUTE_INTENT)] = - &AbilityManagerStub::ExecuteIntentInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::EXECUTE_INSIGHT_INTENT_DONE)] = - &AbilityManagerStub::ExecuteInsightIntentDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::OPEN_FILE)] = - &AbilityManagerStub::OpenFileInner; + if (interfaceCode == AbilityManagerInterfaceCode::FREE_INSTALL_ABILITY_FROM_REMOTE) { + return FreeInstallAbilityFromRemoteInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ADD_FREE_INSTALL_OBSERVER) { + return AddFreeInstallObserverInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY_WITH_TYPE) { + return ConnectAbilityWithTypeInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_RECOVERY) { + return ScheduleRecoverAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_RECOVERY_ENABLE) { + return EnableRecoverAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CLEAR_RECOVERY_PAGE_STACK) { + return ScheduleClearRecoveryPageStackInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_UI_ABILITY_BY_SCB) { + return MinimizeUIAbilityBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CLOSE_UI_ABILITY_BY_SCB) { + return CloseUIAbilityBySCBInner(data, reply); + } + return ERR_CODE_NOT_EXIST; } -void AbilityManagerStub::SecondStepInit() +int AbilityManagerStub::OnRemoteRequestInnerSixth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER)] = - &AbilityManagerStub::GetWantSenderInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SEND_PENDING_WANT_SENDER)] = - &AbilityManagerStub::SendWantSenderInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CANCEL_PENDING_WANT_SENDER)] = - &AbilityManagerStub::CancelWantSenderInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_UID)] = - &AbilityManagerStub::GetPendingWantUidInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_USERID)] = - &AbilityManagerStub::GetPendingWantUserIdInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_BUNDLENAME)] = - &AbilityManagerStub::GetPendingWantBundleNameInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_CODE)] = - &AbilityManagerStub::GetPendingWantCodeInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_TYPE)] = - &AbilityManagerStub::GetPendingWantTypeInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_CANCEL_LISTENER)] = - &AbilityManagerStub::RegisterCancelListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_CANCEL_LISTENER)] = - &AbilityManagerStub::UnregisterCancelListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_REQUEST_WANT)] = - &AbilityManagerStub::GetPendingRequestWantInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER_INFO)] = - &AbilityManagerStub::GetWantSenderInfoInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_APP_MEMORY_SIZE)] = - &AbilityManagerStub::GetAppMemorySizeInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::IS_RAM_CONSTRAINED_DEVICE)] = - &AbilityManagerStub::IsRamConstrainedDeviceInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::LOCK_MISSION_FOR_CLEANUP)] = - &AbilityManagerStub::LockMissionForCleanupInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNLOCK_MISSION_FOR_CLEANUP)] = - &AbilityManagerStub::UnlockMissionForCleanupInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_SESSION_LOCKED_STATE)] = - &AbilityManagerStub::SetLockedStateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_MISSION_LISTENER)] = - &AbilityManagerStub::RegisterMissionListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_MISSION_LISTENER)] = - &AbilityManagerStub::UnRegisterMissionListenerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_MISSION_INFOS)] = - &AbilityManagerStub::GetMissionInfosInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_MISSION_INFO_BY_ID)] = - &AbilityManagerStub::GetMissionInfoInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CLEAN_MISSION)] = - &AbilityManagerStub::CleanMissionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CLEAN_ALL_MISSIONS)] = - &AbilityManagerStub::CleanAllMissionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT)] = - &AbilityManagerStub::MoveMissionToFrontInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT_BY_OPTIONS)] = - &AbilityManagerStub::MoveMissionToFrontByOptionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_FOREGROUND)] = - &AbilityManagerStub::MoveMissionsToForegroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_BACKGROUND)] = - &AbilityManagerStub::MoveMissionsToBackgroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_CALL_ABILITY)] = - &AbilityManagerStub::StartAbilityByCallInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CALL_REQUEST_DONE)] = - &AbilityManagerStub::CallRequestDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::RELEASE_CALL_ABILITY)] = - &AbilityManagerStub::ReleaseCallInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_USER)] = - &AbilityManagerStub::StartUserInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::STOP_USER)] = - &AbilityManagerStub::StopUserInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::LOGOUT_USER)] = - &AbilityManagerStub::LogoutUserInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_ABILITY_RUNNING_INFO)] = - &AbilityManagerStub::GetAbilityRunningInfosInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_EXTENSION_RUNNING_INFO)] = - &AbilityManagerStub::GetExtensionRunningInfosInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_PROCESS_RUNNING_INFO)] = - &AbilityManagerStub::GetProcessRunningInfosInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_ABILITY_CONTROLLER)] = - &AbilityManagerStub::SetAbilityControllerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_MISSION_SNAPSHOT_INFO)] = - &AbilityManagerStub::GetMissionSnapshotInfoInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::IS_USER_A_STABILITY_TEST)] = - &AbilityManagerStub::IsRunningInStabilityTestInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::ACQUIRE_SHARE_DATA)] = - &AbilityManagerStub::AcquireShareDataInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SHARE_DATA_DONE)] = - &AbilityManagerStub::ShareDataDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_ABILITY_TOKEN)] = - &AbilityManagerStub::GetAbilityTokenByCalleeObjInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::FORCE_EXIT_APP)] = - &AbilityManagerStub::ForceExitAppInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::RECORD_APP_EXIT_REASON)] = - &AbilityManagerStub::RecordAppExitReasonInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::RECORD_PROCESS_EXIT_REASON)] = - &AbilityManagerStub::RecordProcessExitReasonInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_SESSION_HANDLER)] = - &AbilityManagerStub::RegisterSessionHandlerInner; + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_COLLABORATOR) { + return RegisterIAbilityManagerCollaboratorInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_COLLABORATOR) { + return UnregisterIAbilityManagerCollaboratorInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_APP_DEBUG_LISTENER) { + return RegisterAppDebugListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_APP_DEBUG_LISTENER) { + return UnregisterAppDebugListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::ATTACH_APP_DEBUG) { + return AttachAppDebugInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DETACH_APP_DEBUG) { + return DetachAppDebugInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::IS_ABILITY_CONTROLLER_START) { + return IsAbilityControllerStartInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::EXECUTE_INTENT) { + return ExecuteIntentInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::EXECUTE_INSIGHT_INTENT_DONE) { + return ExecuteInsightIntentDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::OPEN_FILE) { + return OpenFileInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerSeventh(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER) { + return GetWantSenderInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SEND_PENDING_WANT_SENDER) { + return SendWantSenderInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_PENDING_WANT_SENDER) { + return CancelWantSenderInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_UID) { + return GetPendingWantUidInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_USERID) { + return GetPendingWantUserIdInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_BUNDLENAME) { + return GetPendingWantBundleNameInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_CODE) { + return GetPendingWantCodeInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_TYPE) { + return GetPendingWantTypeInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_CANCEL_LISTENER) { + return RegisterCancelListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_CANCEL_LISTENER) { + return UnregisterCancelListenerInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerEighth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_REQUEST_WANT) { + return GetPendingRequestWantInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER_INFO) { + return GetWantSenderInfoInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_APP_MEMORY_SIZE) { + return GetAppMemorySizeInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::IS_RAM_CONSTRAINED_DEVICE) { + return IsRamConstrainedDeviceInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::LOCK_MISSION_FOR_CLEANUP) { + return LockMissionForCleanupInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNLOCK_MISSION_FOR_CLEANUP) { + return UnlockMissionForCleanupInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_SESSION_LOCKED_STATE) { + return SetLockedStateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_MISSION_LISTENER) { + return RegisterMissionListenerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_MISSION_LISTENER) { + return UnRegisterMissionListenerInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerNinth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_INFOS) { + return GetMissionInfosInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_INFO_BY_ID) { + return GetMissionInfoInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CLEAN_MISSION) { + return CleanMissionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CLEAN_ALL_MISSIONS) { + return CleanAllMissionsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT) { + return MoveMissionToFrontInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT_BY_OPTIONS) { + return MoveMissionToFrontByOptionsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_FOREGROUND) { + return MoveMissionsToForegroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_BACKGROUND) { + return MoveMissionsToBackgroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_CALL_ABILITY) { + return StartAbilityByCallInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CALL_REQUEST_DONE) { + return CallRequestDoneInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerTenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::RELEASE_CALL_ABILITY) { + return ReleaseCallInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_USER) { + return StartUserInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::STOP_USER) { + return StopUserInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::LOGOUT_USER) { + return LogoutUserInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_RUNNING_INFO) { + return GetAbilityRunningInfosInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_EXTENSION_RUNNING_INFO) { + return GetExtensionRunningInfosInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_PROCESS_RUNNING_INFO) { + return GetProcessRunningInfosInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_ABILITY_CONTROLLER) { + return SetAbilityControllerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_SNAPSHOT_INFO) { + return GetMissionSnapshotInfoInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::IS_USER_A_STABILITY_TEST) { + return IsRunningInStabilityTestInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerEleventh(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::ACQUIRE_SHARE_DATA) { + return AcquireShareDataInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SHARE_DATA_DONE) { + return ShareDataDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_TOKEN) { + return GetAbilityTokenByCalleeObjInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::FORCE_EXIT_APP) { + return ForceExitAppInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::RECORD_APP_EXIT_REASON) { + return RecordAppExitReasonInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::RECORD_PROCESS_EXIT_REASON) { + return RecordProcessExitReasonInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_SESSION_HANDLER) { + return RegisterSessionHandlerInner(data, reply); + } #ifdef ABILITY_COMMAND_FOR_TEST - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::BLOCK_ABILITY)] = - &AbilityManagerStub::BlockAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::BLOCK_AMS_SERVICE)] = - &AbilityManagerStub::BlockAmsServiceInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::BLOCK_APP_SERVICE)] = - &AbilityManagerStub::BlockAppServiceInner; + if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_ABILITY) { + return BlockAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_AMS_SERVICE) { + return BlockAmsServiceInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_APP_SERVICE) { + return BlockAppServiceInner(data, reply); + } #endif + return ERR_CODE_NOT_EXIST; } -void AbilityManagerStub::ThirdStepInit() +int AbilityManagerStub::OnRemoteRequestInnerTwelveth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_USER_TEST)] = - &AbilityManagerStub::StartUserTestInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::FINISH_USER_TEST)] = - &AbilityManagerStub::FinishUserTestInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_TOP_ABILITY_TOKEN)] = - &AbilityManagerStub::GetTopAbilityTokenInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CHECK_UI_EXTENSION_IS_FOCUSED)] = - &AbilityManagerStub::CheckUIExtensionIsFocusedInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_FOREGROUND)] = - &AbilityManagerStub::DelegatorDoAbilityForegroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_BACKGROUND)] = - &AbilityManagerStub::DelegatorDoAbilityBackgroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DO_ABILITY_FOREGROUND)] = - &AbilityManagerStub::DoAbilityForegroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DO_ABILITY_BACKGROUND)] = - &AbilityManagerStub::DoAbilityBackgroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_MISSION_ID_BY_ABILITY_TOKEN)] = - &AbilityManagerStub::GetMissionIdByTokenInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_TOP_ABILITY)] = - &AbilityManagerStub::GetTopAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_ELEMENT_NAME_BY_TOKEN)] = - &AbilityManagerStub::GetElementNameByTokenInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::DUMP_ABILITY_INFO_DONE)] = - &AbilityManagerStub::DumpAbilityInfoDoneInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_EXTENSION_ABILITY)] = - &AbilityManagerStub::StartExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::STOP_EXTENSION_ABILITY)] = - &AbilityManagerStub::StopExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UPDATE_MISSION_SNAPSHOT_FROM_WMS)] = - &AbilityManagerStub::UpdateMissionSnapShotFromWMSInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_CONNECTION_OBSERVER)] = - &AbilityManagerStub::RegisterConnectionObserverInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_CONNECTION_OBSERVER)] = - &AbilityManagerStub::UnregisterConnectionObserverInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_DLP_CONNECTION_INFOS)] = - &AbilityManagerStub::GetDlpConnectionInfosInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_ABILITY_TO_BACKGROUND)] = - &AbilityManagerStub::MoveAbilityToBackgroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MOVE_UI_ABILITY_TO_BACKGROUND)] = - &AbilityManagerStub::MoveUIAbilityToBackgroundInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_MISSION_CONTINUE_STATE)] = - &AbilityManagerStub::SetMissionContinueStateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY_BY_SCB)] = - &AbilityManagerStub::PrepareTerminateAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REQUESET_MODAL_UIEXTENSION)] = - &AbilityManagerStub::RequestModalUIExtensionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_UI_EXTENSION_ROOT_HOST_INFO)] = - &AbilityManagerStub::GetUIExtensionRootHostInfoInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::PRELOAD_UIEXTENSION_ABILITY)] = - &AbilityManagerStub::PreloadUIExtensionAbilityInner; + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::START_USER_TEST) { + return StartUserTestInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::FINISH_USER_TEST) { + return FinishUserTestInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_TOP_ABILITY_TOKEN) { + return GetTopAbilityTokenInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CHECK_UI_EXTENSION_IS_FOCUSED) { + return CheckUIExtensionIsFocusedInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_FOREGROUND) { + return DelegatorDoAbilityForegroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_BACKGROUND) { + return DelegatorDoAbilityBackgroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DO_ABILITY_FOREGROUND) { + return DoAbilityForegroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DO_ABILITY_BACKGROUND) { + return DoAbilityBackgroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_ID_BY_ABILITY_TOKEN) { + return GetMissionIdByTokenInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_TOP_ABILITY) { + return GetTopAbilityInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerThirteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::GET_ELEMENT_NAME_BY_TOKEN) { + return GetElementNameByTokenInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::DUMP_ABILITY_INFO_DONE) { + return DumpAbilityInfoDoneInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_EXTENSION_ABILITY) { + return StartExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::STOP_EXTENSION_ABILITY) { + return StopExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UPDATE_MISSION_SNAPSHOT_FROM_WMS) { + return UpdateMissionSnapShotFromWMSInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_CONNECTION_OBSERVER) { + return RegisterConnectionObserverInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_CONNECTION_OBSERVER) { + return UnregisterConnectionObserverInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_DLP_CONNECTION_INFOS) { + return GetDlpConnectionInfosInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_ABILITY_TO_BACKGROUND) { + return MoveAbilityToBackgroundInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MOVE_UI_ABILITY_TO_BACKGROUND) { + return MoveUIAbilityToBackgroundInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerFourteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_CONTINUE_STATE) { + return SetMissionContinueStateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY_BY_SCB) { + return PrepareTerminateAbilityBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REQUESET_MODAL_UIEXTENSION) { + return RequestModalUIExtensionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_UI_EXTENSION_ROOT_HOST_INFO) { + return GetUIExtensionRootHostInfoInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::PRELOAD_UIEXTENSION_ABILITY) { + return PreloadUIExtensionAbilityInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerFifteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); #ifdef SUPPORT_GRAPHICS - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_MISSION_LABEL)] = - &AbilityManagerStub::SetMissionLabelInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_MISSION_ICON)] = - &AbilityManagerStub::SetMissionIconInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_WMS_HANDLER)] = - &AbilityManagerStub::RegisterWindowManagerServiceHandlerInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::COMPLETEFIRSTFRAMEDRAWING)] = - &AbilityManagerStub::CompleteFirstFrameDrawingInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY)] = - &AbilityManagerStub::StartUIExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::MINIMIZE_UI_EXTENSION_ABILITY)] = - &AbilityManagerStub::MinimizeUIExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::TERMINATE_UI_EXTENSION_ABILITY)] = - &AbilityManagerStub::TerminateUIExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CONNECT_UI_EXTENSION_ABILITY)] = - &AbilityManagerStub::ConnectUIExtensionAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY)] = - &AbilityManagerStub::PrepareTerminateAbilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_DIALOG_SESSION_INFO)] = - &AbilityManagerStub::GetDialogSessionInfoInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SEND_DIALOG_RESULT)] = - &AbilityManagerStub::SendDialogResultInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER)] = - &AbilityManagerStub::RegisterAbilityFirstFrameStateObserverInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER)] - = &AbilityManagerStub::UnregisterAbilityFirstFrameStateObserverInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::COMPLETE_FIRST_FRAME_DRAWING_BY_SCB)] = - &AbilityManagerStub::CompleteFirstFrameDrawingBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY_NON_MODAL)] = - &AbilityManagerStub::StartUIExtensionAbilityNonModalInner; + if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_LABEL) { + return SetMissionLabelInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_ICON) { + return SetMissionIconInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_WMS_HANDLER) { + return RegisterWindowManagerServiceHandlerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::COMPLETEFIRSTFRAMEDRAWING) { + return CompleteFirstFrameDrawingInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY) { + return StartUIExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_UI_EXTENSION_ABILITY) { + return MinimizeUIExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_UI_EXTENSION_ABILITY) { + return TerminateUIExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_UI_EXTENSION_ABILITY) { + return ConnectUIExtensionAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY) { + return PrepareTerminateAbilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_DIALOG_SESSION_INFO) { + return GetDialogSessionInfoInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SEND_DIALOG_RESULT) { + return SendDialogResultInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER) { + return RegisterAbilityFirstFrameStateObserverInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER) { + return UnregisterAbilityFirstFrameStateObserverInner(data, reply); + } #endif - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REQUEST_DIALOG_SERVICE)] = - &AbilityManagerStub::HandleRequestDialogService; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REPORT_DRAWN_COMPLETED)] = - &AbilityManagerStub::HandleReportDrawnCompleted; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::QUERY_MISSION_VAILD)] = - &AbilityManagerStub::IsValidMissionIdsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::VERIFY_PERMISSION)] = - &AbilityManagerStub::VerifyPermissionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_UI_ABILITY_BY_SCB)] = - &AbilityManagerStub::StartUIAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_ROOT_SCENE_SESSION)] = - &AbilityManagerStub::SetRootSceneSessionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CALL_ABILITY_BY_SCB)] = - &AbilityManagerStub::CallUIAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_SPECIFIED_ABILITY_BY_SCB)] = - &AbilityManagerStub::StartSpecifiedAbilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::NOTIFY_SAVE_AS_RESULT)] = - &AbilityManagerStub::NotifySaveAsResultInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_SESSIONMANAGERSERVICE)] = - &AbilityManagerStub::SetSessionManagerServiceInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UPDATE_SESSION_INFO)] = - &AbilityManagerStub::UpdateSessionInfoBySCBInner; + return ERR_CODE_NOT_EXIST; } -void AbilityManagerStub::FourthStepInit() +int AbilityManagerStub::OnRemoteRequestInnerSixteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_STATUS_BAR_DELEGATE)] = - &AbilityManagerStub::RegisterStatusBarDelegateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::KILL_PROCESS_WITH_PREPARE_TERMINATE)] = - &AbilityManagerStub::KillProcessWithPrepareTerminateInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REGISTER_AUTO_STARTUP_SYSTEM_CALLBACK)] = - &AbilityManagerStub::RegisterAutoStartupSystemCallbackInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::UNREGISTER_AUTO_STARTUP_SYSTEM_CALLBACK)] = - &AbilityManagerStub::UnregisterAutoStartupSystemCallbackInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP)] = - &AbilityManagerStub::SetApplicationAutoStartupInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP)] = - &AbilityManagerStub::CancelApplicationAutoStartupInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::QUERY_ALL_AUTO_STARTUP_APPLICATION)] = - &AbilityManagerStub::QueryAllAutoStartupApplicationsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_CONNECTION_DATA)] = - &AbilityManagerStub::GetConnectionDataInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP_BY_EDM)] = - &AbilityManagerStub::SetApplicationAutoStartupByEDMInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP_BY_EDM)] = - &AbilityManagerStub::CancelApplicationAutoStartupByEDMInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER)] = - &AbilityManagerStub::StartAbilityForResultAsCallerInner; - requestFuncMap_[static_cast( - AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER_FOR_OPTIONS)] = - &AbilityManagerStub::StartAbilityForResultAsCallerForOptionsInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_FOREGROUND_UI_ABILITIES)] = - &AbilityManagerStub::GetForegroundUIAbilitiesInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::RESTART_APP)] = - &AbilityManagerStub::RestartAppInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::OPEN_ATOMIC_SERVICE)] = - &AbilityManagerStub::OpenAtomicServiceInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::IS_EMBEDDED_OPEN_ALLOWED)] = - &AbilityManagerStub::IsEmbeddedOpenAllowedInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::REQUEST_ASSERT_FAULT_DIALOG)] = - &AbilityManagerStub::RequestAssertFaultDialogInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::NOTIFY_DEBUG_ASSERT_RESULT)] = - &AbilityManagerStub::NotifyDebugAssertResultInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CHANGE_ABILITY_VISIBILITY)] = - &AbilityManagerStub::ChangeAbilityVisibilityInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::CHANGE_UI_ABILITY_VISIBILITY_BY_SCB)] = - &AbilityManagerStub::ChangeUIAbilityVisibilityBySCBInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::START_SHORTCUT)] = - &AbilityManagerStub::StartShortcutInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::SET_RESIDENT_PROCESS_ENABLE)] = - &AbilityManagerStub::SetResidentProcessEnableInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::GET_ABILITY_STATE_BY_PERSISTENT_ID)] = - &AbilityManagerStub::GetAbilityStateByPersistentIdInner; + AbilityManagerInterfaceCode interfaceCode = static_cast(code); +#ifdef SUPPORT_GRAPHICS + if (interfaceCode == AbilityManagerInterfaceCode::COMPLETE_FIRST_FRAME_DRAWING_BY_SCB) { + return CompleteFirstFrameDrawingBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY_NON_MODAL) { + return StartUIExtensionAbilityNonModalInner(data, reply); + } +#endif + if (interfaceCode == AbilityManagerInterfaceCode::REQUEST_DIALOG_SERVICE) { + return HandleRequestDialogService(data, reply); + }; + if (interfaceCode == AbilityManagerInterfaceCode::REPORT_DRAWN_COMPLETED) { + return HandleReportDrawnCompleted(data, reply); + }; + if (interfaceCode == AbilityManagerInterfaceCode::QUERY_MISSION_VAILD) { + return IsValidMissionIdsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::VERIFY_PERMISSION) { + return VerifyPermissionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_UI_ABILITY_BY_SCB) { + return StartUIAbilityBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_ROOT_SCENE_SESSION) { + return SetRootSceneSessionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CALL_ABILITY_BY_SCB) { + return CallUIAbilityBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_SPECIFIED_ABILITY_BY_SCB) { + return StartSpecifiedAbilityBySCBInner(data, reply); + } + return ERR_CODE_NOT_EXIST; } -void AbilityManagerStub::FifthStepInit() +int AbilityManagerStub::OnRemoteRequestInnerSeventeenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) { - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::TRANSFER_ABILITY_RESULT)] = - &AbilityManagerStub::TransferAbilityResultForExtensionInner; - requestFuncMap_[static_cast(AbilityManagerInterfaceCode::NOTIFY_FROZEN_PROCESS_BY_RSS)] = - &AbilityManagerStub::NotifyFrozenProcessByRSSInner; + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_SAVE_AS_RESULT) { + return NotifySaveAsResultInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_SESSIONMANAGERSERVICE) { + return SetSessionManagerServiceInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UPDATE_SESSION_INFO) { + return UpdateSessionInfoBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_STATUS_BAR_DELEGATE) { + return RegisterStatusBarDelegateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::KILL_PROCESS_WITH_PREPARE_TERMINATE) { + return KillProcessWithPrepareTerminateInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_AUTO_STARTUP_SYSTEM_CALLBACK) { + return RegisterAutoStartupSystemCallbackInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_AUTO_STARTUP_SYSTEM_CALLBACK) { + return UnregisterAutoStartupSystemCallbackInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP) { + return SetApplicationAutoStartupInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP) { + return CancelApplicationAutoStartupInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::QUERY_ALL_AUTO_STARTUP_APPLICATION) { + return QueryAllAutoStartupApplicationsInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInnerEighteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::GET_CONNECTION_DATA) { + return GetConnectionDataInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP_BY_EDM) { + return SetApplicationAutoStartupByEDMInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP_BY_EDM) { + return CancelApplicationAutoStartupByEDMInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER) { + return StartAbilityForResultAsCallerInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER_FOR_OPTIONS) { + return StartAbilityForResultAsCallerForOptionsInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_FOREGROUND_UI_ABILITIES) { + return GetForegroundUIAbilitiesInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::RESTART_APP) { + return RestartAppInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::OPEN_ATOMIC_SERVICE) { + return OpenAtomicServiceInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::IS_EMBEDDED_OPEN_ALLOWED) { + return IsEmbeddedOpenAllowedInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::REQUEST_ASSERT_FAULT_DIALOG) { + return RequestAssertFaultDialogInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + + +int AbilityManagerStub::OnRemoteRequestInnerNineteenth(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + AbilityManagerInterfaceCode interfaceCode = static_cast(code); + if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_DEBUG_ASSERT_RESULT) { + return NotifyDebugAssertResultInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CHANGE_ABILITY_VISIBILITY) { + return ChangeAbilityVisibilityInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::CHANGE_UI_ABILITY_VISIBILITY_BY_SCB) { + return ChangeUIAbilityVisibilityBySCBInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::START_SHORTCUT) { + return StartShortcutInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::SET_RESIDENT_PROCESS_ENABLE) { + return SetResidentProcessEnableInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_STATE_BY_PERSISTENT_ID) { + return GetAbilityStateByPersistentIdInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::TRANSFER_ABILITY_RESULT) { + return TransferAbilityResultForExtensionInner(data, reply); + } + if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_FROZEN_PROCESS_BY_RSS) { + return NotifyFrozenProcessByRSSInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::OnRemoteRequestInner(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + int retCode = ERR_OK; + retCode = HandleOnRemoteRequestInnerFirst(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = HandleOnRemoteRequestInnerSecond(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + TAG_LOGW(AAFwkTag::ABILITYMGR, "default case, need check."); + return IPCObjectStub::OnRemoteRequest(code, data, reply, option); +} + +int AbilityManagerStub::HandleOnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + int retCode = ERR_OK; + retCode = OnRemoteRequestInnerFirst(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSecond(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerThird(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerFourth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerFifth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSixth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSeventh(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerEighth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerNinth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerTenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + return ERR_CODE_NOT_EXIST; +} + +int AbilityManagerStub::HandleOnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, + MessageParcel &reply, MessageOption &option) +{ + int retCode = ERR_OK; + retCode = OnRemoteRequestInnerEleventh(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerTwelveth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerThirteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerFourteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerFifteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSixteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSeventeenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerEighteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerNineteenth(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + return ERR_CODE_NOT_EXIST; } int AbilityManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) @@ -461,15 +859,7 @@ int AbilityManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Mess return ERR_INVALID_STATE; } - auto itFunc = requestFuncMap_.find(code); - if (itFunc != requestFuncMap_.end()) { - auto requestFunc = itFunc->second; - if (requestFunc != nullptr) { - return (this->*requestFunc)(data, reply); - } - } - TAG_LOGW(AAFwkTag::ABILITYMGR, "default case, need check."); - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); + return OnRemoteRequestInner(code, data, reply, option); } int AbilityManagerStub::GetTopAbilityInner(MessageParcel &data, MessageParcel &reply) diff --git a/services/abilitymgr/src/ability_scheduler_stub.cpp b/services/abilitymgr/src/ability_scheduler_stub.cpp index 4dd6600a28..17d45bbdfa 100644 --- a/services/abilitymgr/src/ability_scheduler_stub.cpp +++ b/services/abilitymgr/src/ability_scheduler_stub.cpp @@ -15,6 +15,7 @@ #include "ability_scheduler_stub.h" +#include "ability_manager_errors.h" #include "abs_shared_result_set.h" #include "data_ability_observer_interface.h" #include "data_ability_operation.h" @@ -33,51 +34,10 @@ namespace OHOS { namespace AAFwk { constexpr int CYCLE_LIMIT = 2000; AbilitySchedulerStub::AbilitySchedulerStub() -{ - requestFuncMap_[SCHEDULE_ABILITY_TRANSACTION] = &AbilitySchedulerStub::AbilityTransactionInner; - requestFuncMap_[SEND_RESULT] = &AbilitySchedulerStub::SendResultInner; - requestFuncMap_[SCHEDULE_ABILITY_CONNECT] = &AbilitySchedulerStub::ConnectAbilityInner; - requestFuncMap_[SCHEDULE_ABILITY_DISCONNECT] = &AbilitySchedulerStub::DisconnectAbilityInner; - requestFuncMap_[SCHEDULE_ABILITY_COMMAND] = &AbilitySchedulerStub::CommandAbilityInner; - requestFuncMap_[SCHEDULE_ABILITY_PREPARE_TERMINATE] = &AbilitySchedulerStub::PrepareTerminateAbilityInner; - requestFuncMap_[SCHEDULE_ABILITY_COMMAND_WINDOW] = &AbilitySchedulerStub::CommandAbilityWindowInner; - requestFuncMap_[SCHEDULE_SAVE_ABILITY_STATE] = &AbilitySchedulerStub::SaveAbilityStateInner; - requestFuncMap_[SCHEDULE_RESTORE_ABILITY_STATE] = &AbilitySchedulerStub::RestoreAbilityStateInner; - requestFuncMap_[SCHEDULE_GETFILETYPES] = &AbilitySchedulerStub::GetFileTypesInner; - requestFuncMap_[SCHEDULE_OPENFILE] = &AbilitySchedulerStub::OpenFileInner; - requestFuncMap_[SCHEDULE_OPENRAWFILE] = &AbilitySchedulerStub::OpenRawFileInner; - requestFuncMap_[SCHEDULE_INSERT] = &AbilitySchedulerStub::InsertInner; - requestFuncMap_[SCHEDULE_UPDATE] = &AbilitySchedulerStub::UpdatetInner; - requestFuncMap_[SCHEDULE_DELETE] = &AbilitySchedulerStub::DeleteInner; - requestFuncMap_[SCHEDULE_QUERY] = &AbilitySchedulerStub::QueryInner; - requestFuncMap_[SCHEDULE_CALL] = &AbilitySchedulerStub::CallInner; - requestFuncMap_[SCHEDULE_GETTYPE] = &AbilitySchedulerStub::GetTypeInner; - requestFuncMap_[SCHEDULE_RELOAD] = &AbilitySchedulerStub::ReloadInner; - requestFuncMap_[SCHEDULE_BATCHINSERT] = &AbilitySchedulerStub::BatchInsertInner; - requestFuncMap_[SCHEDULE_REGISTEROBSERVER] = &AbilitySchedulerStub::RegisterObserverInner; - requestFuncMap_[SCHEDULE_UNREGISTEROBSERVER] = &AbilitySchedulerStub::UnregisterObserverInner; - requestFuncMap_[SCHEDULE_NOTIFYCHANGE] = &AbilitySchedulerStub::NotifyChangeInner; - requestFuncMap_[SCHEDULE_NORMALIZEURI] = &AbilitySchedulerStub::NormalizeUriInner; - requestFuncMap_[SCHEDULE_DENORMALIZEURI] = &AbilitySchedulerStub::DenormalizeUriInner; - requestFuncMap_[SCHEDULE_EXECUTEBATCH] = &AbilitySchedulerStub::ExecuteBatchInner; - requestFuncMap_[NOTIFY_CONTINUATION_RESULT] = &AbilitySchedulerStub::NotifyContinuationResultInner; - requestFuncMap_[REQUEST_CALL_REMOTE] = &AbilitySchedulerStub::CallRequestInner; - requestFuncMap_[CONTINUE_ABILITY] = &AbilitySchedulerStub::ContinueAbilityInner; - requestFuncMap_[DUMP_ABILITY_RUNNER_INNER] = &AbilitySchedulerStub::DumpAbilityInfoInner; - requestFuncMap_[SCHEDULE_SHARE_DATA] = &AbilitySchedulerStub::ShareDataInner; - requestFuncMap_[SCHEDULE_ONEXECUTE_INTENT] = &AbilitySchedulerStub::OnExecuteIntentInner; - requestFuncMap_[CREATE_MODAL_UI_EXTENSION] = &AbilitySchedulerStub::CreateModalUIExtensionInner; - requestFuncMap_[UPDATE_SESSION_TOKEN] = &AbilitySchedulerStub::UpdateSessionTokenInner; - -#ifdef ABILITY_COMMAND_FOR_TEST - requestFuncMap_[BLOCK_ABILITY_INNER] = &AbilitySchedulerStub::BlockAbilityInner; -#endif -} +{} AbilitySchedulerStub::~AbilitySchedulerStub() -{ - requestFuncMap_.clear(); -} +{} int AbilitySchedulerStub::OnRemoteRequest( uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) @@ -88,18 +48,125 @@ int AbilitySchedulerStub::OnRemoteRequest( TAG_LOGE(AAFwkTag::ABILITYMGR, "local descriptor is not equal to remote"); return ERR_INVALID_STATE; } + return OnRemoteRequestInner(code, data, reply, option); +} - auto itFunc = requestFuncMap_.find(code); - if (itFunc != requestFuncMap_.end()) { - auto requestFunc = itFunc->second; - if (requestFunc != nullptr) { - return (this->*requestFunc)(data, reply); - } +int AbilitySchedulerStub::OnRemoteRequestInner( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) +{ + int retCode = ERR_OK; + retCode = OnRemoteRequestInnerFirst(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerSecond(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; + } + retCode = OnRemoteRequestInnerThird(code, data, reply, option); + if (retCode != ERR_CODE_NOT_EXIST) { + return retCode; } TAG_LOGW(AAFwkTag::ABILITYMGR, "AbilitySchedulerStub::OnRemoteRequest, default case, need check."); return IPCObjectStub::OnRemoteRequest(code, data, reply, option); } +int AbilitySchedulerStub::OnRemoteRequestInnerFirst( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) +{ + switch (code) { + case SCHEDULE_ABILITY_TRANSACTION: + return AbilityTransactionInner(data, reply); + case SEND_RESULT: + return SendResultInner(data, reply); + case SCHEDULE_ABILITY_CONNECT: + return ConnectAbilityInner(data, reply); + case SCHEDULE_ABILITY_DISCONNECT: + return DisconnectAbilityInner(data, reply); + case SCHEDULE_ABILITY_COMMAND: + return CommandAbilityInner(data, reply); + case SCHEDULE_ABILITY_PREPARE_TERMINATE: + return PrepareTerminateAbilityInner(data, reply); + case SCHEDULE_ABILITY_COMMAND_WINDOW: + return CommandAbilityWindowInner(data, reply); + case SCHEDULE_SAVE_ABILITY_STATE: + return SaveAbilityStateInner(data, reply); + case SCHEDULE_RESTORE_ABILITY_STATE: + return RestoreAbilityStateInner(data, reply); + case SCHEDULE_GETFILETYPES: + return GetFileTypesInner(data, reply); + case SCHEDULE_OPENFILE: + return OpenFileInner(data, reply); + case SCHEDULE_OPENRAWFILE: + return OpenRawFileInner(data, reply); + case SCHEDULE_INSERT: + return InsertInner(data, reply); + case SCHEDULE_UPDATE: + return UpdatetInner(data, reply); + case SCHEDULE_DELETE: + return DeleteInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilitySchedulerStub::OnRemoteRequestInnerSecond( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) +{ + switch (code) { + case SCHEDULE_QUERY: + return QueryInner(data, reply); + case SCHEDULE_CALL: + return CallInner(data, reply); + case SCHEDULE_GETTYPE: + return GetTypeInner(data, reply); + case SCHEDULE_RELOAD: + return ReloadInner(data, reply); + case SCHEDULE_BATCHINSERT: + return BatchInsertInner(data, reply); + case SCHEDULE_REGISTEROBSERVER: + return RegisterObserverInner(data, reply); + case SCHEDULE_UNREGISTEROBSERVER: + return UnregisterObserverInner(data, reply); + case SCHEDULE_NOTIFYCHANGE: + return NotifyChangeInner(data, reply); + case SCHEDULE_NORMALIZEURI: + return NormalizeUriInner(data, reply); + case SCHEDULE_DENORMALIZEURI: + return DenormalizeUriInner(data, reply); + case SCHEDULE_EXECUTEBATCH: + return ExecuteBatchInner(data, reply); + case NOTIFY_CONTINUATION_RESULT: + return NotifyContinuationResultInner(data, reply); + case REQUEST_CALL_REMOTE: + return CallRequestInner(data, reply); + case CONTINUE_ABILITY: + return ContinueAbilityInner(data, reply); + case DUMP_ABILITY_RUNNER_INNER: + return DumpAbilityInfoInner(data, reply); + } + return ERR_CODE_NOT_EXIST; +} + +int AbilitySchedulerStub::OnRemoteRequestInnerThird( + uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) +{ + switch (code) { + case SCHEDULE_SHARE_DATA: + return ShareDataInner(data, reply); + case SCHEDULE_ONEXECUTE_INTENT: + return OnExecuteIntentInner(data, reply); + case CREATE_MODAL_UI_EXTENSION: + return CreateModalUIExtensionInner(data, reply); + case UPDATE_SESSION_TOKEN: + return UpdateSessionTokenInner(data, reply); +#ifdef ABILITY_COMMAND_FOR_TEST + case BLOCK_ABILITY_INNER: + return BlockAbilityInner(data, reply); +#endif + } + return ERR_CODE_NOT_EXIST; +} + int AbilitySchedulerStub::AbilityTransactionInner(MessageParcel &data, MessageParcel &reply) { std::shared_ptr want(data.ReadParcelable()); diff --git a/services/abilitymgr/src/resident_process_manager.cpp b/services/abilitymgr/src/resident_process_manager.cpp index 3f6b3211c5..e1a039038b 100644 --- a/services/abilitymgr/src/resident_process_manager.cpp +++ b/services/abilitymgr/src/resident_process_manager.cpp @@ -180,8 +180,9 @@ int32_t ResidentProcessManager::SetResidentProcessEnabled( IN_PROCESS_CALL_WITHOUT_RET(appMgrClient->SetKeepAliveEnableState(bundleName, updateEnable)); } - ffrt::submit(std::bind(&ResidentProcessManager::UpdateResidentProcessesStatus, shared_from_this(), bundleName, - localEnable, updateEnable)); + ffrt::submit([self = shared_from_this(), bundleName, localEnable, updateEnable]() { + self->UpdateResidentProcessesStatus(bundleName, localEnable, updateEnable); + }); return ERR_OK; } diff --git a/services/appmgr/include/app_mgr_service.h b/services/appmgr/include/app_mgr_service.h index 1aed994043..b4bdd7eae5 100644 --- a/services/appmgr/include/app_mgr_service.h +++ b/services/appmgr/include/app_mgr_service.h @@ -698,15 +698,6 @@ private: bool GetDumpIpcKeyByOption(const std::string &option, DumpIpcKey &key); - using DumpFuncType = int (AppMgrService::*)(const std::vector& args, std::string& result); - bool GetDumpFunc(const std::string &optionKey, DumpFuncType &func); - - using DumpIpcAllFuncType = int (AppMgrService::*)(std::string& result); - DumpIpcAllFuncType GetDumpIpcAllFuncByKey(uint32_t key); - - using DumpIpcFuncType = int (AppMgrService::*)(const int32_t pid, std::string& result); - DumpIpcFuncType GetDumpIpcFuncByKey(uint32_t key); - DISALLOW_COPY_AND_MOVE(AppMgrService); }; } // namespace AppExecFwk diff --git a/services/appmgr/src/ams_mgr_scheduler.cpp b/services/appmgr/src/ams_mgr_scheduler.cpp index 576b10aeed..709bfa1f4c 100644 --- a/services/appmgr/src/ams_mgr_scheduler.cpp +++ b/services/appmgr/src/ams_mgr_scheduler.cpp @@ -82,9 +82,10 @@ void AmsMgrScheduler::LoadAbility(const sptr &token, const sptrbundleName.c_str(), abilityInfo->name.c_str()); - std::function loadAbilityFunc = - std::bind(&AppMgrServiceInner::LoadAbility, amsMgrServiceInner_, token, preToken, abilityInfo, - appInfo, want, abilityRecordId); + std::function loadAbilityFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, preToken, + abilityInfo, appInfo, want, abilityRecordId]() { + amsMgrServiceInner->LoadAbility(token, preToken, abilityInfo, appInfo, want, abilityRecordId); + }; // cache other application load ability task before scene board attach if (!amsMgrServiceInner_->GetSceneBoardAttachFlag() && abilityInfo->bundleName != SCENE_BOARD_BUNDLE_NAME) { @@ -117,8 +118,9 @@ void AmsMgrScheduler::UpdateAbilityState(const sptr &token, const TAG_LOGE(AAFwkTag::APPMGR, "Permission verification failed."); return; } - std::function updateAbilityStateFunc = - std::bind(&AppMgrServiceInner::UpdateAbilityState, amsMgrServiceInner_, token, state); + std::function updateAbilityStateFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, state] () { + amsMgrServiceInner->UpdateAbilityState(token, state); + }; amsHandler_->SubmitTask(updateAbilityStateFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_UPDATE_ABILITY_STATE, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -135,8 +137,9 @@ void AmsMgrScheduler::UpdateExtensionState(const sptr &token, con TAG_LOGE(AAFwkTag::APPMGR, "Permission verification failed."); return; } - std::function updateExtensionStateFunc = - std::bind(&AppMgrServiceInner::UpdateExtensionState, amsMgrServiceInner_, token, state); + std::function updateExtensionStateFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, state]() { + amsMgrServiceInner->UpdateExtensionState(token, state); + }; amsHandler_->SubmitTask(updateExtensionStateFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_UPDATE_EXTENSION_STATE, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -153,8 +156,9 @@ void AmsMgrScheduler::TerminateAbility(const sptr &token, bool cl TAG_LOGE(AAFwkTag::APPMGR, "Permission verification failed."); return; } - std::function terminateAbilityFunc = - std::bind(&AppMgrServiceInner::TerminateAbility, amsMgrServiceInner_, token, clearMissionFlag); + std::function terminateAbilityFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, clearMissionFlag]() { + amsMgrServiceInner->TerminateAbility(token, clearMissionFlag); + }; amsHandler_->SubmitTask(terminateAbilityFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_TERMINATE_ABILITY, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -166,8 +170,9 @@ void AmsMgrScheduler::RegisterAppStateCallback(const sptr &ca if (!IsReady()) { return; } - std::function registerAppStateCallbackFunc = - std::bind(&AppMgrServiceInner::RegisterAppStateCallback, amsMgrServiceInner_, callback); + std::function registerAppStateCallbackFunc = [amsMgrServiceInner = amsMgrServiceInner_, callback]() { + amsMgrServiceInner->RegisterAppStateCallback(callback); + }; amsHandler_->SubmitTask(registerAppStateCallbackFunc, TASK_REGISTER_APP_STATE_CALLBACK); } @@ -182,8 +187,11 @@ void AmsMgrScheduler::AbilityBehaviorAnalysis(const sptr &token, TAG_LOGE(AAFwkTag::APPMGR, "Permission verification failed."); return; } - std::function abilityBehaviorAnalysisFunc = std::bind(&AppMgrServiceInner::AbilityBehaviorAnalysis, - amsMgrServiceInner_, token, preToken, visibility, perceptibility, connectionState); + std::function abilityBehaviorAnalysisFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, preToken, + visibility, perceptibility, connectionState]() { + amsMgrServiceInner->AbilityBehaviorAnalysis(token, preToken, + visibility, perceptibility, connectionState); + }; amsHandler_->SubmitTask(abilityBehaviorAnalysisFunc, TASK_ABILITY_BEHAVIOR_ANALYSIS); } @@ -198,8 +206,9 @@ void AmsMgrScheduler::KillProcessByAbilityToken(const sptr &token return; } - std::function killProcessByAbilityTokenFunc = - std::bind(&AppMgrServiceInner::KillProcessByAbilityToken, amsMgrServiceInner_, token); + std::function killProcessByAbilityTokenFunc = [amsMgrServiceInner = amsMgrServiceInner_, token]() { + amsMgrServiceInner->KillProcessByAbilityToken(token); + }; amsHandler_->SubmitTask(killProcessByAbilityTokenFunc, TASK_KILL_PROCESS_BY_ABILITY_TOKEN); } @@ -223,8 +232,9 @@ void AmsMgrScheduler::KillProcessesByUserId(int32_t userId) return; } - std::function killProcessesByUserIdFunc = - std::bind(&AppMgrServiceInner::KillProcessesByUserId, amsMgrServiceInner_, userId); + std::function killProcessesByUserIdFunc = [amsMgrServiceInner = amsMgrServiceInner_, userId]() { + amsMgrServiceInner->KillProcessesByUserId(userId); + }; amsHandler_->SubmitTask(killProcessesByUserIdFunc, TASK_KILL_PROCESSES_BY_USERID); } @@ -241,8 +251,9 @@ void AmsMgrScheduler::KillProcessesByPids(std::vector &pids) return; } - std::function killProcessesByPidsFunc = - std::bind(&AppMgrServiceInner::KillProcessesByPids, amsMgrServiceInner_, pids); + std::function killProcessesByPidsFunc = [amsMgrServiceInner = amsMgrServiceInner_, &pids]() { + amsMgrServiceInner->KillProcessesByPids(pids); + }; amsHandler_->SubmitTask(killProcessesByPidsFunc, TASK_KILL_PROCESSES_BY_PIDS); } @@ -259,8 +270,9 @@ void AmsMgrScheduler::AttachPidToParent(const sptr &token, const return; } - std::function attachPidToParentFunc = - std::bind(&AppMgrServiceInner::AttachPidToParent, amsMgrServiceInner_, token, callerToken); + std::function attachPidToParentFunc = [amsMgrServiceInner = amsMgrServiceInner_, token, callerToken]() { + amsMgrServiceInner->AttachPidToParent(token, callerToken); + }; amsHandler_->SubmitTask(attachPidToParentFunc, TASK_ATTACH_PID_TO_PARENT); } @@ -286,7 +298,9 @@ void AmsMgrScheduler::AbilityAttachTimeOut(const sptr &token) TAG_LOGE(AAFwkTag::APPMGR, "Permission verification failed."); return; } - auto task = [=]() { amsMgrServiceInner_->HandleAbilityAttachTimeOut(token); }; + auto task = [amsMgrServiceInner = amsMgrServiceInner_, token]() { + amsMgrServiceInner->HandleAbilityAttachTimeOut(token); + }; amsHandler_->SubmitTask(task); } @@ -567,8 +581,9 @@ void AmsMgrScheduler::ClearProcessByToken(sptr token) return; } - std::function clearProcessByTokenFunc = - std::bind(&AppMgrServiceInner::ClearProcessByToken, amsMgrServiceInner_, token); + std::function clearProcessByTokenFunc = [amsMgrServiceInner = amsMgrServiceInner_, token]() { + amsMgrServiceInner->ClearProcessByToken(token); + }; amsHandler_->SubmitTask(clearProcessByTokenFunc, TASK_CLEAR_PROCESS_BY_ABILITY_TOKEN); } diff --git a/services/appmgr/src/app_death_recipient.cpp b/services/appmgr/src/app_death_recipient.cpp index 6ec85d22be..30d389961e 100644 --- a/services/appmgr/src/app_death_recipient.cpp +++ b/services/appmgr/src/app_death_recipient.cpp @@ -41,8 +41,11 @@ void AppDeathRecipient::OnRemoteDied(const wptr &remote) return; } - auto onRemoteDiedFunc = std::bind(&AppMgrServiceInner::OnRemoteDied, serviceInner, remote, isRenderProcess_, - isChildProcess_); + auto onRemoteDiedFunc = [serviceInner, remote, + isRenderProcess = isRenderProcess_, + isChildProcess = isChildProcess_]() { + serviceInner->OnRemoteDied(remote, isRenderProcess, isChildProcess); + }; handler->SubmitTask(onRemoteDiedFunc, TASK_ON_REMOTE_DIED); } diff --git a/services/appmgr/src/app_mgr_service.cpp b/services/appmgr/src/app_mgr_service.cpp index bff60162d5..1153dcc654 100644 --- a/services/appmgr/src/app_mgr_service.cpp +++ b/services/appmgr/src/app_mgr_service.cpp @@ -154,8 +154,9 @@ ErrCode AppMgrService::Init() appMgrServiceInner_->SetTaskHandler(taskHandler_); appMgrServiceInner_->SetEventHandler(eventHandler_); DelayedSingleton::GetInstance()->SetAppMgr(appMgrServiceInner_); - std::function initAppMgrServiceInnerTask = - std::bind(&AppMgrServiceInner::Init, appMgrServiceInner_); + std::function initAppMgrServiceInnerTask = [appMgrServiceInner = appMgrServiceInner_]() { + appMgrServiceInner->Init(); + }; taskHandler_->SubmitTask(initAppMgrServiceInnerTask, TASK_INIT_APPMGRSERVICEINNER); ErrCode openErr = appMgrServiceInner_->OpenAppSpawnConnection(); @@ -184,8 +185,9 @@ void AppMgrService::AttachApplication(const sptr &app) } pid_t pid = IPCSkeleton::GetCallingPid(); - std::function attachApplicationFunc = - std::bind(&AppMgrServiceInner::AttachApplication, appMgrServiceInner_, pid, iface_cast(app)); + std::function attachApplicationFunc = [appMgrServiceInner = appMgrServiceInner_, pid, app]() { + appMgrServiceInner->AttachApplication(pid, iface_cast(app)); + }; taskHandler_->SubmitTask(attachApplicationFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_ATTACH_APPLICATION, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -211,8 +213,9 @@ void AppMgrService::ApplicationForegrounded(const int32_t recordId) if (!JudgeAppSelfCalled(recordId)) { return; } - std::function applicationForegroundedFunc = - std::bind(&AppMgrServiceInner::ApplicationForegrounded, appMgrServiceInner_, recordId); + std::function applicationForegroundedFunc = [appMgrServiceInner = appMgrServiceInner_, recordId]() { + appMgrServiceInner->ApplicationForegrounded(recordId); + }; taskHandler_->SubmitTask(applicationForegroundedFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_APPLICATION_FOREGROUNDED, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -228,8 +231,9 @@ void AppMgrService::ApplicationBackgrounded(const int32_t recordId) return; } taskHandler_->CancelTask("appbackground_" + std::to_string(recordId)); - std::function applicationBackgroundedFunc = - std::bind(&AppMgrServiceInner::ApplicationBackgrounded, appMgrServiceInner_, recordId); + std::function applicationBackgroundedFunc = [appMgrServiceInner = appMgrServiceInner_, recordId]() { + appMgrServiceInner->ApplicationBackgrounded(recordId); + }; taskHandler_->SubmitTask(applicationBackgroundedFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_APPLICATION_BACKGROUNDED, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -244,8 +248,9 @@ void AppMgrService::ApplicationTerminated(const int32_t recordId) if (!JudgeAppSelfCalled(recordId)) { return; } - std::function applicationTerminatedFunc = - std::bind(&AppMgrServiceInner::ApplicationTerminated, appMgrServiceInner_, recordId); + std::function applicationTerminatedFunc = [appMgrServiceInner = appMgrServiceInner_, recordId]() { + appMgrServiceInner->ApplicationTerminated(recordId); + }; taskHandler_->SubmitTask(applicationTerminatedFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_APPLICATION_TERMINATED, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -265,8 +270,9 @@ void AppMgrService::AbilityCleaned(const sptr &token) return; } - std::function abilityCleanedFunc = - std::bind(&AppMgrServiceInner::AbilityTerminated, appMgrServiceInner_, token); + std::function abilityCleanedFunc = [appMgrServiceInner = appMgrServiceInner_, token]() { + appMgrServiceInner->AbilityTerminated(token); + }; taskHandler_->SubmitTask(abilityCleanedFunc, AAFwk::TaskAttribute{ .taskName_ = TASK_ABILITY_CLEANED, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -295,8 +301,9 @@ void AppMgrService::StartupResidentProcess(const std::vector startupResidentProcess = - std::bind(&AppMgrServiceInner::LoadResidentProcess, appMgrServiceInner_, bundleInfos); + std::function startupResidentProcess = [appMgrServiceInner = appMgrServiceInner_, bundleInfos]() { + appMgrServiceInner->LoadResidentProcess(bundleInfos); + }; taskHandler_->SubmitTask(startupResidentProcess, AAFwk::TaskAttribute{ .taskName_ = TASK_STARTUP_RESIDENT_PROCESS, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -482,8 +489,9 @@ void AppMgrService::AddAbilityStageDone(const int32_t recordId) if (!JudgeAppSelfCalled(recordId)) { return; } - std::function addAbilityStageDone = - std::bind(&AppMgrServiceInner::AddAbilityStageDone, appMgrServiceInner_, recordId); + std::function addAbilityStageDone = [appMgrServiceInner = appMgrServiceInner_, recordId]() { + appMgrServiceInner->AddAbilityStageDone(recordId); + }; taskHandler_->SubmitTask(addAbilityStageDone, AAFwk::TaskAttribute{ .taskName_ = TASK_ADD_ABILITY_STAGE_DONE, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -553,8 +561,10 @@ int AppMgrService::StartUserTestProcess(const AAFwk::Want &want, const sptr startUserTestProcessFunc = - std::bind(&AppMgrServiceInner::StartUserTestProcess, appMgrServiceInner_, want, observer, bundleInfo, userId); + std::function startUserTestProcessFunc = [appMgrServiceInner = appMgrServiceInner_, + want, observer, bundleInfo, userId]() { + appMgrServiceInner->StartUserTestProcess(want, observer, bundleInfo, userId); + }; taskHandler_->SubmitTask(startUserTestProcessFunc, TASK_START_USER_TEST_PROCESS); return ERR_OK; } @@ -589,8 +599,10 @@ int AppMgrService::FinishUserTest(const std::string &msg, const int64_t &resultC return ERR_INVALID_OPERATION; } pid_t callingPid = IPCSkeleton::GetCallingPid(); - std::function finishUserTestProcessFunc = - std::bind(&AppMgrServiceInner::FinishUserTest, appMgrServiceInner_, msg, resultCode, bundleName, callingPid); + std::function finishUserTestProcessFunc = [appMgrServiceInner = appMgrServiceInner_, msg, + resultCode, bundleName, callingPid]() { + appMgrServiceInner->FinishUserTest(msg, resultCode, bundleName, callingPid); + }; taskHandler_->SubmitTask(finishUserTestProcessFunc, TASK_FINISH_USER_TEST); return ERR_OK; } @@ -613,23 +625,6 @@ int AppMgrService::Dump(int fd, const std::vector& args) return errCode; } -bool AppMgrService::GetDumpFunc(const std::string &optionKey, DumpFuncType &func) -{ - if (optionKey == OPTION_KEY_HELP) { - func = &AppMgrService::ShowHelp; - return true; - } - if (optionKey == OPTION_KEY_DUMP_IPC) { - func = &AppMgrService::DumpIpc; - return true; - } - if (optionKey == OPTION_KEY_DUMP_FFRT) { - func = &AppMgrService::DumpFfrt; - return true; - } - return false; -} - int AppMgrService::Dump(const std::vector& args, std::string& result) { TAG_LOGD(AAFwkTag::APPMGR, "Called."); @@ -639,19 +634,18 @@ int AppMgrService::Dump(const std::vector& args, std::string& re } std::string optionKey = Str16ToStr8(args[0]); - DumpFuncType dumpFunc; - if (!GetDumpFunc(optionKey, dumpFunc)) { - result.append("error: unkown option.\n"); - TAG_LOGE(AAFwkTag::APPMGR, "option key %{public}s does not exist", optionKey.c_str()); - return DumpErrorCode::ERR_UNKNOWN_OPTION_ERROR; + if (optionKey == OPTION_KEY_HELP) { + return ShowHelp(args, result); } - if (dumpFunc == nullptr) { - result.append(MSG_DUMP_FAIL, strlen(MSG_DUMP_FAIL)) - .append(MSG_DUMP_FAIL_REASON_INTERNAL, strlen(MSG_DUMP_FAIL_REASON_INTERNAL)); - TAG_LOGE(AAFwkTag::APPMGR, "dump ffrt function does not exist"); - return DumpErrorCode::ERR_INTERNAL_ERROR; + if (optionKey == OPTION_KEY_DUMP_IPC) { + return DumpIpc(args, result); } - return (this->*dumpFunc)(args, result); + if (optionKey == OPTION_KEY_DUMP_FFRT) { + return DumpFfrt(args, result); + } + result.append("error: unkown option.\n"); + TAG_LOGE(AAFwkTag::APPMGR, "option key %{public}s does not exist", optionKey.c_str()); + return DumpErrorCode::ERR_UNKNOWN_OPTION_ERROR; } int AppMgrService::ShowHelp(const std::vector& args, std::string& result) @@ -665,47 +659,23 @@ int AppMgrService::ShowHelp(const std::vector& args, std::string return ERR_OK; } -AppMgrService::DumpIpcAllFuncType AppMgrService::GetDumpIpcAllFuncByKey(uint32_t key) -{ - if (key == KEY_DUMP_IPC_START) { - return &AppMgrService::DumpIpcAllStart; - } - if (key == KEY_DUMP_IPC_STOP) { - return &AppMgrService::DumpIpcAllStop; - } - if (key == KEY_DUMP_IPC_STAT) { - return &AppMgrService::DumpIpcAllStat; - } - TAG_LOGE(AAFwkTag::APPMGR, "option key %{public}d does not exist", key); - return nullptr; -} - int AppMgrService::DumpIpcAllInner(const AppMgrService::DumpIpcKey key, std::string& result) { TAG_LOGI(AAFwkTag::APPMGR, "Called."); - auto dumpFunc = GetDumpIpcAllFuncByKey(key); - if (dumpFunc == nullptr) { - result.append(MSG_DUMP_FAIL, strlen(MSG_DUMP_FAIL)) - .append(MSG_DUMP_FAIL_REASON_INTERNAL, strlen(MSG_DUMP_FAIL_REASON_INTERNAL)); - TAG_LOGE(AAFwkTag::APPMGR, "dump ipc all function does not exist"); - return DumpErrorCode::ERR_INTERNAL_ERROR; + switch (key) { + case KEY_DUMP_IPC_START: + return DumpIpcAllStart(result); + case KEY_DUMP_IPC_STOP: + return DumpIpcAllStop(result); + case KEY_DUMP_IPC_STAT: + return DumpIpcAllStat(result); + default: { + result.append(MSG_DUMP_FAIL, strlen(MSG_DUMP_FAIL)) + .append(MSG_DUMP_FAIL_REASON_INTERNAL, strlen(MSG_DUMP_FAIL_REASON_INTERNAL)); + TAG_LOGE(AAFwkTag::APPMGR, "dump ipc all function does not exist"); + return DumpErrorCode::ERR_INTERNAL_ERROR; + } } - return (this->*dumpFunc)(result); -} - -AppMgrService::DumpIpcFuncType AppMgrService::GetDumpIpcFuncByKey(uint32_t key) -{ - if (key == KEY_DUMP_IPC_START) { - return &AppMgrService::DumpIpcStart; - } - if (key == KEY_DUMP_IPC_STOP) { - return &AppMgrService::DumpIpcStop; - } - if (key == KEY_DUMP_IPC_STAT) { - return &AppMgrService::DumpIpcStat; - } - TAG_LOGE(AAFwkTag::APPMGR, "option key %{public}d does not exist", key); - return nullptr; } int AppMgrService::DumpIpcWithPidInner(const AppMgrService::DumpIpcKey key, @@ -728,14 +698,21 @@ int AppMgrService::DumpIpcWithPidInner(const AppMgrService::DumpIpcKey key, return DumpErrorCode::ERR_INVALID_PID_ERROR; } - auto dumpFunc = GetDumpIpcFuncByKey(key); - if (dumpFunc == nullptr) { - result.append(MSG_DUMP_FAIL, strlen(MSG_DUMP_FAIL)) - .append(MSG_DUMP_FAIL_REASON_INTERNAL, strlen(MSG_DUMP_FAIL_REASON_INTERNAL)); - TAG_LOGE(AAFwkTag::APPMGR, "dump ipc function does not exist"); - return DumpErrorCode::ERR_INTERNAL_ERROR; + switch (key) { + case KEY_DUMP_IPC_START: + return DumpIpcStart(pid, result); + case KEY_DUMP_IPC_STOP: + return DumpIpcStop(pid, result); + case KEY_DUMP_IPC_STAT: + return DumpIpcStat(pid, result); + default: { + TAG_LOGE(AAFwkTag::APPMGR, "option key %{public}d does not exist", key); + result.append(MSG_DUMP_FAIL, strlen(MSG_DUMP_FAIL)) + .append(MSG_DUMP_FAIL_REASON_INTERNAL, strlen(MSG_DUMP_FAIL_REASON_INTERNAL)); + TAG_LOGE(AAFwkTag::APPMGR, "dump ipc function does not exist"); + return DumpErrorCode::ERR_INTERNAL_ERROR; + } } - return (this->*dumpFunc)(pid, result); } int AppMgrService::DumpFfrtInner(const std::string& pidsRaw, std::string& result) @@ -895,7 +872,9 @@ void AppMgrService::ScheduleAcceptWantDone(const int32_t recordId, const AAFwk:: if (!JudgeAppSelfCalled(recordId)) { return; } - auto task = [=]() { appMgrServiceInner_->ScheduleAcceptWantDone(recordId, want, flag); }; + auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() { + appMgrServiceInner->ScheduleAcceptWantDone(recordId, want, flag); + }; taskHandler_->SubmitTask(task); } @@ -909,7 +888,9 @@ void AppMgrService::ScheduleNewProcessRequestDone(const int32_t recordId, const if (!JudgeAppSelfCalled(recordId)) { return; } - auto task = [=]() { appMgrServiceInner_->ScheduleNewProcessRequestDone(recordId, want, flag); }; + auto task = [appMgrServiceInner = appMgrServiceInner_, recordId, want, flag]() { + appMgrServiceInner->ScheduleNewProcessRequestDone(recordId, want, flag); + }; taskHandler_->SubmitTask(task, AAFwk::TaskQoS::USER_INTERACTIVE); } @@ -959,8 +940,9 @@ void AppMgrService::AttachRenderProcess(const sptr &scheduler) } auto pid = IPCSkeleton::GetCallingPid(); - auto fun = std::bind(&AppMgrServiceInner::AttachRenderProcess, - appMgrServiceInner_, pid, iface_cast(scheduler)); + auto fun = [appMgrServiceInner = appMgrServiceInner_, pid, scheduler]() { + appMgrServiceInner->AttachRenderProcess(pid, iface_cast(scheduler)); + }; taskHandler_->SubmitTask(fun, AAFwk::TaskAttribute{ .taskName_ = TASK_ATTACH_RENDER_PROCESS, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -1370,8 +1352,9 @@ void AppMgrService::AttachChildProcess(const sptr &childScheduler return; } pid_t pid = IPCSkeleton::GetCallingPid(); - std::function task = std::bind(&AppMgrServiceInner::AttachChildProcess, - appMgrServiceInner_, pid, iface_cast(childScheduler)); + std::function task = [appMgrServiceInner = appMgrServiceInner_, pid, childScheduler]() { + appMgrServiceInner->AttachChildProcess(pid, iface_cast(childScheduler)); + }; taskHandler_->SubmitTask(task, AAFwk::TaskAttribute{ .taskName_ = TASK_ATTACH_CHILD_PROCESS, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE @@ -1389,8 +1372,9 @@ void AppMgrService::ExitChildProcessSafely() return; } pid_t pid = IPCSkeleton::GetCallingPid(); - std::function task = std::bind(&AppMgrServiceInner::ExitChildProcessSafelyByChildPid, - appMgrServiceInner_, pid); + std::function task = [appMgrServiceInner = appMgrServiceInner_, pid]() { + appMgrServiceInner->ExitChildProcessSafelyByChildPid(pid); + }; taskHandler_->SubmitTask(task, AAFwk::TaskAttribute{ .taskName_ = TASK_EXIT_CHILD_PROCESS_SAFELY, .taskQos_ = AAFwk::TaskQoS::USER_INTERACTIVE diff --git a/services/appmgr/src/app_mgr_service_inner.cpp b/services/appmgr/src/app_mgr_service_inner.cpp index aa781a9abf..7a1ae95894 100644 --- a/services/appmgr/src/app_mgr_service_inner.cpp +++ b/services/appmgr/src/app_mgr_service_inner.cpp @@ -5291,19 +5291,19 @@ int32_t AppMgrServiceInner::NotifyAppFaultBySA(const AppFaultDataBySA &faultData if (!AppExecFwk::AppfreezeManager::GetInstance()->IsHandleAppfreeze(bundleName) || record->IsDebugging()) { return ERR_OK; } - auto timeoutNotifyApp = std::bind(&AppMgrServiceInner::TimeoutNotifyApp, this, - pid, uid, bundleName, transformedFaultData); + auto timeoutNotifyApp = [this, pid, uid, bundleName, transformedFaultData]() { + this->TimeoutNotifyApp(pid, uid, bundleName, transformedFaultData); + }; taskHandler_->SubmitTask(timeoutNotifyApp, transformedFaultData.timeoutMarkers, timeout); } record->NotifyAppFault(transformedFaultData); TAG_LOGW(AAFwkTag::APPMGR, "FaultDataBySA is: name: %{public}s, faultType: %{public}s, uid: %{public}d," "pid: %{public}d, bundleName: %{public}s", faultData.errorObject.name.c_str(), FaultTypeToString(faultData.faultType).c_str(), uid, pid, bundleName.c_str()); - } else { - TAG_LOGD(AAFwkTag::APPMGR, "this is not called by SA."); - return AAFwk::CHECK_PERMISSION_FAILED; + return ERR_OK; } - return ERR_OK; + TAG_LOGD(AAFwkTag::APPMGR, "this is not called by SA."); + return AAFwk::CHECK_PERMISSION_FAILED; } FaultData AppMgrServiceInner::ConvertDataTypes(const AppFaultDataBySA &faultData) diff --git a/test/fuzztest/abilitymanagerservicesecond_fuzzer/abilitymanagerservicesecond_fuzzer.cpp b/test/fuzztest/abilitymanagerservicesecond_fuzzer/abilitymanagerservicesecond_fuzzer.cpp index 813ae23e27..a5d978d454 100755 --- a/test/fuzztest/abilitymanagerservicesecond_fuzzer/abilitymanagerservicesecond_fuzzer.cpp +++ b/test/fuzztest/abilitymanagerservicesecond_fuzzer/abilitymanagerservicesecond_fuzzer.cpp @@ -115,8 +115,6 @@ bool DoSomethingInterestingWithMyAPI(const char* data, size_t size) sptr dataAbilityScheduler; abilityms->ReleaseDataAbility(dataAbilityScheduler, token); abilityms->AttachAbilityThread(dataAbilityScheduler, token); - abilityms->DumpFuncInit(); - abilityms->DumpSysFuncInit(); std::vector info; abilityms->DumpSysInner(stringParam, info, boolParam, boolParam, intParam); abilityms->DumpSysMissionListInner(stringParam, info, boolParam, boolParam, intParam); diff --git a/test/moduletest/ability_manager_service_dump_test/ability_manager_service_dump_test.cpp b/test/moduletest/ability_manager_service_dump_test/ability_manager_service_dump_test.cpp index a036b86cdf..0a40f909e4 100644 --- a/test/moduletest/ability_manager_service_dump_test/ability_manager_service_dump_test.cpp +++ b/test/moduletest/ability_manager_service_dump_test/ability_manager_service_dump_test.cpp @@ -69,19 +69,6 @@ HWTEST_F(AbilityManagerServiceDumpTest, AbilityManagerService_GetProcessRunningI EXPECT_EQ(result, AppMgrResultCode::RESULT_OK); } -/** - * @tc.name: AbilityManagerService_DumpSysFuncInit_0100 - * @tc.desc: DumpSysFuncInit - * @tc.type: FUNC - * @tc.require: SR000GH1GO - */ -HWTEST_F(AbilityManagerServiceDumpTest, AbilityManagerService_DumpSysFuncInit_0100, TestSize.Level1) -{ - auto abilityMs_ = std::make_shared(); - abilityMs_->DumpSysFuncInit(); - EXPECT_GT(abilityMs_->dumpsysFuncMap_.size(), SIZE_ZERO); -} - /** * @tc.name: AbilityManagerService_DumpSysInner_0100 * @tc.desc: DumpSysInner diff --git a/tools/aa/src/ability_command.cpp b/tools/aa/src/ability_command.cpp index 7ad1a42aff..53bdff6eb4 100644 --- a/tools/aa/src/ability_command.cpp +++ b/tools/aa/src/ability_command.cpp @@ -157,26 +157,26 @@ AbilityManagerShellCommand::AbilityManagerShellCommand(int argc, char* argv[]) : ErrCode AbilityManagerShellCommand::CreateCommandMap() { commandMap_ = { - {"help", std::bind(&AbilityManagerShellCommand::RunAsHelpCommand, this)}, - {"screen", std::bind(&AbilityManagerShellCommand::RunAsScreenCommand, this)}, - {"start", std::bind(&AbilityManagerShellCommand::RunAsStartAbility, this)}, - {"stop-service", std::bind(&AbilityManagerShellCommand::RunAsStopService, this)}, - {"dump", std::bind(&AbilityManagerShellCommand::RunAsDumpsysCommand, this)}, - {"force-stop", std::bind(&AbilityManagerShellCommand::RunAsForceStop, this)}, - {"test", std::bind(&AbilityManagerShellCommand::RunAsTestCommand, this)}, - {"process", std::bind(&AbilityManagerShellCommand::RunAsProcessCommand, this)}, - {"attach", std::bind(&AbilityManagerShellCommand::RunAsAttachDebugCommand, this)}, - {"detach", std::bind(&AbilityManagerShellCommand::RunAsDetachDebugCommand, this)}, - {"appdebug", std::bind(&AbilityManagerShellCommand::RunAsAppDebugDebugCommand, this)}, + {"help", [this]() { return this->RunAsHelpCommand(); }}, + {"screen", [this]() { return this->RunAsScreenCommand(); }}, + {"start", [this]() { return this->RunAsStartAbility(); }}, + {"stop-service", [this]() { return this->RunAsStopService(); }}, + {"dump", [this]() { return this->RunAsDumpsysCommand(); }}, + {"force-stop", [this]() { return this->RunAsForceStop(); }}, + {"test", [this]() { return this->RunAsTestCommand(); }}, + {"process", [this]() { return this->RunAsProcessCommand(); }}, + {"attach", [this]() { return this->RunAsAttachDebugCommand(); }}, + {"detach", [this]() { return this->RunAsDetachDebugCommand(); }}, + {"appdebug", [this]() { return this->RunAsAppDebugDebugCommand(); }}, #ifdef ABILITY_COMMAND_FOR_TEST - {"force-timeout", std::bind(&AbilityManagerShellCommand::RunForceTimeoutForTest, this)}, - {"block-ability", std::bind(&AbilityManagerShellCommand::RunAsBlockAbilityCommand, this)}, - {"block-ams-service", std::bind(&AbilityManagerShellCommand::RunAsBlockAmsServiceCommand, this)}, - {"block-app-service", std::bind(&AbilityManagerShellCommand::RunAsBlockAppServiceCommand, this)}, + {"force-timeout", [this]() { return this->RunForceTimeoutForTest(); }}, + {"block-ability", [this]() { return this->RunAsBlockAbilityCommand(); }}, + {"block-ams-service", [this]() { return this->RunAsBlockAmsServiceCommand(); }}, + {"block-app-service", [this]() { return this->RunAsBlockAppServiceCommand(); }}, #endif #ifdef ABILITY_FAULT_AND_EXIT_TEST - {"forceexitapp", std::bind(&AbilityManagerShellCommand::RunAsForceExitAppCommand, this)}, - {"notifyappfault", std::bind(&AbilityManagerShellCommand::RunAsNotifyAppFaultCommand, this)}, + {"forceexitapp", [this]() { return this->RunAsForceExitAppCommand(); }}, + {"notifyappfault", [this]() { return this->RunAsNotifyAppFaultCommand(); }}, #endif }; diff --git a/tools/aa/src/ability_tool_command.cpp b/tools/aa/src/ability_tool_command.cpp index 521d24ffd5..3b8191cc63 100644 --- a/tools/aa/src/ability_tool_command.cpp +++ b/tools/aa/src/ability_tool_command.cpp @@ -116,11 +116,11 @@ AbilityToolCommand::AbilityToolCommand(int argc, char* argv[]) : ShellCommand(ar ErrCode AbilityToolCommand::CreateCommandMap() { commandMap_ = { - {"help", std::bind(&AbilityToolCommand::RunAsHelpCommand, this)}, - {"start", std::bind(&AbilityToolCommand::RunAsStartAbility, this)}, - {"stop-service", std::bind(&AbilityToolCommand::RunAsStopService, this)}, - {"force-stop", std::bind(&AbilityToolCommand::RunAsForceStop, this)}, - {"test", std::bind(&AbilityToolCommand::RunAsTestCommand, this)}, + {"help", [this]() { return this->RunAsHelpCommand(); }}, + {"start", [this]() { return this->RunAsStartAbility(); }}, + {"stop-service", [this]() { return this->RunAsStopService(); }}, + {"force-stop", [this]() { return this->RunAsForceStop(); }}, + {"test", [this]() { return this->RunAsTestCommand(); }}, }; return OHOS::ERR_OK;