1eace7efcSopenharmony_ci/* 2eace7efcSopenharmony_ci * Copyright (c) 2023-2024 Huawei Device Co., Ltd. 3eace7efcSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4eace7efcSopenharmony_ci * you may not use this file except in compliance with the License. 5eace7efcSopenharmony_ci * You may obtain a copy of the License at 6eace7efcSopenharmony_ci * 7eace7efcSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8eace7efcSopenharmony_ci * 9eace7efcSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10eace7efcSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11eace7efcSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12eace7efcSopenharmony_ci * See the License for the specific language governing permissions and 13eace7efcSopenharmony_ci * limitations under the License. 14eace7efcSopenharmony_ci */ 15eace7efcSopenharmony_ci 16eace7efcSopenharmony_ci#include "ability_manager_stub.h" 17eace7efcSopenharmony_ci 18eace7efcSopenharmony_ci#include "ability_manager_errors.h" 19eace7efcSopenharmony_ci#include "ability_manager_radar.h" 20eace7efcSopenharmony_ci#include "hilog_tag_wrapper.h" 21eace7efcSopenharmony_ci#include "hitrace_meter.h" 22eace7efcSopenharmony_ci#include "status_bar_delegate_interface.h" 23eace7efcSopenharmony_ci#include <iterator> 24eace7efcSopenharmony_ci 25eace7efcSopenharmony_cinamespace OHOS { 26eace7efcSopenharmony_cinamespace AAFwk { 27eace7efcSopenharmony_ciusing AutoStartupInfo = AbilityRuntime::AutoStartupInfo; 28eace7efcSopenharmony_cinamespace { 29eace7efcSopenharmony_ciconst std::u16string extensionDescriptor = u"ohos.aafwk.ExtensionManager"; 30eace7efcSopenharmony_ciconstexpr int32_t CYCLE_LIMIT = 1000; 31eace7efcSopenharmony_ciconstexpr int32_t MAX_KILL_PROCESS_PID_COUNT = 100; 32eace7efcSopenharmony_ciconstexpr int32_t MAX_UPDATE_CONFIG_SIZE = 100; 33eace7efcSopenharmony_ci} // namespace 34eace7efcSopenharmony_ciAbilityManagerStub::AbilityManagerStub() 35eace7efcSopenharmony_ci{} 36eace7efcSopenharmony_ci 37eace7efcSopenharmony_ciAbilityManagerStub::~AbilityManagerStub() 38eace7efcSopenharmony_ci{} 39eace7efcSopenharmony_ci 40eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, 41eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 42eace7efcSopenharmony_ci{ 43eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 44eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_ABILITY) { 45eace7efcSopenharmony_ci return TerminateAbilityInner(data, reply); 46eace7efcSopenharmony_ci } 47eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_ABILITY) { 48eace7efcSopenharmony_ci return MinimizeAbilityInner(data, reply); 49eace7efcSopenharmony_ci } 50eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ATTACH_ABILITY_THREAD) { 51eace7efcSopenharmony_ci return AttachAbilityThreadInner(data, reply); 52eace7efcSopenharmony_ci } 53eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_TRANSITION_DONE) { 54eace7efcSopenharmony_ci return AbilityTransitionDoneInner(data, reply); 55eace7efcSopenharmony_ci } 56eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_WINDOW_CONFIG_TRANSITION_DONE) { 57eace7efcSopenharmony_ci return AbilityWindowConfigTransitionDoneInner(data, reply); 58eace7efcSopenharmony_ci } 59eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY_DONE) { 60eace7efcSopenharmony_ci return ScheduleConnectAbilityDoneInner(data, reply); 61eace7efcSopenharmony_ci } 62eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DISCONNECT_ABILITY_DONE) { 63eace7efcSopenharmony_ci return ScheduleDisconnectAbilityDoneInner(data, reply); 64eace7efcSopenharmony_ci } 65eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::COMMAND_ABILITY_DONE) { 66eace7efcSopenharmony_ci return ScheduleCommandAbilityDoneInner(data, reply); 67eace7efcSopenharmony_ci } 68eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::COMMAND_ABILITY_WINDOW_DONE) { 69eace7efcSopenharmony_ci return ScheduleCommandAbilityWindowDoneInner(data, reply); 70eace7efcSopenharmony_ci } 71eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ACQUIRE_DATA_ABILITY) { 72eace7efcSopenharmony_ci return AcquireDataAbilityInner(data, reply); 73eace7efcSopenharmony_ci } 74eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::RELEASE_DATA_ABILITY) { 75eace7efcSopenharmony_ci return ReleaseDataAbilityInner(data, reply); 76eace7efcSopenharmony_ci } 77eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::BACK_TO_CALLER_UIABILITY) { 78eace7efcSopenharmony_ci return BackToCallerInner(data, reply); 79eace7efcSopenharmony_ci } 80eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 81eace7efcSopenharmony_ci} 82eace7efcSopenharmony_ci 83eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, 84eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 85eace7efcSopenharmony_ci{ 86eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 87eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::KILL_PROCESS) { 88eace7efcSopenharmony_ci return KillProcessInner(data, reply); 89eace7efcSopenharmony_ci } 90eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNINSTALL_APP) { 91eace7efcSopenharmony_ci return UninstallAppInner(data, reply); 92eace7efcSopenharmony_ci } 93eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UPGRADE_APP) { 94eace7efcSopenharmony_ci return UpgradeAppInner(data, reply); 95eace7efcSopenharmony_ci } 96eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY) { 97eace7efcSopenharmony_ci return StartAbilityInner(data, reply); 98eace7efcSopenharmony_ci } 99eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_ADD_CALLER) { 100eace7efcSopenharmony_ci return StartAbilityAddCallerInner(data, reply); 101eace7efcSopenharmony_ci } 102eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_WITH_SPECIFY_TOKENID) { 103eace7efcSopenharmony_ci return StartAbilityInnerSpecifyTokenId(data, reply); 104eace7efcSopenharmony_ci } 105eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_BY_TOKEN) { 106eace7efcSopenharmony_ci return StartAbilityAsCallerByTokenInner(data, reply); 107eace7efcSopenharmony_ci } 108eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_AS_CALLER_FOR_OPTIONS) { 109eace7efcSopenharmony_ci return StartAbilityAsCallerForOptionInner(data, reply); 110eace7efcSopenharmony_ci } 111eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_ADD_CALLER) { 112eace7efcSopenharmony_ci return StartAbilityByUIContentSessionAddCallerInner(data, reply); 113eace7efcSopenharmony_ci } 114eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_SESSION_ABILITY_FOR_OPTIONS) { 115eace7efcSopenharmony_ci return StartAbilityByUIContentSessionForOptionsInner(data, reply); 116eace7efcSopenharmony_ci } 117eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_ONLY_UI_ABILITY) { 118eace7efcSopenharmony_ci return StartAbilityOnlyUIAbilityInner(data, reply); 119eace7efcSopenharmony_ci } 120eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 121eace7efcSopenharmony_ci} 122eace7efcSopenharmony_ci 123eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data, 124eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 125eace7efcSopenharmony_ci{ 126eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 127eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_BY_INSIGHT_INTENT) { 128eace7efcSopenharmony_ci return StartAbilityByInsightIntentInner(data, reply); 129eace7efcSopenharmony_ci } 130eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY) { 131eace7efcSopenharmony_ci return ConnectAbilityInner(data, reply); 132eace7efcSopenharmony_ci } 133eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DISCONNECT_ABILITY) { 134eace7efcSopenharmony_ci return DisconnectAbilityInner(data, reply); 135eace7efcSopenharmony_ci } 136eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::STOP_SERVICE_ABILITY) { 137eace7efcSopenharmony_ci return StopServiceAbilityInner(data, reply); 138eace7efcSopenharmony_ci } 139eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DUMP_STATE) { 140eace7efcSopenharmony_ci return DumpStateInner(data, reply); 141eace7efcSopenharmony_ci } 142eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DUMPSYS_STATE) { 143eace7efcSopenharmony_ci return DumpSysStateInner(data, reply); 144eace7efcSopenharmony_ci } 145eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_SETTINGS) { 146eace7efcSopenharmony_ci return StartAbilityForSettingsInner(data, reply); 147eace7efcSopenharmony_ci } 148eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_MISSION) { 149eace7efcSopenharmony_ci return ContinueMissionInner(data, reply); 150eace7efcSopenharmony_ci } 151eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_MISSION_OF_BUNDLENAME) { 152eace7efcSopenharmony_ci return ContinueMissionOfBundleNameInner(data, reply); 153eace7efcSopenharmony_ci } 154eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONTINUE_ABILITY) { 155eace7efcSopenharmony_ci return ContinueAbilityInner(data, reply); 156eace7efcSopenharmony_ci } 157eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 158eace7efcSopenharmony_ci} 159eace7efcSopenharmony_ci 160eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerFourth(uint32_t code, MessageParcel &data, 161eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 162eace7efcSopenharmony_ci{ 163eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 164eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_CONTINUATION) { 165eace7efcSopenharmony_ci return StartContinuationInner(data, reply); 166eace7efcSopenharmony_ci } 167eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_COMPLETE_CONTINUATION) { 168eace7efcSopenharmony_ci return NotifyCompleteContinuationInner(data, reply); 169eace7efcSopenharmony_ci } 170eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_CONTINUATION_RESULT) { 171eace7efcSopenharmony_ci return NotifyContinuationResultInner(data, reply); 172eace7efcSopenharmony_ci } 173eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SEND_RESULT_TO_ABILITY) { 174eace7efcSopenharmony_ci return SendResultToAbilityInner(data, reply); 175eace7efcSopenharmony_ci } 176eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_MISSION_LISTENER) { 177eace7efcSopenharmony_ci return RegisterRemoteMissionListenerInner(data, reply); 178eace7efcSopenharmony_ci } 179eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_ON_LISTENER) { 180eace7efcSopenharmony_ci return RegisterRemoteOnListenerInner(data, reply); 181eace7efcSopenharmony_ci } 182eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_REMOTE_OFF_LISTENER) { 183eace7efcSopenharmony_ci return RegisterRemoteOffListenerInner(data, reply); 184eace7efcSopenharmony_ci } 185eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_REMOTE_MISSION_LISTENER) { 186eace7efcSopenharmony_ci return UnRegisterRemoteMissionListenerInner(data, reply); 187eace7efcSopenharmony_ci } 188eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_OPTIONS) { 189eace7efcSopenharmony_ci return StartAbilityForOptionsInner(data, reply); 190eace7efcSopenharmony_ci } 191eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_SYNC_MISSIONS) { 192eace7efcSopenharmony_ci return StartSyncRemoteMissionsInner(data, reply); 193eace7efcSopenharmony_ci } 194eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 195eace7efcSopenharmony_ci} 196eace7efcSopenharmony_ci 197eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerFifth(uint32_t code, MessageParcel &data, 198eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 199eace7efcSopenharmony_ci{ 200eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 201eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::STOP_SYNC_MISSIONS) { 202eace7efcSopenharmony_ci return StopSyncRemoteMissionsInner(data, reply); 203eace7efcSopenharmony_ci } 204eace7efcSopenharmony_ci#ifdef ABILITY_COMMAND_FOR_TEST 205eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::FORCE_TIMEOUT) { 206eace7efcSopenharmony_ci return ForceTimeoutForTestInner(data, reply); 207eace7efcSopenharmony_ci } 208eace7efcSopenharmony_ci#endif 209eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::FREE_INSTALL_ABILITY_FROM_REMOTE) { 210eace7efcSopenharmony_ci return FreeInstallAbilityFromRemoteInner(data, reply); 211eace7efcSopenharmony_ci } 212eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ADD_FREE_INSTALL_OBSERVER) { 213eace7efcSopenharmony_ci return AddFreeInstallObserverInner(data, reply); 214eace7efcSopenharmony_ci } 215eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_ABILITY_WITH_TYPE) { 216eace7efcSopenharmony_ci return ConnectAbilityWithTypeInner(data, reply); 217eace7efcSopenharmony_ci } 218eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_RECOVERY) { 219eace7efcSopenharmony_ci return ScheduleRecoverAbilityInner(data, reply); 220eace7efcSopenharmony_ci } 221eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_RECOVERY_ENABLE) { 222eace7efcSopenharmony_ci return EnableRecoverAbilityInner(data, reply); 223eace7efcSopenharmony_ci } 224eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ABILITY_RECOVERY_SUBMITINFO) { 225eace7efcSopenharmony_ci return SubmitSaveRecoveryInfoInner(data, reply); 226eace7efcSopenharmony_ci } 227eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CLEAR_RECOVERY_PAGE_STACK) { 228eace7efcSopenharmony_ci return ScheduleClearRecoveryPageStackInner(data, reply); 229eace7efcSopenharmony_ci } 230eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_UI_ABILITY_BY_SCB) { 231eace7efcSopenharmony_ci return MinimizeUIAbilityBySCBInner(data, reply); 232eace7efcSopenharmony_ci } 233eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CLOSE_UI_ABILITY_BY_SCB) { 234eace7efcSopenharmony_ci return CloseUIAbilityBySCBInner(data, reply); 235eace7efcSopenharmony_ci } 236eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 237eace7efcSopenharmony_ci} 238eace7efcSopenharmony_ci 239eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerSixth(uint32_t code, MessageParcel &data, 240eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 241eace7efcSopenharmony_ci{ 242eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 243eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_COLLABORATOR) { 244eace7efcSopenharmony_ci return RegisterIAbilityManagerCollaboratorInner(data, reply); 245eace7efcSopenharmony_ci } 246eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_COLLABORATOR) { 247eace7efcSopenharmony_ci return UnregisterIAbilityManagerCollaboratorInner(data, reply); 248eace7efcSopenharmony_ci } 249eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_APP_DEBUG_LISTENER) { 250eace7efcSopenharmony_ci return RegisterAppDebugListenerInner(data, reply); 251eace7efcSopenharmony_ci } 252eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_APP_DEBUG_LISTENER) { 253eace7efcSopenharmony_ci return UnregisterAppDebugListenerInner(data, reply); 254eace7efcSopenharmony_ci } 255eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ATTACH_APP_DEBUG) { 256eace7efcSopenharmony_ci return AttachAppDebugInner(data, reply); 257eace7efcSopenharmony_ci } 258eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DETACH_APP_DEBUG) { 259eace7efcSopenharmony_ci return DetachAppDebugInner(data, reply); 260eace7efcSopenharmony_ci } 261eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::IS_ABILITY_CONTROLLER_START) { 262eace7efcSopenharmony_ci return IsAbilityControllerStartInner(data, reply); 263eace7efcSopenharmony_ci } 264eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::EXECUTE_INTENT) { 265eace7efcSopenharmony_ci return ExecuteIntentInner(data, reply); 266eace7efcSopenharmony_ci } 267eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::EXECUTE_INSIGHT_INTENT_DONE) { 268eace7efcSopenharmony_ci return ExecuteInsightIntentDoneInner(data, reply); 269eace7efcSopenharmony_ci } 270eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::OPEN_FILE) { 271eace7efcSopenharmony_ci return OpenFileInner(data, reply); 272eace7efcSopenharmony_ci } 273eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 274eace7efcSopenharmony_ci} 275eace7efcSopenharmony_ci 276eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerSeventh(uint32_t code, MessageParcel &data, 277eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 278eace7efcSopenharmony_ci{ 279eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 280eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER) { 281eace7efcSopenharmony_ci return GetWantSenderInner(data, reply); 282eace7efcSopenharmony_ci } 283eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SEND_PENDING_WANT_SENDER) { 284eace7efcSopenharmony_ci return SendWantSenderInner(data, reply); 285eace7efcSopenharmony_ci } 286eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_PENDING_WANT_SENDER) { 287eace7efcSopenharmony_ci return CancelWantSenderInner(data, reply); 288eace7efcSopenharmony_ci } 289eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_UID) { 290eace7efcSopenharmony_ci return GetPendingWantUidInner(data, reply); 291eace7efcSopenharmony_ci } 292eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_USERID) { 293eace7efcSopenharmony_ci return GetPendingWantUserIdInner(data, reply); 294eace7efcSopenharmony_ci } 295eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_BUNDLENAME) { 296eace7efcSopenharmony_ci return GetPendingWantBundleNameInner(data, reply); 297eace7efcSopenharmony_ci } 298eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_CODE) { 299eace7efcSopenharmony_ci return GetPendingWantCodeInner(data, reply); 300eace7efcSopenharmony_ci } 301eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_TYPE) { 302eace7efcSopenharmony_ci return GetPendingWantTypeInner(data, reply); 303eace7efcSopenharmony_ci } 304eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_CANCEL_LISTENER) { 305eace7efcSopenharmony_ci return RegisterCancelListenerInner(data, reply); 306eace7efcSopenharmony_ci } 307eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_CANCEL_LISTENER) { 308eace7efcSopenharmony_ci return UnregisterCancelListenerInner(data, reply); 309eace7efcSopenharmony_ci } 310eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 311eace7efcSopenharmony_ci} 312eace7efcSopenharmony_ci 313eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerEighth(uint32_t code, MessageParcel &data, 314eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 315eace7efcSopenharmony_ci{ 316eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 317eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_REQUEST_WANT) { 318eace7efcSopenharmony_ci return GetPendingRequestWantInner(data, reply); 319eace7efcSopenharmony_ci } 320eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PENDING_WANT_SENDER_INFO) { 321eace7efcSopenharmony_ci return GetWantSenderInfoInner(data, reply); 322eace7efcSopenharmony_ci } 323eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_APP_MEMORY_SIZE) { 324eace7efcSopenharmony_ci return GetAppMemorySizeInner(data, reply); 325eace7efcSopenharmony_ci } 326eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::IS_RAM_CONSTRAINED_DEVICE) { 327eace7efcSopenharmony_ci return IsRamConstrainedDeviceInner(data, reply); 328eace7efcSopenharmony_ci } 329eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::LOCK_MISSION_FOR_CLEANUP) { 330eace7efcSopenharmony_ci return LockMissionForCleanupInner(data, reply); 331eace7efcSopenharmony_ci } 332eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNLOCK_MISSION_FOR_CLEANUP) { 333eace7efcSopenharmony_ci return UnlockMissionForCleanupInner(data, reply); 334eace7efcSopenharmony_ci } 335eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_SESSION_LOCKED_STATE) { 336eace7efcSopenharmony_ci return SetLockedStateInner(data, reply); 337eace7efcSopenharmony_ci } 338eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_MISSION_LISTENER) { 339eace7efcSopenharmony_ci return RegisterMissionListenerInner(data, reply); 340eace7efcSopenharmony_ci } 341eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_MISSION_LISTENER) { 342eace7efcSopenharmony_ci return UnRegisterMissionListenerInner(data, reply); 343eace7efcSopenharmony_ci } 344eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 345eace7efcSopenharmony_ci} 346eace7efcSopenharmony_ci 347eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerNinth(uint32_t code, MessageParcel &data, 348eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 349eace7efcSopenharmony_ci{ 350eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 351eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_INFOS) { 352eace7efcSopenharmony_ci return GetMissionInfosInner(data, reply); 353eace7efcSopenharmony_ci } 354eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_INFO_BY_ID) { 355eace7efcSopenharmony_ci return GetMissionInfoInner(data, reply); 356eace7efcSopenharmony_ci } 357eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CLEAN_MISSION) { 358eace7efcSopenharmony_ci return CleanMissionInner(data, reply); 359eace7efcSopenharmony_ci } 360eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CLEAN_ALL_MISSIONS) { 361eace7efcSopenharmony_ci return CleanAllMissionsInner(data, reply); 362eace7efcSopenharmony_ci } 363eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT) { 364eace7efcSopenharmony_ci return MoveMissionToFrontInner(data, reply); 365eace7efcSopenharmony_ci } 366eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSION_TO_FRONT_BY_OPTIONS) { 367eace7efcSopenharmony_ci return MoveMissionToFrontByOptionsInner(data, reply); 368eace7efcSopenharmony_ci } 369eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_FOREGROUND) { 370eace7efcSopenharmony_ci return MoveMissionsToForegroundInner(data, reply); 371eace7efcSopenharmony_ci } 372eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_MISSIONS_TO_BACKGROUND) { 373eace7efcSopenharmony_ci return MoveMissionsToBackgroundInner(data, reply); 374eace7efcSopenharmony_ci } 375eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_CALL_ABILITY) { 376eace7efcSopenharmony_ci return StartAbilityByCallInner(data, reply); 377eace7efcSopenharmony_ci } 378eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CALL_REQUEST_DONE) { 379eace7efcSopenharmony_ci return CallRequestDoneInner(data, reply); 380eace7efcSopenharmony_ci } 381eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 382eace7efcSopenharmony_ci} 383eace7efcSopenharmony_ci 384eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerTenth(uint32_t code, MessageParcel &data, 385eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 386eace7efcSopenharmony_ci{ 387eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 388eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::RELEASE_CALL_ABILITY) { 389eace7efcSopenharmony_ci return ReleaseCallInner(data, reply); 390eace7efcSopenharmony_ci } 391eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_USER) { 392eace7efcSopenharmony_ci return StartUserInner(data, reply); 393eace7efcSopenharmony_ci } 394eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::STOP_USER) { 395eace7efcSopenharmony_ci return StopUserInner(data, reply); 396eace7efcSopenharmony_ci } 397eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::LOGOUT_USER) { 398eace7efcSopenharmony_ci return LogoutUserInner(data, reply); 399eace7efcSopenharmony_ci } 400eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_RUNNING_INFO) { 401eace7efcSopenharmony_ci return GetAbilityRunningInfosInner(data, reply); 402eace7efcSopenharmony_ci } 403eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_EXTENSION_RUNNING_INFO) { 404eace7efcSopenharmony_ci return GetExtensionRunningInfosInner(data, reply); 405eace7efcSopenharmony_ci } 406eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_PROCESS_RUNNING_INFO) { 407eace7efcSopenharmony_ci return GetProcessRunningInfosInner(data, reply); 408eace7efcSopenharmony_ci } 409eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_ABILITY_CONTROLLER) { 410eace7efcSopenharmony_ci return SetAbilityControllerInner(data, reply); 411eace7efcSopenharmony_ci } 412eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_SNAPSHOT_INFO) { 413eace7efcSopenharmony_ci return GetMissionSnapshotInfoInner(data, reply); 414eace7efcSopenharmony_ci } 415eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::IS_USER_A_STABILITY_TEST) { 416eace7efcSopenharmony_ci return IsRunningInStabilityTestInner(data, reply); 417eace7efcSopenharmony_ci } 418eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 419eace7efcSopenharmony_ci} 420eace7efcSopenharmony_ci 421eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerEleventh(uint32_t code, MessageParcel &data, 422eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 423eace7efcSopenharmony_ci{ 424eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 425eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::ACQUIRE_SHARE_DATA) { 426eace7efcSopenharmony_ci return AcquireShareDataInner(data, reply); 427eace7efcSopenharmony_ci } 428eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SHARE_DATA_DONE) { 429eace7efcSopenharmony_ci return ShareDataDoneInner(data, reply); 430eace7efcSopenharmony_ci } 431eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_TOKEN) { 432eace7efcSopenharmony_ci return GetAbilityTokenByCalleeObjInner(data, reply); 433eace7efcSopenharmony_ci } 434eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::FORCE_EXIT_APP) { 435eace7efcSopenharmony_ci return ForceExitAppInner(data, reply); 436eace7efcSopenharmony_ci } 437eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::RECORD_APP_EXIT_REASON) { 438eace7efcSopenharmony_ci return RecordAppExitReasonInner(data, reply); 439eace7efcSopenharmony_ci } 440eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::RECORD_PROCESS_EXIT_REASON) { 441eace7efcSopenharmony_ci return RecordProcessExitReasonInner(data, reply); 442eace7efcSopenharmony_ci } 443eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_SESSION_HANDLER) { 444eace7efcSopenharmony_ci return RegisterSessionHandlerInner(data, reply); 445eace7efcSopenharmony_ci } 446eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 447eace7efcSopenharmony_ci} 448eace7efcSopenharmony_ci 449eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerTwelveth(uint32_t code, MessageParcel &data, 450eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 451eace7efcSopenharmony_ci{ 452eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 453eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_USER_TEST) { 454eace7efcSopenharmony_ci return StartUserTestInner(data, reply); 455eace7efcSopenharmony_ci } 456eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::FINISH_USER_TEST) { 457eace7efcSopenharmony_ci return FinishUserTestInner(data, reply); 458eace7efcSopenharmony_ci } 459eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_TOP_ABILITY_TOKEN) { 460eace7efcSopenharmony_ci return GetTopAbilityTokenInner(data, reply); 461eace7efcSopenharmony_ci } 462eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CHECK_UI_EXTENSION_IS_FOCUSED) { 463eace7efcSopenharmony_ci return CheckUIExtensionIsFocusedInner(data, reply); 464eace7efcSopenharmony_ci } 465eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_FOREGROUND) { 466eace7efcSopenharmony_ci return DelegatorDoAbilityForegroundInner(data, reply); 467eace7efcSopenharmony_ci } 468eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DELEGATOR_DO_ABILITY_BACKGROUND) { 469eace7efcSopenharmony_ci return DelegatorDoAbilityBackgroundInner(data, reply); 470eace7efcSopenharmony_ci } 471eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DO_ABILITY_FOREGROUND) { 472eace7efcSopenharmony_ci return DoAbilityForegroundInner(data, reply); 473eace7efcSopenharmony_ci } 474eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DO_ABILITY_BACKGROUND) { 475eace7efcSopenharmony_ci return DoAbilityBackgroundInner(data, reply); 476eace7efcSopenharmony_ci } 477eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_MISSION_ID_BY_ABILITY_TOKEN) { 478eace7efcSopenharmony_ci return GetMissionIdByTokenInner(data, reply); 479eace7efcSopenharmony_ci } 480eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_TOP_ABILITY) { 481eace7efcSopenharmony_ci return GetTopAbilityInner(data, reply); 482eace7efcSopenharmony_ci } 483eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 484eace7efcSopenharmony_ci} 485eace7efcSopenharmony_ci 486eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerThirteenth(uint32_t code, MessageParcel &data, 487eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 488eace7efcSopenharmony_ci{ 489eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 490eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_ELEMENT_NAME_BY_TOKEN) { 491eace7efcSopenharmony_ci return GetElementNameByTokenInner(data, reply); 492eace7efcSopenharmony_ci } 493eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::DUMP_ABILITY_INFO_DONE) { 494eace7efcSopenharmony_ci return DumpAbilityInfoDoneInner(data, reply); 495eace7efcSopenharmony_ci } 496eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_EXTENSION_ABILITY) { 497eace7efcSopenharmony_ci return StartExtensionAbilityInner(data, reply); 498eace7efcSopenharmony_ci } 499eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::STOP_EXTENSION_ABILITY) { 500eace7efcSopenharmony_ci return StopExtensionAbilityInner(data, reply); 501eace7efcSopenharmony_ci } 502eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UPDATE_MISSION_SNAPSHOT_FROM_WMS) { 503eace7efcSopenharmony_ci return UpdateMissionSnapShotFromWMSInner(data, reply); 504eace7efcSopenharmony_ci } 505eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_CONNECTION_OBSERVER) { 506eace7efcSopenharmony_ci return RegisterConnectionObserverInner(data, reply); 507eace7efcSopenharmony_ci } 508eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_CONNECTION_OBSERVER) { 509eace7efcSopenharmony_ci return UnregisterConnectionObserverInner(data, reply); 510eace7efcSopenharmony_ci } 511eace7efcSopenharmony_ci#ifdef WITH_DLP 512eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_DLP_CONNECTION_INFOS) { 513eace7efcSopenharmony_ci return GetDlpConnectionInfosInner(data, reply); 514eace7efcSopenharmony_ci } 515eace7efcSopenharmony_ci#endif // WITH_DLP 516eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_ABILITY_TO_BACKGROUND) { 517eace7efcSopenharmony_ci return MoveAbilityToBackgroundInner(data, reply); 518eace7efcSopenharmony_ci } 519eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MOVE_UI_ABILITY_TO_BACKGROUND) { 520eace7efcSopenharmony_ci return MoveUIAbilityToBackgroundInner(data, reply); 521eace7efcSopenharmony_ci } 522eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 523eace7efcSopenharmony_ci} 524eace7efcSopenharmony_ci 525eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerFourteenth(uint32_t code, MessageParcel &data, 526eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 527eace7efcSopenharmony_ci{ 528eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 529eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_CONTINUE_STATE) { 530eace7efcSopenharmony_ci return SetMissionContinueStateInner(data, reply); 531eace7efcSopenharmony_ci } 532eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY_BY_SCB) { 533eace7efcSopenharmony_ci return PrepareTerminateAbilityBySCBInner(data, reply); 534eace7efcSopenharmony_ci } 535eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REQUESET_MODAL_UIEXTENSION) { 536eace7efcSopenharmony_ci return RequestModalUIExtensionInner(data, reply); 537eace7efcSopenharmony_ci } 538eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_UI_EXTENSION_ROOT_HOST_INFO) { 539eace7efcSopenharmony_ci return GetUIExtensionRootHostInfoInner(data, reply); 540eace7efcSopenharmony_ci } 541eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_UI_EXTENSION_SESSION_INFO) { 542eace7efcSopenharmony_ci return GetUIExtensionSessionInfoInner(data, reply); 543eace7efcSopenharmony_ci } 544eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::PRELOAD_UIEXTENSION_ABILITY) { 545eace7efcSopenharmony_ci return PreloadUIExtensionAbilityInner(data, reply); 546eace7efcSopenharmony_ci } 547eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_UI_SERVICE_EXTENSION_ABILITY) { 548eace7efcSopenharmony_ci return TerminateUIServiceExtensionAbilityInner(data, reply); 549eace7efcSopenharmony_ci } 550eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 551eace7efcSopenharmony_ci} 552eace7efcSopenharmony_ci 553eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerFifteenth(uint32_t code, MessageParcel &data, 554eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 555eace7efcSopenharmony_ci{ 556eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 557eace7efcSopenharmony_ci#ifdef SUPPORT_GRAPHICS 558eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_LABEL) { 559eace7efcSopenharmony_ci return SetMissionLabelInner(data, reply); 560eace7efcSopenharmony_ci } 561eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_MISSION_ICON) { 562eace7efcSopenharmony_ci return SetMissionIconInner(data, reply); 563eace7efcSopenharmony_ci } 564eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_WMS_HANDLER) { 565eace7efcSopenharmony_ci return RegisterWindowManagerServiceHandlerInner(data, reply); 566eace7efcSopenharmony_ci } 567eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::COMPLETEFIRSTFRAMEDRAWING) { 568eace7efcSopenharmony_ci return CompleteFirstFrameDrawingInner(data, reply); 569eace7efcSopenharmony_ci } 570eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY) { 571eace7efcSopenharmony_ci return StartUIExtensionAbilityInner(data, reply); 572eace7efcSopenharmony_ci } 573eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::MINIMIZE_UI_EXTENSION_ABILITY) { 574eace7efcSopenharmony_ci return MinimizeUIExtensionAbilityInner(data, reply); 575eace7efcSopenharmony_ci } 576eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_UI_EXTENSION_ABILITY) { 577eace7efcSopenharmony_ci return TerminateUIExtensionAbilityInner(data, reply); 578eace7efcSopenharmony_ci } 579eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CONNECT_UI_EXTENSION_ABILITY) { 580eace7efcSopenharmony_ci return ConnectUIExtensionAbilityInner(data, reply); 581eace7efcSopenharmony_ci } 582eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::PREPARE_TERMINATE_ABILITY) { 583eace7efcSopenharmony_ci return PrepareTerminateAbilityInner(data, reply); 584eace7efcSopenharmony_ci } 585eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_DIALOG_SESSION_INFO) { 586eace7efcSopenharmony_ci return GetDialogSessionInfoInner(data, reply); 587eace7efcSopenharmony_ci } 588eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SEND_DIALOG_RESULT) { 589eace7efcSopenharmony_ci return SendDialogResultInner(data, reply); 590eace7efcSopenharmony_ci } 591eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER) { 592eace7efcSopenharmony_ci return RegisterAbilityFirstFrameStateObserverInner(data, reply); 593eace7efcSopenharmony_ci } 594eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_ABILITY_FIRST_FRAME_STATE_OBSERVER) { 595eace7efcSopenharmony_ci return UnregisterAbilityFirstFrameStateObserverInner(data, reply); 596eace7efcSopenharmony_ci } 597eace7efcSopenharmony_ci#endif 598eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 599eace7efcSopenharmony_ci} 600eace7efcSopenharmony_ci 601eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerSixteenth(uint32_t code, MessageParcel &data, 602eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 603eace7efcSopenharmony_ci{ 604eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 605eace7efcSopenharmony_ci#ifdef SUPPORT_GRAPHICS 606eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::COMPLETE_FIRST_FRAME_DRAWING_BY_SCB) { 607eace7efcSopenharmony_ci return CompleteFirstFrameDrawingBySCBInner(data, reply); 608eace7efcSopenharmony_ci } 609eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_EXTENSION_ABILITY_EMBEDDED) { 610eace7efcSopenharmony_ci return StartUIExtensionAbilityEmbeddedInner(data, reply); 611eace7efcSopenharmony_ci } 612eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_EXTENSION_CONSTRAINED_EMBEDDED) { 613eace7efcSopenharmony_ci return StartUIExtensionConstrainedEmbeddedInner(data, reply); 614eace7efcSopenharmony_ci } 615eace7efcSopenharmony_ci#endif 616eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REQUEST_DIALOG_SERVICE) { 617eace7efcSopenharmony_ci return HandleRequestDialogService(data, reply); 618eace7efcSopenharmony_ci }; 619eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REPORT_DRAWN_COMPLETED) { 620eace7efcSopenharmony_ci return HandleReportDrawnCompleted(data, reply); 621eace7efcSopenharmony_ci }; 622eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::QUERY_MISSION_VAILD) { 623eace7efcSopenharmony_ci return IsValidMissionIdsInner(data, reply); 624eace7efcSopenharmony_ci } 625eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::VERIFY_PERMISSION) { 626eace7efcSopenharmony_ci return VerifyPermissionInner(data, reply); 627eace7efcSopenharmony_ci } 628eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_UI_ABILITY_BY_SCB) { 629eace7efcSopenharmony_ci return StartUIAbilityBySCBInner(data, reply); 630eace7efcSopenharmony_ci } 631eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_ROOT_SCENE_SESSION) { 632eace7efcSopenharmony_ci return SetRootSceneSessionInner(data, reply); 633eace7efcSopenharmony_ci } 634eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CALL_ABILITY_BY_SCB) { 635eace7efcSopenharmony_ci return CallUIAbilityBySCBInner(data, reply); 636eace7efcSopenharmony_ci } 637eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_SPECIFIED_ABILITY_BY_SCB) { 638eace7efcSopenharmony_ci return StartSpecifiedAbilityBySCBInner(data, reply); 639eace7efcSopenharmony_ci } 640eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 641eace7efcSopenharmony_ci} 642eace7efcSopenharmony_ci 643eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerSeventeenth(uint32_t code, MessageParcel &data, 644eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 645eace7efcSopenharmony_ci{ 646eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 647eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_SAVE_AS_RESULT) { 648eace7efcSopenharmony_ci return NotifySaveAsResultInner(data, reply); 649eace7efcSopenharmony_ci } 650eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_SESSIONMANAGERSERVICE) { 651eace7efcSopenharmony_ci return SetSessionManagerServiceInner(data, reply); 652eace7efcSopenharmony_ci } 653eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UPDATE_SESSION_INFO) { 654eace7efcSopenharmony_ci return UpdateSessionInfoBySCBInner(data, reply); 655eace7efcSopenharmony_ci } 656eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_STATUS_BAR_DELEGATE) { 657eace7efcSopenharmony_ci return RegisterStatusBarDelegateInner(data, reply); 658eace7efcSopenharmony_ci } 659eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::KILL_PROCESS_WITH_PREPARE_TERMINATE) { 660eace7efcSopenharmony_ci return KillProcessWithPrepareTerminateInner(data, reply); 661eace7efcSopenharmony_ci } 662eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REGISTER_AUTO_STARTUP_SYSTEM_CALLBACK) { 663eace7efcSopenharmony_ci return RegisterAutoStartupSystemCallbackInner(data, reply); 664eace7efcSopenharmony_ci } 665eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UNREGISTER_AUTO_STARTUP_SYSTEM_CALLBACK) { 666eace7efcSopenharmony_ci return UnregisterAutoStartupSystemCallbackInner(data, reply); 667eace7efcSopenharmony_ci } 668eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP) { 669eace7efcSopenharmony_ci return SetApplicationAutoStartupInner(data, reply); 670eace7efcSopenharmony_ci } 671eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP) { 672eace7efcSopenharmony_ci return CancelApplicationAutoStartupInner(data, reply); 673eace7efcSopenharmony_ci } 674eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::QUERY_ALL_AUTO_STARTUP_APPLICATION) { 675eace7efcSopenharmony_ci return QueryAllAutoStartupApplicationsInner(data, reply); 676eace7efcSopenharmony_ci } 677eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 678eace7efcSopenharmony_ci} 679eace7efcSopenharmony_ci 680eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerEighteenth(uint32_t code, MessageParcel &data, 681eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 682eace7efcSopenharmony_ci{ 683eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 684eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_CONNECTION_DATA) { 685eace7efcSopenharmony_ci return GetConnectionDataInner(data, reply); 686eace7efcSopenharmony_ci } 687eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_APPLICATION_AUTO_STARTUP_BY_EDM) { 688eace7efcSopenharmony_ci return SetApplicationAutoStartupByEDMInner(data, reply); 689eace7efcSopenharmony_ci } 690eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CANCEL_APPLICATION_AUTO_STARTUP_BY_EDM) { 691eace7efcSopenharmony_ci return CancelApplicationAutoStartupByEDMInner(data, reply); 692eace7efcSopenharmony_ci } 693eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER) { 694eace7efcSopenharmony_ci return StartAbilityForResultAsCallerInner(data, reply); 695eace7efcSopenharmony_ci } 696eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_ABILITY_FOR_RESULT_AS_CALLER_FOR_OPTIONS) { 697eace7efcSopenharmony_ci return StartAbilityForResultAsCallerForOptionsInner(data, reply); 698eace7efcSopenharmony_ci } 699eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_FOREGROUND_UI_ABILITIES) { 700eace7efcSopenharmony_ci return GetForegroundUIAbilitiesInner(data, reply); 701eace7efcSopenharmony_ci } 702eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::RESTART_APP) { 703eace7efcSopenharmony_ci return RestartAppInner(data, reply); 704eace7efcSopenharmony_ci } 705eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::OPEN_ATOMIC_SERVICE) { 706eace7efcSopenharmony_ci return OpenAtomicServiceInner(data, reply); 707eace7efcSopenharmony_ci } 708eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::IS_EMBEDDED_OPEN_ALLOWED) { 709eace7efcSopenharmony_ci return IsEmbeddedOpenAllowedInner(data, reply); 710eace7efcSopenharmony_ci } 711eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::REQUEST_ASSERT_FAULT_DIALOG) { 712eace7efcSopenharmony_ci return RequestAssertFaultDialogInner(data, reply); 713eace7efcSopenharmony_ci } 714eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 715eace7efcSopenharmony_ci} 716eace7efcSopenharmony_ci 717eace7efcSopenharmony_ci 718eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInnerNineteenth(uint32_t code, MessageParcel &data, 719eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 720eace7efcSopenharmony_ci{ 721eace7efcSopenharmony_ci AbilityManagerInterfaceCode interfaceCode = static_cast<AbilityManagerInterfaceCode>(code); 722eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_DEBUG_ASSERT_RESULT) { 723eace7efcSopenharmony_ci return NotifyDebugAssertResultInner(data, reply); 724eace7efcSopenharmony_ci } 725eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CHANGE_ABILITY_VISIBILITY) { 726eace7efcSopenharmony_ci return ChangeAbilityVisibilityInner(data, reply); 727eace7efcSopenharmony_ci } 728eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CHANGE_UI_ABILITY_VISIBILITY_BY_SCB) { 729eace7efcSopenharmony_ci return ChangeUIAbilityVisibilityBySCBInner(data, reply); 730eace7efcSopenharmony_ci } 731eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::START_SHORTCUT) { 732eace7efcSopenharmony_ci return StartShortcutInner(data, reply); 733eace7efcSopenharmony_ci } 734eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::SET_RESIDENT_PROCESS_ENABLE) { 735eace7efcSopenharmony_ci return SetResidentProcessEnableInner(data, reply); 736eace7efcSopenharmony_ci } 737eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::GET_ABILITY_STATE_BY_PERSISTENT_ID) { 738eace7efcSopenharmony_ci return GetAbilityStateByPersistentIdInner(data, reply); 739eace7efcSopenharmony_ci } 740eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::TRANSFER_ABILITY_RESULT) { 741eace7efcSopenharmony_ci return TransferAbilityResultForExtensionInner(data, reply); 742eace7efcSopenharmony_ci } 743eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::NOTIFY_FROZEN_PROCESS_BY_RSS) { 744eace7efcSopenharmony_ci return NotifyFrozenProcessByRSSInner(data, reply); 745eace7efcSopenharmony_ci } 746eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::PRE_START_MISSION) { 747eace7efcSopenharmony_ci return PreStartMissionInner(data, reply); 748eace7efcSopenharmony_ci } 749eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::CLEAN_UI_ABILITY_BY_SCB) { 750eace7efcSopenharmony_ci return CleanUIAbilityBySCBInner(data, reply); 751eace7efcSopenharmony_ci } 752eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::OPEN_LINK) { 753eace7efcSopenharmony_ci return OpenLinkInner(data, reply); 754eace7efcSopenharmony_ci } 755eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::TERMINATE_MISSION) { 756eace7efcSopenharmony_ci return TerminateMissionInner(data, reply); 757eace7efcSopenharmony_ci } 758eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::BLOCK_ALL_APP_START) { 759eace7efcSopenharmony_ci return BlockAllAppStartInner(data, reply); 760eace7efcSopenharmony_ci } 761eace7efcSopenharmony_ci if (interfaceCode == AbilityManagerInterfaceCode::UPDATE_ASSOCIATE_CONFIG_LIST) { 762eace7efcSopenharmony_ci return UpdateAssociateConfigListInner(data, reply); 763eace7efcSopenharmony_ci } 764eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 765eace7efcSopenharmony_ci} 766eace7efcSopenharmony_ci 767eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequestInner(uint32_t code, MessageParcel &data, 768eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 769eace7efcSopenharmony_ci{ 770eace7efcSopenharmony_ci int retCode = ERR_OK; 771eace7efcSopenharmony_ci retCode = HandleOnRemoteRequestInnerFirst(code, data, reply, option); 772eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 773eace7efcSopenharmony_ci return retCode; 774eace7efcSopenharmony_ci } 775eace7efcSopenharmony_ci retCode = HandleOnRemoteRequestInnerSecond(code, data, reply, option); 776eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 777eace7efcSopenharmony_ci return retCode; 778eace7efcSopenharmony_ci } 779eace7efcSopenharmony_ci TAG_LOGW(AAFwkTag::ABILITYMGR, "default case"); 780eace7efcSopenharmony_ci return IPCObjectStub::OnRemoteRequest(code, data, reply, option); 781eace7efcSopenharmony_ci} 782eace7efcSopenharmony_ci 783eace7efcSopenharmony_ciint AbilityManagerStub::HandleOnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data, 784eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 785eace7efcSopenharmony_ci{ 786eace7efcSopenharmony_ci int retCode = ERR_OK; 787eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerFirst(code, data, reply, option); 788eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 789eace7efcSopenharmony_ci return retCode; 790eace7efcSopenharmony_ci } 791eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerSecond(code, data, reply, option); 792eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 793eace7efcSopenharmony_ci return retCode; 794eace7efcSopenharmony_ci } 795eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerThird(code, data, reply, option); 796eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 797eace7efcSopenharmony_ci return retCode; 798eace7efcSopenharmony_ci } 799eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerFourth(code, data, reply, option); 800eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 801eace7efcSopenharmony_ci return retCode; 802eace7efcSopenharmony_ci } 803eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerFifth(code, data, reply, option); 804eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 805eace7efcSopenharmony_ci return retCode; 806eace7efcSopenharmony_ci } 807eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerSixth(code, data, reply, option); 808eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 809eace7efcSopenharmony_ci return retCode; 810eace7efcSopenharmony_ci } 811eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerSeventh(code, data, reply, option); 812eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 813eace7efcSopenharmony_ci return retCode; 814eace7efcSopenharmony_ci } 815eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerEighth(code, data, reply, option); 816eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 817eace7efcSopenharmony_ci return retCode; 818eace7efcSopenharmony_ci } 819eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerNinth(code, data, reply, option); 820eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 821eace7efcSopenharmony_ci return retCode; 822eace7efcSopenharmony_ci } 823eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerTenth(code, data, reply, option); 824eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 825eace7efcSopenharmony_ci return retCode; 826eace7efcSopenharmony_ci } 827eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 828eace7efcSopenharmony_ci} 829eace7efcSopenharmony_ci 830eace7efcSopenharmony_ciint AbilityManagerStub::HandleOnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data, 831eace7efcSopenharmony_ci MessageParcel &reply, MessageOption &option) 832eace7efcSopenharmony_ci{ 833eace7efcSopenharmony_ci int retCode = ERR_OK; 834eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerEleventh(code, data, reply, option); 835eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 836eace7efcSopenharmony_ci return retCode; 837eace7efcSopenharmony_ci } 838eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerTwelveth(code, data, reply, option); 839eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 840eace7efcSopenharmony_ci return retCode; 841eace7efcSopenharmony_ci } 842eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerThirteenth(code, data, reply, option); 843eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 844eace7efcSopenharmony_ci return retCode; 845eace7efcSopenharmony_ci } 846eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerFourteenth(code, data, reply, option); 847eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 848eace7efcSopenharmony_ci return retCode; 849eace7efcSopenharmony_ci } 850eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerFifteenth(code, data, reply, option); 851eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 852eace7efcSopenharmony_ci return retCode; 853eace7efcSopenharmony_ci } 854eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerSixteenth(code, data, reply, option); 855eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 856eace7efcSopenharmony_ci return retCode; 857eace7efcSopenharmony_ci } 858eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerSeventeenth(code, data, reply, option); 859eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 860eace7efcSopenharmony_ci return retCode; 861eace7efcSopenharmony_ci } 862eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerEighteenth(code, data, reply, option); 863eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 864eace7efcSopenharmony_ci return retCode; 865eace7efcSopenharmony_ci } 866eace7efcSopenharmony_ci retCode = OnRemoteRequestInnerNineteenth(code, data, reply, option); 867eace7efcSopenharmony_ci if (retCode != ERR_CODE_NOT_EXIST) { 868eace7efcSopenharmony_ci return retCode; 869eace7efcSopenharmony_ci } 870eace7efcSopenharmony_ci return ERR_CODE_NOT_EXIST; 871eace7efcSopenharmony_ci} 872eace7efcSopenharmony_ci 873eace7efcSopenharmony_ciint AbilityManagerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) 874eace7efcSopenharmony_ci{ 875eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Received code : %{public}d", code); 876eace7efcSopenharmony_ci std::u16string abilityDescriptor = AbilityManagerStub::GetDescriptor(); 877eace7efcSopenharmony_ci std::u16string remoteDescriptor = data.ReadInterfaceToken(); 878eace7efcSopenharmony_ci if (abilityDescriptor != remoteDescriptor && extensionDescriptor != remoteDescriptor) { 879eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "local descriptor unequal to remote"); 880eace7efcSopenharmony_ci return ERR_INVALID_STATE; 881eace7efcSopenharmony_ci } 882eace7efcSopenharmony_ci 883eace7efcSopenharmony_ci return OnRemoteRequestInner(code, data, reply, option); 884eace7efcSopenharmony_ci} 885eace7efcSopenharmony_ci 886eace7efcSopenharmony_ciint AbilityManagerStub::GetTopAbilityInner(MessageParcel &data, MessageParcel &reply) 887eace7efcSopenharmony_ci{ 888eace7efcSopenharmony_ci bool isNeedLocalDeviceId = data.ReadBool(); 889eace7efcSopenharmony_ci AppExecFwk::ElementName result = GetTopAbility(isNeedLocalDeviceId); 890eace7efcSopenharmony_ci if (result.GetDeviceID().empty()) { 891eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "GetTopAbilityInner is nullptr"); 892eace7efcSopenharmony_ci } 893eace7efcSopenharmony_ci reply.WriteParcelable(&result); 894eace7efcSopenharmony_ci return NO_ERROR; 895eace7efcSopenharmony_ci} 896eace7efcSopenharmony_ci 897eace7efcSopenharmony_ciint AbilityManagerStub::GetElementNameByTokenInner(MessageParcel &data, MessageParcel &reply) 898eace7efcSopenharmony_ci{ 899eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 900eace7efcSopenharmony_ci bool isNeedLocalDeviceId = data.ReadBool(); 901eace7efcSopenharmony_ci AppExecFwk::ElementName result = GetElementNameByToken(token, isNeedLocalDeviceId); 902eace7efcSopenharmony_ci if (result.GetDeviceID().empty()) { 903eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "GetElementNameByTokenInner is nullptr"); 904eace7efcSopenharmony_ci } 905eace7efcSopenharmony_ci reply.WriteParcelable(&result); 906eace7efcSopenharmony_ci return NO_ERROR; 907eace7efcSopenharmony_ci} 908eace7efcSopenharmony_ci 909eace7efcSopenharmony_ciint AbilityManagerStub::MoveAbilityToBackgroundInner(MessageParcel &data, MessageParcel &reply) 910eace7efcSopenharmony_ci{ 911eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 912eace7efcSopenharmony_ci if (data.ReadBool()) { 913eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 914eace7efcSopenharmony_ci } 915eace7efcSopenharmony_ci int32_t result = MoveAbilityToBackground(token); 916eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 917eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed"); 918eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 919eace7efcSopenharmony_ci } 920eace7efcSopenharmony_ci return NO_ERROR; 921eace7efcSopenharmony_ci} 922eace7efcSopenharmony_ci 923eace7efcSopenharmony_ciint32_t AbilityManagerStub::MoveUIAbilityToBackgroundInner(MessageParcel &data, MessageParcel &reply) 924eace7efcSopenharmony_ci{ 925eace7efcSopenharmony_ci const sptr<IRemoteObject> token = data.ReadRemoteObject(); 926eace7efcSopenharmony_ci if (!token) { 927eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "token null"); 928eace7efcSopenharmony_ci return IPC_STUB_ERR; 929eace7efcSopenharmony_ci } 930eace7efcSopenharmony_ci int32_t result = MoveUIAbilityToBackground(token); 931eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 932eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write failed"); 933eace7efcSopenharmony_ci return IPC_STUB_ERR; 934eace7efcSopenharmony_ci } 935eace7efcSopenharmony_ci return NO_ERROR; 936eace7efcSopenharmony_ci} 937eace7efcSopenharmony_ci 938eace7efcSopenharmony_ciint AbilityManagerStub::TerminateAbilityInner(MessageParcel &data, MessageParcel &reply) 939eace7efcSopenharmony_ci{ 940eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 941eace7efcSopenharmony_ci if (data.ReadBool()) { 942eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 943eace7efcSopenharmony_ci } 944eace7efcSopenharmony_ci int resultCode = data.ReadInt32(); 945eace7efcSopenharmony_ci Want *resultWant = data.ReadParcelable<Want>(); 946eace7efcSopenharmony_ci bool flag = data.ReadBool(); 947eace7efcSopenharmony_ci int32_t result; 948eace7efcSopenharmony_ci if (flag) { 949eace7efcSopenharmony_ci result = TerminateAbility(token, resultCode, resultWant); 950eace7efcSopenharmony_ci } else { 951eace7efcSopenharmony_ci result = CloseAbility(token, resultCode, resultWant); 952eace7efcSopenharmony_ci } 953eace7efcSopenharmony_ci reply.WriteInt32(result); 954eace7efcSopenharmony_ci if (resultWant != nullptr) { 955eace7efcSopenharmony_ci delete resultWant; 956eace7efcSopenharmony_ci } 957eace7efcSopenharmony_ci return NO_ERROR; 958eace7efcSopenharmony_ci} 959eace7efcSopenharmony_ci 960eace7efcSopenharmony_ciint AbilityManagerStub::BackToCallerInner(MessageParcel &data, MessageParcel &reply) 961eace7efcSopenharmony_ci{ 962eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 963eace7efcSopenharmony_ci if (data.ReadBool()) { 964eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 965eace7efcSopenharmony_ci } 966eace7efcSopenharmony_ci int resultCode = data.ReadInt32(); 967eace7efcSopenharmony_ci Want *resultWant = data.ReadParcelable<Want>(); 968eace7efcSopenharmony_ci int64_t callerRequestCode = data.ReadInt64(); 969eace7efcSopenharmony_ci int32_t result = BackToCallerAbilityWithResult(token, resultCode, resultWant, callerRequestCode); 970eace7efcSopenharmony_ci reply.WriteInt32(result); 971eace7efcSopenharmony_ci if (resultWant != nullptr) { 972eace7efcSopenharmony_ci delete resultWant; 973eace7efcSopenharmony_ci } 974eace7efcSopenharmony_ci return NO_ERROR; 975eace7efcSopenharmony_ci} 976eace7efcSopenharmony_ci 977eace7efcSopenharmony_ciint32_t AbilityManagerStub::TerminateUIServiceExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 978eace7efcSopenharmony_ci{ 979eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 980eace7efcSopenharmony_ci if (data.ReadBool()) { 981eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 982eace7efcSopenharmony_ci } 983eace7efcSopenharmony_ci 984eace7efcSopenharmony_ci int32_t result = TerminateUIServiceExtensionAbility(token); 985eace7efcSopenharmony_ci reply.WriteInt32(result); 986eace7efcSopenharmony_ci return NO_ERROR; 987eace7efcSopenharmony_ci} 988eace7efcSopenharmony_ci 989eace7efcSopenharmony_ciint AbilityManagerStub::TerminateUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 990eace7efcSopenharmony_ci{ 991eace7efcSopenharmony_ci sptr<SessionInfo> extensionSessionInfo = nullptr; 992eace7efcSopenharmony_ci if (data.ReadBool()) { 993eace7efcSopenharmony_ci extensionSessionInfo = data.ReadParcelable<SessionInfo>(); 994eace7efcSopenharmony_ci } 995eace7efcSopenharmony_ci int resultCode = data.ReadInt32(); 996eace7efcSopenharmony_ci Want *resultWant = data.ReadParcelable<Want>(); 997eace7efcSopenharmony_ci int32_t result = TerminateUIExtensionAbility(extensionSessionInfo, resultCode, resultWant); 998eace7efcSopenharmony_ci reply.WriteInt32(result); 999eace7efcSopenharmony_ci if (resultWant != nullptr) { 1000eace7efcSopenharmony_ci delete resultWant; 1001eace7efcSopenharmony_ci } 1002eace7efcSopenharmony_ci return NO_ERROR; 1003eace7efcSopenharmony_ci} 1004eace7efcSopenharmony_ci 1005eace7efcSopenharmony_ciint AbilityManagerStub::SendResultToAbilityInner(MessageParcel &data, MessageParcel &reply) 1006eace7efcSopenharmony_ci{ 1007eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1008eace7efcSopenharmony_ci int resultCode = data.ReadInt32(); 1009eace7efcSopenharmony_ci Want *resultWant = data.ReadParcelable<Want>(); 1010eace7efcSopenharmony_ci if (resultWant == nullptr) { 1011eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "resultWant null"); 1012eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1013eace7efcSopenharmony_ci } 1014eace7efcSopenharmony_ci int32_t result = SendResultToAbility(requestCode, resultCode, *resultWant); 1015eace7efcSopenharmony_ci reply.WriteInt32(result); 1016eace7efcSopenharmony_ci if (resultWant != nullptr) { 1017eace7efcSopenharmony_ci delete resultWant; 1018eace7efcSopenharmony_ci } 1019eace7efcSopenharmony_ci return NO_ERROR; 1020eace7efcSopenharmony_ci} 1021eace7efcSopenharmony_ci 1022eace7efcSopenharmony_ciint AbilityManagerStub::MinimizeAbilityInner(MessageParcel &data, MessageParcel &reply) 1023eace7efcSopenharmony_ci{ 1024eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1025eace7efcSopenharmony_ci auto fromUser = data.ReadBool(); 1026eace7efcSopenharmony_ci int32_t result = MinimizeAbility(token, fromUser); 1027eace7efcSopenharmony_ci reply.WriteInt32(result); 1028eace7efcSopenharmony_ci return NO_ERROR; 1029eace7efcSopenharmony_ci} 1030eace7efcSopenharmony_ci 1031eace7efcSopenharmony_ciint AbilityManagerStub::MinimizeUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 1032eace7efcSopenharmony_ci{ 1033eace7efcSopenharmony_ci sptr<SessionInfo> extensionSessionInfo = nullptr; 1034eace7efcSopenharmony_ci if (data.ReadBool()) { 1035eace7efcSopenharmony_ci extensionSessionInfo = data.ReadParcelable<SessionInfo>(); 1036eace7efcSopenharmony_ci } 1037eace7efcSopenharmony_ci auto fromUser = data.ReadBool(); 1038eace7efcSopenharmony_ci int32_t result = MinimizeUIExtensionAbility(extensionSessionInfo, fromUser); 1039eace7efcSopenharmony_ci reply.WriteInt32(result); 1040eace7efcSopenharmony_ci return NO_ERROR; 1041eace7efcSopenharmony_ci} 1042eace7efcSopenharmony_ci 1043eace7efcSopenharmony_ciint AbilityManagerStub::MinimizeUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 1044eace7efcSopenharmony_ci{ 1045eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 1046eace7efcSopenharmony_ci if (data.ReadBool()) { 1047eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 1048eace7efcSopenharmony_ci } 1049eace7efcSopenharmony_ci bool fromUser = data.ReadBool(); 1050eace7efcSopenharmony_ci uint32_t sceneFlag = data.ReadUint32(); 1051eace7efcSopenharmony_ci int32_t result = MinimizeUIAbilityBySCB(sessionInfo, fromUser, sceneFlag); 1052eace7efcSopenharmony_ci reply.WriteInt32(result); 1053eace7efcSopenharmony_ci return NO_ERROR; 1054eace7efcSopenharmony_ci} 1055eace7efcSopenharmony_ci 1056eace7efcSopenharmony_ciint AbilityManagerStub::AttachAbilityThreadInner(MessageParcel &data, MessageParcel &reply) 1057eace7efcSopenharmony_ci{ 1058eace7efcSopenharmony_ci auto scheduler = iface_cast<IAbilityScheduler>(data.ReadRemoteObject()); 1059eace7efcSopenharmony_ci if (scheduler == nullptr) { 1060eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "scheduler null"); 1061eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1062eace7efcSopenharmony_ci } 1063eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1064eace7efcSopenharmony_ci int32_t result = AttachAbilityThread(scheduler, token); 1065eace7efcSopenharmony_ci reply.WriteInt32(result); 1066eace7efcSopenharmony_ci return NO_ERROR; 1067eace7efcSopenharmony_ci} 1068eace7efcSopenharmony_ci 1069eace7efcSopenharmony_ciint AbilityManagerStub::AbilityTransitionDoneInner(MessageParcel &data, MessageParcel &reply) 1070eace7efcSopenharmony_ci{ 1071eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1072eace7efcSopenharmony_ci int targetState = data.ReadInt32(); 1073eace7efcSopenharmony_ci std::unique_ptr<PacMap> saveData(data.ReadParcelable<PacMap>()); 1074eace7efcSopenharmony_ci if (!saveData) { 1075eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "saveData null"); 1076eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1077eace7efcSopenharmony_ci } 1078eace7efcSopenharmony_ci int32_t result = AbilityTransitionDone(token, targetState, *saveData); 1079eace7efcSopenharmony_ci reply.WriteInt32(result); 1080eace7efcSopenharmony_ci return NO_ERROR; 1081eace7efcSopenharmony_ci} 1082eace7efcSopenharmony_ci 1083eace7efcSopenharmony_ciint AbilityManagerStub::AbilityWindowConfigTransitionDoneInner(MessageParcel &data, MessageParcel &reply) 1084eace7efcSopenharmony_ci{ 1085eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1086eace7efcSopenharmony_ci std::unique_ptr<WindowConfig> windowConfig(data.ReadParcelable<WindowConfig>()); 1087eace7efcSopenharmony_ci if (!windowConfig) { 1088eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "windowConfig null"); 1089eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1090eace7efcSopenharmony_ci } 1091eace7efcSopenharmony_ci int32_t result = AbilityWindowConfigTransitionDone(token, *windowConfig); 1092eace7efcSopenharmony_ci reply.WriteInt32(result); 1093eace7efcSopenharmony_ci return NO_ERROR; 1094eace7efcSopenharmony_ci} 1095eace7efcSopenharmony_ci 1096eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleConnectAbilityDoneInner(MessageParcel &data, MessageParcel &reply) 1097eace7efcSopenharmony_ci{ 1098eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 1099eace7efcSopenharmony_ci sptr<IRemoteObject> remoteObject = nullptr; 1100eace7efcSopenharmony_ci if (data.ReadBool()) { 1101eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 1102eace7efcSopenharmony_ci } 1103eace7efcSopenharmony_ci if (data.ReadBool()) { 1104eace7efcSopenharmony_ci remoteObject = data.ReadRemoteObject(); 1105eace7efcSopenharmony_ci } 1106eace7efcSopenharmony_ci int32_t result = ScheduleConnectAbilityDone(token, remoteObject); 1107eace7efcSopenharmony_ci reply.WriteInt32(result); 1108eace7efcSopenharmony_ci return NO_ERROR; 1109eace7efcSopenharmony_ci} 1110eace7efcSopenharmony_ci 1111eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleDisconnectAbilityDoneInner(MessageParcel &data, MessageParcel &reply) 1112eace7efcSopenharmony_ci{ 1113eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1114eace7efcSopenharmony_ci int32_t result = ScheduleDisconnectAbilityDone(token); 1115eace7efcSopenharmony_ci reply.WriteInt32(result); 1116eace7efcSopenharmony_ci return NO_ERROR; 1117eace7efcSopenharmony_ci} 1118eace7efcSopenharmony_ci 1119eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleCommandAbilityDoneInner(MessageParcel &data, MessageParcel &reply) 1120eace7efcSopenharmony_ci{ 1121eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 1122eace7efcSopenharmony_ci int32_t result = ScheduleCommandAbilityDone(token); 1123eace7efcSopenharmony_ci reply.WriteInt32(result); 1124eace7efcSopenharmony_ci return NO_ERROR; 1125eace7efcSopenharmony_ci} 1126eace7efcSopenharmony_ci 1127eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleCommandAbilityWindowDoneInner(MessageParcel &data, MessageParcel &reply) 1128eace7efcSopenharmony_ci{ 1129eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 1130eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = data.ReadParcelable<SessionInfo>(); 1131eace7efcSopenharmony_ci int32_t winCmd = data.ReadInt32(); 1132eace7efcSopenharmony_ci int32_t abilityCmd = data.ReadInt32(); 1133eace7efcSopenharmony_ci int32_t result = ScheduleCommandAbilityWindowDone(token, sessionInfo, 1134eace7efcSopenharmony_ci static_cast<WindowCommand>(winCmd), static_cast<AbilityCommand>(abilityCmd)); 1135eace7efcSopenharmony_ci reply.WriteInt32(result); 1136eace7efcSopenharmony_ci return NO_ERROR; 1137eace7efcSopenharmony_ci} 1138eace7efcSopenharmony_ci 1139eace7efcSopenharmony_ciint AbilityManagerStub::AcquireDataAbilityInner(MessageParcel &data, MessageParcel &reply) 1140eace7efcSopenharmony_ci{ 1141eace7efcSopenharmony_ci std::unique_ptr<Uri> uri = std::make_unique<Uri>(data.ReadString()); 1142eace7efcSopenharmony_ci bool tryBind = data.ReadBool(); 1143eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 1144eace7efcSopenharmony_ci sptr<IAbilityScheduler> result = AcquireDataAbility(*uri, tryBind, callerToken); 1145eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "acquire data ability %{public}s", result ? "ok" : "failed"); 1146eace7efcSopenharmony_ci if (result) { 1147eace7efcSopenharmony_ci reply.WriteRemoteObject(result->AsObject()); 1148eace7efcSopenharmony_ci } else { 1149eace7efcSopenharmony_ci reply.WriteParcelable(nullptr); 1150eace7efcSopenharmony_ci } 1151eace7efcSopenharmony_ci return NO_ERROR; 1152eace7efcSopenharmony_ci} 1153eace7efcSopenharmony_ci 1154eace7efcSopenharmony_ciint AbilityManagerStub::ReleaseDataAbilityInner(MessageParcel &data, MessageParcel &reply) 1155eace7efcSopenharmony_ci{ 1156eace7efcSopenharmony_ci auto scheduler = iface_cast<IAbilityScheduler>(data.ReadRemoteObject()); 1157eace7efcSopenharmony_ci if (scheduler == nullptr) { 1158eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "scheduler null"); 1159eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1160eace7efcSopenharmony_ci } 1161eace7efcSopenharmony_ci auto callerToken = data.ReadRemoteObject(); 1162eace7efcSopenharmony_ci int32_t result = ReleaseDataAbility(scheduler, callerToken); 1163eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "release data ability ret = %d", result); 1164eace7efcSopenharmony_ci reply.WriteInt32(result); 1165eace7efcSopenharmony_ci return NO_ERROR; 1166eace7efcSopenharmony_ci} 1167eace7efcSopenharmony_ci 1168eace7efcSopenharmony_ciint AbilityManagerStub::KillProcessInner(MessageParcel &data, MessageParcel &reply) 1169eace7efcSopenharmony_ci{ 1170eace7efcSopenharmony_ci std::string bundleName = Str16ToStr8(data.ReadString16()); 1171eace7efcSopenharmony_ci bool clearPageStack = data.ReadBool(); 1172eace7efcSopenharmony_ci int result = KillProcess(bundleName, clearPageStack); 1173eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1174eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "remove stack error"); 1175eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1176eace7efcSopenharmony_ci } 1177eace7efcSopenharmony_ci return NO_ERROR; 1178eace7efcSopenharmony_ci} 1179eace7efcSopenharmony_ci 1180eace7efcSopenharmony_ciint AbilityManagerStub::UninstallAppInner(MessageParcel &data, MessageParcel &reply) 1181eace7efcSopenharmony_ci{ 1182eace7efcSopenharmony_ci std::string bundleName = Str16ToStr8(data.ReadString16()); 1183eace7efcSopenharmony_ci int32_t uid = data.ReadInt32(); 1184eace7efcSopenharmony_ci int32_t appIndex = data.ReadInt32(); 1185eace7efcSopenharmony_ci int32_t result = UninstallApp(bundleName, uid, appIndex); 1186eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1187eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "remove stack error"); 1188eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1189eace7efcSopenharmony_ci } 1190eace7efcSopenharmony_ci return NO_ERROR; 1191eace7efcSopenharmony_ci} 1192eace7efcSopenharmony_ci 1193eace7efcSopenharmony_ciint32_t AbilityManagerStub::UpgradeAppInner(MessageParcel &data, MessageParcel &reply) 1194eace7efcSopenharmony_ci{ 1195eace7efcSopenharmony_ci std::string bundleName = Str16ToStr8(data.ReadString16()); 1196eace7efcSopenharmony_ci int32_t uid = data.ReadInt32(); 1197eace7efcSopenharmony_ci std::string exitMsg = Str16ToStr8(data.ReadString16()); 1198eace7efcSopenharmony_ci int32_t appIndex = data.ReadInt32(); 1199eace7efcSopenharmony_ci int32_t result = UpgradeApp(bundleName, uid, exitMsg, appIndex); 1200eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1201eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "UpgradeAppInner error"); 1202eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1203eace7efcSopenharmony_ci } 1204eace7efcSopenharmony_ci return NO_ERROR; 1205eace7efcSopenharmony_ci} 1206eace7efcSopenharmony_ci 1207eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityInner(MessageParcel &data, MessageParcel &reply) 1208eace7efcSopenharmony_ci{ 1209eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1210eace7efcSopenharmony_ci if (want == nullptr) { 1211eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1212eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1213eace7efcSopenharmony_ci } 1214eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1215eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1216eace7efcSopenharmony_ci int32_t result = StartAbility(*want, userId, requestCode); 1217eace7efcSopenharmony_ci reply.WriteInt32(result); 1218eace7efcSopenharmony_ci return NO_ERROR; 1219eace7efcSopenharmony_ci} 1220eace7efcSopenharmony_ci 1221eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityInnerSpecifyTokenId(MessageParcel &data, MessageParcel &reply) 1222eace7efcSopenharmony_ci{ 1223eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1224eace7efcSopenharmony_ci if (want == nullptr) { 1225eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1226eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1227eace7efcSopenharmony_ci } 1228eace7efcSopenharmony_ci 1229eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1230eace7efcSopenharmony_ci if (data.ReadBool()) { 1231eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1232eace7efcSopenharmony_ci } 1233eace7efcSopenharmony_ci int32_t specifyTokenId = data.ReadInt32(); 1234eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1235eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1236eace7efcSopenharmony_ci int32_t result = StartAbilityWithSpecifyTokenId(*want, callerToken, specifyTokenId, userId, requestCode); 1237eace7efcSopenharmony_ci reply.WriteInt32(result); 1238eace7efcSopenharmony_ci return NO_ERROR; 1239eace7efcSopenharmony_ci} 1240eace7efcSopenharmony_ci 1241eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityByUIContentSessionAddCallerInner(MessageParcel &data, MessageParcel &reply) 1242eace7efcSopenharmony_ci{ 1243eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 1244eace7efcSopenharmony_ci if (want == nullptr) { 1245eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1246eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1247eace7efcSopenharmony_ci } 1248eace7efcSopenharmony_ci 1249eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1250eace7efcSopenharmony_ci if (data.ReadBool()) { 1251eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1252eace7efcSopenharmony_ci if (callerToken == nullptr) { 1253eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken null"); 1254eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1255eace7efcSopenharmony_ci } 1256eace7efcSopenharmony_ci } 1257eace7efcSopenharmony_ci 1258eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 1259eace7efcSopenharmony_ci if (data.ReadBool()) { 1260eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 1261eace7efcSopenharmony_ci if (sessionInfo == nullptr) { 1262eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionInfo null"); 1263eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1264eace7efcSopenharmony_ci } 1265eace7efcSopenharmony_ci } 1266eace7efcSopenharmony_ci 1267eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1268eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1269eace7efcSopenharmony_ci int32_t result = StartAbilityByUIContentSession(*want, callerToken, sessionInfo, userId, requestCode); 1270eace7efcSopenharmony_ci reply.WriteInt32(result); 1271eace7efcSopenharmony_ci return NO_ERROR; 1272eace7efcSopenharmony_ci} 1273eace7efcSopenharmony_ci 1274eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityByUIContentSessionForOptionsInner(MessageParcel &data, MessageParcel &reply) 1275eace7efcSopenharmony_ci{ 1276eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 1277eace7efcSopenharmony_ci if (want == nullptr) { 1278eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1279eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1280eace7efcSopenharmony_ci } 1281eace7efcSopenharmony_ci std::unique_ptr<StartOptions> startOptions(data.ReadParcelable<StartOptions>()); 1282eace7efcSopenharmony_ci if (startOptions == nullptr) { 1283eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null"); 1284eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1285eace7efcSopenharmony_ci } 1286eace7efcSopenharmony_ci startOptions->processOptions = nullptr; 1287eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1288eace7efcSopenharmony_ci if (data.ReadBool()) { 1289eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1290eace7efcSopenharmony_ci if (callerToken == nullptr) { 1291eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken null"); 1292eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1293eace7efcSopenharmony_ci } 1294eace7efcSopenharmony_ci } 1295eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 1296eace7efcSopenharmony_ci if (data.ReadBool()) { 1297eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 1298eace7efcSopenharmony_ci if (sessionInfo == nullptr) { 1299eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "sessionInfo null"); 1300eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1301eace7efcSopenharmony_ci } 1302eace7efcSopenharmony_ci } 1303eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1304eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1305eace7efcSopenharmony_ci int32_t result = StartAbilityByUIContentSession(*want, *startOptions, 1306eace7efcSopenharmony_ci callerToken, sessionInfo, userId, requestCode); 1307eace7efcSopenharmony_ci reply.WriteInt32(result); 1308eace7efcSopenharmony_ci return NO_ERROR; 1309eace7efcSopenharmony_ci} 1310eace7efcSopenharmony_ci 1311eace7efcSopenharmony_ciint AbilityManagerStub::StartExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 1312eace7efcSopenharmony_ci{ 1313eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1314eace7efcSopenharmony_ci if (want == nullptr) { 1315eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1316eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1317eace7efcSopenharmony_ci } 1318eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1319eace7efcSopenharmony_ci if (data.ReadBool()) { 1320eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1321eace7efcSopenharmony_ci } 1322eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1323eace7efcSopenharmony_ci int32_t extensionType = data.ReadInt32(); 1324eace7efcSopenharmony_ci int32_t result = StartExtensionAbility(*want, callerToken, userId, 1325eace7efcSopenharmony_ci static_cast<AppExecFwk::ExtensionAbilityType>(extensionType)); 1326eace7efcSopenharmony_ci reply.WriteInt32(result); 1327eace7efcSopenharmony_ci return NO_ERROR; 1328eace7efcSopenharmony_ci} 1329eace7efcSopenharmony_ci 1330eace7efcSopenharmony_ciint AbilityManagerStub::RequestModalUIExtensionInner(MessageParcel &data, MessageParcel &reply) 1331eace7efcSopenharmony_ci{ 1332eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1333eace7efcSopenharmony_ci if (want == nullptr) { 1334eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1335eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1336eace7efcSopenharmony_ci } 1337eace7efcSopenharmony_ci int32_t result = RequestModalUIExtension(*want); 1338eace7efcSopenharmony_ci reply.WriteInt32(result); 1339eace7efcSopenharmony_ci return NO_ERROR; 1340eace7efcSopenharmony_ci} 1341eace7efcSopenharmony_ci 1342eace7efcSopenharmony_ciint AbilityManagerStub::PreloadUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 1343eace7efcSopenharmony_ci{ 1344eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1345eace7efcSopenharmony_ci if (want == nullptr) { 1346eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1347eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1348eace7efcSopenharmony_ci } 1349eace7efcSopenharmony_ci std::string hostBundleName = Str16ToStr8(data.ReadString16()); 1350eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1351eace7efcSopenharmony_ci int32_t result = PreloadUIExtensionAbility(*want, hostBundleName, userId); 1352eace7efcSopenharmony_ci reply.WriteInt32(result); 1353eace7efcSopenharmony_ci return NO_ERROR; 1354eace7efcSopenharmony_ci} 1355eace7efcSopenharmony_ci 1356eace7efcSopenharmony_ciint AbilityManagerStub::ChangeAbilityVisibilityInner(MessageParcel &data, MessageParcel &reply) 1357eace7efcSopenharmony_ci{ 1358eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 1359eace7efcSopenharmony_ci if (!token) { 1360eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read token fail"); 1361eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1362eace7efcSopenharmony_ci } 1363eace7efcSopenharmony_ci 1364eace7efcSopenharmony_ci bool isShow = data.ReadBool(); 1365eace7efcSopenharmony_ci int result = ChangeAbilityVisibility(token, isShow); 1366eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1367eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "fail"); 1368eace7efcSopenharmony_ci return ERR_NATIVE_IPC_PARCEL_FAILED; 1369eace7efcSopenharmony_ci } 1370eace7efcSopenharmony_ci return NO_ERROR; 1371eace7efcSopenharmony_ci} 1372eace7efcSopenharmony_ci 1373eace7efcSopenharmony_ciint AbilityManagerStub::ChangeUIAbilityVisibilityBySCBInner(MessageParcel &data, MessageParcel &reply) 1374eace7efcSopenharmony_ci{ 1375eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = data.ReadParcelable<SessionInfo>(); 1376eace7efcSopenharmony_ci if (!sessionInfo) { 1377eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read sessionInfo fail"); 1378eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1379eace7efcSopenharmony_ci } 1380eace7efcSopenharmony_ci 1381eace7efcSopenharmony_ci bool isShow = data.ReadBool(); 1382eace7efcSopenharmony_ci int result = ChangeUIAbilityVisibilityBySCB(sessionInfo, isShow); 1383eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1384eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write fail"); 1385eace7efcSopenharmony_ci return ERR_NATIVE_IPC_PARCEL_FAILED; 1386eace7efcSopenharmony_ci } 1387eace7efcSopenharmony_ci return NO_ERROR; 1388eace7efcSopenharmony_ci} 1389eace7efcSopenharmony_ci 1390eace7efcSopenharmony_ciint AbilityManagerStub::StartUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 1391eace7efcSopenharmony_ci{ 1392eace7efcSopenharmony_ci sptr<SessionInfo> extensionSessionInfo = nullptr; 1393eace7efcSopenharmony_ci if (data.ReadBool()) { 1394eace7efcSopenharmony_ci extensionSessionInfo = data.ReadParcelable<SessionInfo>(); 1395eace7efcSopenharmony_ci if (extensionSessionInfo == nullptr) { 1396eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null extensionSessionInfo"); 1397eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1398eace7efcSopenharmony_ci } 1399eace7efcSopenharmony_ci // To ensure security, this attribute must be rewritten. 1400eace7efcSopenharmony_ci extensionSessionInfo->uiExtensionUsage = UIExtensionUsage::MODAL; 1401eace7efcSopenharmony_ci } 1402eace7efcSopenharmony_ci 1403eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1404eace7efcSopenharmony_ci 1405eace7efcSopenharmony_ci int32_t result = StartUIExtensionAbility(extensionSessionInfo, userId); 1406eace7efcSopenharmony_ci reply.WriteInt32(result); 1407eace7efcSopenharmony_ci return NO_ERROR; 1408eace7efcSopenharmony_ci} 1409eace7efcSopenharmony_ci 1410eace7efcSopenharmony_ciint AbilityManagerStub::StartUIExtensionAbilityEmbeddedInner(MessageParcel &data, MessageParcel &reply) 1411eace7efcSopenharmony_ci{ 1412eace7efcSopenharmony_ci sptr<SessionInfo> extensionSessionInfo = nullptr; 1413eace7efcSopenharmony_ci if (data.ReadBool()) { 1414eace7efcSopenharmony_ci extensionSessionInfo = data.ReadParcelable<SessionInfo>(); 1415eace7efcSopenharmony_ci if (extensionSessionInfo == nullptr) { 1416eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null extensionSessionInfo"); 1417eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1418eace7efcSopenharmony_ci } 1419eace7efcSopenharmony_ci // To ensure security, this attribute must be rewritten. 1420eace7efcSopenharmony_ci extensionSessionInfo->uiExtensionUsage = UIExtensionUsage::EMBEDDED; 1421eace7efcSopenharmony_ci } 1422eace7efcSopenharmony_ci 1423eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1424eace7efcSopenharmony_ci 1425eace7efcSopenharmony_ci int32_t result = StartUIExtensionAbility(extensionSessionInfo, userId); 1426eace7efcSopenharmony_ci reply.WriteInt32(result); 1427eace7efcSopenharmony_ci return NO_ERROR; 1428eace7efcSopenharmony_ci} 1429eace7efcSopenharmony_ci 1430eace7efcSopenharmony_ciint AbilityManagerStub::StartUIExtensionConstrainedEmbeddedInner(MessageParcel &data, MessageParcel &reply) 1431eace7efcSopenharmony_ci{ 1432eace7efcSopenharmony_ci sptr<SessionInfo> extensionSessionInfo = nullptr; 1433eace7efcSopenharmony_ci if (data.ReadBool()) { 1434eace7efcSopenharmony_ci extensionSessionInfo = data.ReadParcelable<SessionInfo>(); 1435eace7efcSopenharmony_ci if (extensionSessionInfo == nullptr) { 1436eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null extensionSessionInfo"); 1437eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1438eace7efcSopenharmony_ci } 1439eace7efcSopenharmony_ci // To ensure security, this attribute must be rewritten. 1440eace7efcSopenharmony_ci extensionSessionInfo->uiExtensionUsage = UIExtensionUsage::CONSTRAINED_EMBEDDED; 1441eace7efcSopenharmony_ci } 1442eace7efcSopenharmony_ci 1443eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1444eace7efcSopenharmony_ci 1445eace7efcSopenharmony_ci int32_t result = StartUIExtensionAbility(extensionSessionInfo, userId); 1446eace7efcSopenharmony_ci reply.WriteInt32(result); 1447eace7efcSopenharmony_ci return NO_ERROR; 1448eace7efcSopenharmony_ci} 1449eace7efcSopenharmony_ci 1450eace7efcSopenharmony_ciint AbilityManagerStub::StopExtensionAbilityInner(MessageParcel& data, MessageParcel& reply) 1451eace7efcSopenharmony_ci{ 1452eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1453eace7efcSopenharmony_ci if (want == nullptr) { 1454eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1455eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1456eace7efcSopenharmony_ci } 1457eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1458eace7efcSopenharmony_ci if (data.ReadBool()) { 1459eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1460eace7efcSopenharmony_ci } 1461eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1462eace7efcSopenharmony_ci int32_t extensionType = data.ReadInt32(); 1463eace7efcSopenharmony_ci int32_t result = 1464eace7efcSopenharmony_ci StopExtensionAbility(*want, callerToken, userId, static_cast<AppExecFwk::ExtensionAbilityType>(extensionType)); 1465eace7efcSopenharmony_ci reply.WriteInt32(result); 1466eace7efcSopenharmony_ci return NO_ERROR; 1467eace7efcSopenharmony_ci} 1468eace7efcSopenharmony_ci 1469eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityAddCallerInner(MessageParcel &data, MessageParcel &reply) 1470eace7efcSopenharmony_ci{ 1471eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1472eace7efcSopenharmony_ci if (want == nullptr) { 1473eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1474eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1475eace7efcSopenharmony_ci } 1476eace7efcSopenharmony_ci 1477eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1478eace7efcSopenharmony_ci if (data.ReadBool()) { 1479eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1480eace7efcSopenharmony_ci } 1481eace7efcSopenharmony_ci 1482eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1483eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1484eace7efcSopenharmony_ci int32_t result = StartAbility(*want, callerToken, userId, requestCode); 1485eace7efcSopenharmony_ci reply.WriteInt32(result); 1486eace7efcSopenharmony_ci return NO_ERROR; 1487eace7efcSopenharmony_ci} 1488eace7efcSopenharmony_ci 1489eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityAsCallerByTokenInner(MessageParcel &data, MessageParcel &reply) 1490eace7efcSopenharmony_ci{ 1491eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1492eace7efcSopenharmony_ci if (want == nullptr) { 1493eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1494eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1495eace7efcSopenharmony_ci } 1496eace7efcSopenharmony_ci 1497eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1498eace7efcSopenharmony_ci sptr<IRemoteObject> asCallerSourceToken = nullptr; 1499eace7efcSopenharmony_ci if (data.ReadBool()) { 1500eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1501eace7efcSopenharmony_ci } 1502eace7efcSopenharmony_ci if (data.ReadBool()) { 1503eace7efcSopenharmony_ci asCallerSourceToken = data.ReadRemoteObject(); 1504eace7efcSopenharmony_ci } 1505eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1506eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1507eace7efcSopenharmony_ci int32_t result = StartAbilityAsCaller(*want, callerToken, asCallerSourceToken, userId, requestCode); 1508eace7efcSopenharmony_ci reply.WriteInt32(result); 1509eace7efcSopenharmony_ci return NO_ERROR; 1510eace7efcSopenharmony_ci} 1511eace7efcSopenharmony_ci 1512eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityAsCallerForOptionInner(MessageParcel &data, MessageParcel &reply) 1513eace7efcSopenharmony_ci{ 1514eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1515eace7efcSopenharmony_ci if (want == nullptr) { 1516eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1517eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1518eace7efcSopenharmony_ci } 1519eace7efcSopenharmony_ci StartOptions *startOptions = data.ReadParcelable<StartOptions>(); 1520eace7efcSopenharmony_ci if (startOptions == nullptr) { 1521eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null startOptions"); 1522eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1523eace7efcSopenharmony_ci } 1524eace7efcSopenharmony_ci startOptions->processOptions = nullptr; 1525eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1526eace7efcSopenharmony_ci sptr<IRemoteObject> asCallerSourceToken = nullptr; 1527eace7efcSopenharmony_ci if (data.ReadBool()) { 1528eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1529eace7efcSopenharmony_ci } 1530eace7efcSopenharmony_ci if (data.ReadBool()) { 1531eace7efcSopenharmony_ci asCallerSourceToken = data.ReadRemoteObject(); 1532eace7efcSopenharmony_ci } 1533eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1534eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1535eace7efcSopenharmony_ci int32_t result = StartAbilityAsCaller(*want, *startOptions, callerToken, asCallerSourceToken, userId, requestCode); 1536eace7efcSopenharmony_ci reply.WriteInt32(result); 1537eace7efcSopenharmony_ci delete startOptions; 1538eace7efcSopenharmony_ci return NO_ERROR; 1539eace7efcSopenharmony_ci} 1540eace7efcSopenharmony_ci 1541eace7efcSopenharmony_ciint AbilityManagerStub::ConnectAbilityInner(MessageParcel &data, MessageParcel &reply) 1542eace7efcSopenharmony_ci{ 1543eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1544eace7efcSopenharmony_ci if (want == nullptr) { 1545eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1546eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1547eace7efcSopenharmony_ci } 1548eace7efcSopenharmony_ci sptr<IAbilityConnection> callback = nullptr; 1549eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 1550eace7efcSopenharmony_ci if (data.ReadBool()) { 1551eace7efcSopenharmony_ci callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 1552eace7efcSopenharmony_ci } 1553eace7efcSopenharmony_ci if (data.ReadBool()) { 1554eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 1555eace7efcSopenharmony_ci } 1556eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1557eace7efcSopenharmony_ci int32_t result = ConnectAbilityCommon(*want, callback, token, AppExecFwk::ExtensionAbilityType::SERVICE, userId); 1558eace7efcSopenharmony_ci reply.WriteInt32(result); 1559eace7efcSopenharmony_ci return NO_ERROR; 1560eace7efcSopenharmony_ci} 1561eace7efcSopenharmony_ci 1562eace7efcSopenharmony_ciint AbilityManagerStub::ConnectAbilityWithTypeInner(MessageParcel &data, MessageParcel &reply) 1563eace7efcSopenharmony_ci{ 1564eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1565eace7efcSopenharmony_ci if (want == nullptr) { 1566eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s, null want", __func__); 1567eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1568eace7efcSopenharmony_ci } 1569eace7efcSopenharmony_ci sptr<IAbilityConnection> callback = nullptr; 1570eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 1571eace7efcSopenharmony_ci if (data.ReadBool()) { 1572eace7efcSopenharmony_ci callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 1573eace7efcSopenharmony_ci } 1574eace7efcSopenharmony_ci if (data.ReadBool()) { 1575eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 1576eace7efcSopenharmony_ci } 1577eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1578eace7efcSopenharmony_ci AppExecFwk::ExtensionAbilityType extensionType = static_cast<AppExecFwk::ExtensionAbilityType>(data.ReadInt32()); 1579eace7efcSopenharmony_ci bool isQueryExtensionOnly = data.ReadBool(); 1580eace7efcSopenharmony_ci int32_t result = ConnectAbilityCommon(*want, callback, token, extensionType, userId, isQueryExtensionOnly); 1581eace7efcSopenharmony_ci reply.WriteInt32(result); 1582eace7efcSopenharmony_ci return NO_ERROR; 1583eace7efcSopenharmony_ci} 1584eace7efcSopenharmony_ci 1585eace7efcSopenharmony_ciint AbilityManagerStub::ConnectUIExtensionAbilityInner(MessageParcel &data, MessageParcel &reply) 1586eace7efcSopenharmony_ci{ 1587eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1588eace7efcSopenharmony_ci if (want == nullptr) { 1589eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s, null want", __func__); 1590eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1591eace7efcSopenharmony_ci } 1592eace7efcSopenharmony_ci sptr<IAbilityConnection> callback = nullptr; 1593eace7efcSopenharmony_ci if (data.ReadBool()) { 1594eace7efcSopenharmony_ci callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 1595eace7efcSopenharmony_ci } 1596eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 1597eace7efcSopenharmony_ci if (data.ReadBool()) { 1598eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 1599eace7efcSopenharmony_ci } 1600eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1601eace7efcSopenharmony_ci 1602eace7efcSopenharmony_ci sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr; 1603eace7efcSopenharmony_ci if (data.ReadBool()) { 1604eace7efcSopenharmony_ci connectInfo = data.ReadParcelable<UIExtensionAbilityConnectInfo>(); 1605eace7efcSopenharmony_ci } 1606eace7efcSopenharmony_ci 1607eace7efcSopenharmony_ci int32_t result = ConnectUIExtensionAbility(*want, callback, sessionInfo, userId, connectInfo); 1608eace7efcSopenharmony_ci if (connectInfo != nullptr && !reply.WriteParcelable(connectInfo)) { 1609eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "connectInfo write fail"); 1610eace7efcSopenharmony_ci } 1611eace7efcSopenharmony_ci 1612eace7efcSopenharmony_ci reply.WriteInt32(result); 1613eace7efcSopenharmony_ci return NO_ERROR; 1614eace7efcSopenharmony_ci} 1615eace7efcSopenharmony_ci 1616eace7efcSopenharmony_ciint AbilityManagerStub::DisconnectAbilityInner(MessageParcel &data, MessageParcel &reply) 1617eace7efcSopenharmony_ci{ 1618eace7efcSopenharmony_ci sptr<IAbilityConnection> callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 1619eace7efcSopenharmony_ci if (callback == nullptr) { 1620eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 1621eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1622eace7efcSopenharmony_ci } 1623eace7efcSopenharmony_ci int32_t result = DisconnectAbility(callback); 1624eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "disconnect ability ret = %d", result); 1625eace7efcSopenharmony_ci reply.WriteInt32(result); 1626eace7efcSopenharmony_ci return NO_ERROR; 1627eace7efcSopenharmony_ci} 1628eace7efcSopenharmony_ci 1629eace7efcSopenharmony_ciint AbilityManagerStub::StopServiceAbilityInner(MessageParcel &data, MessageParcel &reply) 1630eace7efcSopenharmony_ci{ 1631eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1632eace7efcSopenharmony_ci if (want == nullptr) { 1633eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1634eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1635eace7efcSopenharmony_ci } 1636eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1637eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 1638eace7efcSopenharmony_ci if (data.ReadBool()) { 1639eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 1640eace7efcSopenharmony_ci } 1641eace7efcSopenharmony_ci int32_t result = StopServiceAbility(*want, userId, token); 1642eace7efcSopenharmony_ci reply.WriteInt32(result); 1643eace7efcSopenharmony_ci return NO_ERROR; 1644eace7efcSopenharmony_ci} 1645eace7efcSopenharmony_ci 1646eace7efcSopenharmony_ciint AbilityManagerStub::DumpSysStateInner(MessageParcel &data, MessageParcel &reply) 1647eace7efcSopenharmony_ci{ 1648eace7efcSopenharmony_ci std::vector<std::string> result; 1649eace7efcSopenharmony_ci std::string args = Str16ToStr8(data.ReadString16()); 1650eace7efcSopenharmony_ci std::vector<std::string> argList; 1651eace7efcSopenharmony_ci 1652eace7efcSopenharmony_ci auto isClient = data.ReadBool(); 1653eace7efcSopenharmony_ci auto isUserID = data.ReadBool(); 1654eace7efcSopenharmony_ci auto UserID = data.ReadInt32(); 1655eace7efcSopenharmony_ci SplitStr(args, " ", argList); 1656eace7efcSopenharmony_ci if (argList.empty()) { 1657eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1658eace7efcSopenharmony_ci } 1659eace7efcSopenharmony_ci DumpSysState(args, result, isClient, isUserID, UserID); 1660eace7efcSopenharmony_ci reply.WriteInt32(result.size()); 1661eace7efcSopenharmony_ci for (auto stack : result) { 1662eace7efcSopenharmony_ci reply.WriteString16(Str8ToStr16(stack)); 1663eace7efcSopenharmony_ci } 1664eace7efcSopenharmony_ci return NO_ERROR; 1665eace7efcSopenharmony_ci} 1666eace7efcSopenharmony_ci 1667eace7efcSopenharmony_ciint AbilityManagerStub::DumpStateInner(MessageParcel &data, MessageParcel &reply) 1668eace7efcSopenharmony_ci{ 1669eace7efcSopenharmony_ci std::vector<std::string> result; 1670eace7efcSopenharmony_ci std::string args = Str16ToStr8(data.ReadString16()); 1671eace7efcSopenharmony_ci std::vector<std::string> argList; 1672eace7efcSopenharmony_ci SplitStr(args, " ", argList); 1673eace7efcSopenharmony_ci if (argList.empty()) { 1674eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1675eace7efcSopenharmony_ci } 1676eace7efcSopenharmony_ci DumpState(args, result); 1677eace7efcSopenharmony_ci reply.WriteInt32(result.size()); 1678eace7efcSopenharmony_ci for (auto stack : result) { 1679eace7efcSopenharmony_ci reply.WriteString16(Str8ToStr16(stack)); 1680eace7efcSopenharmony_ci } 1681eace7efcSopenharmony_ci return NO_ERROR; 1682eace7efcSopenharmony_ci} 1683eace7efcSopenharmony_ci 1684eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityForSettingsInner(MessageParcel &data, MessageParcel &reply) 1685eace7efcSopenharmony_ci{ 1686eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1687eace7efcSopenharmony_ci if (want == nullptr) { 1688eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 1689eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1690eace7efcSopenharmony_ci } 1691eace7efcSopenharmony_ci AbilityStartSetting *abilityStartSetting = data.ReadParcelable<AbilityStartSetting>(); 1692eace7efcSopenharmony_ci if (abilityStartSetting == nullptr) { 1693eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "abilityStartSetting null"); 1694eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1695eace7efcSopenharmony_ci } 1696eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1697eace7efcSopenharmony_ci if (data.ReadBool()) { 1698eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1699eace7efcSopenharmony_ci } 1700eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1701eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1702eace7efcSopenharmony_ci int32_t result = StartAbility(*want, *abilityStartSetting, callerToken, userId, requestCode); 1703eace7efcSopenharmony_ci reply.WriteInt32(result); 1704eace7efcSopenharmony_ci delete abilityStartSetting; 1705eace7efcSopenharmony_ci return NO_ERROR; 1706eace7efcSopenharmony_ci} 1707eace7efcSopenharmony_ci 1708eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityForOptionsInner(MessageParcel &data, MessageParcel &reply) 1709eace7efcSopenharmony_ci{ 1710eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1711eace7efcSopenharmony_ci if (want == nullptr) { 1712eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 1713eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1714eace7efcSopenharmony_ci } 1715eace7efcSopenharmony_ci StartOptions *startOptions = data.ReadParcelable<StartOptions>(); 1716eace7efcSopenharmony_ci if (startOptions == nullptr) { 1717eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null"); 1718eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1719eace7efcSopenharmony_ci } 1720eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1721eace7efcSopenharmony_ci if (data.ReadBool()) { 1722eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1723eace7efcSopenharmony_ci } 1724eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 1725eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 1726eace7efcSopenharmony_ci int32_t result = StartAbility(*want, *startOptions, callerToken, userId, requestCode); 1727eace7efcSopenharmony_ci reply.WriteInt32(result); 1728eace7efcSopenharmony_ci delete startOptions; 1729eace7efcSopenharmony_ci return NO_ERROR; 1730eace7efcSopenharmony_ci} 1731eace7efcSopenharmony_ci 1732eace7efcSopenharmony_ciint AbilityManagerStub::CloseUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 1733eace7efcSopenharmony_ci{ 1734eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 1735eace7efcSopenharmony_ci if (data.ReadBool()) { 1736eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 1737eace7efcSopenharmony_ci } 1738eace7efcSopenharmony_ci int32_t result = CloseUIAbilityBySCB(sessionInfo); 1739eace7efcSopenharmony_ci reply.WriteInt32(result); 1740eace7efcSopenharmony_ci return NO_ERROR; 1741eace7efcSopenharmony_ci} 1742eace7efcSopenharmony_ci 1743eace7efcSopenharmony_ciint AbilityManagerStub::GetWantSenderInner(MessageParcel &data, MessageParcel &reply) 1744eace7efcSopenharmony_ci{ 1745eace7efcSopenharmony_ci std::unique_ptr<WantSenderInfo> wantSenderInfo(data.ReadParcelable<WantSenderInfo>()); 1746eace7efcSopenharmony_ci if (wantSenderInfo == nullptr) { 1747eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSenderInfo null"); 1748eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1749eace7efcSopenharmony_ci } 1750eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 1751eace7efcSopenharmony_ci if (data.ReadBool()) { 1752eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 1753eace7efcSopenharmony_ci } 1754eace7efcSopenharmony_ci 1755eace7efcSopenharmony_ci int32_t uid = data.ReadInt32(); 1756eace7efcSopenharmony_ci sptr<IWantSender> wantSender = GetWantSender(*wantSenderInfo, callerToken, uid); 1757eace7efcSopenharmony_ci if (!reply.WriteRemoteObject(((wantSender == nullptr) ? nullptr : wantSender->AsObject()))) { 1758eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "failed reply wantSender to client, for write parcel error"); 1759eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1760eace7efcSopenharmony_ci } 1761eace7efcSopenharmony_ci return NO_ERROR; 1762eace7efcSopenharmony_ci} 1763eace7efcSopenharmony_ci 1764eace7efcSopenharmony_ciint AbilityManagerStub::SendWantSenderInner(MessageParcel &data, MessageParcel &reply) 1765eace7efcSopenharmony_ci{ 1766eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1767eace7efcSopenharmony_ci if (wantSender == nullptr) { 1768eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1769eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1770eace7efcSopenharmony_ci } 1771eace7efcSopenharmony_ci std::unique_ptr<SenderInfo> senderInfo(data.ReadParcelable<SenderInfo>()); 1772eace7efcSopenharmony_ci if (senderInfo == nullptr) { 1773eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "senderInfo null"); 1774eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1775eace7efcSopenharmony_ci } 1776eace7efcSopenharmony_ci int32_t result = SendWantSender(wantSender, *senderInfo); 1777eace7efcSopenharmony_ci reply.WriteInt32(result); 1778eace7efcSopenharmony_ci return NO_ERROR; 1779eace7efcSopenharmony_ci} 1780eace7efcSopenharmony_ci 1781eace7efcSopenharmony_ciint AbilityManagerStub::CancelWantSenderInner(MessageParcel &data, MessageParcel &reply) 1782eace7efcSopenharmony_ci{ 1783eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1784eace7efcSopenharmony_ci if (wantSender == nullptr) { 1785eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1786eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1787eace7efcSopenharmony_ci } 1788eace7efcSopenharmony_ci CancelWantSender(wantSender); 1789eace7efcSopenharmony_ci return NO_ERROR; 1790eace7efcSopenharmony_ci} 1791eace7efcSopenharmony_ci 1792eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingWantUidInner(MessageParcel &data, MessageParcel &reply) 1793eace7efcSopenharmony_ci{ 1794eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1795eace7efcSopenharmony_ci if (wantSender == nullptr) { 1796eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1797eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1798eace7efcSopenharmony_ci } 1799eace7efcSopenharmony_ci 1800eace7efcSopenharmony_ci int32_t uid = GetPendingWantUid(wantSender); 1801eace7efcSopenharmony_ci reply.WriteInt32(uid); 1802eace7efcSopenharmony_ci return NO_ERROR; 1803eace7efcSopenharmony_ci} 1804eace7efcSopenharmony_ci 1805eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingWantUserIdInner(MessageParcel &data, MessageParcel &reply) 1806eace7efcSopenharmony_ci{ 1807eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1808eace7efcSopenharmony_ci if (wantSender == nullptr) { 1809eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1810eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1811eace7efcSopenharmony_ci } 1812eace7efcSopenharmony_ci 1813eace7efcSopenharmony_ci int32_t userId = GetPendingWantUserId(wantSender); 1814eace7efcSopenharmony_ci reply.WriteInt32(userId); 1815eace7efcSopenharmony_ci return NO_ERROR; 1816eace7efcSopenharmony_ci} 1817eace7efcSopenharmony_ci 1818eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingWantBundleNameInner(MessageParcel &data, MessageParcel &reply) 1819eace7efcSopenharmony_ci{ 1820eace7efcSopenharmony_ci auto remote = data.ReadRemoteObject(); 1821eace7efcSopenharmony_ci if (remote == nullptr) { 1822eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "readRemoteObject null"); 1823eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1824eace7efcSopenharmony_ci } 1825eace7efcSopenharmony_ci 1826eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(remote); 1827eace7efcSopenharmony_ci if (wantSender == nullptr) { 1828eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1829eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1830eace7efcSopenharmony_ci } 1831eace7efcSopenharmony_ci 1832eace7efcSopenharmony_ci std::string bundleName = GetPendingWantBundleName(wantSender); 1833eace7efcSopenharmony_ci reply.WriteString16(Str8ToStr16(bundleName)); 1834eace7efcSopenharmony_ci return NO_ERROR; 1835eace7efcSopenharmony_ci} 1836eace7efcSopenharmony_ci 1837eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingWantCodeInner(MessageParcel &data, MessageParcel &reply) 1838eace7efcSopenharmony_ci{ 1839eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1840eace7efcSopenharmony_ci if (wantSender == nullptr) { 1841eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1842eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1843eace7efcSopenharmony_ci } 1844eace7efcSopenharmony_ci 1845eace7efcSopenharmony_ci int32_t code = GetPendingWantCode(wantSender); 1846eace7efcSopenharmony_ci reply.WriteInt32(code); 1847eace7efcSopenharmony_ci return NO_ERROR; 1848eace7efcSopenharmony_ci} 1849eace7efcSopenharmony_ci 1850eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingWantTypeInner(MessageParcel &data, MessageParcel &reply) 1851eace7efcSopenharmony_ci{ 1852eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1853eace7efcSopenharmony_ci if (wantSender == nullptr) { 1854eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1855eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1856eace7efcSopenharmony_ci } 1857eace7efcSopenharmony_ci 1858eace7efcSopenharmony_ci int32_t type = GetPendingWantType(wantSender); 1859eace7efcSopenharmony_ci reply.WriteInt32(type); 1860eace7efcSopenharmony_ci return NO_ERROR; 1861eace7efcSopenharmony_ci} 1862eace7efcSopenharmony_ci 1863eace7efcSopenharmony_ciint AbilityManagerStub::RegisterCancelListenerInner(MessageParcel &data, MessageParcel &reply) 1864eace7efcSopenharmony_ci{ 1865eace7efcSopenharmony_ci sptr<IWantSender> sender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1866eace7efcSopenharmony_ci if (sender == nullptr) { 1867eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "sender null"); 1868eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1869eace7efcSopenharmony_ci } 1870eace7efcSopenharmony_ci sptr<IWantReceiver> receiver = iface_cast<IWantReceiver>(data.ReadRemoteObject()); 1871eace7efcSopenharmony_ci if (receiver == nullptr) { 1872eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "receiver null"); 1873eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1874eace7efcSopenharmony_ci } 1875eace7efcSopenharmony_ci RegisterCancelListener(sender, receiver); 1876eace7efcSopenharmony_ci return NO_ERROR; 1877eace7efcSopenharmony_ci} 1878eace7efcSopenharmony_ci 1879eace7efcSopenharmony_ciint AbilityManagerStub::UnregisterCancelListenerInner(MessageParcel &data, MessageParcel &reply) 1880eace7efcSopenharmony_ci{ 1881eace7efcSopenharmony_ci sptr<IWantSender> sender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1882eace7efcSopenharmony_ci if (sender == nullptr) { 1883eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "sender null"); 1884eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1885eace7efcSopenharmony_ci } 1886eace7efcSopenharmony_ci sptr<IWantReceiver> receiver = iface_cast<IWantReceiver>(data.ReadRemoteObject()); 1887eace7efcSopenharmony_ci if (receiver == nullptr) { 1888eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "receiver null"); 1889eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1890eace7efcSopenharmony_ci } 1891eace7efcSopenharmony_ci UnregisterCancelListener(sender, receiver); 1892eace7efcSopenharmony_ci return NO_ERROR; 1893eace7efcSopenharmony_ci} 1894eace7efcSopenharmony_ci 1895eace7efcSopenharmony_ciint AbilityManagerStub::GetPendingRequestWantInner(MessageParcel &data, MessageParcel &reply) 1896eace7efcSopenharmony_ci{ 1897eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 1898eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1899eace7efcSopenharmony_ci if (wantSender == nullptr) { 1900eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1901eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1902eace7efcSopenharmony_ci } 1903eace7efcSopenharmony_ci 1904eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 1905eace7efcSopenharmony_ci int32_t result = GetPendingRequestWant(wantSender, want); 1906eace7efcSopenharmony_ci if (result != NO_ERROR) { 1907eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "getPendingRequestWant fail"); 1908eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1909eace7efcSopenharmony_ci } 1910eace7efcSopenharmony_ci reply.WriteParcelable(want.get()); 1911eace7efcSopenharmony_ci return NO_ERROR; 1912eace7efcSopenharmony_ci} 1913eace7efcSopenharmony_ci 1914eace7efcSopenharmony_ciint AbilityManagerStub::GetWantSenderInfoInner(MessageParcel &data, MessageParcel &reply) 1915eace7efcSopenharmony_ci{ 1916eace7efcSopenharmony_ci sptr<IWantSender> wantSender = iface_cast<IWantSender>(data.ReadRemoteObject()); 1917eace7efcSopenharmony_ci if (wantSender == nullptr) { 1918eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantSender null"); 1919eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1920eace7efcSopenharmony_ci } 1921eace7efcSopenharmony_ci 1922eace7efcSopenharmony_ci std::shared_ptr<WantSenderInfo> info(data.ReadParcelable<WantSenderInfo>()); 1923eace7efcSopenharmony_ci int32_t result = GetWantSenderInfo(wantSender, info); 1924eace7efcSopenharmony_ci if (result != NO_ERROR) { 1925eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "getWantSenderInfo fail"); 1926eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1927eace7efcSopenharmony_ci } 1928eace7efcSopenharmony_ci reply.WriteParcelable(info.get()); 1929eace7efcSopenharmony_ci return NO_ERROR; 1930eace7efcSopenharmony_ci} 1931eace7efcSopenharmony_ci 1932eace7efcSopenharmony_ciint AbilityManagerStub::GetAppMemorySizeInner(MessageParcel &data, MessageParcel &reply) 1933eace7efcSopenharmony_ci{ 1934eace7efcSopenharmony_ci int32_t result = GetAppMemorySize(); 1935eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result %{public}d", result); 1936eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 1937eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "GetAppMemorySize error"); 1938eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1939eace7efcSopenharmony_ci } 1940eace7efcSopenharmony_ci return NO_ERROR; 1941eace7efcSopenharmony_ci} 1942eace7efcSopenharmony_ci 1943eace7efcSopenharmony_ciint AbilityManagerStub::IsRamConstrainedDeviceInner(MessageParcel &data, MessageParcel &reply) 1944eace7efcSopenharmony_ci{ 1945eace7efcSopenharmony_ci auto result = IsRamConstrainedDevice(); 1946eace7efcSopenharmony_ci if (!reply.WriteBool(result)) { 1947eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 1948eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 1949eace7efcSopenharmony_ci } 1950eace7efcSopenharmony_ci return NO_ERROR; 1951eace7efcSopenharmony_ci} 1952eace7efcSopenharmony_ci 1953eace7efcSopenharmony_ciint AbilityManagerStub::ContinueMissionInner(MessageParcel &data, MessageParcel &reply) 1954eace7efcSopenharmony_ci{ 1955eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "called"); 1956eace7efcSopenharmony_ci std::string srcDeviceId = data.ReadString(); 1957eace7efcSopenharmony_ci std::string dstDeviceId = data.ReadString(); 1958eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 1959eace7efcSopenharmony_ci sptr<IRemoteObject> callback = data.ReadRemoteObject(); 1960eace7efcSopenharmony_ci if (callback == nullptr) { 1961eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null callback"); 1962eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1963eace7efcSopenharmony_ci } 1964eace7efcSopenharmony_ci std::unique_ptr<WantParams> wantParams(data.ReadParcelable<WantParams>()); 1965eace7efcSopenharmony_ci if (wantParams == nullptr) { 1966eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null wantParams"); 1967eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1968eace7efcSopenharmony_ci } 1969eace7efcSopenharmony_ci int32_t result = ContinueMission(srcDeviceId, dstDeviceId, missionId, callback, *wantParams); 1970eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 1971eace7efcSopenharmony_ci return result; 1972eace7efcSopenharmony_ci} 1973eace7efcSopenharmony_ci 1974eace7efcSopenharmony_ciint AbilityManagerStub::ContinueMissionOfBundleNameInner(MessageParcel &data, MessageParcel &reply) 1975eace7efcSopenharmony_ci{ 1976eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "amsStub %{public}s call", __func__); 1977eace7efcSopenharmony_ci ContinueMissionInfo continueMissionInfo; 1978eace7efcSopenharmony_ci continueMissionInfo.srcDeviceId = data.ReadString(); 1979eace7efcSopenharmony_ci continueMissionInfo.dstDeviceId = data.ReadString(); 1980eace7efcSopenharmony_ci continueMissionInfo.bundleName = data.ReadString(); 1981eace7efcSopenharmony_ci sptr<IRemoteObject> callback = data.ReadRemoteObject(); 1982eace7efcSopenharmony_ci if (callback == nullptr) { 1983eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null wantParams"); 1984eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1985eace7efcSopenharmony_ci } 1986eace7efcSopenharmony_ci std::unique_ptr<WantParams> wantParams(data.ReadParcelable<WantParams>()); 1987eace7efcSopenharmony_ci if (wantParams == nullptr) { 1988eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null wantParams"); 1989eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 1990eace7efcSopenharmony_ci } 1991eace7efcSopenharmony_ci continueMissionInfo.wantParams = *wantParams; 1992eace7efcSopenharmony_ci continueMissionInfo.srcBundleName = data.ReadString(); 1993eace7efcSopenharmony_ci continueMissionInfo.continueType = data.ReadString(); 1994eace7efcSopenharmony_ci int32_t result = ContinueMission(continueMissionInfo, callback); 1995eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 1996eace7efcSopenharmony_ci return result; 1997eace7efcSopenharmony_ci} 1998eace7efcSopenharmony_ci 1999eace7efcSopenharmony_ciint AbilityManagerStub::ContinueAbilityInner(MessageParcel &data, MessageParcel &reply) 2000eace7efcSopenharmony_ci{ 2001eace7efcSopenharmony_ci std::string deviceId = data.ReadString(); 2002eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2003eace7efcSopenharmony_ci uint32_t versionCode = data.ReadUint32(); 2004eace7efcSopenharmony_ci AAFWK::ContinueRadar::GetInstance().SaveDataContinue("ContinueAbility"); 2005eace7efcSopenharmony_ci int32_t result = ContinueAbility(deviceId, missionId, versionCode); 2006eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2007eace7efcSopenharmony_ci return result; 2008eace7efcSopenharmony_ci} 2009eace7efcSopenharmony_ci 2010eace7efcSopenharmony_ciint AbilityManagerStub::StartContinuationInner(MessageParcel &data, MessageParcel &reply) 2011eace7efcSopenharmony_ci{ 2012eace7efcSopenharmony_ci AAFWK::ContinueRadar::GetInstance().SaveDataRes("GetContentInfo"); 2013eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 2014eace7efcSopenharmony_ci if (want == nullptr) { 2015eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 2016eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2017eace7efcSopenharmony_ci } 2018eace7efcSopenharmony_ci 2019eace7efcSopenharmony_ci sptr<IRemoteObject> abilityToken = data.ReadRemoteObject(); 2020eace7efcSopenharmony_ci if (abilityToken == nullptr) { 2021eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null abilityToken"); 2022eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2023eace7efcSopenharmony_ci } 2024eace7efcSopenharmony_ci int32_t status = data.ReadInt32(); 2025eace7efcSopenharmony_ci int32_t result = StartContinuation(*want, abilityToken, status); 2026eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2027eace7efcSopenharmony_ci 2028eace7efcSopenharmony_ci return result; 2029eace7efcSopenharmony_ci} 2030eace7efcSopenharmony_ci 2031eace7efcSopenharmony_ciint AbilityManagerStub::NotifyCompleteContinuationInner(MessageParcel &data, MessageParcel &reply) 2032eace7efcSopenharmony_ci{ 2033eace7efcSopenharmony_ci std::string devId = data.ReadString(); 2034eace7efcSopenharmony_ci int32_t sessionId = data.ReadInt32(); 2035eace7efcSopenharmony_ci bool isSuccess = data.ReadBool(); 2036eace7efcSopenharmony_ci 2037eace7efcSopenharmony_ci NotifyCompleteContinuation(devId, sessionId, isSuccess); 2038eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "end"); 2039eace7efcSopenharmony_ci return NO_ERROR; 2040eace7efcSopenharmony_ci} 2041eace7efcSopenharmony_ci 2042eace7efcSopenharmony_ciint AbilityManagerStub::NotifyContinuationResultInner(MessageParcel &data, MessageParcel &reply) 2043eace7efcSopenharmony_ci{ 2044eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2045eace7efcSopenharmony_ci int32_t continuationResult = data.ReadInt32(); 2046eace7efcSopenharmony_ci 2047eace7efcSopenharmony_ci int32_t result = NotifyContinuationResult(missionId, continuationResult); 2048eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2049eace7efcSopenharmony_ci return result; 2050eace7efcSopenharmony_ci} 2051eace7efcSopenharmony_ci 2052eace7efcSopenharmony_ciint AbilityManagerStub::LockMissionForCleanupInner(MessageParcel &data, MessageParcel &reply) 2053eace7efcSopenharmony_ci{ 2054eace7efcSopenharmony_ci int32_t id = data.ReadInt32(); 2055eace7efcSopenharmony_ci int result = LockMissionForCleanup(id); 2056eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2057eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "lock mission fail"); 2058eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2059eace7efcSopenharmony_ci } 2060eace7efcSopenharmony_ci return NO_ERROR; 2061eace7efcSopenharmony_ci} 2062eace7efcSopenharmony_ci 2063eace7efcSopenharmony_ciint AbilityManagerStub::UnlockMissionForCleanupInner(MessageParcel &data, MessageParcel &reply) 2064eace7efcSopenharmony_ci{ 2065eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2066eace7efcSopenharmony_ci int32_t id = data.ReadInt32(); 2067eace7efcSopenharmony_ci int result = UnlockMissionForCleanup(id); 2068eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2069eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "unlock mission fail"); 2070eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2071eace7efcSopenharmony_ci } 2072eace7efcSopenharmony_ci return NO_ERROR; 2073eace7efcSopenharmony_ci} 2074eace7efcSopenharmony_ci 2075eace7efcSopenharmony_ciint AbilityManagerStub::SetLockedStateInner(MessageParcel &data, MessageParcel &reply) 2076eace7efcSopenharmony_ci{ 2077eace7efcSopenharmony_ci int32_t sessionId = data.ReadInt32(); 2078eace7efcSopenharmony_ci bool flag = data.ReadBool(); 2079eace7efcSopenharmony_ci SetLockedState(sessionId, flag); 2080eace7efcSopenharmony_ci return NO_ERROR; 2081eace7efcSopenharmony_ci} 2082eace7efcSopenharmony_ci 2083eace7efcSopenharmony_ciint AbilityManagerStub::RegisterMissionListenerInner(MessageParcel &data, MessageParcel &reply) 2084eace7efcSopenharmony_ci{ 2085eace7efcSopenharmony_ci sptr<IMissionListener> listener = iface_cast<IMissionListener>(data.ReadRemoteObject()); 2086eace7efcSopenharmony_ci if (listener == nullptr) { 2087eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2088eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2089eace7efcSopenharmony_ci } 2090eace7efcSopenharmony_ci 2091eace7efcSopenharmony_ci int32_t result = RegisterMissionListener(listener); 2092eace7efcSopenharmony_ci reply.WriteInt32(result); 2093eace7efcSopenharmony_ci return NO_ERROR; 2094eace7efcSopenharmony_ci} 2095eace7efcSopenharmony_ci 2096eace7efcSopenharmony_ciint AbilityManagerStub::UnRegisterMissionListenerInner(MessageParcel &data, MessageParcel &reply) 2097eace7efcSopenharmony_ci{ 2098eace7efcSopenharmony_ci sptr<IMissionListener> listener = iface_cast<IMissionListener>(data.ReadRemoteObject()); 2099eace7efcSopenharmony_ci if (listener == nullptr) { 2100eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2101eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2102eace7efcSopenharmony_ci } 2103eace7efcSopenharmony_ci 2104eace7efcSopenharmony_ci int32_t result = UnRegisterMissionListener(listener); 2105eace7efcSopenharmony_ci reply.WriteInt32(result); 2106eace7efcSopenharmony_ci return NO_ERROR; 2107eace7efcSopenharmony_ci} 2108eace7efcSopenharmony_ci 2109eace7efcSopenharmony_ciint AbilityManagerStub::GetMissionInfosInner(MessageParcel &data, MessageParcel &reply) 2110eace7efcSopenharmony_ci{ 2111eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2112eace7efcSopenharmony_ci std::string deviceId = Str16ToStr8(data.ReadString16()); 2113eace7efcSopenharmony_ci int numMax = data.ReadInt32(); 2114eace7efcSopenharmony_ci std::vector<MissionInfo> missionInfos; 2115eace7efcSopenharmony_ci int32_t result = GetMissionInfos(deviceId, numMax, missionInfos); 2116eace7efcSopenharmony_ci reply.WriteInt32(missionInfos.size()); 2117eace7efcSopenharmony_ci for (auto &it : missionInfos) { 2118eace7efcSopenharmony_ci if (!reply.WriteParcelable(&it)) { 2119eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2120eace7efcSopenharmony_ci } 2121eace7efcSopenharmony_ci } 2122eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2123eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2124eace7efcSopenharmony_ci } 2125eace7efcSopenharmony_ci return result; 2126eace7efcSopenharmony_ci} 2127eace7efcSopenharmony_ci 2128eace7efcSopenharmony_ciint AbilityManagerStub::GetMissionInfoInner(MessageParcel &data, MessageParcel &reply) 2129eace7efcSopenharmony_ci{ 2130eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2131eace7efcSopenharmony_ci MissionInfo info; 2132eace7efcSopenharmony_ci std::string deviceId = Str16ToStr8(data.ReadString16()); 2133eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2134eace7efcSopenharmony_ci int result = GetMissionInfo(deviceId, missionId, info); 2135eace7efcSopenharmony_ci if (!reply.WriteParcelable(&info)) { 2136eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "GetMissionInfo error"); 2137eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2138eace7efcSopenharmony_ci } 2139eace7efcSopenharmony_ci 2140eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2141eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "GetMissionInfo result error"); 2142eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2143eace7efcSopenharmony_ci } 2144eace7efcSopenharmony_ci return NO_ERROR; 2145eace7efcSopenharmony_ci} 2146eace7efcSopenharmony_ci 2147eace7efcSopenharmony_ciint AbilityManagerStub::CleanMissionInner(MessageParcel &data, MessageParcel &reply) 2148eace7efcSopenharmony_ci{ 2149eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2150eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2151eace7efcSopenharmony_ci int result = CleanMission(missionId); 2152eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2153eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "cleanMission fail"); 2154eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2155eace7efcSopenharmony_ci } 2156eace7efcSopenharmony_ci return NO_ERROR; 2157eace7efcSopenharmony_ci} 2158eace7efcSopenharmony_ci 2159eace7efcSopenharmony_ciint AbilityManagerStub::CleanAllMissionsInner(MessageParcel &data, MessageParcel &reply) 2160eace7efcSopenharmony_ci{ 2161eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2162eace7efcSopenharmony_ci int result = CleanAllMissions(); 2163eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2164eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "cleanAllMissions fail"); 2165eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2166eace7efcSopenharmony_ci } 2167eace7efcSopenharmony_ci return NO_ERROR; 2168eace7efcSopenharmony_ci} 2169eace7efcSopenharmony_ci 2170eace7efcSopenharmony_ciint AbilityManagerStub::MoveMissionToFrontInner(MessageParcel &data, MessageParcel &reply) 2171eace7efcSopenharmony_ci{ 2172eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2173eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2174eace7efcSopenharmony_ci int result = MoveMissionToFront(missionId); 2175eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2176eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 2177eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2178eace7efcSopenharmony_ci } 2179eace7efcSopenharmony_ci return NO_ERROR; 2180eace7efcSopenharmony_ci} 2181eace7efcSopenharmony_ci 2182eace7efcSopenharmony_ciint AbilityManagerStub::GetMissionIdByTokenInner(MessageParcel &data, MessageParcel &reply) 2183eace7efcSopenharmony_ci{ 2184eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2185eace7efcSopenharmony_ci int32_t missionId = GetMissionIdByToken(token); 2186eace7efcSopenharmony_ci if (!reply.WriteInt32(missionId)) { 2187eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write missionId fail"); 2188eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2189eace7efcSopenharmony_ci } 2190eace7efcSopenharmony_ci return NO_ERROR; 2191eace7efcSopenharmony_ci} 2192eace7efcSopenharmony_ci 2193eace7efcSopenharmony_ciint AbilityManagerStub::MoveMissionToFrontByOptionsInner(MessageParcel &data, MessageParcel &reply) 2194eace7efcSopenharmony_ci{ 2195eace7efcSopenharmony_ci HITRACE_METER_NAME(HITRACE_TAG_ABILITY_MANAGER, __PRETTY_FUNCTION__); 2196eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2197eace7efcSopenharmony_ci std::unique_ptr<StartOptions> startOptions(data.ReadParcelable<StartOptions>()); 2198eace7efcSopenharmony_ci if (startOptions == nullptr) { 2199eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null"); 2200eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2201eace7efcSopenharmony_ci } 2202eace7efcSopenharmony_ci startOptions->processOptions = nullptr; 2203eace7efcSopenharmony_ci int result = MoveMissionToFront(missionId, *startOptions); 2204eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2205eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "moveMissionToFront fail"); 2206eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2207eace7efcSopenharmony_ci } 2208eace7efcSopenharmony_ci return NO_ERROR; 2209eace7efcSopenharmony_ci} 2210eace7efcSopenharmony_ci 2211eace7efcSopenharmony_ciint AbilityManagerStub::MoveMissionsToForegroundInner(MessageParcel &data, MessageParcel &reply) 2212eace7efcSopenharmony_ci{ 2213eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 2214eace7efcSopenharmony_ci std::vector<int32_t> missionIds; 2215eace7efcSopenharmony_ci data.ReadInt32Vector(&missionIds); 2216eace7efcSopenharmony_ci int32_t topMissionId = data.ReadInt32(); 2217eace7efcSopenharmony_ci int32_t errCode = MoveMissionsToForeground(missionIds, topMissionId); 2218eace7efcSopenharmony_ci if (!reply.WriteInt32(errCode)) { 2219eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2220eace7efcSopenharmony_ci } 2221eace7efcSopenharmony_ci return errCode; 2222eace7efcSopenharmony_ci} 2223eace7efcSopenharmony_ci 2224eace7efcSopenharmony_ciint AbilityManagerStub::MoveMissionsToBackgroundInner(MessageParcel &data, MessageParcel &reply) 2225eace7efcSopenharmony_ci{ 2226eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 2227eace7efcSopenharmony_ci std::vector<int32_t> missionIds; 2228eace7efcSopenharmony_ci std::vector<int32_t> result; 2229eace7efcSopenharmony_ci 2230eace7efcSopenharmony_ci data.ReadInt32Vector(&missionIds); 2231eace7efcSopenharmony_ci int32_t errCode = MoveMissionsToBackground(missionIds, result); 2232eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "%{public}s is called. resultSize: %{public}zu", __func__, result.size()); 2233eace7efcSopenharmony_ci if (!reply.WriteInt32Vector(result)) { 2234eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s call writeInt32Vector fail", __func__); 2235eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2236eace7efcSopenharmony_ci } 2237eace7efcSopenharmony_ci if (!reply.WriteInt32(errCode)) { 2238eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2239eace7efcSopenharmony_ci } 2240eace7efcSopenharmony_ci return NO_ERROR; 2241eace7efcSopenharmony_ci} 2242eace7efcSopenharmony_ci 2243eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityByCallInner(MessageParcel &data, MessageParcel &reply) 2244eace7efcSopenharmony_ci{ 2245eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "AbilityManagerStub::StartAbilityByCallInner begin."); 2246eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 2247eace7efcSopenharmony_ci if (want == nullptr) { 2248eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 2249eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2250eace7efcSopenharmony_ci } 2251eace7efcSopenharmony_ci 2252eace7efcSopenharmony_ci auto callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 2253eace7efcSopenharmony_ci if (callback == nullptr) { 2254eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 2255eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2256eace7efcSopenharmony_ci } 2257eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 2258eace7efcSopenharmony_ci if (data.ReadBool()) { 2259eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 2260eace7efcSopenharmony_ci } 2261eace7efcSopenharmony_ci 2262eace7efcSopenharmony_ci int32_t accountId = data.ReadInt32(); 2263eace7efcSopenharmony_ci int32_t result = StartAbilityByCall(*want, callback, callerToken, accountId); 2264eace7efcSopenharmony_ci 2265eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "resolve call ability ret = %d", result); 2266eace7efcSopenharmony_ci 2267eace7efcSopenharmony_ci reply.WriteInt32(result); 2268eace7efcSopenharmony_ci 2269eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "AbilityManagerStub::StartAbilityByCallInner end."); 2270eace7efcSopenharmony_ci 2271eace7efcSopenharmony_ci return NO_ERROR; 2272eace7efcSopenharmony_ci} 2273eace7efcSopenharmony_ci 2274eace7efcSopenharmony_ciint AbilityManagerStub::StartUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 2275eace7efcSopenharmony_ci{ 2276eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 2277eace7efcSopenharmony_ci if (data.ReadBool()) { 2278eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 2279eace7efcSopenharmony_ci } 2280eace7efcSopenharmony_ci uint32_t sceneFlag = data.ReadUint32(); 2281eace7efcSopenharmony_ci bool isColdStart = false; 2282eace7efcSopenharmony_ci int32_t result = StartUIAbilityBySCB(sessionInfo, isColdStart, sceneFlag); 2283eace7efcSopenharmony_ci reply.WriteBool(isColdStart); 2284eace7efcSopenharmony_ci reply.WriteInt32(result); 2285eace7efcSopenharmony_ci return NO_ERROR; 2286eace7efcSopenharmony_ci} 2287eace7efcSopenharmony_ci 2288eace7efcSopenharmony_ciint AbilityManagerStub::CallRequestDoneInner(MessageParcel &data, MessageParcel &reply) 2289eace7efcSopenharmony_ci{ 2290eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2291eace7efcSopenharmony_ci sptr<IRemoteObject> callStub = data.ReadRemoteObject(); 2292eace7efcSopenharmony_ci CallRequestDone(token, callStub); 2293eace7efcSopenharmony_ci return NO_ERROR; 2294eace7efcSopenharmony_ci} 2295eace7efcSopenharmony_ci 2296eace7efcSopenharmony_ciint AbilityManagerStub::ReleaseCallInner(MessageParcel &data, MessageParcel &reply) 2297eace7efcSopenharmony_ci{ 2298eace7efcSopenharmony_ci auto callback = iface_cast<IAbilityConnection>(data.ReadRemoteObject()); 2299eace7efcSopenharmony_ci if (callback == nullptr) { 2300eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 2301eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2302eace7efcSopenharmony_ci } 2303eace7efcSopenharmony_ci 2304eace7efcSopenharmony_ci std::unique_ptr<AppExecFwk::ElementName> element(data.ReadParcelable<AppExecFwk::ElementName>()); 2305eace7efcSopenharmony_ci if (element == nullptr) { 2306eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "receive null"); 2307eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2308eace7efcSopenharmony_ci } 2309eace7efcSopenharmony_ci int32_t result = ReleaseCall(callback, *element); 2310eace7efcSopenharmony_ci 2311eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "release call ability ret = %d", result); 2312eace7efcSopenharmony_ci 2313eace7efcSopenharmony_ci reply.WriteInt32(result); 2314eace7efcSopenharmony_ci 2315eace7efcSopenharmony_ci return NO_ERROR; 2316eace7efcSopenharmony_ci} 2317eace7efcSopenharmony_ci 2318eace7efcSopenharmony_ciint AbilityManagerStub::StartUserInner(MessageParcel &data, MessageParcel &reply) 2319eace7efcSopenharmony_ci{ 2320eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 2321eace7efcSopenharmony_ci sptr<IUserCallback> callback = nullptr; 2322eace7efcSopenharmony_ci if (data.ReadBool()) { 2323eace7efcSopenharmony_ci callback = iface_cast<IUserCallback>(data.ReadRemoteObject()); 2324eace7efcSopenharmony_ci } else { 2325eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback invalid value"); 2326eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2327eace7efcSopenharmony_ci } 2328eace7efcSopenharmony_ci bool isAppRecovery = data.ReadBool(); 2329eace7efcSopenharmony_ci int result = StartUser(userId, callback, isAppRecovery); 2330eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2331eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startUser fail"); 2332eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2333eace7efcSopenharmony_ci } 2334eace7efcSopenharmony_ci return NO_ERROR; 2335eace7efcSopenharmony_ci} 2336eace7efcSopenharmony_ci 2337eace7efcSopenharmony_ciint AbilityManagerStub::StopUserInner(MessageParcel &data, MessageParcel &reply) 2338eace7efcSopenharmony_ci{ 2339eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 2340eace7efcSopenharmony_ci sptr<IUserCallback> callback = nullptr; 2341eace7efcSopenharmony_ci if (data.ReadBool()) { 2342eace7efcSopenharmony_ci callback = iface_cast<IUserCallback>(data.ReadRemoteObject()); 2343eace7efcSopenharmony_ci } 2344eace7efcSopenharmony_ci int result = StopUser(userId, callback); 2345eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2346eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "stopUser fail"); 2347eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2348eace7efcSopenharmony_ci } 2349eace7efcSopenharmony_ci return NO_ERROR; 2350eace7efcSopenharmony_ci} 2351eace7efcSopenharmony_ci 2352eace7efcSopenharmony_ciint AbilityManagerStub::LogoutUserInner(MessageParcel &data, MessageParcel &reply) 2353eace7efcSopenharmony_ci{ 2354eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 2355eace7efcSopenharmony_ci int result = LogoutUser(userId); 2356eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2357eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "logoutUser fail"); 2358eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2359eace7efcSopenharmony_ci } 2360eace7efcSopenharmony_ci return NO_ERROR; 2361eace7efcSopenharmony_ci} 2362eace7efcSopenharmony_ci 2363eace7efcSopenharmony_ciint AbilityManagerStub::GetAbilityRunningInfosInner(MessageParcel &data, MessageParcel &reply) 2364eace7efcSopenharmony_ci{ 2365eace7efcSopenharmony_ci std::vector<AbilityRunningInfo> abilityRunningInfos; 2366eace7efcSopenharmony_ci auto result = GetAbilityRunningInfos(abilityRunningInfos); 2367eace7efcSopenharmony_ci reply.WriteInt32(abilityRunningInfos.size()); 2368eace7efcSopenharmony_ci for (auto &it : abilityRunningInfos) { 2369eace7efcSopenharmony_ci if (!reply.WriteParcelable(&it)) { 2370eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2371eace7efcSopenharmony_ci } 2372eace7efcSopenharmony_ci } 2373eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2374eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2375eace7efcSopenharmony_ci } 2376eace7efcSopenharmony_ci return result; 2377eace7efcSopenharmony_ci} 2378eace7efcSopenharmony_ci 2379eace7efcSopenharmony_ciint AbilityManagerStub::GetExtensionRunningInfosInner(MessageParcel &data, MessageParcel &reply) 2380eace7efcSopenharmony_ci{ 2381eace7efcSopenharmony_ci auto upperLimit = data.ReadInt32(); 2382eace7efcSopenharmony_ci std::vector<ExtensionRunningInfo> infos; 2383eace7efcSopenharmony_ci auto result = GetExtensionRunningInfos(upperLimit, infos); 2384eace7efcSopenharmony_ci reply.WriteInt32(infos.size()); 2385eace7efcSopenharmony_ci for (auto &it : infos) { 2386eace7efcSopenharmony_ci if (!reply.WriteParcelable(&it)) { 2387eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2388eace7efcSopenharmony_ci } 2389eace7efcSopenharmony_ci } 2390eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2391eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2392eace7efcSopenharmony_ci } 2393eace7efcSopenharmony_ci return result; 2394eace7efcSopenharmony_ci} 2395eace7efcSopenharmony_ci 2396eace7efcSopenharmony_ciint AbilityManagerStub::GetProcessRunningInfosInner(MessageParcel &data, MessageParcel &reply) 2397eace7efcSopenharmony_ci{ 2398eace7efcSopenharmony_ci std::vector<AppExecFwk::RunningProcessInfo> infos; 2399eace7efcSopenharmony_ci auto result = GetProcessRunningInfos(infos); 2400eace7efcSopenharmony_ci reply.WriteInt32(infos.size()); 2401eace7efcSopenharmony_ci for (auto &it : infos) { 2402eace7efcSopenharmony_ci if (!reply.WriteParcelable(&it)) { 2403eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2404eace7efcSopenharmony_ci } 2405eace7efcSopenharmony_ci } 2406eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2407eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2408eace7efcSopenharmony_ci } 2409eace7efcSopenharmony_ci return NO_ERROR; 2410eace7efcSopenharmony_ci} 2411eace7efcSopenharmony_ci 2412eace7efcSopenharmony_ciint AbilityManagerStub::StartSyncRemoteMissionsInner(MessageParcel &data, MessageParcel &reply) 2413eace7efcSopenharmony_ci{ 2414eace7efcSopenharmony_ci std::string deviceId = data.ReadString(); 2415eace7efcSopenharmony_ci bool fixConflict = data.ReadBool(); 2416eace7efcSopenharmony_ci int64_t tag = data.ReadInt64(); 2417eace7efcSopenharmony_ci int result = StartSyncRemoteMissions(deviceId, fixConflict, tag); 2418eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2419eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "fail"); 2420eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2421eace7efcSopenharmony_ci } 2422eace7efcSopenharmony_ci return NO_ERROR; 2423eace7efcSopenharmony_ci} 2424eace7efcSopenharmony_ci 2425eace7efcSopenharmony_ciint AbilityManagerStub::StopSyncRemoteMissionsInner(MessageParcel &data, MessageParcel &reply) 2426eace7efcSopenharmony_ci{ 2427eace7efcSopenharmony_ci int result = StopSyncRemoteMissions(data.ReadString()); 2428eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2429eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "fail"); 2430eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2431eace7efcSopenharmony_ci } 2432eace7efcSopenharmony_ci return NO_ERROR; 2433eace7efcSopenharmony_ci} 2434eace7efcSopenharmony_ci 2435eace7efcSopenharmony_ciint AbilityManagerStub::RegisterRemoteMissionListenerInner(MessageParcel &data, MessageParcel &reply) 2436eace7efcSopenharmony_ci{ 2437eace7efcSopenharmony_ci std::string deviceId = data.ReadString(); 2438eace7efcSopenharmony_ci if (deviceId.empty()) { 2439eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "deviceId empty"); 2440eace7efcSopenharmony_ci return INVALID_PARAMETERS_ERR; 2441eace7efcSopenharmony_ci } 2442eace7efcSopenharmony_ci sptr<IRemoteMissionListener> listener = iface_cast<IRemoteMissionListener>(data.ReadRemoteObject()); 2443eace7efcSopenharmony_ci if (listener == nullptr) { 2444eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2445eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2446eace7efcSopenharmony_ci } 2447eace7efcSopenharmony_ci int32_t result = RegisterMissionListener(deviceId, listener); 2448eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", 2449eace7efcSopenharmony_ci result); 2450eace7efcSopenharmony_ci return result; 2451eace7efcSopenharmony_ci} 2452eace7efcSopenharmony_ci 2453eace7efcSopenharmony_ciint AbilityManagerStub::RegisterRemoteOnListenerInner(MessageParcel &data, MessageParcel &reply) 2454eace7efcSopenharmony_ci{ 2455eace7efcSopenharmony_ci std::string type = data.ReadString(); 2456eace7efcSopenharmony_ci if (type.empty()) { 2457eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "type empty"); 2458eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2459eace7efcSopenharmony_ci } 2460eace7efcSopenharmony_ci sptr<IRemoteOnListener> listener = iface_cast<IRemoteOnListener>(data.ReadRemoteObject()); 2461eace7efcSopenharmony_ci if (listener == nullptr) { 2462eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2463eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2464eace7efcSopenharmony_ci } 2465eace7efcSopenharmony_ci int32_t result = RegisterOnListener(type, listener); 2466eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2467eace7efcSopenharmony_ci return result; 2468eace7efcSopenharmony_ci} 2469eace7efcSopenharmony_ci 2470eace7efcSopenharmony_ciint AbilityManagerStub::RegisterRemoteOffListenerInner(MessageParcel &data, MessageParcel &reply) 2471eace7efcSopenharmony_ci{ 2472eace7efcSopenharmony_ci std::string type = data.ReadString(); 2473eace7efcSopenharmony_ci if (type.empty()) { 2474eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "type empty"); 2475eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2476eace7efcSopenharmony_ci } 2477eace7efcSopenharmony_ci sptr<IRemoteOnListener> listener = iface_cast<IRemoteOnListener>(data.ReadRemoteObject()); 2478eace7efcSopenharmony_ci if (listener == nullptr) { 2479eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2480eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2481eace7efcSopenharmony_ci } 2482eace7efcSopenharmony_ci int32_t result = RegisterOffListener(type, listener); 2483eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2484eace7efcSopenharmony_ci return result; 2485eace7efcSopenharmony_ci} 2486eace7efcSopenharmony_ci 2487eace7efcSopenharmony_ciint AbilityManagerStub::UnRegisterRemoteMissionListenerInner(MessageParcel &data, MessageParcel &reply) 2488eace7efcSopenharmony_ci{ 2489eace7efcSopenharmony_ci std::string deviceId = data.ReadString(); 2490eace7efcSopenharmony_ci if (deviceId.empty()) { 2491eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "deviceId empty"); 2492eace7efcSopenharmony_ci return INVALID_PARAMETERS_ERR; 2493eace7efcSopenharmony_ci } 2494eace7efcSopenharmony_ci sptr<IRemoteMissionListener> listener = iface_cast<IRemoteMissionListener>(data.ReadRemoteObject()); 2495eace7efcSopenharmony_ci if (listener == nullptr) { 2496eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null listener"); 2497eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2498eace7efcSopenharmony_ci } 2499eace7efcSopenharmony_ci int32_t result = UnRegisterMissionListener(deviceId, listener); 2500eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", 2501eace7efcSopenharmony_ci result); 2502eace7efcSopenharmony_ci return result; 2503eace7efcSopenharmony_ci} 2504eace7efcSopenharmony_ci 2505eace7efcSopenharmony_ciint AbilityManagerStub::RegisterSnapshotHandlerInner(MessageParcel &data, MessageParcel &reply) 2506eace7efcSopenharmony_ci{ 2507eace7efcSopenharmony_ci sptr<ISnapshotHandler> handler = iface_cast<ISnapshotHandler>(data.ReadRemoteObject()); 2508eace7efcSopenharmony_ci if (handler == nullptr) { 2509eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null handler"); 2510eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2511eace7efcSopenharmony_ci } 2512eace7efcSopenharmony_ci int32_t result = RegisterSnapshotHandler(handler); 2513eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", 2514eace7efcSopenharmony_ci result); 2515eace7efcSopenharmony_ci return result; 2516eace7efcSopenharmony_ci} 2517eace7efcSopenharmony_ci 2518eace7efcSopenharmony_ciint AbilityManagerStub::GetMissionSnapshotInfoInner(MessageParcel &data, MessageParcel &reply) 2519eace7efcSopenharmony_ci{ 2520eace7efcSopenharmony_ci std::string deviceId = data.ReadString(); 2521eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2522eace7efcSopenharmony_ci bool isLowResolution = data.ReadBool(); 2523eace7efcSopenharmony_ci MissionSnapshot missionSnapshot; 2524eace7efcSopenharmony_ci int32_t result = GetMissionSnapshot(deviceId, missionId, missionSnapshot, isLowResolution); 2525eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2526eace7efcSopenharmony_ci if (!reply.WriteParcelable(&missionSnapshot)) { 2527eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "GetMissionSnapshot error"); 2528eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2529eace7efcSopenharmony_ci } 2530eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2531eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "GetMissionSnapshot result error"); 2532eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2533eace7efcSopenharmony_ci } 2534eace7efcSopenharmony_ci return NO_ERROR; 2535eace7efcSopenharmony_ci} 2536eace7efcSopenharmony_ci 2537eace7efcSopenharmony_ciint AbilityManagerStub::SetAbilityControllerInner(MessageParcel &data, MessageParcel &reply) 2538eace7efcSopenharmony_ci{ 2539eace7efcSopenharmony_ci sptr<AppExecFwk::IAbilityController> controller = 2540eace7efcSopenharmony_ci iface_cast<AppExecFwk::IAbilityController>(data.ReadRemoteObject()); 2541eace7efcSopenharmony_ci if (controller == nullptr) { 2542eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null controller"); 2543eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2544eace7efcSopenharmony_ci } 2545eace7efcSopenharmony_ci bool imAStabilityTest = data.ReadBool(); 2546eace7efcSopenharmony_ci int32_t result = SetAbilityController(controller, imAStabilityTest); 2547eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2548eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2549eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "fail"); 2550eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2551eace7efcSopenharmony_ci } 2552eace7efcSopenharmony_ci return NO_ERROR; 2553eace7efcSopenharmony_ci} 2554eace7efcSopenharmony_ci 2555eace7efcSopenharmony_ciint AbilityManagerStub::IsRunningInStabilityTestInner(MessageParcel &data, MessageParcel &reply) 2556eace7efcSopenharmony_ci{ 2557eace7efcSopenharmony_ci bool result = IsRunningInStabilityTest(); 2558eace7efcSopenharmony_ci TAG_LOGI(AAFwkTag::ABILITYMGR, "result=%{public}d", result); 2559eace7efcSopenharmony_ci if (!reply.WriteBool(result)) { 2560eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "fail"); 2561eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2562eace7efcSopenharmony_ci } 2563eace7efcSopenharmony_ci return NO_ERROR; 2564eace7efcSopenharmony_ci} 2565eace7efcSopenharmony_ci 2566eace7efcSopenharmony_ciint AbilityManagerStub::StartUserTestInner(MessageParcel &data, MessageParcel &reply) 2567eace7efcSopenharmony_ci{ 2568eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 2569eace7efcSopenharmony_ci if (want == nullptr) { 2570eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 2571eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2572eace7efcSopenharmony_ci } 2573eace7efcSopenharmony_ci auto observer = data.ReadRemoteObject(); 2574eace7efcSopenharmony_ci int32_t result = StartUserTest(*want, observer); 2575eace7efcSopenharmony_ci reply.WriteInt32(result); 2576eace7efcSopenharmony_ci return result; 2577eace7efcSopenharmony_ci} 2578eace7efcSopenharmony_ci 2579eace7efcSopenharmony_ciint AbilityManagerStub::FinishUserTestInner(MessageParcel &data, MessageParcel &reply) 2580eace7efcSopenharmony_ci{ 2581eace7efcSopenharmony_ci std::string msg = data.ReadString(); 2582eace7efcSopenharmony_ci int64_t resultCode = data.ReadInt64(); 2583eace7efcSopenharmony_ci std::string bundleName = data.ReadString(); 2584eace7efcSopenharmony_ci int32_t result = FinishUserTest(msg, resultCode, bundleName); 2585eace7efcSopenharmony_ci reply.WriteInt32(result); 2586eace7efcSopenharmony_ci return result; 2587eace7efcSopenharmony_ci} 2588eace7efcSopenharmony_ci 2589eace7efcSopenharmony_ciint AbilityManagerStub::GetTopAbilityTokenInner(MessageParcel &data, MessageParcel &reply) 2590eace7efcSopenharmony_ci{ 2591eace7efcSopenharmony_ci sptr<IRemoteObject> token; 2592eace7efcSopenharmony_ci auto result = GetTopAbility(token); 2593eace7efcSopenharmony_ci if (!reply.WriteRemoteObject(token)) { 2594eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "data write fail"); 2595eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2596eace7efcSopenharmony_ci } 2597eace7efcSopenharmony_ci reply.WriteInt32(result); 2598eace7efcSopenharmony_ci 2599eace7efcSopenharmony_ci return NO_ERROR; 2600eace7efcSopenharmony_ci} 2601eace7efcSopenharmony_ci 2602eace7efcSopenharmony_ciint AbilityManagerStub::CheckUIExtensionIsFocusedInner(MessageParcel &data, MessageParcel &reply) 2603eace7efcSopenharmony_ci{ 2604eace7efcSopenharmony_ci uint32_t uiExtensionTokenId = data.ReadUint32(); 2605eace7efcSopenharmony_ci bool isFocused = false; 2606eace7efcSopenharmony_ci auto result = CheckUIExtensionIsFocused(uiExtensionTokenId, isFocused); 2607eace7efcSopenharmony_ci if (result == ERR_OK) { 2608eace7efcSopenharmony_ci if (!reply.WriteBool(isFocused)) { 2609eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2610eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2611eace7efcSopenharmony_ci } 2612eace7efcSopenharmony_ci } 2613eace7efcSopenharmony_ci return result; 2614eace7efcSopenharmony_ci} 2615eace7efcSopenharmony_ci 2616eace7efcSopenharmony_ciint AbilityManagerStub::DelegatorDoAbilityForegroundInner(MessageParcel &data, MessageParcel &reply) 2617eace7efcSopenharmony_ci{ 2618eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2619eace7efcSopenharmony_ci auto result = DelegatorDoAbilityForeground(token); 2620eace7efcSopenharmony_ci reply.WriteInt32(result); 2621eace7efcSopenharmony_ci 2622eace7efcSopenharmony_ci return NO_ERROR; 2623eace7efcSopenharmony_ci} 2624eace7efcSopenharmony_ci 2625eace7efcSopenharmony_ciint AbilityManagerStub::DelegatorDoAbilityBackgroundInner(MessageParcel &data, MessageParcel &reply) 2626eace7efcSopenharmony_ci{ 2627eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2628eace7efcSopenharmony_ci auto result = DelegatorDoAbilityBackground(token); 2629eace7efcSopenharmony_ci reply.WriteInt32(result); 2630eace7efcSopenharmony_ci return NO_ERROR; 2631eace7efcSopenharmony_ci} 2632eace7efcSopenharmony_ci 2633eace7efcSopenharmony_ciint AbilityManagerStub::DoAbilityForeground(const sptr<IRemoteObject> &token, uint32_t flag) 2634eace7efcSopenharmony_ci{ 2635eace7efcSopenharmony_ci return 0; 2636eace7efcSopenharmony_ci} 2637eace7efcSopenharmony_ci 2638eace7efcSopenharmony_ciint AbilityManagerStub::DoAbilityBackground(const sptr<IRemoteObject> &token, uint32_t flag) 2639eace7efcSopenharmony_ci{ 2640eace7efcSopenharmony_ci return 0; 2641eace7efcSopenharmony_ci} 2642eace7efcSopenharmony_ci 2643eace7efcSopenharmony_ciint AbilityManagerStub::DoAbilityForegroundInner(MessageParcel &data, MessageParcel &reply) 2644eace7efcSopenharmony_ci{ 2645eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2646eace7efcSopenharmony_ci uint32_t flag = data.ReadUint32(); 2647eace7efcSopenharmony_ci auto result = DoAbilityForeground(token, flag); 2648eace7efcSopenharmony_ci reply.WriteInt32(result); 2649eace7efcSopenharmony_ci 2650eace7efcSopenharmony_ci return NO_ERROR; 2651eace7efcSopenharmony_ci} 2652eace7efcSopenharmony_ci 2653eace7efcSopenharmony_ciint AbilityManagerStub::DoAbilityBackgroundInner(MessageParcel &data, MessageParcel &reply) 2654eace7efcSopenharmony_ci{ 2655eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2656eace7efcSopenharmony_ci uint32_t flag = data.ReadUint32(); 2657eace7efcSopenharmony_ci auto result = DoAbilityBackground(token, flag); 2658eace7efcSopenharmony_ci reply.WriteInt32(result); 2659eace7efcSopenharmony_ci return NO_ERROR; 2660eace7efcSopenharmony_ci} 2661eace7efcSopenharmony_ci 2662eace7efcSopenharmony_ciint AbilityManagerStub::RegisterObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer) 2663eace7efcSopenharmony_ci{ 2664eace7efcSopenharmony_ci // should implement in child. 2665eace7efcSopenharmony_ci return NO_ERROR; 2666eace7efcSopenharmony_ci} 2667eace7efcSopenharmony_ci 2668eace7efcSopenharmony_ciint AbilityManagerStub::UnregisterObserver(const sptr<AbilityRuntime::IConnectionObserver> &observer) 2669eace7efcSopenharmony_ci{ 2670eace7efcSopenharmony_ci // should implement in child 2671eace7efcSopenharmony_ci return NO_ERROR; 2672eace7efcSopenharmony_ci} 2673eace7efcSopenharmony_ci 2674eace7efcSopenharmony_ci#ifdef WITH_DLP 2675eace7efcSopenharmony_ciint AbilityManagerStub::GetDlpConnectionInfos(std::vector<AbilityRuntime::DlpConnectionInfo> &infos) 2676eace7efcSopenharmony_ci{ 2677eace7efcSopenharmony_ci // should implement in child 2678eace7efcSopenharmony_ci return NO_ERROR; 2679eace7efcSopenharmony_ci} 2680eace7efcSopenharmony_ci#endif // WITH_DLP 2681eace7efcSopenharmony_ci 2682eace7efcSopenharmony_ciint AbilityManagerStub::GetConnectionData(std::vector<AbilityRuntime::ConnectionData> &infos) 2683eace7efcSopenharmony_ci{ 2684eace7efcSopenharmony_ci // should implement in child 2685eace7efcSopenharmony_ci return NO_ERROR; 2686eace7efcSopenharmony_ci} 2687eace7efcSopenharmony_ci 2688eace7efcSopenharmony_ci#ifdef ABILITY_COMMAND_FOR_TEST 2689eace7efcSopenharmony_ciint AbilityManagerStub::ForceTimeoutForTestInner(MessageParcel &data, MessageParcel &reply) 2690eace7efcSopenharmony_ci{ 2691eace7efcSopenharmony_ci std::string abilityName = Str16ToStr8(data.ReadString16()); 2692eace7efcSopenharmony_ci std::string state = Str16ToStr8(data.ReadString16()); 2693eace7efcSopenharmony_ci int result = ForceTimeoutForTest(abilityName, state); 2694eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2695eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "force ability timeout error"); 2696eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2697eace7efcSopenharmony_ci } 2698eace7efcSopenharmony_ci return NO_ERROR; 2699eace7efcSopenharmony_ci} 2700eace7efcSopenharmony_ci#endif 2701eace7efcSopenharmony_ci 2702eace7efcSopenharmony_ciint AbilityManagerStub::FreeInstallAbilityFromRemoteInner(MessageParcel &data, MessageParcel &reply) 2703eace7efcSopenharmony_ci{ 2704eace7efcSopenharmony_ci std::unique_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>()); 2705eace7efcSopenharmony_ci if (want == nullptr) { 2706eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 2707eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2708eace7efcSopenharmony_ci } 2709eace7efcSopenharmony_ci want->SetParam(FROM_REMOTE_KEY, true); 2710eace7efcSopenharmony_ci 2711eace7efcSopenharmony_ci auto callback = data.ReadRemoteObject(); 2712eace7efcSopenharmony_ci if (callback == nullptr) { 2713eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 2714eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2715eace7efcSopenharmony_ci } 2716eace7efcSopenharmony_ci 2717eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 2718eace7efcSopenharmony_ci int32_t requestCode = data.ReadInt32(); 2719eace7efcSopenharmony_ci int32_t result = FreeInstallAbilityFromRemote(*want, callback, userId, requestCode); 2720eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2721eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2722eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2723eace7efcSopenharmony_ci } 2724eace7efcSopenharmony_ci return NO_ERROR; 2725eace7efcSopenharmony_ci} 2726eace7efcSopenharmony_ci 2727eace7efcSopenharmony_ciint AbilityManagerStub::AddFreeInstallObserverInner(MessageParcel &data, MessageParcel &reply) 2728eace7efcSopenharmony_ci{ 2729eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 2730eace7efcSopenharmony_ci if (data.ReadBool()) { 2731eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 2732eace7efcSopenharmony_ci if (callerToken == nullptr) { 2733eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null callerToken"); 2734eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2735eace7efcSopenharmony_ci } 2736eace7efcSopenharmony_ci } 2737eace7efcSopenharmony_ci sptr<AbilityRuntime::IFreeInstallObserver> observer = 2738eace7efcSopenharmony_ci iface_cast<AbilityRuntime::IFreeInstallObserver>(data.ReadRemoteObject()); 2739eace7efcSopenharmony_ci if (observer == nullptr) { 2740eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "observer null"); 2741eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2742eace7efcSopenharmony_ci } 2743eace7efcSopenharmony_ci int32_t result = AddFreeInstallObserver(callerToken, observer); 2744eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2745eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2746eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2747eace7efcSopenharmony_ci } 2748eace7efcSopenharmony_ci return NO_ERROR; 2749eace7efcSopenharmony_ci} 2750eace7efcSopenharmony_ci 2751eace7efcSopenharmony_ciint AbilityManagerStub::DumpAbilityInfoDoneInner(MessageParcel &data, MessageParcel &reply) 2752eace7efcSopenharmony_ci{ 2753eace7efcSopenharmony_ci std::vector<std::string> infos; 2754eace7efcSopenharmony_ci data.ReadStringVector(&infos); 2755eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 2756eace7efcSopenharmony_ci int32_t result = DumpAbilityInfoDone(infos, callerToken); 2757eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2758eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2759eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2760eace7efcSopenharmony_ci } 2761eace7efcSopenharmony_ci return NO_ERROR; 2762eace7efcSopenharmony_ci} 2763eace7efcSopenharmony_ci 2764eace7efcSopenharmony_ciint AbilityManagerStub::UpdateMissionSnapShotFromWMSInner(MessageParcel &data, MessageParcel &reply) 2765eace7efcSopenharmony_ci{ 2766eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2767eace7efcSopenharmony_ci if (token == nullptr) { 2768eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null token"); 2769eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2770eace7efcSopenharmony_ci } 2771eace7efcSopenharmony_ci#ifdef SUPPORT_SCREEN 2772eace7efcSopenharmony_ci std::shared_ptr<Media::PixelMap> pixelMap(data.ReadParcelable<Media::PixelMap>()); 2773eace7efcSopenharmony_ci if (pixelMap == nullptr) { 2774eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null pixelMap"); 2775eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2776eace7efcSopenharmony_ci } 2777eace7efcSopenharmony_ci UpdateMissionSnapShot(token, pixelMap); 2778eace7efcSopenharmony_ci#endif // SUPPORT_SCREEN 2779eace7efcSopenharmony_ci return NO_ERROR; 2780eace7efcSopenharmony_ci} 2781eace7efcSopenharmony_ci 2782eace7efcSopenharmony_ciint AbilityManagerStub::EnableRecoverAbilityInner(MessageParcel &data, MessageParcel &reply) 2783eace7efcSopenharmony_ci{ 2784eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2785eace7efcSopenharmony_ci if (!token) { 2786eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 2787eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2788eace7efcSopenharmony_ci } 2789eace7efcSopenharmony_ci EnableRecoverAbility(token); 2790eace7efcSopenharmony_ci return NO_ERROR; 2791eace7efcSopenharmony_ci} 2792eace7efcSopenharmony_ci 2793eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleClearRecoveryPageStackInner(MessageParcel &data, MessageParcel &reply) 2794eace7efcSopenharmony_ci{ 2795eace7efcSopenharmony_ci ScheduleClearRecoveryPageStack(); 2796eace7efcSopenharmony_ci return NO_ERROR; 2797eace7efcSopenharmony_ci} 2798eace7efcSopenharmony_ci 2799eace7efcSopenharmony_ciint AbilityManagerStub::SubmitSaveRecoveryInfoInner(MessageParcel &data, MessageParcel &reply) 2800eace7efcSopenharmony_ci{ 2801eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2802eace7efcSopenharmony_ci if (!token) { 2803eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 2804eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2805eace7efcSopenharmony_ci } 2806eace7efcSopenharmony_ci SubmitSaveRecoveryInfo(token); 2807eace7efcSopenharmony_ci return NO_ERROR; 2808eace7efcSopenharmony_ci} 2809eace7efcSopenharmony_ci 2810eace7efcSopenharmony_ciint AbilityManagerStub::HandleRequestDialogService(MessageParcel &data, MessageParcel &reply) 2811eace7efcSopenharmony_ci{ 2812eace7efcSopenharmony_ci std::unique_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>()); 2813eace7efcSopenharmony_ci if (want == nullptr) { 2814eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 2815eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2816eace7efcSopenharmony_ci } 2817eace7efcSopenharmony_ci 2818eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 2819eace7efcSopenharmony_ci if (!callerToken) { 2820eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken invalid"); 2821eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2822eace7efcSopenharmony_ci } 2823eace7efcSopenharmony_ci 2824eace7efcSopenharmony_ci int32_t result = RequestDialogService(*want, callerToken); 2825eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2826eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2827eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2828eace7efcSopenharmony_ci } 2829eace7efcSopenharmony_ci return NO_ERROR; 2830eace7efcSopenharmony_ci} 2831eace7efcSopenharmony_ci 2832eace7efcSopenharmony_ciint32_t AbilityManagerStub::HandleReportDrawnCompleted(MessageParcel &data, MessageParcel &reply) 2833eace7efcSopenharmony_ci{ 2834eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 2835eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 2836eace7efcSopenharmony_ci if (callerToken == nullptr) { 2837eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null callerToken"); 2838eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2839eace7efcSopenharmony_ci } 2840eace7efcSopenharmony_ci 2841eace7efcSopenharmony_ci auto result = ReportDrawnCompleted(callerToken); 2842eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2843eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2844eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2845eace7efcSopenharmony_ci } 2846eace7efcSopenharmony_ci return NO_ERROR; 2847eace7efcSopenharmony_ci} 2848eace7efcSopenharmony_ci 2849eace7efcSopenharmony_ciint AbilityManagerStub::AcquireShareDataInner(MessageParcel &data, MessageParcel &reply) 2850eace7efcSopenharmony_ci{ 2851eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 2852eace7efcSopenharmony_ci sptr<IAcquireShareDataCallback> shareData = iface_cast<IAcquireShareDataCallback>(data.ReadRemoteObject()); 2853eace7efcSopenharmony_ci if (!shareData) { 2854eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null shareData"); 2855eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2856eace7efcSopenharmony_ci } 2857eace7efcSopenharmony_ci int32_t result = AcquireShareData(missionId, shareData); 2858eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2859eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2860eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2861eace7efcSopenharmony_ci } 2862eace7efcSopenharmony_ci return NO_ERROR; 2863eace7efcSopenharmony_ci} 2864eace7efcSopenharmony_ci 2865eace7efcSopenharmony_ciint AbilityManagerStub::ShareDataDoneInner(MessageParcel &data, MessageParcel &reply) 2866eace7efcSopenharmony_ci{ 2867eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2868eace7efcSopenharmony_ci if (!token) { 2869eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 2870eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2871eace7efcSopenharmony_ci } 2872eace7efcSopenharmony_ci int32_t resultCode = data.ReadInt32(); 2873eace7efcSopenharmony_ci int32_t uniqueId = data.ReadInt32(); 2874eace7efcSopenharmony_ci std::shared_ptr<WantParams> wantParam(data.ReadParcelable<WantParams>()); 2875eace7efcSopenharmony_ci if (!wantParam) { 2876eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "wantParam read fail"); 2877eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2878eace7efcSopenharmony_ci } 2879eace7efcSopenharmony_ci int32_t result = ShareDataDone(token, resultCode, uniqueId, *wantParam); 2880eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2881eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 2882eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2883eace7efcSopenharmony_ci } 2884eace7efcSopenharmony_ci return NO_ERROR; 2885eace7efcSopenharmony_ci} 2886eace7efcSopenharmony_ci 2887eace7efcSopenharmony_ciint AbilityManagerStub::GetAbilityTokenByCalleeObjInner(MessageParcel &data, MessageParcel &reply) 2888eace7efcSopenharmony_ci{ 2889eace7efcSopenharmony_ci sptr<IRemoteObject> callStub = data.ReadRemoteObject(); 2890eace7efcSopenharmony_ci if (!callStub) { 2891eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read call stub fail"); 2892eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2893eace7efcSopenharmony_ci } 2894eace7efcSopenharmony_ci sptr<IRemoteObject> result; 2895eace7efcSopenharmony_ci GetAbilityTokenByCalleeObj(callStub, result); 2896eace7efcSopenharmony_ci reply.WriteRemoteObject(result); 2897eace7efcSopenharmony_ci return NO_ERROR; 2898eace7efcSopenharmony_ci} 2899eace7efcSopenharmony_ci 2900eace7efcSopenharmony_ciint AbilityManagerStub::ScheduleRecoverAbilityInner(MessageParcel &data, MessageParcel &reply) 2901eace7efcSopenharmony_ci{ 2902eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2903eace7efcSopenharmony_ci if (!token) { 2904eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 2905eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2906eace7efcSopenharmony_ci } 2907eace7efcSopenharmony_ci 2908eace7efcSopenharmony_ci int reason = data.ReadInt32(); 2909eace7efcSopenharmony_ci Want *want = data.ReadParcelable<Want>(); 2910eace7efcSopenharmony_ci ScheduleRecoverAbility(token, reason, want); 2911eace7efcSopenharmony_ci if (want != nullptr) { 2912eace7efcSopenharmony_ci delete want; 2913eace7efcSopenharmony_ci } 2914eace7efcSopenharmony_ci return NO_ERROR; 2915eace7efcSopenharmony_ci} 2916eace7efcSopenharmony_ci 2917eace7efcSopenharmony_ciint AbilityManagerStub::RegisterConnectionObserverInner(MessageParcel &data, MessageParcel &reply) 2918eace7efcSopenharmony_ci{ 2919eace7efcSopenharmony_ci sptr<AbilityRuntime::IConnectionObserver> observer = iface_cast<AbilityRuntime::IConnectionObserver>( 2920eace7efcSopenharmony_ci data.ReadRemoteObject()); 2921eace7efcSopenharmony_ci if (!observer) { 2922eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read observer fail"); 2923eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2924eace7efcSopenharmony_ci } 2925eace7efcSopenharmony_ci 2926eace7efcSopenharmony_ci return RegisterObserver(observer); 2927eace7efcSopenharmony_ci} 2928eace7efcSopenharmony_ci 2929eace7efcSopenharmony_ciint AbilityManagerStub::UnregisterConnectionObserverInner(MessageParcel &data, MessageParcel &reply) 2930eace7efcSopenharmony_ci{ 2931eace7efcSopenharmony_ci sptr<AbilityRuntime::IConnectionObserver> observer = iface_cast<AbilityRuntime::IConnectionObserver>( 2932eace7efcSopenharmony_ci data.ReadRemoteObject()); 2933eace7efcSopenharmony_ci if (!observer) { 2934eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read observer fail"); 2935eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2936eace7efcSopenharmony_ci } 2937eace7efcSopenharmony_ci 2938eace7efcSopenharmony_ci return UnregisterObserver(observer); 2939eace7efcSopenharmony_ci} 2940eace7efcSopenharmony_ci 2941eace7efcSopenharmony_ci#ifdef WITH_DLP 2942eace7efcSopenharmony_ciint AbilityManagerStub::GetDlpConnectionInfosInner(MessageParcel &data, MessageParcel &reply) 2943eace7efcSopenharmony_ci{ 2944eace7efcSopenharmony_ci std::vector<AbilityRuntime::DlpConnectionInfo> infos; 2945eace7efcSopenharmony_ci auto result = GetDlpConnectionInfos(infos); 2946eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2947eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 2948eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2949eace7efcSopenharmony_ci } 2950eace7efcSopenharmony_ci 2951eace7efcSopenharmony_ci if (!reply.WriteInt32(infos.size())) { 2952eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write infos size fail"); 2953eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2954eace7efcSopenharmony_ci } 2955eace7efcSopenharmony_ci 2956eace7efcSopenharmony_ci for (auto &item : infos) { 2957eace7efcSopenharmony_ci if (!reply.WriteParcelable(&item)) { 2958eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write info item fail"); 2959eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2960eace7efcSopenharmony_ci } 2961eace7efcSopenharmony_ci } 2962eace7efcSopenharmony_ci 2963eace7efcSopenharmony_ci return ERR_OK; 2964eace7efcSopenharmony_ci} 2965eace7efcSopenharmony_ci#endif // WITH_DLP 2966eace7efcSopenharmony_ci 2967eace7efcSopenharmony_ciint AbilityManagerStub::GetConnectionDataInner(MessageParcel &data, MessageParcel &reply) 2968eace7efcSopenharmony_ci{ 2969eace7efcSopenharmony_ci std::vector<AbilityRuntime::ConnectionData> connectionData; 2970eace7efcSopenharmony_ci auto result = GetConnectionData(connectionData); 2971eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 2972eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 2973eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2974eace7efcSopenharmony_ci } 2975eace7efcSopenharmony_ci 2976eace7efcSopenharmony_ci if (!reply.WriteInt32(connectionData.size())) { 2977eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write infos size fail"); 2978eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2979eace7efcSopenharmony_ci } 2980eace7efcSopenharmony_ci 2981eace7efcSopenharmony_ci for (auto &item : connectionData) { 2982eace7efcSopenharmony_ci if (!reply.WriteParcelable(&item)) { 2983eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write info item fail"); 2984eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 2985eace7efcSopenharmony_ci } 2986eace7efcSopenharmony_ci } 2987eace7efcSopenharmony_ci 2988eace7efcSopenharmony_ci return ERR_OK; 2989eace7efcSopenharmony_ci} 2990eace7efcSopenharmony_ci 2991eace7efcSopenharmony_ciint AbilityManagerStub::SetMissionContinueStateInner(MessageParcel &data, MessageParcel &reply) 2992eace7efcSopenharmony_ci{ 2993eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 2994eace7efcSopenharmony_ci if (!token) { 2995eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 2996eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 2997eace7efcSopenharmony_ci } 2998eace7efcSopenharmony_ci 2999eace7efcSopenharmony_ci int32_t state = data.ReadInt32(); 3000eace7efcSopenharmony_ci int result = SetMissionContinueState(token, static_cast<AAFwk::ContinueState>(state)); 3001eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3002eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "setMissionContinueState fail"); 3003eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3004eace7efcSopenharmony_ci } 3005eace7efcSopenharmony_ci return NO_ERROR; 3006eace7efcSopenharmony_ci} 3007eace7efcSopenharmony_ci 3008eace7efcSopenharmony_ci#ifdef SUPPORT_SCREEN 3009eace7efcSopenharmony_ciint AbilityManagerStub::SetMissionLabelInner(MessageParcel &data, MessageParcel &reply) 3010eace7efcSopenharmony_ci{ 3011eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 3012eace7efcSopenharmony_ci if (!token) { 3013eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 3014eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3015eace7efcSopenharmony_ci } 3016eace7efcSopenharmony_ci 3017eace7efcSopenharmony_ci std::string label = Str16ToStr8(data.ReadString16()); 3018eace7efcSopenharmony_ci int result = SetMissionLabel(token, label); 3019eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3020eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "setMissionLabel failed"); 3021eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3022eace7efcSopenharmony_ci } 3023eace7efcSopenharmony_ci return NO_ERROR; 3024eace7efcSopenharmony_ci} 3025eace7efcSopenharmony_ci 3026eace7efcSopenharmony_ciint AbilityManagerStub::SetMissionIconInner(MessageParcel &data, MessageParcel &reply) 3027eace7efcSopenharmony_ci{ 3028eace7efcSopenharmony_ci sptr<IRemoteObject> token = data.ReadRemoteObject(); 3029eace7efcSopenharmony_ci if (!token) { 3030eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 3031eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3032eace7efcSopenharmony_ci } 3033eace7efcSopenharmony_ci 3034eace7efcSopenharmony_ci std::shared_ptr<Media::PixelMap> icon(data.ReadParcelable<Media::PixelMap>()); 3035eace7efcSopenharmony_ci if (!icon) { 3036eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read icon fail"); 3037eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3038eace7efcSopenharmony_ci } 3039eace7efcSopenharmony_ci 3040eace7efcSopenharmony_ci int result = SetMissionIcon(token, icon); 3041eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3042eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "setMissionIcon fail"); 3043eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3044eace7efcSopenharmony_ci } 3045eace7efcSopenharmony_ci return NO_ERROR; 3046eace7efcSopenharmony_ci} 3047eace7efcSopenharmony_ci 3048eace7efcSopenharmony_ciint AbilityManagerStub::RegisterWindowManagerServiceHandlerInner(MessageParcel &data, MessageParcel &reply) 3049eace7efcSopenharmony_ci{ 3050eace7efcSopenharmony_ci sptr<IWindowManagerServiceHandler> handler = iface_cast<IWindowManagerServiceHandler>(data.ReadRemoteObject()); 3051eace7efcSopenharmony_ci if (handler == nullptr) { 3052eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s null handler", __func__); 3053eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3054eace7efcSopenharmony_ci } 3055eace7efcSopenharmony_ci bool animationEnabled = data.ReadBool(); 3056eace7efcSopenharmony_ci return RegisterWindowManagerServiceHandler(handler, animationEnabled); 3057eace7efcSopenharmony_ci} 3058eace7efcSopenharmony_ci 3059eace7efcSopenharmony_ciint AbilityManagerStub::CompleteFirstFrameDrawingInner(MessageParcel &data, MessageParcel &reply) 3060eace7efcSopenharmony_ci{ 3061eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3062eace7efcSopenharmony_ci sptr<IRemoteObject> abilityToken = data.ReadRemoteObject(); 3063eace7efcSopenharmony_ci if (abilityToken == nullptr) { 3064eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "%{public}s null abilityToken", __func__); 3065eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3066eace7efcSopenharmony_ci } 3067eace7efcSopenharmony_ci CompleteFirstFrameDrawing(abilityToken); 3068eace7efcSopenharmony_ci return NO_ERROR; 3069eace7efcSopenharmony_ci} 3070eace7efcSopenharmony_ci 3071eace7efcSopenharmony_ciint AbilityManagerStub::CompleteFirstFrameDrawingBySCBInner(MessageParcel &data, MessageParcel &reply) 3072eace7efcSopenharmony_ci{ 3073eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3074eace7efcSopenharmony_ci int32_t sessionId = data.ReadInt32(); 3075eace7efcSopenharmony_ci CompleteFirstFrameDrawing(sessionId); 3076eace7efcSopenharmony_ci return NO_ERROR; 3077eace7efcSopenharmony_ci} 3078eace7efcSopenharmony_ci 3079eace7efcSopenharmony_ciint AbilityManagerStub::PrepareTerminateAbilityInner(MessageParcel &data, MessageParcel &reply) 3080eace7efcSopenharmony_ci{ 3081eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "call"); 3082eace7efcSopenharmony_ci sptr<IRemoteObject> token = nullptr; 3083eace7efcSopenharmony_ci if (data.ReadBool()) { 3084eace7efcSopenharmony_ci token = data.ReadRemoteObject(); 3085eace7efcSopenharmony_ci } 3086eace7efcSopenharmony_ci sptr<IPrepareTerminateCallback> callback = iface_cast<IPrepareTerminateCallback>(data.ReadRemoteObject()); 3087eace7efcSopenharmony_ci if (callback == nullptr) { 3088eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 3089eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3090eace7efcSopenharmony_ci } 3091eace7efcSopenharmony_ci int result = PrepareTerminateAbility(token, callback); 3092eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3093eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "end failed err: %{public}d", result); 3094eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3095eace7efcSopenharmony_ci } 3096eace7efcSopenharmony_ci return NO_ERROR; 3097eace7efcSopenharmony_ci} 3098eace7efcSopenharmony_ci 3099eace7efcSopenharmony_ciint AbilityManagerStub::GetDialogSessionInfoInner(MessageParcel &data, MessageParcel &reply) 3100eace7efcSopenharmony_ci{ 3101eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "call"); 3102eace7efcSopenharmony_ci std::string dialogSessionId = data.ReadString(); 3103eace7efcSopenharmony_ci sptr<DialogSessionInfo> info; 3104eace7efcSopenharmony_ci int result = GetDialogSessionInfo(dialogSessionId, info); 3105eace7efcSopenharmony_ci if (result != ERR_OK || info == nullptr) { 3106eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "not find dialogSessionInfo"); 3107eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3108eace7efcSopenharmony_ci } 3109eace7efcSopenharmony_ci if (!reply.WriteParcelable(info)) { 3110eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3111eace7efcSopenharmony_ci } 3112eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3113eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3114eace7efcSopenharmony_ci } 3115eace7efcSopenharmony_ci return NO_ERROR; 3116eace7efcSopenharmony_ci} 3117eace7efcSopenharmony_ci 3118eace7efcSopenharmony_ciint AbilityManagerStub::SendDialogResultInner(MessageParcel &data, MessageParcel &reply) 3119eace7efcSopenharmony_ci{ 3120eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "call"); 3121eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3122eace7efcSopenharmony_ci if (want == nullptr) { 3123eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3124eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3125eace7efcSopenharmony_ci } 3126eace7efcSopenharmony_ci std::string dialogSessionId = data.ReadString(); 3127eace7efcSopenharmony_ci bool isAllow = data.ReadBool(); 3128eace7efcSopenharmony_ci int result = SendDialogResult(*want, dialogSessionId, isAllow); 3129eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3130eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3131eace7efcSopenharmony_ci } 3132eace7efcSopenharmony_ci return NO_ERROR; 3133eace7efcSopenharmony_ci} 3134eace7efcSopenharmony_ci 3135eace7efcSopenharmony_ciint AbilityManagerStub::RegisterAbilityFirstFrameStateObserverInner(MessageParcel &data, MessageParcel &reply) 3136eace7efcSopenharmony_ci{ 3137eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3138eace7efcSopenharmony_ci auto callback = iface_cast<AppExecFwk::IAbilityFirstFrameStateObserver>(data.ReadRemoteObject()); 3139eace7efcSopenharmony_ci if (callback == nullptr) { 3140eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 3141eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3142eace7efcSopenharmony_ci } 3143eace7efcSopenharmony_ci 3144eace7efcSopenharmony_ci std::string targetBundleName = data.ReadString(); 3145eace7efcSopenharmony_ci auto ret = RegisterAbilityFirstFrameStateObserver(callback, targetBundleName); 3146eace7efcSopenharmony_ci if (!reply.WriteInt32(ret)) { 3147eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write ret error"); 3148eace7efcSopenharmony_ci return IPC_STUB_ERR; 3149eace7efcSopenharmony_ci } 3150eace7efcSopenharmony_ci return NO_ERROR; 3151eace7efcSopenharmony_ci} 3152eace7efcSopenharmony_ci 3153eace7efcSopenharmony_ciint AbilityManagerStub::UnregisterAbilityFirstFrameStateObserverInner(MessageParcel &data, MessageParcel &reply) 3154eace7efcSopenharmony_ci{ 3155eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3156eace7efcSopenharmony_ci auto callback = iface_cast<AppExecFwk::IAbilityFirstFrameStateObserver>(data.ReadRemoteObject()); 3157eace7efcSopenharmony_ci if (callback == nullptr) { 3158eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 3159eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3160eace7efcSopenharmony_ci } 3161eace7efcSopenharmony_ci auto ret = UnregisterAbilityFirstFrameStateObserver(callback); 3162eace7efcSopenharmony_ci if (!reply.WriteInt32(ret)) { 3163eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write ret error"); 3164eace7efcSopenharmony_ci return IPC_STUB_ERR; 3165eace7efcSopenharmony_ci } 3166eace7efcSopenharmony_ci return NO_ERROR; 3167eace7efcSopenharmony_ci} 3168eace7efcSopenharmony_ci#endif 3169eace7efcSopenharmony_ci 3170eace7efcSopenharmony_ciint32_t AbilityManagerStub::IsValidMissionIdsInner(MessageParcel &data, MessageParcel &reply) 3171eace7efcSopenharmony_ci{ 3172eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3173eace7efcSopenharmony_ci std::vector<int32_t> missionIds; 3174eace7efcSopenharmony_ci std::vector<MissionValidResult> results; 3175eace7efcSopenharmony_ci 3176eace7efcSopenharmony_ci data.ReadInt32Vector(&missionIds); 3177eace7efcSopenharmony_ci auto err = IsValidMissionIds(missionIds, results); 3178eace7efcSopenharmony_ci if (err != ERR_OK) { 3179eace7efcSopenharmony_ci results.clear(); 3180eace7efcSopenharmony_ci } 3181eace7efcSopenharmony_ci 3182eace7efcSopenharmony_ci if (!reply.WriteInt32(err)) { 3183eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3184eace7efcSopenharmony_ci } 3185eace7efcSopenharmony_ci 3186eace7efcSopenharmony_ci reply.WriteInt32(static_cast<int32_t>(results.size())); 3187eace7efcSopenharmony_ci for (auto &item : results) { 3188eace7efcSopenharmony_ci if (!reply.WriteParcelable(&item)) { 3189eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3190eace7efcSopenharmony_ci } 3191eace7efcSopenharmony_ci } 3192eace7efcSopenharmony_ci return NO_ERROR; 3193eace7efcSopenharmony_ci} 3194eace7efcSopenharmony_ci 3195eace7efcSopenharmony_ciint AbilityManagerStub::VerifyPermissionInner(MessageParcel &data, MessageParcel &reply) 3196eace7efcSopenharmony_ci{ 3197eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "verifyPermission call"); 3198eace7efcSopenharmony_ci std::string permission = data.ReadString(); 3199eace7efcSopenharmony_ci int32_t pid = data.ReadInt32(); 3200eace7efcSopenharmony_ci int32_t uid = data.ReadInt32(); 3201eace7efcSopenharmony_ci 3202eace7efcSopenharmony_ci auto result = VerifyPermission(permission, pid, uid); 3203eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3204eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "verifyPermission fail"); 3205eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3206eace7efcSopenharmony_ci } 3207eace7efcSopenharmony_ci return NO_ERROR; 3208eace7efcSopenharmony_ci} 3209eace7efcSopenharmony_ci 3210eace7efcSopenharmony_ciint32_t AbilityManagerStub::ForceExitAppInner(MessageParcel &data, MessageParcel &reply) 3211eace7efcSopenharmony_ci{ 3212eace7efcSopenharmony_ci int32_t pid = data.ReadInt32(); 3213eace7efcSopenharmony_ci std::unique_ptr<ExitReason> exitReason(data.ReadParcelable<ExitReason>()); 3214eace7efcSopenharmony_ci if (!exitReason) { 3215eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "exitReason null"); 3216eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3217eace7efcSopenharmony_ci } 3218eace7efcSopenharmony_ci int32_t result = ForceExitApp(pid, *exitReason); 3219eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3220eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3221eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3222eace7efcSopenharmony_ci } 3223eace7efcSopenharmony_ci return NO_ERROR; 3224eace7efcSopenharmony_ci} 3225eace7efcSopenharmony_ci 3226eace7efcSopenharmony_ciint32_t AbilityManagerStub::RecordAppExitReasonInner(MessageParcel &data, MessageParcel &reply) 3227eace7efcSopenharmony_ci{ 3228eace7efcSopenharmony_ci std::unique_ptr<ExitReason> exitReason(data.ReadParcelable<ExitReason>()); 3229eace7efcSopenharmony_ci if (!exitReason) { 3230eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "exitReason null"); 3231eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3232eace7efcSopenharmony_ci } 3233eace7efcSopenharmony_ci int32_t result = RecordAppExitReason(*exitReason); 3234eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3235eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3236eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3237eace7efcSopenharmony_ci } 3238eace7efcSopenharmony_ci return NO_ERROR; 3239eace7efcSopenharmony_ci} 3240eace7efcSopenharmony_ci 3241eace7efcSopenharmony_ciint32_t AbilityManagerStub::RecordProcessExitReasonInner(MessageParcel &data, MessageParcel &reply) 3242eace7efcSopenharmony_ci{ 3243eace7efcSopenharmony_ci int32_t pid = data.ReadInt32(); 3244eace7efcSopenharmony_ci std::unique_ptr<ExitReason> exitReason(data.ReadParcelable<ExitReason>()); 3245eace7efcSopenharmony_ci if (!exitReason) { 3246eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "exitReason null"); 3247eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3248eace7efcSopenharmony_ci } 3249eace7efcSopenharmony_ci int32_t result = RecordProcessExitReason(pid, *exitReason); 3250eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3251eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3252eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3253eace7efcSopenharmony_ci } 3254eace7efcSopenharmony_ci return NO_ERROR; 3255eace7efcSopenharmony_ci} 3256eace7efcSopenharmony_ci 3257eace7efcSopenharmony_ciint AbilityManagerStub::SetRootSceneSessionInner(MessageParcel &data, MessageParcel &reply) 3258eace7efcSopenharmony_ci{ 3259eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Call."); 3260eace7efcSopenharmony_ci auto rootSceneSession = data.ReadRemoteObject(); 3261eace7efcSopenharmony_ci if (rootSceneSession == nullptr) { 3262eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null rootSceneSession"); 3263eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3264eace7efcSopenharmony_ci } 3265eace7efcSopenharmony_ci SetRootSceneSession(rootSceneSession); 3266eace7efcSopenharmony_ci return NO_ERROR; 3267eace7efcSopenharmony_ci} 3268eace7efcSopenharmony_ci 3269eace7efcSopenharmony_ciint AbilityManagerStub::CallUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 3270eace7efcSopenharmony_ci{ 3271eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Call."); 3272eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 3273eace7efcSopenharmony_ci if (data.ReadBool()) { 3274eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 3275eace7efcSopenharmony_ci } 3276eace7efcSopenharmony_ci bool isColdStart = false; 3277eace7efcSopenharmony_ci CallUIAbilityBySCB(sessionInfo, isColdStart); 3278eace7efcSopenharmony_ci reply.WriteBool(isColdStart); 3279eace7efcSopenharmony_ci return NO_ERROR; 3280eace7efcSopenharmony_ci} 3281eace7efcSopenharmony_ci 3282eace7efcSopenharmony_ciint32_t AbilityManagerStub::StartSpecifiedAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 3283eace7efcSopenharmony_ci{ 3284eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Call."); 3285eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3286eace7efcSopenharmony_ci if (want == nullptr) { 3287eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3288eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3289eace7efcSopenharmony_ci } 3290eace7efcSopenharmony_ci StartSpecifiedAbilityBySCB(*want); 3291eace7efcSopenharmony_ci return NO_ERROR; 3292eace7efcSopenharmony_ci} 3293eace7efcSopenharmony_ci 3294eace7efcSopenharmony_ciint AbilityManagerStub::NotifySaveAsResultInner(MessageParcel &data, MessageParcel &reply) 3295eace7efcSopenharmony_ci{ 3296eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3297eace7efcSopenharmony_ci if (!want) { 3298eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3299eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3300eace7efcSopenharmony_ci } 3301eace7efcSopenharmony_ci int resultCode = data.ReadInt32(); 3302eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 3303eace7efcSopenharmony_ci int32_t result = NotifySaveAsResult(*want, resultCode, requestCode); 3304eace7efcSopenharmony_ci reply.WriteInt32(result); 3305eace7efcSopenharmony_ci return NO_ERROR; 3306eace7efcSopenharmony_ci} 3307eace7efcSopenharmony_ci 3308eace7efcSopenharmony_ciint AbilityManagerStub::SetSessionManagerServiceInner(MessageParcel &data, MessageParcel &reply) 3309eace7efcSopenharmony_ci{ 3310eace7efcSopenharmony_ci sptr<IRemoteObject> sessionManagerService = data.ReadRemoteObject(); 3311eace7efcSopenharmony_ci if (!sessionManagerService) { 3312eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read ability token fail"); 3313eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3314eace7efcSopenharmony_ci } 3315eace7efcSopenharmony_ci SetSessionManagerService(sessionManagerService); 3316eace7efcSopenharmony_ci return NO_ERROR; 3317eace7efcSopenharmony_ci} 3318eace7efcSopenharmony_ci 3319eace7efcSopenharmony_ciint32_t AbilityManagerStub::RegisterIAbilityManagerCollaboratorInner(MessageParcel &data, MessageParcel &reply) 3320eace7efcSopenharmony_ci{ 3321eace7efcSopenharmony_ci int32_t type = data.ReadInt32(); 3322eace7efcSopenharmony_ci sptr<IAbilityManagerCollaborator> collaborator = iface_cast<IAbilityManagerCollaborator>(data.ReadRemoteObject()); 3323eace7efcSopenharmony_ci if (collaborator == nullptr) { 3324eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null collaborator"); 3325eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3326eace7efcSopenharmony_ci } 3327eace7efcSopenharmony_ci int32_t ret = RegisterIAbilityManagerCollaborator(type, collaborator); 3328eace7efcSopenharmony_ci reply.WriteInt32(ret); 3329eace7efcSopenharmony_ci return NO_ERROR; 3330eace7efcSopenharmony_ci} 3331eace7efcSopenharmony_ci 3332eace7efcSopenharmony_ciint32_t AbilityManagerStub::UnregisterIAbilityManagerCollaboratorInner(MessageParcel &data, MessageParcel &reply) 3333eace7efcSopenharmony_ci{ 3334eace7efcSopenharmony_ci int32_t type = data.ReadInt32(); 3335eace7efcSopenharmony_ci int32_t ret = UnregisterIAbilityManagerCollaborator(type); 3336eace7efcSopenharmony_ci reply.WriteInt32(ret); 3337eace7efcSopenharmony_ci return NO_ERROR; 3338eace7efcSopenharmony_ci} 3339eace7efcSopenharmony_ci 3340eace7efcSopenharmony_ciint AbilityManagerStub::PrepareTerminateAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 3341eace7efcSopenharmony_ci{ 3342eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Call."); 3343eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 3344eace7efcSopenharmony_ci if (data.ReadBool()) { 3345eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 3346eace7efcSopenharmony_ci } 3347eace7efcSopenharmony_ci bool isPrepareTerminate = false; 3348eace7efcSopenharmony_ci auto result = PrepareTerminateAbilityBySCB(sessionInfo, isPrepareTerminate); 3349eace7efcSopenharmony_ci if (result == ERR_OK) { 3350eace7efcSopenharmony_ci if (!reply.WriteBool(isPrepareTerminate)) { 3351eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 3352eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3353eace7efcSopenharmony_ci } 3354eace7efcSopenharmony_ci } 3355eace7efcSopenharmony_ci return result; 3356eace7efcSopenharmony_ci} 3357eace7efcSopenharmony_ci 3358eace7efcSopenharmony_ciint32_t AbilityManagerStub::RegisterStatusBarDelegateInner(MessageParcel &data, MessageParcel &reply) 3359eace7efcSopenharmony_ci{ 3360eace7efcSopenharmony_ci auto delegate = iface_cast<AbilityRuntime::IStatusBarDelegate>(data.ReadRemoteObject()); 3361eace7efcSopenharmony_ci if (delegate == nullptr) { 3362eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "delegate null"); 3363eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3364eace7efcSopenharmony_ci } 3365eace7efcSopenharmony_ci int32_t result = RegisterStatusBarDelegate(delegate); 3366eace7efcSopenharmony_ci reply.WriteInt32(result); 3367eace7efcSopenharmony_ci return NO_ERROR; 3368eace7efcSopenharmony_ci} 3369eace7efcSopenharmony_ci 3370eace7efcSopenharmony_ciint32_t AbilityManagerStub::KillProcessWithPrepareTerminateInner(MessageParcel &data, MessageParcel &reply) 3371eace7efcSopenharmony_ci{ 3372eace7efcSopenharmony_ci auto size = data.ReadUint32(); 3373eace7efcSopenharmony_ci if (size == 0 || size > MAX_KILL_PROCESS_PID_COUNT) { 3374eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid size"); 3375eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3376eace7efcSopenharmony_ci } 3377eace7efcSopenharmony_ci std::vector<int32_t> pids; 3378eace7efcSopenharmony_ci for (uint32_t i = 0; i < size; i++) { 3379eace7efcSopenharmony_ci pids.emplace_back(data.ReadInt32()); 3380eace7efcSopenharmony_ci } 3381eace7efcSopenharmony_ci int32_t result = KillProcessWithPrepareTerminate(pids); 3382eace7efcSopenharmony_ci if (result != ERR_OK) { 3383eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "kill process fail"); 3384eace7efcSopenharmony_ci } 3385eace7efcSopenharmony_ci return NO_ERROR; 3386eace7efcSopenharmony_ci} 3387eace7efcSopenharmony_ci 3388eace7efcSopenharmony_ciint32_t AbilityManagerStub::RegisterAutoStartupSystemCallbackInner(MessageParcel &data, MessageParcel &reply) 3389eace7efcSopenharmony_ci{ 3390eace7efcSopenharmony_ci sptr<IRemoteObject> callback = data.ReadRemoteObject(); 3391eace7efcSopenharmony_ci if (callback == nullptr) { 3392eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 3393eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3394eace7efcSopenharmony_ci } 3395eace7efcSopenharmony_ci int32_t result = RegisterAutoStartupSystemCallback(callback); 3396eace7efcSopenharmony_ci reply.WriteInt32(result); 3397eace7efcSopenharmony_ci return NO_ERROR; 3398eace7efcSopenharmony_ci} 3399eace7efcSopenharmony_ci 3400eace7efcSopenharmony_ciint32_t AbilityManagerStub::UnregisterAutoStartupSystemCallbackInner(MessageParcel &data, MessageParcel &reply) 3401eace7efcSopenharmony_ci{ 3402eace7efcSopenharmony_ci sptr<IRemoteObject> callback = data.ReadRemoteObject(); 3403eace7efcSopenharmony_ci if (callback == nullptr) { 3404eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callback null"); 3405eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3406eace7efcSopenharmony_ci } 3407eace7efcSopenharmony_ci int32_t result = UnregisterAutoStartupSystemCallback(callback); 3408eace7efcSopenharmony_ci reply.WriteInt32(result); 3409eace7efcSopenharmony_ci return NO_ERROR; 3410eace7efcSopenharmony_ci} 3411eace7efcSopenharmony_ci 3412eace7efcSopenharmony_ciint32_t AbilityManagerStub::SetApplicationAutoStartupInner(MessageParcel &data, MessageParcel &reply) 3413eace7efcSopenharmony_ci{ 3414eace7efcSopenharmony_ci sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>(); 3415eace7efcSopenharmony_ci if (info == nullptr) { 3416eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "info null"); 3417eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3418eace7efcSopenharmony_ci } 3419eace7efcSopenharmony_ci int32_t result = SetApplicationAutoStartup(*info); 3420eace7efcSopenharmony_ci reply.WriteInt32(result); 3421eace7efcSopenharmony_ci return NO_ERROR; 3422eace7efcSopenharmony_ci} 3423eace7efcSopenharmony_ci 3424eace7efcSopenharmony_ciint32_t AbilityManagerStub::CancelApplicationAutoStartupInner(MessageParcel &data, MessageParcel &reply) 3425eace7efcSopenharmony_ci{ 3426eace7efcSopenharmony_ci sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>(); 3427eace7efcSopenharmony_ci if (info == nullptr) { 3428eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "info null"); 3429eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3430eace7efcSopenharmony_ci } 3431eace7efcSopenharmony_ci int32_t result = CancelApplicationAutoStartup(*info); 3432eace7efcSopenharmony_ci reply.WriteInt32(result); 3433eace7efcSopenharmony_ci return NO_ERROR; 3434eace7efcSopenharmony_ci} 3435eace7efcSopenharmony_ci 3436eace7efcSopenharmony_ciint32_t AbilityManagerStub::QueryAllAutoStartupApplicationsInner(MessageParcel &data, MessageParcel &reply) 3437eace7efcSopenharmony_ci{ 3438eace7efcSopenharmony_ci std::vector<AutoStartupInfo> infoList; 3439eace7efcSopenharmony_ci auto result = QueryAllAutoStartupApplications(infoList); 3440eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3441eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3442eace7efcSopenharmony_ci } 3443eace7efcSopenharmony_ci 3444eace7efcSopenharmony_ci reply.WriteInt32(static_cast<int32_t>(infoList.size())); 3445eace7efcSopenharmony_ci for (auto &info : infoList) { 3446eace7efcSopenharmony_ci if (!reply.WriteParcelable(&info)) { 3447eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3448eace7efcSopenharmony_ci } 3449eace7efcSopenharmony_ci } 3450eace7efcSopenharmony_ci return NO_ERROR; 3451eace7efcSopenharmony_ci} 3452eace7efcSopenharmony_ci 3453eace7efcSopenharmony_ciint AbilityManagerStub::RegisterSessionHandlerInner(MessageParcel &data, MessageParcel &reply) 3454eace7efcSopenharmony_ci{ 3455eace7efcSopenharmony_ci sptr<IRemoteObject> handler = data.ReadRemoteObject(); 3456eace7efcSopenharmony_ci if (handler == nullptr) { 3457eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null handler"); 3458eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3459eace7efcSopenharmony_ci } 3460eace7efcSopenharmony_ci int32_t result = RegisterSessionHandler(handler); 3461eace7efcSopenharmony_ci reply.WriteInt32(result); 3462eace7efcSopenharmony_ci return NO_ERROR; 3463eace7efcSopenharmony_ci} 3464eace7efcSopenharmony_ci 3465eace7efcSopenharmony_ciint32_t AbilityManagerStub::RegisterAppDebugListenerInner(MessageParcel &data, MessageParcel &reply) 3466eace7efcSopenharmony_ci{ 3467eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3468eace7efcSopenharmony_ci auto appDebugLister = iface_cast<AppExecFwk::IAppDebugListener>(data.ReadRemoteObject()); 3469eace7efcSopenharmony_ci if (appDebugLister == nullptr) { 3470eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "appDebugLister null"); 3471eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3472eace7efcSopenharmony_ci } 3473eace7efcSopenharmony_ci 3474eace7efcSopenharmony_ci auto result = RegisterAppDebugListener(appDebugLister); 3475eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3476eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3477eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3478eace7efcSopenharmony_ci } 3479eace7efcSopenharmony_ci return NO_ERROR; 3480eace7efcSopenharmony_ci} 3481eace7efcSopenharmony_ci 3482eace7efcSopenharmony_ciint32_t AbilityManagerStub::UnregisterAppDebugListenerInner(MessageParcel &data, MessageParcel &reply) 3483eace7efcSopenharmony_ci{ 3484eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3485eace7efcSopenharmony_ci auto appDebugLister = iface_cast<AppExecFwk::IAppDebugListener>(data.ReadRemoteObject()); 3486eace7efcSopenharmony_ci if (appDebugLister == nullptr) { 3487eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "appDebugLister null"); 3488eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3489eace7efcSopenharmony_ci } 3490eace7efcSopenharmony_ci 3491eace7efcSopenharmony_ci auto result = UnregisterAppDebugListener(appDebugLister); 3492eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3493eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3494eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3495eace7efcSopenharmony_ci } 3496eace7efcSopenharmony_ci return NO_ERROR; 3497eace7efcSopenharmony_ci} 3498eace7efcSopenharmony_ci 3499eace7efcSopenharmony_ciint32_t AbilityManagerStub::AttachAppDebugInner(MessageParcel &data, MessageParcel &reply) 3500eace7efcSopenharmony_ci{ 3501eace7efcSopenharmony_ci auto bundleName = data.ReadString(); 3502eace7efcSopenharmony_ci if (bundleName.empty()) { 3503eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "empty bundleName"); 3504eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3505eace7efcSopenharmony_ci } 3506eace7efcSopenharmony_ci 3507eace7efcSopenharmony_ci auto result = AttachAppDebug(bundleName); 3508eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3509eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3510eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3511eace7efcSopenharmony_ci } 3512eace7efcSopenharmony_ci return NO_ERROR; 3513eace7efcSopenharmony_ci} 3514eace7efcSopenharmony_ci 3515eace7efcSopenharmony_ciint32_t AbilityManagerStub::DetachAppDebugInner(MessageParcel &data, MessageParcel &reply) 3516eace7efcSopenharmony_ci{ 3517eace7efcSopenharmony_ci auto bundleName = data.ReadString(); 3518eace7efcSopenharmony_ci if (bundleName.empty()) { 3519eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "empty bundleName"); 3520eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3521eace7efcSopenharmony_ci } 3522eace7efcSopenharmony_ci 3523eace7efcSopenharmony_ci auto result = DetachAppDebug(bundleName); 3524eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3525eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3526eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3527eace7efcSopenharmony_ci } 3528eace7efcSopenharmony_ci return NO_ERROR; 3529eace7efcSopenharmony_ci} 3530eace7efcSopenharmony_ci 3531eace7efcSopenharmony_ciint32_t AbilityManagerStub::IsAbilityControllerStartInner(MessageParcel &data, MessageParcel &reply) 3532eace7efcSopenharmony_ci{ 3533eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3534eace7efcSopenharmony_ci if (want == nullptr) { 3535eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3536eace7efcSopenharmony_ci return true; 3537eace7efcSopenharmony_ci } 3538eace7efcSopenharmony_ci bool result = IsAbilityControllerStart(*want); 3539eace7efcSopenharmony_ci reply.WriteBool(result); 3540eace7efcSopenharmony_ci return NO_ERROR; 3541eace7efcSopenharmony_ci} 3542eace7efcSopenharmony_ci 3543eace7efcSopenharmony_ciint32_t AbilityManagerStub::ExecuteIntentInner(MessageParcel &data, MessageParcel &reply) 3544eace7efcSopenharmony_ci{ 3545eace7efcSopenharmony_ci uint64_t key = data.ReadUint64(); 3546eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 3547eace7efcSopenharmony_ci if (callerToken == nullptr) { 3548eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null callerToken"); 3549eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3550eace7efcSopenharmony_ci } 3551eace7efcSopenharmony_ci std::unique_ptr<InsightIntentExecuteParam> param(data.ReadParcelable<InsightIntentExecuteParam>()); 3552eace7efcSopenharmony_ci if (param == nullptr) { 3553eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "param null"); 3554eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3555eace7efcSopenharmony_ci } 3556eace7efcSopenharmony_ci auto result = ExecuteIntent(key, callerToken, *param); 3557eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3558eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3559eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3560eace7efcSopenharmony_ci } 3561eace7efcSopenharmony_ci return NO_ERROR; 3562eace7efcSopenharmony_ci} 3563eace7efcSopenharmony_ci 3564eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityForResultAsCallerInner(MessageParcel &data, MessageParcel &reply) 3565eace7efcSopenharmony_ci{ 3566eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3567eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3568eace7efcSopenharmony_ci if (want == nullptr) { 3569eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3570eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3571eace7efcSopenharmony_ci } 3572eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3573eace7efcSopenharmony_ci if (data.ReadBool()) { 3574eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3575eace7efcSopenharmony_ci } 3576eace7efcSopenharmony_ci int32_t requestCode = data.ReadInt32(); 3577eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3578eace7efcSopenharmony_ci int32_t result = StartAbilityForResultAsCaller(*want, callerToken, requestCode, userId); 3579eace7efcSopenharmony_ci reply.WriteInt32(result); 3580eace7efcSopenharmony_ci return NO_ERROR; 3581eace7efcSopenharmony_ci} 3582eace7efcSopenharmony_ci 3583eace7efcSopenharmony_ciint AbilityManagerStub::StartAbilityForResultAsCallerForOptionsInner(MessageParcel &data, MessageParcel &reply) 3584eace7efcSopenharmony_ci{ 3585eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3586eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3587eace7efcSopenharmony_ci if (want == nullptr) { 3588eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3589eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3590eace7efcSopenharmony_ci } 3591eace7efcSopenharmony_ci std::unique_ptr<StartOptions> startOptions(data.ReadParcelable<StartOptions>()); 3592eace7efcSopenharmony_ci if (startOptions == nullptr) { 3593eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null"); 3594eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3595eace7efcSopenharmony_ci } 3596eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3597eace7efcSopenharmony_ci if (data.ReadBool()) { 3598eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3599eace7efcSopenharmony_ci } 3600eace7efcSopenharmony_ci int32_t requestCode = data.ReadInt32(); 3601eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3602eace7efcSopenharmony_ci int32_t result = StartAbilityForResultAsCaller(*want, *startOptions, callerToken, requestCode, userId); 3603eace7efcSopenharmony_ci reply.WriteInt32(result); 3604eace7efcSopenharmony_ci return NO_ERROR; 3605eace7efcSopenharmony_ci} 3606eace7efcSopenharmony_ci 3607eace7efcSopenharmony_ciint32_t AbilityManagerStub::StartAbilityOnlyUIAbilityInner(MessageParcel &data, MessageParcel &reply) 3608eace7efcSopenharmony_ci{ 3609eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3610eace7efcSopenharmony_ci if (want == nullptr) { 3611eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null want"); 3612eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3613eace7efcSopenharmony_ci } 3614eace7efcSopenharmony_ci 3615eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3616eace7efcSopenharmony_ci if (!data.ReadBool()) { 3617eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid caller token"); 3618eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3619eace7efcSopenharmony_ci } 3620eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3621eace7efcSopenharmony_ci uint32_t specifyTokenId = data.ReadUint32(); 3622eace7efcSopenharmony_ci int32_t result = StartAbilityOnlyUIAbility(*want, callerToken, specifyTokenId); 3623eace7efcSopenharmony_ci reply.WriteInt32(result); 3624eace7efcSopenharmony_ci return NO_ERROR; 3625eace7efcSopenharmony_ci} 3626eace7efcSopenharmony_ci 3627eace7efcSopenharmony_ciint32_t AbilityManagerStub::StartAbilityByInsightIntentInner(MessageParcel &data, MessageParcel &reply) 3628eace7efcSopenharmony_ci{ 3629eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3630eace7efcSopenharmony_ci if (want == nullptr) { 3631eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3632eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3633eace7efcSopenharmony_ci } 3634eace7efcSopenharmony_ci 3635eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3636eace7efcSopenharmony_ci if (!data.ReadBool()) { 3637eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "invalid caller token"); 3638eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3639eace7efcSopenharmony_ci } 3640eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3641eace7efcSopenharmony_ci uint64_t intentId = data.ReadUint64(); 3642eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3643eace7efcSopenharmony_ci int32_t result = StartAbilityByInsightIntent(*want, callerToken, intentId, userId); 3644eace7efcSopenharmony_ci reply.WriteInt32(result); 3645eace7efcSopenharmony_ci return NO_ERROR; 3646eace7efcSopenharmony_ci} 3647eace7efcSopenharmony_ci 3648eace7efcSopenharmony_ciint32_t AbilityManagerStub::ExecuteInsightIntentDoneInner(MessageParcel &data, MessageParcel &reply) 3649eace7efcSopenharmony_ci{ 3650eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3651eace7efcSopenharmony_ci auto token = data.ReadRemoteObject(); 3652eace7efcSopenharmony_ci if (token == nullptr) { 3653eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null token"); 3654eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3655eace7efcSopenharmony_ci } 3656eace7efcSopenharmony_ci 3657eace7efcSopenharmony_ci auto intentId = data.ReadInt64(); 3658eace7efcSopenharmony_ci std::unique_ptr<InsightIntentExecuteResult> executeResult(data.ReadParcelable<InsightIntentExecuteResult>()); 3659eace7efcSopenharmony_ci if (!executeResult) { 3660eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "executeResult null"); 3661eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3662eace7efcSopenharmony_ci } 3663eace7efcSopenharmony_ci 3664eace7efcSopenharmony_ci int32_t result = ExecuteInsightIntentDone(token, intentId, *executeResult); 3665eace7efcSopenharmony_ci reply.WriteInt32(result); 3666eace7efcSopenharmony_ci return NO_ERROR; 3667eace7efcSopenharmony_ci} 3668eace7efcSopenharmony_ci 3669eace7efcSopenharmony_ciint32_t AbilityManagerStub::SetApplicationAutoStartupByEDMInner(MessageParcel &data, MessageParcel &reply) 3670eace7efcSopenharmony_ci{ 3671eace7efcSopenharmony_ci sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>(); 3672eace7efcSopenharmony_ci if (info == nullptr) { 3673eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "info null"); 3674eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3675eace7efcSopenharmony_ci } 3676eace7efcSopenharmony_ci auto flag = data.ReadBool(); 3677eace7efcSopenharmony_ci int32_t result = SetApplicationAutoStartupByEDM(*info, flag); 3678eace7efcSopenharmony_ci return reply.WriteInt32(result); 3679eace7efcSopenharmony_ci} 3680eace7efcSopenharmony_ci 3681eace7efcSopenharmony_ciint32_t AbilityManagerStub::CancelApplicationAutoStartupByEDMInner(MessageParcel &data, MessageParcel &reply) 3682eace7efcSopenharmony_ci{ 3683eace7efcSopenharmony_ci sptr<AutoStartupInfo> info = data.ReadParcelable<AutoStartupInfo>(); 3684eace7efcSopenharmony_ci if (info == nullptr) { 3685eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "info null"); 3686eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3687eace7efcSopenharmony_ci } 3688eace7efcSopenharmony_ci auto flag = data.ReadBool(); 3689eace7efcSopenharmony_ci int32_t result = CancelApplicationAutoStartupByEDM(*info, flag); 3690eace7efcSopenharmony_ci return reply.WriteInt32(result); 3691eace7efcSopenharmony_ci} 3692eace7efcSopenharmony_ci 3693eace7efcSopenharmony_ciint32_t AbilityManagerStub::OpenFileInner(MessageParcel &data, MessageParcel &reply) 3694eace7efcSopenharmony_ci{ 3695eace7efcSopenharmony_ci std::unique_ptr<Uri> uri(data.ReadParcelable<Uri>()); 3696eace7efcSopenharmony_ci if (!uri) { 3697eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "read uri fail"); 3698eace7efcSopenharmony_ci return ERR_DEAD_OBJECT; 3699eace7efcSopenharmony_ci } 3700eace7efcSopenharmony_ci auto flag = data.ReadInt32(); 3701eace7efcSopenharmony_ci int fd = OpenFile(*uri, flag); 3702eace7efcSopenharmony_ci reply.WriteFileDescriptor(fd); 3703eace7efcSopenharmony_ci return ERR_OK; 3704eace7efcSopenharmony_ci} 3705eace7efcSopenharmony_ci 3706eace7efcSopenharmony_ciint32_t AbilityManagerStub::RequestAssertFaultDialogInner(MessageParcel &data, MessageParcel &reply) 3707eace7efcSopenharmony_ci{ 3708eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Request to display assert fault dialog."); 3709eace7efcSopenharmony_ci sptr<IRemoteObject> callback = data.ReadRemoteObject(); 3710eace7efcSopenharmony_ci std::unique_ptr<WantParams> wantParams(data.ReadParcelable<WantParams>()); 3711eace7efcSopenharmony_ci if (wantParams == nullptr) { 3712eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null wantParams"); 3713eace7efcSopenharmony_ci return ERR_NULL_OBJECT; 3714eace7efcSopenharmony_ci } 3715eace7efcSopenharmony_ci auto result = RequestAssertFaultDialog(callback, *wantParams); 3716eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3717eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3718eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3719eace7efcSopenharmony_ci } 3720eace7efcSopenharmony_ci return NO_ERROR; 3721eace7efcSopenharmony_ci} 3722eace7efcSopenharmony_ci 3723eace7efcSopenharmony_ciint32_t AbilityManagerStub::NotifyDebugAssertResultInner(MessageParcel &data, MessageParcel &reply) 3724eace7efcSopenharmony_ci{ 3725eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "Notify user action result to assert fault process."); 3726eace7efcSopenharmony_ci uint64_t assertSessionId = data.ReadUint64(); 3727eace7efcSopenharmony_ci int32_t status = data.ReadInt32(); 3728eace7efcSopenharmony_ci auto result = NotifyDebugAssertResult(assertSessionId, static_cast<AAFwk::UserStatus>(status)); 3729eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3730eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3731eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3732eace7efcSopenharmony_ci } 3733eace7efcSopenharmony_ci return NO_ERROR; 3734eace7efcSopenharmony_ci} 3735eace7efcSopenharmony_ci 3736eace7efcSopenharmony_ciint32_t AbilityManagerStub::GetForegroundUIAbilitiesInner(MessageParcel &data, MessageParcel &reply) 3737eace7efcSopenharmony_ci{ 3738eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "called"); 3739eace7efcSopenharmony_ci std::vector<AppExecFwk::AbilityStateData> abilityStateDatas; 3740eace7efcSopenharmony_ci int32_t result = GetForegroundUIAbilities(abilityStateDatas); 3741eace7efcSopenharmony_ci if (result != ERR_OK) { 3742eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "get foreground abilities fail"); 3743eace7efcSopenharmony_ci return result; 3744eace7efcSopenharmony_ci } 3745eace7efcSopenharmony_ci auto infoSize = abilityStateDatas.size(); 3746eace7efcSopenharmony_ci if (infoSize > CYCLE_LIMIT) { 3747eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "infoSize exceeds limit"); 3748eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3749eace7efcSopenharmony_ci } 3750eace7efcSopenharmony_ci if (!reply.WriteInt32(infoSize)) { 3751eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write data size fail"); 3752eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3753eace7efcSopenharmony_ci } 3754eace7efcSopenharmony_ci for (auto &it : abilityStateDatas) { 3755eace7efcSopenharmony_ci if (!reply.WriteParcelable(&it)) { 3756eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write parcelable fail"); 3757eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3758eace7efcSopenharmony_ci } 3759eace7efcSopenharmony_ci } 3760eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3761eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3762eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3763eace7efcSopenharmony_ci } 3764eace7efcSopenharmony_ci return result; 3765eace7efcSopenharmony_ci} 3766eace7efcSopenharmony_ci 3767eace7efcSopenharmony_ciint32_t AbilityManagerStub::UpdateSessionInfoBySCBInner(MessageParcel &data, MessageParcel &reply) 3768eace7efcSopenharmony_ci{ 3769eace7efcSopenharmony_ci auto size = data.ReadInt32(); 3770eace7efcSopenharmony_ci int32_t threshold = 512; 3771eace7efcSopenharmony_ci if (size > threshold) { 3772eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "vector size too large"); 3773eace7efcSopenharmony_ci return ERR_ENOUGH_DATA; 3774eace7efcSopenharmony_ci } 3775eace7efcSopenharmony_ci std::list<SessionInfo> sessionInfos; 3776eace7efcSopenharmony_ci for (auto i = 0; i < size; i++) { 3777eace7efcSopenharmony_ci std::unique_ptr<SessionInfo> info(data.ReadParcelable<SessionInfo>()); 3778eace7efcSopenharmony_ci if (info == nullptr) { 3779eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "null info"); 3780eace7efcSopenharmony_ci return ERR_NATIVE_IPC_PARCEL_FAILED; 3781eace7efcSopenharmony_ci } 3782eace7efcSopenharmony_ci sessionInfos.emplace_back(*info); 3783eace7efcSopenharmony_ci } 3784eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3785eace7efcSopenharmony_ci std::vector<int32_t> sessionIds; 3786eace7efcSopenharmony_ci auto result = UpdateSessionInfoBySCB(sessionInfos, userId, sessionIds); 3787eace7efcSopenharmony_ci if (result != ERR_OK) { 3788eace7efcSopenharmony_ci return result; 3789eace7efcSopenharmony_ci } 3790eace7efcSopenharmony_ci size = static_cast<int32_t>(sessionIds.size()); 3791eace7efcSopenharmony_ci if (size > threshold) { 3792eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "vector size too large"); 3793eace7efcSopenharmony_ci return ERR_ENOUGH_DATA; 3794eace7efcSopenharmony_ci } 3795eace7efcSopenharmony_ci reply.WriteInt32(size); 3796eace7efcSopenharmony_ci for (auto index = 0; index < size; index++) { 3797eace7efcSopenharmony_ci reply.WriteInt32(sessionIds[index]); 3798eace7efcSopenharmony_ci } 3799eace7efcSopenharmony_ci return ERR_OK; 3800eace7efcSopenharmony_ci} 3801eace7efcSopenharmony_ci 3802eace7efcSopenharmony_ciint32_t AbilityManagerStub::GetUIExtensionRootHostInfoInner(MessageParcel &data, MessageParcel &reply) 3803eace7efcSopenharmony_ci{ 3804eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3805eace7efcSopenharmony_ci if (data.ReadBool()) { 3806eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3807eace7efcSopenharmony_ci if (callerToken == nullptr) { 3808eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken null"); 3809eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3810eace7efcSopenharmony_ci } 3811eace7efcSopenharmony_ci } 3812eace7efcSopenharmony_ci 3813eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3814eace7efcSopenharmony_ci UIExtensionHostInfo hostInfo; 3815eace7efcSopenharmony_ci auto result = GetUIExtensionRootHostInfo(callerToken, hostInfo, userId); 3816eace7efcSopenharmony_ci if (!reply.WriteParcelable(&hostInfo)) { 3817eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write host info fail"); 3818eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3819eace7efcSopenharmony_ci } 3820eace7efcSopenharmony_ci 3821eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3822eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3823eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3824eace7efcSopenharmony_ci } 3825eace7efcSopenharmony_ci 3826eace7efcSopenharmony_ci return NO_ERROR; 3827eace7efcSopenharmony_ci} 3828eace7efcSopenharmony_ci 3829eace7efcSopenharmony_ciint32_t AbilityManagerStub::GetUIExtensionSessionInfoInner(MessageParcel &data, MessageParcel &reply) 3830eace7efcSopenharmony_ci{ 3831eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3832eace7efcSopenharmony_ci if (data.ReadBool()) { 3833eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3834eace7efcSopenharmony_ci if (callerToken == nullptr) { 3835eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken null"); 3836eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3837eace7efcSopenharmony_ci } 3838eace7efcSopenharmony_ci } 3839eace7efcSopenharmony_ci 3840eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3841eace7efcSopenharmony_ci UIExtensionSessionInfo uiExtensionSessionInfo; 3842eace7efcSopenharmony_ci auto result = GetUIExtensionSessionInfo(callerToken, uiExtensionSessionInfo, userId); 3843eace7efcSopenharmony_ci if (!reply.WriteParcelable(&uiExtensionSessionInfo)) { 3844eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write ui extension session info fail"); 3845eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3846eace7efcSopenharmony_ci } 3847eace7efcSopenharmony_ci 3848eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3849eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3850eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3851eace7efcSopenharmony_ci } 3852eace7efcSopenharmony_ci 3853eace7efcSopenharmony_ci return NO_ERROR; 3854eace7efcSopenharmony_ci} 3855eace7efcSopenharmony_ci 3856eace7efcSopenharmony_ciint32_t AbilityManagerStub::RestartAppInner(MessageParcel &data, MessageParcel &reply) 3857eace7efcSopenharmony_ci{ 3858eace7efcSopenharmony_ci TAG_LOGD(AAFwkTag::ABILITYMGR, "call."); 3859eace7efcSopenharmony_ci std::unique_ptr<AAFwk::Want> want(data.ReadParcelable<AAFwk::Want>()); 3860eace7efcSopenharmony_ci if (want == nullptr) { 3861eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3862eace7efcSopenharmony_ci return IPC_STUB_ERR; 3863eace7efcSopenharmony_ci } 3864eace7efcSopenharmony_ci bool isAppRecovery = data.ReadBool(); 3865eace7efcSopenharmony_ci auto result = RestartApp(*want, isAppRecovery); 3866eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3867eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3868eace7efcSopenharmony_ci return IPC_STUB_ERR; 3869eace7efcSopenharmony_ci } 3870eace7efcSopenharmony_ci return ERR_OK; 3871eace7efcSopenharmony_ci} 3872eace7efcSopenharmony_ci 3873eace7efcSopenharmony_ciint32_t AbilityManagerStub::OpenAtomicServiceInner(MessageParcel &data, MessageParcel &reply) 3874eace7efcSopenharmony_ci{ 3875eace7efcSopenharmony_ci std::unique_ptr<Want> want(data.ReadParcelable<Want>()); 3876eace7efcSopenharmony_ci if (want == nullptr) { 3877eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3878eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3879eace7efcSopenharmony_ci } 3880eace7efcSopenharmony_ci std::unique_ptr<StartOptions> options(data.ReadParcelable<StartOptions>()); 3881eace7efcSopenharmony_ci if (options == nullptr) { 3882eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "options null"); 3883eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3884eace7efcSopenharmony_ci } 3885eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3886eace7efcSopenharmony_ci if (data.ReadBool()) { 3887eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3888eace7efcSopenharmony_ci } 3889eace7efcSopenharmony_ci int32_t requestCode = data.ReadInt32(); 3890eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 3891eace7efcSopenharmony_ci int32_t openRet = OpenAtomicService(*want, *options, callerToken, requestCode, userId); 3892eace7efcSopenharmony_ci if (openRet != ERR_OK) { 3893eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "open atomic service fail"); 3894eace7efcSopenharmony_ci return openRet; 3895eace7efcSopenharmony_ci } 3896eace7efcSopenharmony_ci if (!reply.WriteInt32(openRet)) { 3897eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write openRet fail"); 3898eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3899eace7efcSopenharmony_ci } 3900eace7efcSopenharmony_ci return ERR_OK; 3901eace7efcSopenharmony_ci} 3902eace7efcSopenharmony_ci 3903eace7efcSopenharmony_ciint32_t AbilityManagerStub::SetResidentProcessEnableInner(MessageParcel &data, MessageParcel &reply) 3904eace7efcSopenharmony_ci{ 3905eace7efcSopenharmony_ci std::string bundleName = data.ReadString(); 3906eace7efcSopenharmony_ci bool enable = data.ReadBool(); 3907eace7efcSopenharmony_ci auto result = SetResidentProcessEnabled(bundleName, enable); 3908eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3909eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3910eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3911eace7efcSopenharmony_ci } 3912eace7efcSopenharmony_ci return NO_ERROR; 3913eace7efcSopenharmony_ci} 3914eace7efcSopenharmony_ci 3915eace7efcSopenharmony_ciint32_t AbilityManagerStub::IsEmbeddedOpenAllowedInner(MessageParcel &data, MessageParcel &reply) 3916eace7efcSopenharmony_ci{ 3917eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = nullptr; 3918eace7efcSopenharmony_ci if (data.ReadBool()) { 3919eace7efcSopenharmony_ci callerToken = data.ReadRemoteObject(); 3920eace7efcSopenharmony_ci if (callerToken == nullptr) { 3921eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "callerToken null"); 3922eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3923eace7efcSopenharmony_ci } 3924eace7efcSopenharmony_ci } 3925eace7efcSopenharmony_ci 3926eace7efcSopenharmony_ci std::string appId = data.ReadString(); 3927eace7efcSopenharmony_ci auto result = IsEmbeddedOpenAllowed(callerToken, appId); 3928eace7efcSopenharmony_ci 3929eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 3930eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result fail"); 3931eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3932eace7efcSopenharmony_ci } 3933eace7efcSopenharmony_ci 3934eace7efcSopenharmony_ci return NO_ERROR; 3935eace7efcSopenharmony_ci} 3936eace7efcSopenharmony_ci 3937eace7efcSopenharmony_ciint32_t AbilityManagerStub::StartShortcutInner(MessageParcel &data, MessageParcel &reply) 3938eace7efcSopenharmony_ci{ 3939eace7efcSopenharmony_ci std::shared_ptr<Want> want(data.ReadParcelable<Want>()); 3940eace7efcSopenharmony_ci if (want == nullptr) { 3941eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3942eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3943eace7efcSopenharmony_ci } 3944eace7efcSopenharmony_ci StartOptions *startOptions = data.ReadParcelable<StartOptions>(); 3945eace7efcSopenharmony_ci if (startOptions == nullptr) { 3946eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "startOptions null"); 3947eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3948eace7efcSopenharmony_ci } 3949eace7efcSopenharmony_ci startOptions->processOptions = nullptr; 3950eace7efcSopenharmony_ci 3951eace7efcSopenharmony_ci int32_t result = StartShortcut(*want, *startOptions); 3952eace7efcSopenharmony_ci reply.WriteInt32(result); 3953eace7efcSopenharmony_ci delete startOptions; 3954eace7efcSopenharmony_ci return NO_ERROR; 3955eace7efcSopenharmony_ci} 3956eace7efcSopenharmony_ci 3957eace7efcSopenharmony_ciint32_t AbilityManagerStub::GetAbilityStateByPersistentIdInner(MessageParcel &data, MessageParcel &reply) 3958eace7efcSopenharmony_ci{ 3959eace7efcSopenharmony_ci int32_t persistentId = data.ReadInt32(); 3960eace7efcSopenharmony_ci bool state = false; 3961eace7efcSopenharmony_ci int32_t result = GetAbilityStateByPersistentId(persistentId, state); 3962eace7efcSopenharmony_ci if (result == ERR_OK) { 3963eace7efcSopenharmony_ci if (!reply.WriteBool(state)) { 3964eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "reply write fail"); 3965eace7efcSopenharmony_ci return IPC_STUB_ERR; 3966eace7efcSopenharmony_ci } 3967eace7efcSopenharmony_ci } 3968eace7efcSopenharmony_ci return result; 3969eace7efcSopenharmony_ci} 3970eace7efcSopenharmony_ci 3971eace7efcSopenharmony_ciint32_t AbilityManagerStub::TransferAbilityResultForExtensionInner(MessageParcel &data, MessageParcel &reply) 3972eace7efcSopenharmony_ci{ 3973eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 3974eace7efcSopenharmony_ci int32_t resultCode = data.ReadInt32(); 3975eace7efcSopenharmony_ci sptr<Want> want = data.ReadParcelable<Want>(); 3976eace7efcSopenharmony_ci if (want == nullptr) { 3977eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 3978eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 3979eace7efcSopenharmony_ci } 3980eace7efcSopenharmony_ci int32_t result = TransferAbilityResultForExtension(callerToken, resultCode, *want); 3981eace7efcSopenharmony_ci reply.WriteInt32(result); 3982eace7efcSopenharmony_ci return NO_ERROR; 3983eace7efcSopenharmony_ci} 3984eace7efcSopenharmony_ci 3985eace7efcSopenharmony_ciint32_t AbilityManagerStub::NotifyFrozenProcessByRSSInner(MessageParcel &data, MessageParcel &reply) 3986eace7efcSopenharmony_ci{ 3987eace7efcSopenharmony_ci std::vector<int32_t> pidList; 3988eace7efcSopenharmony_ci data.ReadInt32Vector(&pidList); 3989eace7efcSopenharmony_ci int32_t uid = data.ReadInt32(); 3990eace7efcSopenharmony_ci NotifyFrozenProcessByRSS(pidList, uid); 3991eace7efcSopenharmony_ci return NO_ERROR; 3992eace7efcSopenharmony_ci} 3993eace7efcSopenharmony_ci 3994eace7efcSopenharmony_ciint32_t AbilityManagerStub::PreStartMissionInner(MessageParcel &data, MessageParcel &reply) 3995eace7efcSopenharmony_ci{ 3996eace7efcSopenharmony_ci std::string bundleName = data.ReadString(); 3997eace7efcSopenharmony_ci std::string moduleName = data.ReadString(); 3998eace7efcSopenharmony_ci std::string abilityName = data.ReadString(); 3999eace7efcSopenharmony_ci std::string startTime = data.ReadString(); 4000eace7efcSopenharmony_ci int32_t result = PreStartMission(bundleName, moduleName, abilityName, startTime); 4001eace7efcSopenharmony_ci reply.WriteInt32(result); 4002eace7efcSopenharmony_ci return NO_ERROR; 4003eace7efcSopenharmony_ci} 4004eace7efcSopenharmony_ci 4005eace7efcSopenharmony_ciint32_t AbilityManagerStub::CleanUIAbilityBySCBInner(MessageParcel &data, MessageParcel &reply) 4006eace7efcSopenharmony_ci{ 4007eace7efcSopenharmony_ci sptr<SessionInfo> sessionInfo = nullptr; 4008eace7efcSopenharmony_ci if (data.ReadBool()) { 4009eace7efcSopenharmony_ci sessionInfo = data.ReadParcelable<SessionInfo>(); 4010eace7efcSopenharmony_ci } 4011eace7efcSopenharmony_ci int32_t result = CleanUIAbilityBySCB(sessionInfo); 4012eace7efcSopenharmony_ci reply.WriteInt32(result); 4013eace7efcSopenharmony_ci return NO_ERROR; 4014eace7efcSopenharmony_ci} 4015eace7efcSopenharmony_ci 4016eace7efcSopenharmony_ciint32_t AbilityManagerStub::OpenLinkInner(MessageParcel &data, MessageParcel &reply) 4017eace7efcSopenharmony_ci{ 4018eace7efcSopenharmony_ci sptr<Want> want = data.ReadParcelable<Want>(); 4019eace7efcSopenharmony_ci if (want == nullptr) { 4020eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "want null"); 4021eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 4022eace7efcSopenharmony_ci } 4023eace7efcSopenharmony_ci sptr<IRemoteObject> callerToken = data.ReadRemoteObject(); 4024eace7efcSopenharmony_ci int32_t userId = data.ReadInt32(); 4025eace7efcSopenharmony_ci int requestCode = data.ReadInt32(); 4026eace7efcSopenharmony_ci 4027eace7efcSopenharmony_ci int32_t result = OpenLink(*want, callerToken, userId, requestCode); 4028eace7efcSopenharmony_ci if (result != NO_ERROR && result != ERR_OPEN_LINK_START_ABILITY_DEFAULT_OK) { 4029eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "openLink fail"); 4030eace7efcSopenharmony_ci } 4031eace7efcSopenharmony_ci reply.WriteInt32(result); 4032eace7efcSopenharmony_ci return result; 4033eace7efcSopenharmony_ci} 4034eace7efcSopenharmony_ci 4035eace7efcSopenharmony_ciint32_t AbilityManagerStub::TerminateMissionInner(MessageParcel &data, MessageParcel &reply) 4036eace7efcSopenharmony_ci{ 4037eace7efcSopenharmony_ci int32_t missionId = data.ReadInt32(); 4038eace7efcSopenharmony_ci int32_t result = TerminateMission(missionId); 4039eace7efcSopenharmony_ci if (result != NO_ERROR && result != ERR_OPEN_LINK_START_ABILITY_DEFAULT_OK) { 4040eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "openLink fail"); 4041eace7efcSopenharmony_ci } 4042eace7efcSopenharmony_ci reply.WriteInt32(result); 4043eace7efcSopenharmony_ci return result; 4044eace7efcSopenharmony_ci} 4045eace7efcSopenharmony_ci 4046eace7efcSopenharmony_ciint32_t AbilityManagerStub::BlockAllAppStartInner(MessageParcel &data, MessageParcel &reply) 4047eace7efcSopenharmony_ci{ 4048eace7efcSopenharmony_ci bool flag = data.ReadBool(); 4049eace7efcSopenharmony_ci int32_t result = BlockAllAppStart(flag); 4050eace7efcSopenharmony_ci if (!reply.WriteInt32(result)) { 4051eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "write result failed"); 4052eace7efcSopenharmony_ci return IPC_STUB_ERR; 4053eace7efcSopenharmony_ci } 4054eace7efcSopenharmony_ci return ERR_OK; 4055eace7efcSopenharmony_ci} 4056eace7efcSopenharmony_ci 4057eace7efcSopenharmony_ciint32_t AbilityManagerStub::UpdateAssociateConfigListInner(MessageParcel &data, MessageParcel &reply) 4058eace7efcSopenharmony_ci{ 4059eace7efcSopenharmony_ci int32_t size = data.ReadInt32(); 4060eace7efcSopenharmony_ci if (size > MAX_UPDATE_CONFIG_SIZE) { 4061eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "config size error"); 4062eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 4063eace7efcSopenharmony_ci } 4064eace7efcSopenharmony_ci std::map<std::string, std::list<std::string>> configs; 4065eace7efcSopenharmony_ci for (int32_t i = 0; i < size; ++i) { 4066eace7efcSopenharmony_ci std::string key = data.ReadString(); 4067eace7efcSopenharmony_ci int32_t itemSize = data.ReadInt32(); 4068eace7efcSopenharmony_ci if (itemSize > MAX_UPDATE_CONFIG_SIZE) { 4069eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "config size error"); 4070eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 4071eace7efcSopenharmony_ci } 4072eace7efcSopenharmony_ci configs.emplace(key, std::list<std::string>()); 4073eace7efcSopenharmony_ci for (int32_t j = 0; j < itemSize; ++j) { 4074eace7efcSopenharmony_ci configs[key].push_back(data.ReadString()); 4075eace7efcSopenharmony_ci } 4076eace7efcSopenharmony_ci } 4077eace7efcSopenharmony_ci 4078eace7efcSopenharmony_ci std::list<std::string> exportConfigs; 4079eace7efcSopenharmony_ci size = data.ReadInt32(); 4080eace7efcSopenharmony_ci if (size > MAX_UPDATE_CONFIG_SIZE) { 4081eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "config size error"); 4082eace7efcSopenharmony_ci return ERR_INVALID_VALUE; 4083eace7efcSopenharmony_ci } 4084eace7efcSopenharmony_ci for (int32_t i = 0; i < size; ++i) { 4085eace7efcSopenharmony_ci exportConfigs.push_back(data.ReadString()); 4086eace7efcSopenharmony_ci } 4087eace7efcSopenharmony_ci int32_t flag = data.ReadInt32(); 4088eace7efcSopenharmony_ci int32_t result = UpdateAssociateConfigList(configs, exportConfigs, flag); 4089eace7efcSopenharmony_ci if (result != NO_ERROR) { 4090eace7efcSopenharmony_ci TAG_LOGE(AAFwkTag::ABILITYMGR, "update associate config fail"); 4091eace7efcSopenharmony_ci } 4092eace7efcSopenharmony_ci reply.WriteInt32(result); 4093eace7efcSopenharmony_ci return NO_ERROR; 4094eace7efcSopenharmony_ci} 4095eace7efcSopenharmony_ci} // namespace AAFwk 4096eace7efcSopenharmony_ci} // namespace OHOS