1eace7efcSopenharmony_ci/* 2eace7efcSopenharmony_ci * Copyright (c) 2021-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#ifndef OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_MANAGER_H 17eace7efcSopenharmony_ci#define OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_MANAGER_H 18eace7efcSopenharmony_ci 19eace7efcSopenharmony_ci#include <list> 20eace7efcSopenharmony_ci#include <map> 21eace7efcSopenharmony_ci#include <string> 22eace7efcSopenharmony_ci#include <unordered_map> 23eace7efcSopenharmony_ci#include "cpp/mutex.h" 24eace7efcSopenharmony_ci 25eace7efcSopenharmony_ci#include "ability_cache_manager.h" 26eace7efcSopenharmony_ci#include "ability_connect_callback_interface.h" 27eace7efcSopenharmony_ci#include "task_handler_wrap.h" 28eace7efcSopenharmony_ci#include "event_handler_wrap.h" 29eace7efcSopenharmony_ci#include "ability_record.h" 30eace7efcSopenharmony_ci#include "ability_running_info.h" 31eace7efcSopenharmony_ci#include "event_report.h" 32eace7efcSopenharmony_ci#include "extension_config.h" 33eace7efcSopenharmony_ci#include "extension_running_info.h" 34eace7efcSopenharmony_ci#include "connection_record.h" 35eace7efcSopenharmony_ci#include "element_name.h" 36eace7efcSopenharmony_ci#include "ui_extension_ability_connect_info.h" 37eace7efcSopenharmony_ci#include "extension_record_manager.h" 38eace7efcSopenharmony_ci#include "want.h" 39eace7efcSopenharmony_ci#include "iremote_object.h" 40eace7efcSopenharmony_ci#include "nocopyable.h" 41eace7efcSopenharmony_ci 42eace7efcSopenharmony_cinamespace OHOS { 43eace7efcSopenharmony_cinamespace AAFwk { 44eace7efcSopenharmony_ciusing OHOS::AppExecFwk::AbilityType; 45eace7efcSopenharmony_ciusing UIExtensionAbilityConnectInfo = AbilityRuntime::UIExtensionAbilityConnectInfo; 46eace7efcSopenharmony_ciusing UIExtensionAbilityConnectManager = AbilityRuntime::ExtensionRecordManager; 47eace7efcSopenharmony_ciusing UIExtensionSessionInfo = AbilityRuntime::UIExtensionSessionInfo; 48eace7efcSopenharmony_ci/** 49eace7efcSopenharmony_ci * @class AbilityConnectManager 50eace7efcSopenharmony_ci * AbilityConnectManager provides a facility for managing service ability connection. 51eace7efcSopenharmony_ci */ 52eace7efcSopenharmony_ciclass AbilityConnectManager : public std::enable_shared_from_this<AbilityConnectManager> { 53eace7efcSopenharmony_cipublic: 54eace7efcSopenharmony_ci using ConnectMapType = std::map<sptr<IRemoteObject>, std::list<std::shared_ptr<ConnectionRecord>>>; 55eace7efcSopenharmony_ci using ServiceMapType = std::map<std::string, std::shared_ptr<AbilityRecord>>; 56eace7efcSopenharmony_ci using ConnectListType = std::list<std::shared_ptr<ConnectionRecord>>; 57eace7efcSopenharmony_ci using RecipientMapType = std::map<sptr<IRemoteObject>, sptr<IRemoteObject::DeathRecipient>>; 58eace7efcSopenharmony_ci using UIExtWindowMapValType = std::pair<std::weak_ptr<AbilityRecord>, sptr<SessionInfo>>; 59eace7efcSopenharmony_ci using UIExtensionMapType = std::map<sptr<IRemoteObject>, UIExtWindowMapValType>; 60eace7efcSopenharmony_ci using WindowExtMapValType = std::pair<uint32_t, sptr<SessionInfo>>; 61eace7efcSopenharmony_ci using WindowExtensionMapType = std::map<sptr<IRemoteObject>, WindowExtMapValType>; 62eace7efcSopenharmony_ci 63eace7efcSopenharmony_ci explicit AbilityConnectManager(int userId); 64eace7efcSopenharmony_ci virtual ~AbilityConnectManager(); 65eace7efcSopenharmony_ci 66eace7efcSopenharmony_ci /** 67eace7efcSopenharmony_ci * StartAbility with request. 68eace7efcSopenharmony_ci * 69eace7efcSopenharmony_ci * @param abilityRequest, the request of the service ability to start. 70eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 71eace7efcSopenharmony_ci */ 72eace7efcSopenharmony_ci int32_t StartAbility(const AbilityRequest &abilityRequest); 73eace7efcSopenharmony_ci 74eace7efcSopenharmony_ci /** 75eace7efcSopenharmony_ci * TerminateAbility with token and result want. 76eace7efcSopenharmony_ci * 77eace7efcSopenharmony_ci * @param token, the token of service type's ability to terminate. 78eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 79eace7efcSopenharmony_ci */ 80eace7efcSopenharmony_ci int TerminateAbility(const sptr<IRemoteObject> &token); 81eace7efcSopenharmony_ci 82eace7efcSopenharmony_ci /** 83eace7efcSopenharmony_ci * StopServiceAbility with request. 84eace7efcSopenharmony_ci * 85eace7efcSopenharmony_ci * @param abilityRequest, request. 86eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 87eace7efcSopenharmony_ci */ 88eace7efcSopenharmony_ci int StopServiceAbility(const AbilityRequest &abilityRequest); 89eace7efcSopenharmony_ci 90eace7efcSopenharmony_ci /** 91eace7efcSopenharmony_ci * ConnectAbilityLocked, connect session with service ability. 92eace7efcSopenharmony_ci * 93eace7efcSopenharmony_ci * @param abilityRequest, Special want for service type's ability. 94eace7efcSopenharmony_ci * @param connect, Callback used to notify caller the result of connecting or disconnecting. 95eace7efcSopenharmony_ci * @param callerToken, caller ability token. 96eace7efcSopenharmony_ci * @param sessionInfo the extension session info of the ability to connect. 97eace7efcSopenharmony_ci * @param connectInfo the connect info. 98eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 99eace7efcSopenharmony_ci */ 100eace7efcSopenharmony_ci int32_t ConnectAbilityLocked(const AbilityRequest &abilityRequest, const sptr<IAbilityConnection> &connect, 101eace7efcSopenharmony_ci const sptr<IRemoteObject> &callerToken, sptr<SessionInfo> sessionInfo = nullptr, 102eace7efcSopenharmony_ci sptr<UIExtensionAbilityConnectInfo> connectInfo = nullptr); 103eace7efcSopenharmony_ci 104eace7efcSopenharmony_ci /** 105eace7efcSopenharmony_ci * PreloadUIExtensionAbilityInner, preload uiextension ability. 106eace7efcSopenharmony_ci * 107eace7efcSopenharmony_ci * @param abilityRequest, Special want for service type's ability. 108eace7efcSopenharmony_ci * @param hostBundleName, the caller application bundle name. 109eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 110eace7efcSopenharmony_ci */ 111eace7efcSopenharmony_ci int PreloadUIExtensionAbilityInner(const AbilityRequest &abilityRequest, std::string &hostBundleName); 112eace7efcSopenharmony_ci 113eace7efcSopenharmony_ci /** 114eace7efcSopenharmony_ci * PreloadUIExtensionAbilityLocked, preload uiextension ability. 115eace7efcSopenharmony_ci * 116eace7efcSopenharmony_ci * @param abilityRequest, Special want for service type's ability. 117eace7efcSopenharmony_ci * @param hostBundleName, the caller application bundle name. 118eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 119eace7efcSopenharmony_ci */ 120eace7efcSopenharmony_ci int PreloadUIExtensionAbilityLocked(const AbilityRequest &abilityRequest, std::string &hostBundleName); 121eace7efcSopenharmony_ci 122eace7efcSopenharmony_ci /** 123eace7efcSopenharmony_ci * UnloadUIExtensionAbility, unload uiextension ability. 124eace7efcSopenharmony_ci * 125eace7efcSopenharmony_ci * @param abilityRecord, uiextension ability record. 126eace7efcSopenharmony_ci * @param hostBundleName, the caller application bundle name. 127eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 128eace7efcSopenharmony_ci */ 129eace7efcSopenharmony_ci int UnloadUIExtensionAbility(const std::shared_ptr<AAFwk::AbilityRecord> &abilityRecord, std::string &bundleName); 130eace7efcSopenharmony_ci 131eace7efcSopenharmony_ci /** 132eace7efcSopenharmony_ci * ClearPreloadUIExtensionRecord, clear preload uiextension record. 133eace7efcSopenharmony_ci * 134eace7efcSopenharmony_ci * @param abilityRecord, uiextension ability record. 135eace7efcSopenharmony_ci */ 136eace7efcSopenharmony_ci void ClearPreloadUIExtensionRecord(const std::shared_ptr<AbilityRecord> &abilityRecord); 137eace7efcSopenharmony_ci 138eace7efcSopenharmony_ci /** 139eace7efcSopenharmony_ci * DisconnectAbilityLocked, disconnect session with callback. 140eace7efcSopenharmony_ci * 141eace7efcSopenharmony_ci * @param connect, Callback used to notify caller the result of connecting or disconnecting. 142eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 143eace7efcSopenharmony_ci */ 144eace7efcSopenharmony_ci int DisconnectAbilityLocked(const sptr<IAbilityConnection> &connect); 145eace7efcSopenharmony_ci 146eace7efcSopenharmony_ci /** 147eace7efcSopenharmony_ci * AttachAbilityThreadLocked, ability call this interface after loaded. 148eace7efcSopenharmony_ci * 149eace7efcSopenharmony_ci * @param scheduler, the interface handler of kit ability. 150eace7efcSopenharmony_ci * @param token, ability's token. 151eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 152eace7efcSopenharmony_ci */ 153eace7efcSopenharmony_ci int AttachAbilityThreadLocked(const sptr<IAbilityScheduler> &scheduler, const sptr<IRemoteObject> &token); 154eace7efcSopenharmony_ci 155eace7efcSopenharmony_ci void OnAbilityRequestDone(const sptr<IRemoteObject> &token, const int32_t state); 156eace7efcSopenharmony_ci 157eace7efcSopenharmony_ci void OnAppStateChanged(const AppInfo &info); 158eace7efcSopenharmony_ci 159eace7efcSopenharmony_ci /** 160eace7efcSopenharmony_ci * AbilityTransitionDone, ability call this interface after lift cycle was changed. 161eace7efcSopenharmony_ci * 162eace7efcSopenharmony_ci * @param token, ability's token. 163eace7efcSopenharmony_ci * @param state, the state of ability lift cycle. 164eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 165eace7efcSopenharmony_ci */ 166eace7efcSopenharmony_ci int AbilityTransitionDone(const sptr<IRemoteObject> &token, int state); 167eace7efcSopenharmony_ci 168eace7efcSopenharmony_ci /** 169eace7efcSopenharmony_ci * @brief execute after the ability schedule the lifecycle 170eace7efcSopenharmony_ci * 171eace7efcSopenharmony_ci * @param token the ability token 172eace7efcSopenharmony_ci * @param windowConfig the windowconfig 173eace7efcSopenharmony_ci * @return execute error code 174eace7efcSopenharmony_ci */ 175eace7efcSopenharmony_ci int AbilityWindowConfigTransactionDone( 176eace7efcSopenharmony_ci const sptr<IRemoteObject> &token, const AppExecFwk::WindowConfig &windowConfig); 177eace7efcSopenharmony_ci 178eace7efcSopenharmony_ci /** 179eace7efcSopenharmony_ci * ScheduleConnectAbilityDoneLocked, service ability call this interface while session was connected. 180eace7efcSopenharmony_ci * 181eace7efcSopenharmony_ci * @param token, service ability's token. 182eace7efcSopenharmony_ci * @param remoteObject, the session proxy of service ability. 183eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 184eace7efcSopenharmony_ci */ 185eace7efcSopenharmony_ci int ScheduleConnectAbilityDoneLocked(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &remoteObject); 186eace7efcSopenharmony_ci 187eace7efcSopenharmony_ci /** 188eace7efcSopenharmony_ci * ScheduleDisconnectAbilityDone, service ability call this interface while session was disconnected. 189eace7efcSopenharmony_ci * 190eace7efcSopenharmony_ci * @param token,service ability's token. 191eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 192eace7efcSopenharmony_ci */ 193eace7efcSopenharmony_ci int ScheduleDisconnectAbilityDoneLocked(const sptr<IRemoteObject> &token); 194eace7efcSopenharmony_ci 195eace7efcSopenharmony_ci /** 196eace7efcSopenharmony_ci * ScheduleCommandAbilityDoneLocked, service ability call this interface while session was onCommanded. 197eace7efcSopenharmony_ci * 198eace7efcSopenharmony_ci * @param token,service ability's token. 199eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 200eace7efcSopenharmony_ci */ 201eace7efcSopenharmony_ci int ScheduleCommandAbilityDoneLocked(const sptr<IRemoteObject> &token); 202eace7efcSopenharmony_ci 203eace7efcSopenharmony_ci int ScheduleCommandAbilityWindowDone( 204eace7efcSopenharmony_ci const sptr<IRemoteObject> &token, 205eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo, 206eace7efcSopenharmony_ci WindowCommand winCmd, 207eace7efcSopenharmony_ci AbilityCommand abilityCmd); 208eace7efcSopenharmony_ci 209eace7efcSopenharmony_ci /** 210eace7efcSopenharmony_ci * GetUIExtensionBySessionInfo. 211eace7efcSopenharmony_ci * 212eace7efcSopenharmony_ci * @param sessionToken, service ability's session token. 213eace7efcSopenharmony_ci * @return Returns AbilityRecord shared_ptr. 214eace7efcSopenharmony_ci */ 215eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetUIExtensionBySessionInfo(const sptr<SessionInfo> &sessionInfo); 216eace7efcSopenharmony_ci 217eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetExtensionByTokenFromServiceMap(const sptr<IRemoteObject> &token); 218eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetExtensionByTokenFromAbilityCache(const sptr<IRemoteObject> &token); 219eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetExtensionByTokenFromTerminatingMap(const sptr<IRemoteObject> &token); 220eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetExtensionByIdFromServiceMap(const int64_t &abilityRecordId); 221eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetExtensionByIdFromTerminatingMap(const int64_t &abilityRecordId); 222eace7efcSopenharmony_ci ConnectListType GetConnectRecordListByCallback(sptr<IAbilityConnection> callback); 223eace7efcSopenharmony_ci 224eace7efcSopenharmony_ci void GetExtensionRunningInfos(int upperLimit, std::vector<ExtensionRunningInfo> &info, 225eace7efcSopenharmony_ci const int32_t userId, bool isPerm); 226eace7efcSopenharmony_ci 227eace7efcSopenharmony_ci void GetAbilityRunningInfos(std::vector<AbilityRunningInfo> &info, bool isPerm); 228eace7efcSopenharmony_ci 229eace7efcSopenharmony_ci void GetExtensionRunningInfo(std::shared_ptr<AbilityRecord> &abilityRecord, const int32_t userId, 230eace7efcSopenharmony_ci std::vector<ExtensionRunningInfo> &info); 231eace7efcSopenharmony_ci 232eace7efcSopenharmony_ci /** 233eace7efcSopenharmony_ci * set from ability manager service for sequenced task 234eace7efcSopenharmony_ci */ 235eace7efcSopenharmony_ci inline void SetTaskHandler(const std::shared_ptr<TaskHandlerWrap> &taskHandler) 236eace7efcSopenharmony_ci { 237eace7efcSopenharmony_ci taskHandler_ = taskHandler; 238eace7efcSopenharmony_ci } 239eace7efcSopenharmony_ci /** 240eace7efcSopenharmony_ci * SetEventHandler. 241eace7efcSopenharmony_ci * 242eace7efcSopenharmony_ci * @param handler,EventHandler 243eace7efcSopenharmony_ci */ 244eace7efcSopenharmony_ci inline void SetEventHandler(const std::shared_ptr<EventHandlerWrap> &handler) 245eace7efcSopenharmony_ci { 246eace7efcSopenharmony_ci eventHandler_ = handler; 247eace7efcSopenharmony_ci } 248eace7efcSopenharmony_ci 249eace7efcSopenharmony_ci uint32_t GetSceneBoardTokenId() const 250eace7efcSopenharmony_ci { 251eace7efcSopenharmony_ci return sceneBoardTokenId_; 252eace7efcSopenharmony_ci } 253eace7efcSopenharmony_ci 254eace7efcSopenharmony_ci /** 255eace7efcSopenharmony_ci * @brief Get extensionList by pid. 256eace7efcSopenharmony_ci * @param pid Process id. 257eace7efcSopenharmony_ci * @param extensionList UIExtensionAbility name list. 258eace7efcSopenharmony_ci */ 259eace7efcSopenharmony_ci int32_t GetActiveUIExtensionList(const int32_t pid, std::vector<std::string> &extensionList); 260eace7efcSopenharmony_ci 261eace7efcSopenharmony_ci /** 262eace7efcSopenharmony_ci * @brief Get extensionList by bundleName. 263eace7efcSopenharmony_ci * @param bundleName The application bundle name. 264eace7efcSopenharmony_ci * @param extensionList UIExtensionAbility name list. 265eace7efcSopenharmony_ci */ 266eace7efcSopenharmony_ci int32_t GetActiveUIExtensionList(const std::string &bundleName, std::vector<std::string> &extensionList); 267eace7efcSopenharmony_ci 268eace7efcSopenharmony_ci /** 269eace7efcSopenharmony_ci * OnAbilityDied. 270eace7efcSopenharmony_ci * 271eace7efcSopenharmony_ci * @param abilityRecord, service ability record. 272eace7efcSopenharmony_ci */ 273eace7efcSopenharmony_ci void OnAbilityDied(const std::shared_ptr<AbilityRecord> &abilityRecord, int32_t currentUserId); 274eace7efcSopenharmony_ci 275eace7efcSopenharmony_ci void DumpState(std::vector<std::string> &info, bool isClient, const std::string &args = ""); 276eace7efcSopenharmony_ci 277eace7efcSopenharmony_ci void DumpStateByUri(std::vector<std::string> &info, bool isClient, const std::string &args, 278eace7efcSopenharmony_ci std::vector<std::string> ¶ms); 279eace7efcSopenharmony_ci 280eace7efcSopenharmony_ci void PauseExtensions(); 281eace7efcSopenharmony_ci 282eace7efcSopenharmony_ci void OnTimeOut(uint32_t msgId, int64_t abilityRecordId, bool isHalf = false); 283eace7efcSopenharmony_ci 284eace7efcSopenharmony_ci /** 285eace7efcSopenharmony_ci * @brief schedule to background 286eace7efcSopenharmony_ci * 287eace7efcSopenharmony_ci * @param abilityRecord the ability to move 288eace7efcSopenharmony_ci */ 289eace7efcSopenharmony_ci void MoveToBackground(const std::shared_ptr<AbilityRecord> &abilityRecord); 290eace7efcSopenharmony_ci 291eace7efcSopenharmony_ci void CommandAbilityWindow(const std::shared_ptr<AbilityRecord> &abilityRecord, 292eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo, WindowCommand winCmd); 293eace7efcSopenharmony_ci 294eace7efcSopenharmony_ci bool IsUIExtensionFocused(uint32_t uiExtensionTokenId, const sptr<IRemoteObject>& focusToken); 295eace7efcSopenharmony_ci 296eace7efcSopenharmony_ci sptr<IRemoteObject> GetUIExtensionSourceToken(const sptr<IRemoteObject> &token); 297eace7efcSopenharmony_ci 298eace7efcSopenharmony_ci bool IsWindowExtensionFocused(uint32_t extensionTokenId, const sptr<IRemoteObject>& focusToken); 299eace7efcSopenharmony_ci 300eace7efcSopenharmony_ci void HandleProcessFrozen(const std::vector<int32_t> &pidList, int32_t uid); 301eace7efcSopenharmony_ci 302eace7efcSopenharmony_ci void ForegroundAbilityWindowLocked(const std::shared_ptr<AbilityRecord> &abilityRecord, 303eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo); 304eace7efcSopenharmony_ci 305eace7efcSopenharmony_ci void BackgroundAbilityWindowLocked(const std::shared_ptr<AbilityRecord> &abilityRecord, 306eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo); 307eace7efcSopenharmony_ci 308eace7efcSopenharmony_ci void TerminateAbilityWindowLocked(const std::shared_ptr<AbilityRecord> &abilityRecord, 309eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo); 310eace7efcSopenharmony_ci 311eace7efcSopenharmony_ci void RemoveLauncherDeathRecipient(); 312eace7efcSopenharmony_ci 313eace7efcSopenharmony_ci /** 314eace7efcSopenharmony_ci * @brief Get ui extension session info 315eace7efcSopenharmony_ci * 316eace7efcSopenharmony_ci * @param token The ability token. 317eace7efcSopenharmony_ci * @param uiExtensionSessionInfo The ui extension session info. 318eace7efcSopenharmony_ci * @param userId The user id. 319eace7efcSopenharmony_ci * @return int32_t Returns ERR_OK on success, others on failure. 320eace7efcSopenharmony_ci */ 321eace7efcSopenharmony_ci int32_t GetUIExtensionSessionInfo(const sptr<IRemoteObject> token, UIExtensionSessionInfo &uiExtensionSessionInfo); 322eace7efcSopenharmony_ci 323eace7efcSopenharmony_ci void GetUIExtensionCallerTokenList(const std::shared_ptr<AbilityRecord> &abilityRecord, 324eace7efcSopenharmony_ci std::list<sptr<IRemoteObject>> &callerList); 325eace7efcSopenharmony_ci 326eace7efcSopenharmony_ci void CloseAssertDialog(const std::string &assertSessionId); 327eace7efcSopenharmony_ci 328eace7efcSopenharmony_ci void SignRestartAppFlag(int32_t uid); 329eace7efcSopenharmony_ci 330eace7efcSopenharmony_ci std::shared_ptr<AAFwk::AbilityRecord> GetUIExtensionRootHostInfo(const sptr<IRemoteObject> token); 331eace7efcSopenharmony_ci void UninstallApp(const std::string &bundleName); 332eace7efcSopenharmony_ci 333eace7efcSopenharmony_ci int32_t UpdateKeepAliveEnableState(const std::string &bundleName, const std::string &moduleName, 334eace7efcSopenharmony_ci const std::string &mainElement, bool updateEnable); 335eace7efcSopenharmony_ci 336eace7efcSopenharmony_ci // MSG 0 - 20 represents timeout message 337eace7efcSopenharmony_ci static constexpr uint32_t CONNECT_TIMEOUT_MSG = 1; 338eace7efcSopenharmony_ci 339eace7efcSopenharmony_ciprivate: 340eace7efcSopenharmony_ci /** 341eace7efcSopenharmony_ci * StartAbilityLocked with request. 342eace7efcSopenharmony_ci * 343eace7efcSopenharmony_ci * @param abilityRequest, the request of the service ability to start. 344eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 345eace7efcSopenharmony_ci */ 346eace7efcSopenharmony_ci int32_t StartAbilityLocked(const AbilityRequest &abilityRequest); 347eace7efcSopenharmony_ci 348eace7efcSopenharmony_ci /** 349eace7efcSopenharmony_ci * TerminateAbilityLocked with token and result want. 350eace7efcSopenharmony_ci * 351eace7efcSopenharmony_ci * @param token, the token of service type's ability to terminate. 352eace7efcSopenharmony_ci * @param resultCode, the result code of service type's ability to terminate. 353eace7efcSopenharmony_ci * @param resultWant, the result want for service type's ability to terminate. 354eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 355eace7efcSopenharmony_ci */ 356eace7efcSopenharmony_ci int TerminateAbilityLocked(const sptr<IRemoteObject> &token); 357eace7efcSopenharmony_ci 358eace7efcSopenharmony_ci /** 359eace7efcSopenharmony_ci * StopAbilityLocked with request. 360eace7efcSopenharmony_ci * 361eace7efcSopenharmony_ci * @param abilityRequest, the request of the service ability to start. 362eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 363eace7efcSopenharmony_ci */ 364eace7efcSopenharmony_ci int StopServiceAbilityLocked(const AbilityRequest &abilityRequest); 365eace7efcSopenharmony_ci 366eace7efcSopenharmony_ci /** 367eace7efcSopenharmony_ci * DisconnectAbilityLocked, disconnect session with callback. 368eace7efcSopenharmony_ci * 369eace7efcSopenharmony_ci * @param connect, Callback used to notify caller the result of connecting or disconnecting. 370eace7efcSopenharmony_ci * @param callerDied, bool Indicates if it is caused by the caller's death. 371eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 372eace7efcSopenharmony_ci */ 373eace7efcSopenharmony_ci int DisconnectAbilityLocked(const sptr<IAbilityConnection> &connect, bool callerDied); 374eace7efcSopenharmony_ci 375eace7efcSopenharmony_ci /** 376eace7efcSopenharmony_ci * LoadAbility. 377eace7efcSopenharmony_ci * 378eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to load. 379eace7efcSopenharmony_ci */ 380eace7efcSopenharmony_ci void LoadAbility(const std::shared_ptr<AbilityRecord> &abilityRecord); 381eace7efcSopenharmony_ci 382eace7efcSopenharmony_ci /** 383eace7efcSopenharmony_ci * ConnectAbility.Schedule connect ability 384eace7efcSopenharmony_ci * 385eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to connect. 386eace7efcSopenharmony_ci */ 387eace7efcSopenharmony_ci void ConnectAbility(const std::shared_ptr<AbilityRecord> &abilityRecord); 388eace7efcSopenharmony_ci 389eace7efcSopenharmony_ci /** 390eace7efcSopenharmony_ci * ConnectAbility.Schedule connect ability 391eace7efcSopenharmony_ci * 392eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to connect. 393eace7efcSopenharmony_ci */ 394eace7efcSopenharmony_ci void ConnectUIServiceExtAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, 395eace7efcSopenharmony_ci int connectRecordId, const Want &want); 396eace7efcSopenharmony_ci 397eace7efcSopenharmony_ci /** 398eace7efcSopenharmony_ci * ConnectAbility.Schedule Resume Connect ability 399eace7efcSopenharmony_ci * 400eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to connect. 401eace7efcSopenharmony_ci */ 402eace7efcSopenharmony_ci void ResumeConnectAbility(const std::shared_ptr<AbilityRecord> &abilityRecord); 403eace7efcSopenharmony_ci 404eace7efcSopenharmony_ci /** 405eace7efcSopenharmony_ci * CommandAbility. Schedule command ability 406eace7efcSopenharmony_ci * 407eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to command. 408eace7efcSopenharmony_ci */ 409eace7efcSopenharmony_ci void CommandAbility(const std::shared_ptr<AbilityRecord> &abilityRecord); 410eace7efcSopenharmony_ci 411eace7efcSopenharmony_ci /** 412eace7efcSopenharmony_ci * CompleteCommandAbility. complete command ability 413eace7efcSopenharmony_ci * 414eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to command. 415eace7efcSopenharmony_ci */ 416eace7efcSopenharmony_ci void CompleteCommandAbility(std::shared_ptr<AbilityRecord> abilityRecord); 417eace7efcSopenharmony_ci 418eace7efcSopenharmony_ci /** 419eace7efcSopenharmony_ci * TerminateDone. 420eace7efcSopenharmony_ci * 421eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the ability to terminate. 422eace7efcSopenharmony_ci */ 423eace7efcSopenharmony_ci void TerminateDone(const std::shared_ptr<AbilityRecord> &abilityRecord); 424eace7efcSopenharmony_ci 425eace7efcSopenharmony_ci /** 426eace7efcSopenharmony_ci * GetServiceRecordByElementName. 427eace7efcSopenharmony_ci * 428eace7efcSopenharmony_ci * @param element, service ability's element. 429eace7efcSopenharmony_ci * @return Returns AbilityRecord shared_ptr. 430eace7efcSopenharmony_ci */ 431eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> GetServiceRecordByElementName(const std::string &element); 432eace7efcSopenharmony_ci 433eace7efcSopenharmony_ci /** 434eace7efcSopenharmony_ci * dispatch service ability life cycle . 435eace7efcSopenharmony_ci * 436eace7efcSopenharmony_ci * @param abilityRecord. 437eace7efcSopenharmony_ci * @param state. 438eace7efcSopenharmony_ci */ 439eace7efcSopenharmony_ci int DispatchInactive(const std::shared_ptr<AbilityRecord> &abilityRecord, int state); 440eace7efcSopenharmony_ci int DispatchForeground(const std::shared_ptr<AbilityRecord> &abilityRecord); 441eace7efcSopenharmony_ci int DispatchBackground(const std::shared_ptr<AbilityRecord> &abilityRecord); 442eace7efcSopenharmony_ci int DispatchTerminate(const std::shared_ptr<AbilityRecord> &abilityRecord); 443eace7efcSopenharmony_ci 444eace7efcSopenharmony_ci void HandleStartTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord); 445eace7efcSopenharmony_ci void HandleStopTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord); 446eace7efcSopenharmony_ci void HandleTerminateDisconnectTask(const ConnectListType& connectlist); 447eace7efcSopenharmony_ci void HandleCommandTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord); 448eace7efcSopenharmony_ci void HandleCommandWindowTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord, 449eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo, WindowCommand winCmd); 450eace7efcSopenharmony_ci void HandleForegroundTimeoutTask(const std::shared_ptr<AbilityRecord> &abilityRecord); 451eace7efcSopenharmony_ci void HandleConnectTimeoutTask(std::shared_ptr<AbilityRecord> abilityRecord); 452eace7efcSopenharmony_ci void HandleRestartResidentTask(const AbilityRequest &abilityRequest); 453eace7efcSopenharmony_ci void HandleActiveAbility(std::shared_ptr<AbilityRecord> &targetService, 454eace7efcSopenharmony_ci std::shared_ptr<ConnectionRecord> &connectRecord); 455eace7efcSopenharmony_ci void HandleCommandDestroy(const sptr<SessionInfo> &sessionInfo); 456eace7efcSopenharmony_ci void TerminateOrCacheAbility(std::shared_ptr<AbilityRecord> abilityRecord); 457eace7efcSopenharmony_ci 458eace7efcSopenharmony_ci /** 459eace7efcSopenharmony_ci * IsAbilityConnected. 460eace7efcSopenharmony_ci * 461eace7efcSopenharmony_ci * @param abilityRecord, the ptr of the connected ability. 462eace7efcSopenharmony_ci * @param connectRecordList, connect record list. 463eace7efcSopenharmony_ci * @return true: ability is connected, false: ability is not connected 464eace7efcSopenharmony_ci */ 465eace7efcSopenharmony_ci bool IsAbilityConnected(const std::shared_ptr<AbilityRecord> &abilityRecord, 466eace7efcSopenharmony_ci const std::list<std::shared_ptr<ConnectionRecord>> &connectRecordList); 467eace7efcSopenharmony_ci 468eace7efcSopenharmony_ci /** 469eace7efcSopenharmony_ci * RemoveConnectionRecordFromMap. 470eace7efcSopenharmony_ci * 471eace7efcSopenharmony_ci * @param connect, the ptr of the connect record. 472eace7efcSopenharmony_ci */ 473eace7efcSopenharmony_ci void RemoveConnectionRecordFromMap(std::shared_ptr<ConnectionRecord> connect); 474eace7efcSopenharmony_ci 475eace7efcSopenharmony_ci /** 476eace7efcSopenharmony_ci * RemoveServiceAbility. 477eace7efcSopenharmony_ci * 478eace7efcSopenharmony_ci * @param service, the ptr of the ability record. 479eace7efcSopenharmony_ci */ 480eace7efcSopenharmony_ci void RemoveServiceAbility(const std::shared_ptr<AbilityRecord> &service); 481eace7efcSopenharmony_ci 482eace7efcSopenharmony_ci /** 483eace7efcSopenharmony_ci * GetOrCreateServiceRecord. 484eace7efcSopenharmony_ci * 485eace7efcSopenharmony_ci * @param abilityRequest, Special want for service type's ability. 486eace7efcSopenharmony_ci * @param isCreatedByConnect, whether is created by connect ability mode. 487eace7efcSopenharmony_ci * @param targetAbilityRecord, the target service ability record. 488eace7efcSopenharmony_ci * @param isLoadedAbility, whether the target ability has been loaded. 489eace7efcSopenharmony_ci */ 490eace7efcSopenharmony_ci void GetOrCreateServiceRecord(const AbilityRequest &abilityRequest, const bool isCreatedByConnect, 491eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> &targetAbilityRecord, bool &isLoadedAbility); 492eace7efcSopenharmony_ci 493eace7efcSopenharmony_ci /** 494eace7efcSopenharmony_ci * GetConnectRecordListFromMap. 495eace7efcSopenharmony_ci * 496eace7efcSopenharmony_ci * @param connect, callback object. 497eace7efcSopenharmony_ci * @param isCreatedByConnect, whether is created by connect ability mode. 498eace7efcSopenharmony_ci * @param connectRecordList, the target connectRecordList. 499eace7efcSopenharmony_ci * @param isCallbackConnected, whether the callback has been connected. 500eace7efcSopenharmony_ci */ 501eace7efcSopenharmony_ci void GetConnectRecordListFromMap( 502eace7efcSopenharmony_ci const sptr<IAbilityConnection> &connect, std::list<std::shared_ptr<ConnectionRecord>> &connectRecordList); 503eace7efcSopenharmony_ci 504eace7efcSopenharmony_ci /** 505eace7efcSopenharmony_ci * AddConnectDeathRecipient. 506eace7efcSopenharmony_ci * 507eace7efcSopenharmony_ci * @param connect, callback object. 508eace7efcSopenharmony_ci */ 509eace7efcSopenharmony_ci void AddConnectDeathRecipient(sptr<IRemoteObject> connectObject); 510eace7efcSopenharmony_ci 511eace7efcSopenharmony_ci /** 512eace7efcSopenharmony_ci * RemoteConnectDeathRecipient. 513eace7efcSopenharmony_ci * 514eace7efcSopenharmony_ci * @param connect, callback object. 515eace7efcSopenharmony_ci */ 516eace7efcSopenharmony_ci void RemoveConnectDeathRecipient(sptr<IRemoteObject> connectObject); 517eace7efcSopenharmony_ci 518eace7efcSopenharmony_ci /** 519eace7efcSopenharmony_ci * RemoteConnectDeathRecipient. 520eace7efcSopenharmony_ci * 521eace7efcSopenharmony_ci * @param remote, callback object. 522eace7efcSopenharmony_ci */ 523eace7efcSopenharmony_ci void OnCallBackDied(const wptr<IRemoteObject> &remote); 524eace7efcSopenharmony_ci 525eace7efcSopenharmony_ci /** 526eace7efcSopenharmony_ci * HandleOnCallBackDied. 527eace7efcSopenharmony_ci * 528eace7efcSopenharmony_ci * @param connect, callback object. 529eace7efcSopenharmony_ci */ 530eace7efcSopenharmony_ci void HandleCallBackDiedTask(const sptr<IRemoteObject> &connect); 531eace7efcSopenharmony_ci 532eace7efcSopenharmony_ci /** 533eace7efcSopenharmony_ci * HandleOnCallBackDied. 534eace7efcSopenharmony_ci * 535eace7efcSopenharmony_ci * @param abilityRecord, died ability. 536eace7efcSopenharmony_ci */ 537eace7efcSopenharmony_ci void HandleAbilityDiedTask(const std::shared_ptr<AbilityRecord> &abilityRecord, int32_t currentUserId); 538eace7efcSopenharmony_ci void HandleUIExtensionDied(const std::shared_ptr<AbilityRecord> &abilityRecord); 539eace7efcSopenharmony_ci 540eace7efcSopenharmony_ci void RestartAbility(const std::shared_ptr<AbilityRecord> &abilityRecord, int32_t currentUserId); 541eace7efcSopenharmony_ci 542eace7efcSopenharmony_ci /** 543eace7efcSopenharmony_ci * PostTimeOutTask. 544eace7efcSopenharmony_ci * 545eace7efcSopenharmony_ci * @param abilityRecord, ability. 546eace7efcSopenharmony_ci * @param messageId, message id. 547eace7efcSopenharmony_ci */ 548eace7efcSopenharmony_ci void PostTimeOutTask(const std::shared_ptr<AbilityRecord> &abilityRecord, uint32_t messageId); 549eace7efcSopenharmony_ci void PostTimeOutTask(const std::shared_ptr<AbilityRecord> &abilityRecord, int connectRecordId, uint32_t messageId); 550eace7efcSopenharmony_ci 551eace7efcSopenharmony_ci void CompleteForeground(const std::shared_ptr<AbilityRecord> &abilityRecord); 552eace7efcSopenharmony_ci void CompleteBackground(const std::shared_ptr<AbilityRecord> &abilityRecord); 553eace7efcSopenharmony_ci void PrintTimeOutLog(const std::shared_ptr<AbilityRecord> &ability, uint32_t msgId, bool isHalf = false); 554eace7efcSopenharmony_ci 555eace7efcSopenharmony_ci void PostRestartResidentTask(const AbilityRequest &abilityRequest); 556eace7efcSopenharmony_ci 557eace7efcSopenharmony_ci bool IsAbilityNeedKeepAlive(const std::shared_ptr<AbilityRecord> &abilityRecord); 558eace7efcSopenharmony_ci 559eace7efcSopenharmony_ci void ProcessPreload(const std::shared_ptr<AbilityRecord> &record) const; 560eace7efcSopenharmony_ci 561eace7efcSopenharmony_ci void HandleInactiveTimeout(const std::shared_ptr<AbilityRecord> &ability); 562eace7efcSopenharmony_ci void MoveToTerminatingMap(const std::shared_ptr<AbilityRecord>& abilityRecord); 563eace7efcSopenharmony_ci 564eace7efcSopenharmony_ci void DoForegroundUIExtension(std::shared_ptr<AbilityRecord> abilityRecord, const AbilityRequest &abilityRequest); 565eace7efcSopenharmony_ci void DoBackgroundAbilityWindow(const std::shared_ptr<AbilityRecord> &abilityRecord, 566eace7efcSopenharmony_ci const sptr<SessionInfo> &sessionInfo); 567eace7efcSopenharmony_ci 568eace7efcSopenharmony_ci /** 569eace7efcSopenharmony_ci * When a service is under starting, enque the request and handle it after the service starting completes 570eace7efcSopenharmony_ci */ 571eace7efcSopenharmony_ci void EnqueueStartServiceReq(const AbilityRequest &abilityRequest, const std::string &serviceUri = ""); 572eace7efcSopenharmony_ci /** 573eace7efcSopenharmony_ci * After the service starting completes, complete the request list 574eace7efcSopenharmony_ci */ 575eace7efcSopenharmony_ci void CompleteStartServiceReq(const std::string &serviceUri); 576eace7efcSopenharmony_ci 577eace7efcSopenharmony_ci void AddUIExtWindowDeathRecipient(const sptr<IRemoteObject> &session); 578eace7efcSopenharmony_ci void RemoveUIExtWindowDeathRecipient(const sptr<IRemoteObject> &session); 579eace7efcSopenharmony_ci void OnUIExtWindowDied(const wptr<IRemoteObject> &remote); 580eace7efcSopenharmony_ci void HandleUIExtWindowDiedTask(const sptr<IRemoteObject> &remote); 581eace7efcSopenharmony_ci 582eace7efcSopenharmony_ci /** 583eace7efcSopenharmony_ci * Post an extension's disconnect task, auto disconnect when extension connected timeout. 584eace7efcSopenharmony_ci */ 585eace7efcSopenharmony_ci void PostExtensionDelayDisconnectTask(const std::shared_ptr<ConnectionRecord> &connectRecord); 586eace7efcSopenharmony_ci 587eace7efcSopenharmony_ci /** 588eace7efcSopenharmony_ci * Remove the extension's disconnect task. 589eace7efcSopenharmony_ci */ 590eace7efcSopenharmony_ci void RemoveExtensionDelayDisconnectTask(const std::shared_ptr<ConnectionRecord> &connectRecord); 591eace7efcSopenharmony_ci 592eace7efcSopenharmony_ci /** 593eace7efcSopenharmony_ci * Handle extension disconnect task. 594eace7efcSopenharmony_ci */ 595eace7efcSopenharmony_ci void HandleExtensionDisconnectTask(const std::shared_ptr<ConnectionRecord> &connectRecord); 596eace7efcSopenharmony_ci 597eace7efcSopenharmony_ciprivate: 598eace7efcSopenharmony_ci void TerminateRecord(std::shared_ptr<AbilityRecord> abilityRecord); 599eace7efcSopenharmony_ci int DisconnectRecordNormal(ConnectListType &list, std::shared_ptr<ConnectionRecord> connectRecord, 600eace7efcSopenharmony_ci bool callerDied) const; 601eace7efcSopenharmony_ci void DisconnectRecordForce(ConnectListType &list, std::shared_ptr<ConnectionRecord> connectRecord); 602eace7efcSopenharmony_ci int TerminateAbilityInner(const sptr<IRemoteObject> &token); 603eace7efcSopenharmony_ci bool IsLauncher(std::shared_ptr<AbilityRecord> serviceExtension) const; 604eace7efcSopenharmony_ci void KillProcessesByUserId() const; 605eace7efcSopenharmony_ci void SetLastExitReason(const AbilityRequest &abilityRequest, std::shared_ptr<AbilityRecord> &targetService); 606eace7efcSopenharmony_ci inline bool IsUIExtensionAbility(const std::shared_ptr<AbilityRecord> &abilityRecord); 607eace7efcSopenharmony_ci inline bool IsCacheExtensionAbilityType(const std::shared_ptr<AbilityRecord> &abilityRecord); 608eace7efcSopenharmony_ci inline bool CheckUIExtensionAbilityLoaded(const AbilityRequest &abilityRequest); 609eace7efcSopenharmony_ci inline bool CheckUIExtensionAbilitySessionExist(const std::shared_ptr<AbilityRecord> &abilityRecord); 610eace7efcSopenharmony_ci inline void RemoveUIExtensionAbilityRecord(const std::shared_ptr<AbilityRecord> &abilityRecord); 611eace7efcSopenharmony_ci inline void AddUIExtensionAbilityRecordToTerminatedList(const std::shared_ptr<AbilityRecord> &abilityRecord); 612eace7efcSopenharmony_ci inline bool IsCallerValid(const std::shared_ptr<AbilityRecord> &abilityRecord); 613eace7efcSopenharmony_ci int32_t GetOrCreateExtensionRecord(const AbilityRequest &abilityRequest, bool isCreatedByConnect, 614eace7efcSopenharmony_ci const std::string &hostBundleName, std::shared_ptr<AbilityRecord> &extensionRecord, bool &isLoaded); 615eace7efcSopenharmony_ci int32_t GetOrCreateTargetServiceRecord( 616eace7efcSopenharmony_ci const AbilityRequest &abilityRequest, const sptr<UIExtensionAbilityConnectInfo> &connectInfo, 617eace7efcSopenharmony_ci std::shared_ptr<AbilityRecord> &targetService, bool &isLoadedAbility); 618eace7efcSopenharmony_ci void HandleNotifyAssertFaultDialogDied(const std::shared_ptr<AbilityRecord> &abilityRecord); 619eace7efcSopenharmony_ci EventInfo BuildEventInfo(const std::shared_ptr<AbilityRecord> &abilityRecord); 620eace7efcSopenharmony_ci void UpdateUIExtensionInfo(const std::shared_ptr<AbilityRecord> &abilityRecord); 621eace7efcSopenharmony_ci std::string GenerateBundleName(const AbilityRequest &abilityRequest) const; 622eace7efcSopenharmony_ci 623eace7efcSopenharmony_ci bool AddToServiceMap(const std::string &key, std::shared_ptr<AbilityRecord> abilityRecord); 624eace7efcSopenharmony_ci ServiceMapType GetServiceMap(); 625eace7efcSopenharmony_ci 626eace7efcSopenharmony_ci void AddConnectObjectToMap(sptr<IRemoteObject> connectObject, const ConnectListType &connectRecordList, 627eace7efcSopenharmony_ci bool updateOnly); 628eace7efcSopenharmony_ci 629eace7efcSopenharmony_ci void KeepAbilityAlive(const std::shared_ptr<AbilityRecord> &abilityRecord, int32_t currentUserId); 630eace7efcSopenharmony_ci void ProcessEliminateAbilityRecord(std::shared_ptr<AbilityRecord> eliminateRecord); 631eace7efcSopenharmony_ci std::string GetServiceKey(const std::shared_ptr<AbilityRecord> &service); 632eace7efcSopenharmony_ci 633eace7efcSopenharmony_ci int32_t ReportXiaoYiToRSSIfNeeded(const AppExecFwk::AbilityInfo &abilityInfo); 634eace7efcSopenharmony_ci int32_t ReportAbilityStartInfoToRSS(const AppExecFwk::AbilityInfo &abilityInfo); 635eace7efcSopenharmony_ci void ReportEventToRSS(const AppExecFwk::AbilityInfo &abilityInfo, 636eace7efcSopenharmony_ci const std::shared_ptr<AbilityRecord> abilityRecord, sptr<IRemoteObject> callerToken); 637eace7efcSopenharmony_ci 638eace7efcSopenharmony_ciprivate: 639eace7efcSopenharmony_ci const std::string TASK_ON_CALLBACK_DIED = "OnCallbackDiedTask"; 640eace7efcSopenharmony_ci const std::string TASK_ON_ABILITY_DIED = "OnAbilityDiedTask"; 641eace7efcSopenharmony_ci 642eace7efcSopenharmony_ci ffrt::mutex serialMutex_; 643eace7efcSopenharmony_ci 644eace7efcSopenharmony_ci std::mutex connectMapMutex_; 645eace7efcSopenharmony_ci ConnectMapType connectMap_; 646eace7efcSopenharmony_ci 647eace7efcSopenharmony_ci ffrt::mutex serviceMapMutex_; 648eace7efcSopenharmony_ci ServiceMapType serviceMap_; 649eace7efcSopenharmony_ci std::list<std::shared_ptr<AbilityRecord>> terminatingExtensionList_; 650eace7efcSopenharmony_ci 651eace7efcSopenharmony_ci std::mutex recipientMapMutex_; 652eace7efcSopenharmony_ci RecipientMapType recipientMap_; 653eace7efcSopenharmony_ci 654eace7efcSopenharmony_ci std::mutex uiExtRecipientMapMutex_; 655eace7efcSopenharmony_ci RecipientMapType uiExtRecipientMap_; 656eace7efcSopenharmony_ci 657eace7efcSopenharmony_ci std::shared_ptr<TaskHandlerWrap> taskHandler_; 658eace7efcSopenharmony_ci std::shared_ptr<EventHandlerWrap> eventHandler_; 659eace7efcSopenharmony_ci int userId_; 660eace7efcSopenharmony_ci std::vector<AbilityRequest> restartResidentTaskList_; 661eace7efcSopenharmony_ci 662eace7efcSopenharmony_ci std::mutex startServiceReqListLock_; 663eace7efcSopenharmony_ci std::unordered_map<std::string, std::shared_ptr<std::list<AbilityRequest>>> startServiceReqList_; 664eace7efcSopenharmony_ci 665eace7efcSopenharmony_ci std::mutex uiExtensionMapMutex_; 666eace7efcSopenharmony_ci UIExtensionMapType uiExtensionMap_; 667eace7efcSopenharmony_ci 668eace7efcSopenharmony_ci std::mutex windowExtensionMapMutex_; 669eace7efcSopenharmony_ci WindowExtensionMapType windowExtensionMap_; 670eace7efcSopenharmony_ci 671eace7efcSopenharmony_ci std::unique_ptr<UIExtensionAbilityConnectManager> uiExtensionAbilityRecordMgr_ = nullptr; 672eace7efcSopenharmony_ci uint32_t sceneBoardTokenId_ = 0; 673eace7efcSopenharmony_ci 674eace7efcSopenharmony_ci DISALLOW_COPY_AND_MOVE(AbilityConnectManager); 675eace7efcSopenharmony_ci}; 676eace7efcSopenharmony_ci} // namespace AAFwk 677eace7efcSopenharmony_ci} // namespace OHOS 678eace7efcSopenharmony_ci#endif // OHOS_ABILITY_RUNTIME_ABILITY_CONNECT_MANAGER_H 679