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_AMS_MGR_SCHEDULER_H 17eace7efcSopenharmony_ci#define OHOS_ABILITY_RUNTIME_AMS_MGR_SCHEDULER_H 18eace7efcSopenharmony_ci 19eace7efcSopenharmony_ci#include "ability_info.h" 20eace7efcSopenharmony_ci#include "ability_running_record.h" 21eace7efcSopenharmony_ci#include "ams_mgr_stub.h" 22eace7efcSopenharmony_ci#include "app_debug_listener_interface.h" 23eace7efcSopenharmony_ci#include "app_mgr_constants.h" 24eace7efcSopenharmony_ci#include "app_mgr_service_inner.h" 25eace7efcSopenharmony_ci#include "app_record_id.h" 26eace7efcSopenharmony_ci#include "app_running_record.h" 27eace7efcSopenharmony_ci#include "app_scheduler_proxy.h" 28eace7efcSopenharmony_ci#include "appexecfwk_errors.h" 29eace7efcSopenharmony_ci#include "application_info.h" 30eace7efcSopenharmony_ci#include "if_system_ability_manager.h" 31eace7efcSopenharmony_ci#include "nocopyable.h" 32eace7efcSopenharmony_ci#include "system_ability.h" 33eace7efcSopenharmony_ci#include "task_handler_wrap.h" 34eace7efcSopenharmony_ci 35eace7efcSopenharmony_cinamespace OHOS { 36eace7efcSopenharmony_cinamespace AppExecFwk { 37eace7efcSopenharmony_ciclass AmsMgrScheduler : public AmsMgrStub { 38eace7efcSopenharmony_cipublic: 39eace7efcSopenharmony_ci AmsMgrScheduler( 40eace7efcSopenharmony_ci const std::shared_ptr<AppMgrServiceInner> &MgrServiceInner_, 41eace7efcSopenharmony_ci const std::shared_ptr<AAFwk::TaskHandlerWrap> &Handler_); 42eace7efcSopenharmony_ci virtual ~AmsMgrScheduler() override; 43eace7efcSopenharmony_ci 44eace7efcSopenharmony_ci /** 45eace7efcSopenharmony_ci * LoadAbility, call LoadAbility() through proxy project, load the ability that needed to be started. 46eace7efcSopenharmony_ci * 47eace7efcSopenharmony_ci * @param token, the unique identification to start the ability. 48eace7efcSopenharmony_ci * @param preToken, the unique identification to call the ability. 49eace7efcSopenharmony_ci * @param abilityInfo, the ability information. 50eace7efcSopenharmony_ci * @param appInfo, the app information. 51eace7efcSopenharmony_ci * @param want, the starting information. 52eace7efcSopenharmony_ci */ 53eace7efcSopenharmony_ci virtual void LoadAbility(const std::shared_ptr<AbilityInfo> &abilityInfo, 54eace7efcSopenharmony_ci const std::shared_ptr<ApplicationInfo> &appInfo, 55eace7efcSopenharmony_ci const std::shared_ptr<AAFwk::Want> &want, std::shared_ptr<AbilityRuntime::LoadParam> loadParam) override; 56eace7efcSopenharmony_ci 57eace7efcSopenharmony_ci /** 58eace7efcSopenharmony_ci * TerminateAbility, call TerminateAbility() through the proxy object, terminate the token ability. 59eace7efcSopenharmony_ci * 60eace7efcSopenharmony_ci * @param token, token, he unique identification to terminate the ability. 61eace7efcSopenharmony_ci * @param clearMissionFlag, indicates whether terminate the ability when clearMission. 62eace7efcSopenharmony_ci * @return 63eace7efcSopenharmony_ci */ 64eace7efcSopenharmony_ci virtual void TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag) override; 65eace7efcSopenharmony_ci 66eace7efcSopenharmony_ci /** 67eace7efcSopenharmony_ci * UpdateAbilityState, call UpdateAbilityState() through the proxy object, update the ability status. 68eace7efcSopenharmony_ci * 69eace7efcSopenharmony_ci * @param token, the unique identification to update the ability. 70eace7efcSopenharmony_ci * @param state, ability status that needs to be updated. 71eace7efcSopenharmony_ci * @return 72eace7efcSopenharmony_ci */ 73eace7efcSopenharmony_ci virtual void UpdateAbilityState(const sptr<IRemoteObject> &token, const AbilityState state) override; 74eace7efcSopenharmony_ci 75eace7efcSopenharmony_ci /** 76eace7efcSopenharmony_ci * UpdateExtensionState, call UpdateExtensionState() through the proxy object, update the extension status. 77eace7efcSopenharmony_ci * 78eace7efcSopenharmony_ci * @param token, the unique identification to update the extension. 79eace7efcSopenharmony_ci * @param state, extension status that needs to be updated. 80eace7efcSopenharmony_ci * @return 81eace7efcSopenharmony_ci */ 82eace7efcSopenharmony_ci virtual void UpdateExtensionState(const sptr<IRemoteObject> &token, const ExtensionState state) override; 83eace7efcSopenharmony_ci 84eace7efcSopenharmony_ci /** 85eace7efcSopenharmony_ci * RegisterAppStateCallback, call RegisterAppStateCallback() through the proxy object, register the callback. 86eace7efcSopenharmony_ci * 87eace7efcSopenharmony_ci * @param callback, Ams register the callback. 88eace7efcSopenharmony_ci * @return 89eace7efcSopenharmony_ci */ 90eace7efcSopenharmony_ci virtual void RegisterAppStateCallback(const sptr<IAppStateCallback> &callback) override; 91eace7efcSopenharmony_ci 92eace7efcSopenharmony_ci /** 93eace7efcSopenharmony_ci * KillProcessByAbilityToken, call KillProcessByAbilityToken() through proxy object, 94eace7efcSopenharmony_ci * kill the process by ability token. 95eace7efcSopenharmony_ci * 96eace7efcSopenharmony_ci * @param token, the unique identification to the ability. 97eace7efcSopenharmony_ci * @return 98eace7efcSopenharmony_ci */ 99eace7efcSopenharmony_ci virtual void KillProcessByAbilityToken(const sptr<IRemoteObject> &token) override; 100eace7efcSopenharmony_ci 101eace7efcSopenharmony_ci /** 102eace7efcSopenharmony_ci * KillProcessesByUserId, call KillProcessesByUserId() through proxy object, 103eace7efcSopenharmony_ci * kill the processes by userId. 104eace7efcSopenharmony_ci * 105eace7efcSopenharmony_ci * @param userId, the user id. 106eace7efcSopenharmony_ci * @return 107eace7efcSopenharmony_ci */ 108eace7efcSopenharmony_ci virtual void KillProcessesByUserId(int32_t userId) override; 109eace7efcSopenharmony_ci 110eace7efcSopenharmony_ci /** 111eace7efcSopenharmony_ci * KillProcessesByPids, only in process call is allowed, 112eace7efcSopenharmony_ci * kill the processes by pid list given. 113eace7efcSopenharmony_ci * 114eace7efcSopenharmony_ci * @param pids, the pid list of processes are going to be killed. 115eace7efcSopenharmony_ci */ 116eace7efcSopenharmony_ci virtual void KillProcessesByPids(std::vector<int32_t> &pids) override; 117eace7efcSopenharmony_ci 118eace7efcSopenharmony_ci /** 119eace7efcSopenharmony_ci * Set child and parent relationship 120eace7efcSopenharmony_ci * @param token child process 121eace7efcSopenharmony_ci * @param callerToken parent process 122eace7efcSopenharmony_ci */ 123eace7efcSopenharmony_ci virtual void AttachPidToParent(const sptr<IRemoteObject> &token, const sptr<IRemoteObject> &callerToken) override; 124eace7efcSopenharmony_ci 125eace7efcSopenharmony_ci /** 126eace7efcSopenharmony_ci * KillProcessWithAccount, call KillProcessWithAccount() through proxy object, kill the 127eace7efcSopenharmony_ci * process. 128eace7efcSopenharmony_ci * 129eace7efcSopenharmony_ci * @param bundleName, bundle name in Application record. 130eace7efcSopenharmony_ci * @param accountId, account ID. 131eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 132eace7efcSopenharmony_ci */ 133eace7efcSopenharmony_ci virtual int32_t KillProcessWithAccount( 134eace7efcSopenharmony_ci const std::string &bundleName, const int accountId, const bool clearPageStack = false) override; 135eace7efcSopenharmony_ci 136eace7efcSopenharmony_ci /** 137eace7efcSopenharmony_ci * UpdateApplicationInfoInstalled, call UpdateApplicationInfoInstalled() through proxy object, 138eace7efcSopenharmony_ci * update the application info after new module installed. 139eace7efcSopenharmony_ci * 140eace7efcSopenharmony_ci * @param bundleName, bundle name in Application record. 141eace7efcSopenharmony_ci * @param uid, uid. 142eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 143eace7efcSopenharmony_ci */ 144eace7efcSopenharmony_ci virtual int32_t UpdateApplicationInfoInstalled(const std::string &bundleName, const int uid) override; 145eace7efcSopenharmony_ci 146eace7efcSopenharmony_ci /** 147eace7efcSopenharmony_ci * KillApplication, call KillApplication() through proxy object, kill the application. 148eace7efcSopenharmony_ci * 149eace7efcSopenharmony_ci * @param bundleName, bundle name in Application record. 150eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 151eace7efcSopenharmony_ci */ 152eace7efcSopenharmony_ci virtual int32_t KillApplication(const std::string &bundleName, const bool clearPageStack = false) override; 153eace7efcSopenharmony_ci 154eace7efcSopenharmony_ci /** 155eace7efcSopenharmony_ci * ForceKillApplication, force kill the application. 156eace7efcSopenharmony_ci * 157eace7efcSopenharmony_ci * @param bundleName, bundle name in Application record. 158eace7efcSopenharmony_ci * @param userId, userId. 159eace7efcSopenharmony_ci * @param appIndex, appIndex. 160eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 161eace7efcSopenharmony_ci */ 162eace7efcSopenharmony_ci virtual int32_t ForceKillApplication(const std::string &bundleName, const int userId = -1, 163eace7efcSopenharmony_ci const int appIndex = 0) override; 164eace7efcSopenharmony_ci 165eace7efcSopenharmony_ci /** 166eace7efcSopenharmony_ci * KillProcessesByAccessTokenId. 167eace7efcSopenharmony_ci * 168eace7efcSopenharmony_ci * @param accessTokenId, accessTokenId. 169eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 170eace7efcSopenharmony_ci */ 171eace7efcSopenharmony_ci virtual int32_t KillProcessesByAccessTokenId(const uint32_t accessTokenId) override; 172eace7efcSopenharmony_ci 173eace7efcSopenharmony_ci /** 174eace7efcSopenharmony_ci * KillApplicationByUid, call KillApplicationByUid() through proxy object, kill the application. 175eace7efcSopenharmony_ci * 176eace7efcSopenharmony_ci * @param bundleName, bundle name in Application record. 177eace7efcSopenharmony_ci * @param uid, uid. 178eace7efcSopenharmony_ci * @param reason, caller function name. 179eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 180eace7efcSopenharmony_ci */ 181eace7efcSopenharmony_ci virtual int KillApplicationByUid(const std::string &bundleName, const int uid, 182eace7efcSopenharmony_ci const std::string& reason = "KillApplicationByUid") override; 183eace7efcSopenharmony_ci 184eace7efcSopenharmony_ci /** 185eace7efcSopenharmony_ci * KillApplicationSelf, this allows app to terminate itself. 186eace7efcSopenharmony_ci * 187eace7efcSopenharmony_ci * @param clearPageStack, the flag indicates if ClearPageStack lifecycle should be scheduled. 188eace7efcSopenharmony_ci * @return ERR_OK for success call, others for failure. 189eace7efcSopenharmony_ci */ 190eace7efcSopenharmony_ci virtual int KillApplicationSelf(const bool clearPageStack = false, 191eace7efcSopenharmony_ci const std::string& reason = "KillApplicationSelf") override; 192eace7efcSopenharmony_ci 193eace7efcSopenharmony_ci /** 194eace7efcSopenharmony_ci * Get application info by process id. 195eace7efcSopenharmony_ci * 196eace7efcSopenharmony_ci * @param pid Process id. 197eace7efcSopenharmony_ci * @param application Application information got. 198eace7efcSopenharmony_ci * @param debug Whether IsDebugApp. 199eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 200eace7efcSopenharmony_ci */ 201eace7efcSopenharmony_ci int GetApplicationInfoByProcessID(const int pid, AppExecFwk::ApplicationInfo &application, bool &debug) override; 202eace7efcSopenharmony_ci 203eace7efcSopenharmony_ci /** 204eace7efcSopenharmony_ci * Record process exit reason to appRunningRecord 205eace7efcSopenharmony_ci * @param pid pid 206eace7efcSopenharmony_ci * @param reason reason enum 207eace7efcSopenharmony_ci * @param exitMsg exitMsg 208eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 209eace7efcSopenharmony_ci */ 210eace7efcSopenharmony_ci virtual int32_t NotifyAppMgrRecordExitReason(int32_t pid, int32_t reason, const std::string &exitMsg) override; 211eace7efcSopenharmony_ci 212eace7efcSopenharmony_ci /** 213eace7efcSopenharmony_ci * AbilityAttachTimeOut, called by ability manager service when an ability is loaded timeout. 214eace7efcSopenharmony_ci * 215eace7efcSopenharmony_ci * @param token indicates the token of the ability which is timeout. 216eace7efcSopenharmony_ci */ 217eace7efcSopenharmony_ci virtual void AbilityAttachTimeOut(const sptr<IRemoteObject> &token) override; 218eace7efcSopenharmony_ci 219eace7efcSopenharmony_ci /** 220eace7efcSopenharmony_ci * PrepareTerminate, called before terminating one ability by ability manager service to notify application. 221eace7efcSopenharmony_ci * 222eace7efcSopenharmony_ci * @param token indicates the token of the ability to be terminated. 223eace7efcSopenharmony_ci * @param clearMissionFlag indicates whether it is caused by cleaning mission. 224eace7efcSopenharmony_ci */ 225eace7efcSopenharmony_ci virtual void PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag = false) override; 226eace7efcSopenharmony_ci 227eace7efcSopenharmony_ci /** 228eace7efcSopenharmony_ci * GetRunningProcessInfoByToken, get process info for one ability. 229eace7efcSopenharmony_ci * 230eace7efcSopenharmony_ci * @param token indicates the token of the ability requested. 231eace7efcSopenharmony_ci * @param info output of the information. 232eace7efcSopenharmony_ci */ 233eace7efcSopenharmony_ci virtual void GetRunningProcessInfoByToken( 234eace7efcSopenharmony_ci const sptr<IRemoteObject> &token, AppExecFwk::RunningProcessInfo &info) override; 235eace7efcSopenharmony_ci 236eace7efcSopenharmony_ci /** 237eace7efcSopenharmony_ci * Set AbilityForegroundingFlag of an app-record to true. 238eace7efcSopenharmony_ci * 239eace7efcSopenharmony_ci * @param pid, pid. 240eace7efcSopenharmony_ci * 241eace7efcSopenharmony_ci */ 242eace7efcSopenharmony_ci void SetAbilityForegroundingFlagToAppRecord(const pid_t pid) override; 243eace7efcSopenharmony_ci 244eace7efcSopenharmony_ci /** 245eace7efcSopenharmony_ci * Start specified ability. 246eace7efcSopenharmony_ci * 247eace7efcSopenharmony_ci * @param want Want contains information of the ability to start. 248eace7efcSopenharmony_ci * @param abilityInfo Ability information. 249eace7efcSopenharmony_ci * @param requestId request id to callback 250eace7efcSopenharmony_ci */ 251eace7efcSopenharmony_ci virtual void StartSpecifiedAbility( 252eace7efcSopenharmony_ci const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo, int32_t requestId = 0) override; 253eace7efcSopenharmony_ci 254eace7efcSopenharmony_ci /** 255eace7efcSopenharmony_ci * Register response of start specified ability. 256eace7efcSopenharmony_ci * 257eace7efcSopenharmony_ci * @param response Response of start specified ability. 258eace7efcSopenharmony_ci */ 259eace7efcSopenharmony_ci virtual void RegisterStartSpecifiedAbilityResponse(const sptr<IStartSpecifiedAbilityResponse> &response) override; 260eace7efcSopenharmony_ci 261eace7efcSopenharmony_ci /** 262eace7efcSopenharmony_ci * Start specified process. 263eace7efcSopenharmony_ci * 264eace7efcSopenharmony_ci * @param want Want contains information wish to start. 265eace7efcSopenharmony_ci * @param abilityInfo Ability information. 266eace7efcSopenharmony_ci * @param requestId for callback 267eace7efcSopenharmony_ci */ 268eace7efcSopenharmony_ci virtual void StartSpecifiedProcess(const AAFwk::Want &want, const AppExecFwk::AbilityInfo &abilityInfo, 269eace7efcSopenharmony_ci int32_t requestId = 0) override; 270eace7efcSopenharmony_ci 271eace7efcSopenharmony_ci /** 272eace7efcSopenharmony_ci * SetCurrentUserId, set the userid to app mgr by ability mgr when switching to another user. 273eace7efcSopenharmony_ci * 274eace7efcSopenharmony_ci * @param userId the new user. 275eace7efcSopenharmony_ci */ 276eace7efcSopenharmony_ci virtual void SetCurrentUserId(const int32_t userId) override; 277eace7efcSopenharmony_ci 278eace7efcSopenharmony_ci virtual void SetEnableStartProcessFlagByUserId(int32_t userId, bool enableStartProcess) override; 279eace7efcSopenharmony_ci 280eace7efcSopenharmony_ci /** 281eace7efcSopenharmony_ci * GetBundleNameByPid, get bundleName and uid of a process. 282eace7efcSopenharmony_ci * 283eace7efcSopenharmony_ci * @param pid input param indicates the pid of the process. 284eace7efcSopenharmony_ci * @param bundleName output for bundleName. 285eace7efcSopenharmony_ci * @param uid output for uid. 286eace7efcSopenharmony_ci * @return ERR_OK for success call, others for failure. 287eace7efcSopenharmony_ci */ 288eace7efcSopenharmony_ci virtual int32_t GetBundleNameByPid(const int pid, std::string &bundleName, int32_t &uid) override; 289eace7efcSopenharmony_ci 290eace7efcSopenharmony_ci /** 291eace7efcSopenharmony_ci * @brief Register app debug listener. 292eace7efcSopenharmony_ci * @param listener App debug listener. 293eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 294eace7efcSopenharmony_ci */ 295eace7efcSopenharmony_ci int32_t RegisterAppDebugListener(const sptr<IAppDebugListener> &listener) override; 296eace7efcSopenharmony_ci 297eace7efcSopenharmony_ci /** 298eace7efcSopenharmony_ci * @brief Unregister app debug listener. 299eace7efcSopenharmony_ci * @param listener App debug listener. 300eace7efcSopenharmony_ci * @return ERR_OK, return back success, others fail. 301eace7efcSopenharmony_ci */ 302eace7efcSopenharmony_ci int32_t UnregisterAppDebugListener(const sptr<IAppDebugListener> &listener) override; 303eace7efcSopenharmony_ci 304eace7efcSopenharmony_ci /** 305eace7efcSopenharmony_ci * @brief Attach app debug. 306eace7efcSopenharmony_ci * @param bundleName The application bundle name. 307eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 308eace7efcSopenharmony_ci */ 309eace7efcSopenharmony_ci int32_t AttachAppDebug(const std::string &bundleName) override; 310eace7efcSopenharmony_ci 311eace7efcSopenharmony_ci /** 312eace7efcSopenharmony_ci * @brief Detach app debug. 313eace7efcSopenharmony_ci * @param bundleName The application bundle name. 314eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 315eace7efcSopenharmony_ci */ 316eace7efcSopenharmony_ci int32_t DetachAppDebug(const std::string &bundleName) override; 317eace7efcSopenharmony_ci 318eace7efcSopenharmony_ci /** 319eace7efcSopenharmony_ci * @brief Set app waiting debug mode. 320eace7efcSopenharmony_ci * @param bundleName The application bundle name. 321eace7efcSopenharmony_ci * @param isPersist The persist flag. 322eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 323eace7efcSopenharmony_ci */ 324eace7efcSopenharmony_ci int32_t SetAppWaitingDebug(const std::string &bundleName, bool isPersist) override; 325eace7efcSopenharmony_ci 326eace7efcSopenharmony_ci /** 327eace7efcSopenharmony_ci * @brief Cancel app waiting debug mode. 328eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 329eace7efcSopenharmony_ci */ 330eace7efcSopenharmony_ci int32_t CancelAppWaitingDebug() override; 331eace7efcSopenharmony_ci 332eace7efcSopenharmony_ci /** 333eace7efcSopenharmony_ci * @brief Get waiting debug mode application. 334eace7efcSopenharmony_ci * @param debugInfoList The debug info list, including bundle name and persist flag. 335eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 336eace7efcSopenharmony_ci */ 337eace7efcSopenharmony_ci int32_t GetWaitingDebugApp(std::vector<std::string> &debugInfoList) override; 338eace7efcSopenharmony_ci 339eace7efcSopenharmony_ci /** 340eace7efcSopenharmony_ci * @brief Determine whether it is a waiting debug application based on the bundle name. 341eace7efcSopenharmony_ci * @return Returns true if it is a waiting debug application, otherwise it returns false. 342eace7efcSopenharmony_ci */ 343eace7efcSopenharmony_ci bool IsWaitingDebugApp(const std::string &bundleName) override; 344eace7efcSopenharmony_ci 345eace7efcSopenharmony_ci /** 346eace7efcSopenharmony_ci * @brief Clear non persist waiting debug flag. 347eace7efcSopenharmony_ci */ 348eace7efcSopenharmony_ci void ClearNonPersistWaitingDebugFlag() override; 349eace7efcSopenharmony_ci 350eace7efcSopenharmony_ci /** 351eace7efcSopenharmony_ci * @brief Registering ability debug mode response. 352eace7efcSopenharmony_ci * @param response Response for ability debug object. 353eace7efcSopenharmony_ci * @return Returns ERR_OK on success, others on failure. 354eace7efcSopenharmony_ci */ 355eace7efcSopenharmony_ci int32_t RegisterAbilityDebugResponse(const sptr<IAbilityDebugResponse> &response) override; 356eace7efcSopenharmony_ci 357eace7efcSopenharmony_ci /** 358eace7efcSopenharmony_ci * @brief Determine whether it is an attachment debug application based on the bundle name. 359eace7efcSopenharmony_ci * @param bundleName The application bundle name. 360eace7efcSopenharmony_ci * @return Returns true if it is an attach debug application, otherwise it returns false. 361eace7efcSopenharmony_ci */ 362eace7efcSopenharmony_ci bool IsAttachDebug(const std::string &bundleName) override; 363eace7efcSopenharmony_ci 364eace7efcSopenharmony_ci /** 365eace7efcSopenharmony_ci * @brief Set resident process enable status. 366eace7efcSopenharmony_ci * @param bundleName The application bundle name. 367eace7efcSopenharmony_ci * @param enable The current updated enable status. 368eace7efcSopenharmony_ci * @param uid indicates user, 0 for all users 369eace7efcSopenharmony_ci */ 370eace7efcSopenharmony_ci void SetKeepAliveEnableState(const std::string &bundleName, bool enable, int32_t uid) override; 371eace7efcSopenharmony_ci 372eace7efcSopenharmony_ci /** 373eace7efcSopenharmony_ci * To clear the process by ability token. 374eace7efcSopenharmony_ci * 375eace7efcSopenharmony_ci * @param token the unique identification to the ability. 376eace7efcSopenharmony_ci */ 377eace7efcSopenharmony_ci virtual void ClearProcessByToken(sptr<IRemoteObject> token) override; 378eace7efcSopenharmony_ci 379eace7efcSopenharmony_ci /** 380eace7efcSopenharmony_ci * whether memory size is sufficient. 381eace7efcSopenharmony_ci * @return Returns true is sufficient memory size, others return false. 382eace7efcSopenharmony_ci */ 383eace7efcSopenharmony_ci virtual bool IsMemorySizeSufficent() override; 384eace7efcSopenharmony_ci 385eace7efcSopenharmony_ci /** 386eace7efcSopenharmony_ci * Notifies that one ability is attached to status bar. 387eace7efcSopenharmony_ci * 388eace7efcSopenharmony_ci * @param token the token of the abilityRecord that is attached to status bar. 389eace7efcSopenharmony_ci */ 390eace7efcSopenharmony_ci void AttachedToStatusBar(const sptr<IRemoteObject> &token) override; 391eace7efcSopenharmony_ci 392eace7efcSopenharmony_ci virtual void BlockProcessCacheByPids(const std::vector<int32_t> &pids) override; 393eace7efcSopenharmony_ci 394eace7efcSopenharmony_ci /** 395eace7efcSopenharmony_ci * Request to clean uiability from user. 396eace7efcSopenharmony_ci * 397eace7efcSopenharmony_ci * @param token the token of ability. 398eace7efcSopenharmony_ci * @return Returns true if clean success, others return false. 399eace7efcSopenharmony_ci */ 400eace7efcSopenharmony_ci virtual bool CleanAbilityByUserRequest(const sptr<IRemoteObject> &token) override; 401eace7efcSopenharmony_ci 402eace7efcSopenharmony_ci /** 403eace7efcSopenharmony_ci * whether killed for upgrade web. 404eace7efcSopenharmony_ci * 405eace7efcSopenharmony_ci * @param bundleName the bundle name is killed for upgrade web. 406eace7efcSopenharmony_ci * @return Returns true is killed for upgrade web, others return false. 407eace7efcSopenharmony_ci */ 408eace7efcSopenharmony_ci virtual bool IsKilledForUpgradeWeb(const std::string &bundleName) override; 409eace7efcSopenharmony_ci 410eace7efcSopenharmony_ci /** 411eace7efcSopenharmony_ci * whether the abilities of process specified by pid type only UIAbility. 412eace7efcSopenharmony_ci * @return Returns true is only UIAbility, otherwise return false 413eace7efcSopenharmony_ci */ 414eace7efcSopenharmony_ci virtual bool IsProcessContainsOnlyUIAbility(const pid_t pid) override; 415eace7efcSopenharmony_ci 416eace7efcSopenharmony_ci /** 417eace7efcSopenharmony_ci * Whether a process is attached, refer to AttachApplication 418eace7efcSopenharmony_ci */ 419eace7efcSopenharmony_ci virtual bool IsProcessAttached(sptr<IRemoteObject> token) override; 420eace7efcSopenharmony_ci 421eace7efcSopenharmony_ci virtual bool IsAppKilling(sptr<IRemoteObject> token) override; 422eace7efcSopenharmony_ci 423eace7efcSopenharmony_ci virtual void SetAppExceptionCallback(sptr<IRemoteObject> callback) override; 424eace7efcSopenharmony_ci 425eace7efcSopenharmony_ciprivate: 426eace7efcSopenharmony_ci /** 427eace7efcSopenharmony_ci * @brief Judge whether the application service is ready. 428eace7efcSopenharmony_ci * 429eace7efcSopenharmony_ci * @return Returns true means service is ready, otherwise service is not ready. 430eace7efcSopenharmony_ci */ 431eace7efcSopenharmony_ci bool IsReady() const; 432eace7efcSopenharmony_ci 433eace7efcSopenharmony_ciprivate: 434eace7efcSopenharmony_ci std::shared_ptr<AppMgrServiceInner> amsMgrServiceInner_; 435eace7efcSopenharmony_ci std::shared_ptr<AAFwk::TaskHandlerWrap> amsHandler_; 436eace7efcSopenharmony_ci sptr<ISystemAbilityManager> systemAbilityMgr_; 437eace7efcSopenharmony_ci 438eace7efcSopenharmony_ci DISALLOW_COPY_AND_MOVE(AmsMgrScheduler); 439eace7efcSopenharmony_ci}; 440eace7efcSopenharmony_ci} // namespace AppExecFwk 441eace7efcSopenharmony_ci} // namespace OHOS 442eace7efcSopenharmony_ci#endif // OHOS_ABILITY_RUNTIME_AMS_MGR_SCHEDULER_H 443