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_APP_RUNNING_MANAGER_H
17eace7efcSopenharmony_ci#define OHOS_ABILITY_RUNTIME_APP_RUNNING_MANAGER_H
18eace7efcSopenharmony_ci
19eace7efcSopenharmony_ci#include <map>
20eace7efcSopenharmony_ci#include <mutex>
21eace7efcSopenharmony_ci#include <regex>
22eace7efcSopenharmony_ci#include <set>
23eace7efcSopenharmony_ci
24eace7efcSopenharmony_ci#include "ability_info.h"
25eace7efcSopenharmony_ci#include "app_debug_listener_interface.h"
26eace7efcSopenharmony_ci#include "app_jsheap_mem_info.h"
27eace7efcSopenharmony_ci#include "app_malloc_info.h"
28eace7efcSopenharmony_ci#include "app_mem_info.h"
29eace7efcSopenharmony_ci#include "app_running_record.h"
30eace7efcSopenharmony_ci#include "app_state_data.h"
31eace7efcSopenharmony_ci#include "application_info.h"
32eace7efcSopenharmony_ci#include "bundle_info.h"
33eace7efcSopenharmony_ci#include "configuration.h"
34eace7efcSopenharmony_ci#include "iremote_object.h"
35eace7efcSopenharmony_ci#include "record_query_result.h"
36eace7efcSopenharmony_ci#include "refbase.h"
37eace7efcSopenharmony_ci#include "running_process_info.h"
38eace7efcSopenharmony_ci
39eace7efcSopenharmony_cinamespace OHOS {
40eace7efcSopenharmony_cinamespace Rosen {
41eace7efcSopenharmony_ciclass WindowVisibilityInfo;
42eace7efcSopenharmony_ci}
43eace7efcSopenharmony_cinamespace AppExecFwk {
44eace7efcSopenharmony_ci
45eace7efcSopenharmony_ciclass AppRunningManager {
46eace7efcSopenharmony_cipublic:
47eace7efcSopenharmony_ci    AppRunningManager();
48eace7efcSopenharmony_ci    virtual ~AppRunningManager();
49eace7efcSopenharmony_ci    /**
50eace7efcSopenharmony_ci     * CreateAppRunningRecord, Get or create application record information.
51eace7efcSopenharmony_ci     *
52eace7efcSopenharmony_ci     * @param token, the unique identification to start the ability.
53eace7efcSopenharmony_ci     * @param abilityInfo, ability information.
54eace7efcSopenharmony_ci     * @param appInfo, app information.
55eace7efcSopenharmony_ci     * @param processName, app process name.
56eace7efcSopenharmony_ci     * @param uid, app uid in Application record.
57eace7efcSopenharmony_ci     * @param result, If error occurs, error code is in |result|.
58eace7efcSopenharmony_ci     *
59eace7efcSopenharmony_ci     * @return AppRunningRecord pointer if success get or create.
60eace7efcSopenharmony_ci     */
61eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> CreateAppRunningRecord(const std::shared_ptr<ApplicationInfo> &appInfo,
62eace7efcSopenharmony_ci        const std::string &processName, const BundleInfo &bundleInfo, const std::string &instanceKey);
63eace7efcSopenharmony_ci
64eace7efcSopenharmony_ci    /**
65eace7efcSopenharmony_ci     * CheckAppRunningRecordIsExist, Get process record by application name and process Name.
66eace7efcSopenharmony_ci     *
67eace7efcSopenharmony_ci     * @param appName, the application name.
68eace7efcSopenharmony_ci     * @param processName, the process name.
69eace7efcSopenharmony_ci     * @param uid, the process uid.
70eace7efcSopenharmony_ci     *
71eace7efcSopenharmony_ci     * @return process record.
72eace7efcSopenharmony_ci     */
73eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> CheckAppRunningRecordIsExist(const std::string &appName,
74eace7efcSopenharmony_ci        const std::string &processName, const int uid, const BundleInfo &bundleInfo,
75eace7efcSopenharmony_ci        const std::string &specifiedProcessFlag = "", bool *isProCache = nullptr, const std::string &instanceKey = "");
76eace7efcSopenharmony_ci
77eace7efcSopenharmony_ci#ifdef APP_NO_RESPONSE_DIALOG
78eace7efcSopenharmony_ci    /**
79eace7efcSopenharmony_ci     * CheckAppRunningRecordIsExist, Check whether the process of the app exists by bundle name and process Name.
80eace7efcSopenharmony_ci     *
81eace7efcSopenharmony_ci     * @param bundleName, Indicates the bundle name of the bundle..
82eace7efcSopenharmony_ci     * @param abilityName, ability name.
83eace7efcSopenharmony_ci     *
84eace7efcSopenharmony_ci     * @return true if exist.
85eace7efcSopenharmony_ci     */
86eace7efcSopenharmony_ci    bool CheckAppRunningRecordIsExist(const std::string &bundleName, const std::string &abilityName);
87eace7efcSopenharmony_ci#endif
88eace7efcSopenharmony_ci
89eace7efcSopenharmony_ci    /**
90eace7efcSopenharmony_ci     * CheckAppRunningRecordIsExistByBundleName, Check whether the process of the application exists.
91eace7efcSopenharmony_ci     *
92eace7efcSopenharmony_ci     * @param bundleName, the bundle name.
93eace7efcSopenharmony_ci     *
94eace7efcSopenharmony_ci     * @return, Return true if exist.
95eace7efcSopenharmony_ci     */
96eace7efcSopenharmony_ci    bool CheckAppRunningRecordIsExistByBundleName(const std::string &bundleName);
97eace7efcSopenharmony_ci
98eace7efcSopenharmony_ci    /**
99eace7efcSopenharmony_ci     * CheckAppRunningRecordIsExistByUid, check app exist when concurrent.
100eace7efcSopenharmony_ci     *
101eace7efcSopenharmony_ci     * @param uid, the process uid.
102eace7efcSopenharmony_ci     * @return, Return true if exist.
103eace7efcSopenharmony_ci     */
104eace7efcSopenharmony_ci    bool CheckAppRunningRecordIsExistByUid(int32_t uid);
105eace7efcSopenharmony_ci
106eace7efcSopenharmony_ci    /**
107eace7efcSopenharmony_ci     * CheckAppRunningRecordIsExistByBundleName, Check whether the process of the application exists.
108eace7efcSopenharmony_ci     *
109eace7efcSopenharmony_ci     * @param bundleName Indicates the bundle name of the bundle.
110eace7efcSopenharmony_ci     * @param appCloneIndex the appindex of the bundle.
111eace7efcSopenharmony_ci     * @param isRunning Obtain the running status of the application, the result is true if running, false otherwise.
112eace7efcSopenharmony_ci     * @return, Return ERR_OK if success, others fail.
113eace7efcSopenharmony_ci     */
114eace7efcSopenharmony_ci    int32_t CheckAppCloneRunningRecordIsExistByBundleName(const std::string &bundleName,
115eace7efcSopenharmony_ci        int32_t appCloneIndex, bool &isRunning);
116eace7efcSopenharmony_ci
117eace7efcSopenharmony_ci    /**
118eace7efcSopenharmony_ci     * GetAppRunningRecordByPid, Get process record by application pid.
119eace7efcSopenharmony_ci     *
120eace7efcSopenharmony_ci     * @param pid, the application pid.
121eace7efcSopenharmony_ci     *
122eace7efcSopenharmony_ci     * @return process record.
123eace7efcSopenharmony_ci     */
124eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetAppRunningRecordByPid(const pid_t pid);
125eace7efcSopenharmony_ci
126eace7efcSopenharmony_ci    /**
127eace7efcSopenharmony_ci     * GetAppRunningRecordByAbilityToken, Get process record by ability token.
128eace7efcSopenharmony_ci     *
129eace7efcSopenharmony_ci     * @param abilityToken, the ability token.
130eace7efcSopenharmony_ci     *
131eace7efcSopenharmony_ci     * @return process record.
132eace7efcSopenharmony_ci     */
133eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetAppRunningRecordByAbilityToken(const sptr<IRemoteObject> &abilityToken);
134eace7efcSopenharmony_ci
135eace7efcSopenharmony_ci    /**
136eace7efcSopenharmony_ci     * OnRemoteDied, Equipment death notification.
137eace7efcSopenharmony_ci     *
138eace7efcSopenharmony_ci     * @param remote, Death client.
139eace7efcSopenharmony_ci     * @param appMgrServiceInner, Application manager service inner instance.
140eace7efcSopenharmony_ci     * @return
141eace7efcSopenharmony_ci     */
142eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> OnRemoteDied(const wptr<IRemoteObject> &remote,
143eace7efcSopenharmony_ci        std::shared_ptr<AppMgrServiceInner> appMgrServiceInner);
144eace7efcSopenharmony_ci
145eace7efcSopenharmony_ci    /**
146eace7efcSopenharmony_ci     * GetAppRunningRecordMap, Get application record list.
147eace7efcSopenharmony_ci     *
148eace7efcSopenharmony_ci     * @return the application record list.
149eace7efcSopenharmony_ci     */
150eace7efcSopenharmony_ci    std::map<const int32_t, const std::shared_ptr<AppRunningRecord>> GetAppRunningRecordMap();
151eace7efcSopenharmony_ci
152eace7efcSopenharmony_ci    /**
153eace7efcSopenharmony_ci     * RemoveAppRunningRecordById, Remove application information through application id.
154eace7efcSopenharmony_ci     *
155eace7efcSopenharmony_ci     * @param recordId, the application id.
156eace7efcSopenharmony_ci     * @return
157eace7efcSopenharmony_ci     */
158eace7efcSopenharmony_ci    void RemoveAppRunningRecordById(const int32_t recordId);
159eace7efcSopenharmony_ci
160eace7efcSopenharmony_ci    /**
161eace7efcSopenharmony_ci     * ClearAppRunningRecordMap, Clear application record list.
162eace7efcSopenharmony_ci     *
163eace7efcSopenharmony_ci     * @return
164eace7efcSopenharmony_ci     */
165eace7efcSopenharmony_ci    void ClearAppRunningRecordMap();
166eace7efcSopenharmony_ci
167eace7efcSopenharmony_ci    /**
168eace7efcSopenharmony_ci     * Get the pid of a non-resident process.
169eace7efcSopenharmony_ci     *
170eace7efcSopenharmony_ci     * @return Return true if found, otherwise return false.
171eace7efcSopenharmony_ci     */
172eace7efcSopenharmony_ci    bool ProcessExitByBundleName(
173eace7efcSopenharmony_ci        const std::string &bundleName, std::list<pid_t> &pids, const bool clearPageStack = false);
174eace7efcSopenharmony_ci    /**
175eace7efcSopenharmony_ci     * Get Foreground Applications.
176eace7efcSopenharmony_ci     *
177eace7efcSopenharmony_ci     * @return Foreground Applications.
178eace7efcSopenharmony_ci     */
179eace7efcSopenharmony_ci    void GetForegroundApplications(std::vector<AppStateData> &list);
180eace7efcSopenharmony_ci
181eace7efcSopenharmony_ci    /*
182eace7efcSopenharmony_ci    *  ANotify application update system environment changes.
183eace7efcSopenharmony_ci    *
184eace7efcSopenharmony_ci    * @param config System environment change parameters.
185eace7efcSopenharmony_ci    * @return Returns ERR_OK on success, others on failure.
186eace7efcSopenharmony_ci    */
187eace7efcSopenharmony_ci    int32_t UpdateConfiguration(const Configuration &config, const int32_t userId = -1);
188eace7efcSopenharmony_ci
189eace7efcSopenharmony_ci    /**
190eace7efcSopenharmony_ci     *  Update config by sa.
191eace7efcSopenharmony_ci     *
192eace7efcSopenharmony_ci     * @param config Application enviroment change parameters.
193eace7efcSopenharmony_ci     * @param name Application bundle name.
194eace7efcSopenharmony_ci     * @return Returns ERR_OK on success, others on failure.
195eace7efcSopenharmony_ci     */
196eace7efcSopenharmony_ci    int32_t UpdateConfigurationByBundleName(const Configuration &config, const std::string &name);
197eace7efcSopenharmony_ci
198eace7efcSopenharmony_ci    /*
199eace7efcSopenharmony_ci    *  Notify application background of current memory level.
200eace7efcSopenharmony_ci    *
201eace7efcSopenharmony_ci    * @param level current memory level.
202eace7efcSopenharmony_ci    * @return Returns ERR_OK on success, others on failure.
203eace7efcSopenharmony_ci    */
204eace7efcSopenharmony_ci    int32_t NotifyMemoryLevel(int32_t level);
205eace7efcSopenharmony_ci
206eace7efcSopenharmony_ci    /**
207eace7efcSopenharmony_ci     * Notify applications the current memory level.
208eace7efcSopenharmony_ci     *
209eace7efcSopenharmony_ci     * @param  procLevelMap , <pid_t, MemoryLevel>.
210eace7efcSopenharmony_ci     * @return Returns ERR_OK on success, others on failure.
211eace7efcSopenharmony_ci     */
212eace7efcSopenharmony_ci    int32_t NotifyProcMemoryLevel(const std::map<pid_t, MemoryLevel> &procLevelMap);
213eace7efcSopenharmony_ci
214eace7efcSopenharmony_ci    /*
215eace7efcSopenharmony_ci    * Get the application's memory allocation info.
216eace7efcSopenharmony_ci    *
217eace7efcSopenharmony_ci    * @param pid, pid input.
218eace7efcSopenharmony_ci    * @param mallocInfo, dynamic storage information output.
219eace7efcSopenharmony_ci    *
220eace7efcSopenharmony_ci    * @return Returns ERR_OK on success, others on failure.
221eace7efcSopenharmony_ci    */
222eace7efcSopenharmony_ci    int32_t DumpHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo);
223eace7efcSopenharmony_ci
224eace7efcSopenharmony_ci    /**
225eace7efcSopenharmony_ci     * DumpJsHeapMemory, call DumpJsHeapMemory() through proxy project.
226eace7efcSopenharmony_ci     * triggerGC and dump the application's jsheap memory info.
227eace7efcSopenharmony_ci     *
228eace7efcSopenharmony_ci     * @param info, pid, tid, needGc, needSnapshot
229eace7efcSopenharmony_ci     * @return Returns ERR_OK on success, others on failure.
230eace7efcSopenharmony_ci     */
231eace7efcSopenharmony_ci    int32_t DumpJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info);
232eace7efcSopenharmony_ci
233eace7efcSopenharmony_ci    /**
234eace7efcSopenharmony_ci     * Set AbilityForegroundingFlag of an app-record to true.
235eace7efcSopenharmony_ci     *
236eace7efcSopenharmony_ci     * @param pid, pid.
237eace7efcSopenharmony_ci     *
238eace7efcSopenharmony_ci     */
239eace7efcSopenharmony_ci    void SetAbilityForegroundingFlagToAppRecord(const pid_t pid);
240eace7efcSopenharmony_ci
241eace7efcSopenharmony_ci    void HandleTerminateTimeOut(int64_t eventId);
242eace7efcSopenharmony_ci    void HandleAbilityAttachTimeOut(const sptr<IRemoteObject> &token, std::shared_ptr<AppMgrServiceInner> serviceInner);
243eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetAppRunningRecord(const int64_t eventId);
244eace7efcSopenharmony_ci    void TerminateAbility(const sptr<IRemoteObject> &token, bool clearMissionFlag,
245eace7efcSopenharmony_ci        std::shared_ptr<AppMgrServiceInner> appMgrServiceInner);
246eace7efcSopenharmony_ci
247eace7efcSopenharmony_ci    /**
248eace7efcSopenharmony_ci     *
249eace7efcSopenharmony_ci     * @brief update the application info after new module installed.
250eace7efcSopenharmony_ci     *
251eace7efcSopenharmony_ci     * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext.
252eace7efcSopenharmony_ci     *
253eace7efcSopenharmony_ci     */
254eace7efcSopenharmony_ci    int32_t ProcessUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo);
255eace7efcSopenharmony_ci
256eace7efcSopenharmony_ci    bool ProcessExitByBundleNameAndUid(
257eace7efcSopenharmony_ci        const std::string &bundleName, const int uid, std::list<pid_t> &pids, const bool clearPageStack = false);
258eace7efcSopenharmony_ci    bool GetPidsByUserId(int32_t userId, std::list<pid_t> &pids);
259eace7efcSopenharmony_ci
260eace7efcSopenharmony_ci    void PrepareTerminate(const sptr<IRemoteObject> &token, bool clearMissionFlag = false);
261eace7efcSopenharmony_ci
262eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetTerminatingAppRunningRecord(const sptr<IRemoteObject> &abilityToken);
263eace7efcSopenharmony_ci
264eace7efcSopenharmony_ci    void GetRunningProcessInfoByToken(const sptr<IRemoteObject> &token, AppExecFwk::RunningProcessInfo &info);
265eace7efcSopenharmony_ci    int32_t GetRunningProcessInfoByPid(const pid_t pid, OHOS::AppExecFwk::RunningProcessInfo &info);
266eace7efcSopenharmony_ci
267eace7efcSopenharmony_ci    void initConfig(const Configuration &config);
268eace7efcSopenharmony_ci    void ClipStringContent(const std::regex &re, const std::string &source, std::string &afterCutStr);
269eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetAppRunningRecordByRenderPid(const pid_t pid);
270eace7efcSopenharmony_ci    std::shared_ptr<RenderRecord> OnRemoteRenderDied(const wptr<IRemoteObject> &remote);
271eace7efcSopenharmony_ci    bool GetAppRunningStateByBundleName(const std::string &bundleName);
272eace7efcSopenharmony_ci    int32_t NotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
273eace7efcSopenharmony_ci    int32_t NotifyHotReloadPage(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
274eace7efcSopenharmony_ci    int32_t NotifyUnLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback);
275eace7efcSopenharmony_ci    bool IsApplicationFirstForeground(const AppRunningRecord &foregroundingRecord);
276eace7efcSopenharmony_ci    bool IsApplicationBackground(const AppRunningRecord &backgroundingRecord);
277eace7efcSopenharmony_ci    bool IsApplicationFirstFocused(const AppRunningRecord &foregroundingRecord);
278eace7efcSopenharmony_ci    bool IsApplicationUnfocused(const std::string &bundleName);
279eace7efcSopenharmony_ci#ifdef SUPPORT_SCREEN
280eace7efcSopenharmony_ci    void OnWindowVisibilityChanged(const std::vector<sptr<OHOS::Rosen::WindowVisibilityInfo>> &windowVisibilityInfos);
281eace7efcSopenharmony_ci#endif //SUPPORT_SCREEN
282eace7efcSopenharmony_ci    /**
283eace7efcSopenharmony_ci     * @brief Set attach app debug mode.
284eace7efcSopenharmony_ci     * @param bundleName The application bundle name.
285eace7efcSopenharmony_ci     * @param isAttachDebug Determine if it is in attach debug mode.
286eace7efcSopenharmony_ci     */
287eace7efcSopenharmony_ci    void SetAttachAppDebug(const std::string &bundleName, const bool &isAttachDebug);
288eace7efcSopenharmony_ci
289eace7efcSopenharmony_ci    /**
290eace7efcSopenharmony_ci     * @brief Obtain app debug infos through bundleName.
291eace7efcSopenharmony_ci     * @param bundleName The application bundle name.
292eace7efcSopenharmony_ci     * @param isDetachDebug Determine if it is a Detach.
293eace7efcSopenharmony_ci     * @return Specify the stored app informations based on bundle name output.
294eace7efcSopenharmony_ci     */
295eace7efcSopenharmony_ci    std::vector<AppDebugInfo> GetAppDebugInfosByBundleName(const std::string &bundleName, const bool &isDetachDebug);
296eace7efcSopenharmony_ci
297eace7efcSopenharmony_ci    /**
298eace7efcSopenharmony_ci     * @brief Obtain ability tokens through bundleName.
299eace7efcSopenharmony_ci     * @param bundleName The application bundle name.
300eace7efcSopenharmony_ci     * @param abilityTokens Specify the stored ability token based on bundle name output.
301eace7efcSopenharmony_ci     */
302eace7efcSopenharmony_ci    void GetAbilityTokensByBundleName(const std::string &bundleName, std::vector<sptr<IRemoteObject>> &abilityTokens);
303eace7efcSopenharmony_ci
304eace7efcSopenharmony_ci    std::shared_ptr<AppRunningRecord> GetAppRunningRecordByChildProcessPid(const pid_t pid);
305eace7efcSopenharmony_ci    std::shared_ptr<ChildProcessRecord> OnChildProcessRemoteDied(const wptr<IRemoteObject> &remote);
306eace7efcSopenharmony_ci    bool IsChildProcessReachLimit(uint32_t accessTokenId);
307eace7efcSopenharmony_ci
308eace7efcSopenharmony_ci    /**
309eace7efcSopenharmony_ci     * @brief Obtain number of app through bundlename.
310eace7efcSopenharmony_ci     * @param bundleName The application bundle name.
311eace7efcSopenharmony_ci     * @return Returns the number of queries.
312eace7efcSopenharmony_ci     */
313eace7efcSopenharmony_ci    int32_t GetAllAppRunningRecordCountByBundleName(const std::string &bundleName);
314eace7efcSopenharmony_ci
315eace7efcSopenharmony_ci    int32_t SignRestartAppFlag(int32_t uid);
316eace7efcSopenharmony_ci
317eace7efcSopenharmony_ci    int32_t GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId);
318eace7efcSopenharmony_ci
319eace7efcSopenharmony_ci    int32_t GetAllUIExtensionRootHostPid(pid_t pid, std::vector<pid_t> &hostPids);
320eace7efcSopenharmony_ci
321eace7efcSopenharmony_ci    int32_t GetAllUIExtensionProviderPid(pid_t hostPid, std::vector<pid_t> &providerPids);
322eace7efcSopenharmony_ci
323eace7efcSopenharmony_ci    int32_t AddUIExtensionLauncherItem(int32_t uiExtensionAbilityId, pid_t hostPid, pid_t providerPid);
324eace7efcSopenharmony_ci    int32_t RemoveUIExtensionLauncherItem(pid_t pid);
325eace7efcSopenharmony_ci    int32_t RemoveUIExtensionLauncherItemById(int32_t uiExtensionAbilityId);
326eace7efcSopenharmony_ci
327eace7efcSopenharmony_ci    int DumpIpcAllStart(std::string& result);
328eace7efcSopenharmony_ci
329eace7efcSopenharmony_ci    int DumpIpcAllStop(std::string& result);
330eace7efcSopenharmony_ci
331eace7efcSopenharmony_ci    int DumpIpcAllStat(std::string& result);
332eace7efcSopenharmony_ci
333eace7efcSopenharmony_ci    int DumpIpcStart(const int32_t pid, std::string& result);
334eace7efcSopenharmony_ci
335eace7efcSopenharmony_ci    int DumpIpcStop(const int32_t pid, std::string& result);
336eace7efcSopenharmony_ci
337eace7efcSopenharmony_ci    int DumpIpcStat(const int32_t pid, std::string& result);
338eace7efcSopenharmony_ci
339eace7efcSopenharmony_ci    int DumpFfrt(const std::vector<int32_t>& pids, std::string& result);
340eace7efcSopenharmony_ci
341eace7efcSopenharmony_ci    bool IsAppProcessesAllCached(const std::string &bundleName, int32_t uid,
342eace7efcSopenharmony_ci        const std::set<std::shared_ptr<AppRunningRecord>> &cachedSet);
343eace7efcSopenharmony_ci
344eace7efcSopenharmony_ci    int32_t UpdateConfigurationDelayed(const std::shared_ptr<AppRunningRecord> &appRecord);
345eace7efcSopenharmony_ci
346eace7efcSopenharmony_ci    bool GetPidsByBundleNameUserIdAndAppIndex(const std::string &bundleName,
347eace7efcSopenharmony_ci        const int userId, const int appIndex, std::list<pid_t> &pids);
348eace7efcSopenharmony_ci
349eace7efcSopenharmony_ci    bool HandleUserRequestClean(const sptr<IRemoteObject> &abilityToken, pid_t &pid, int32_t &uid);
350eace7efcSopenharmony_ci
351eace7efcSopenharmony_ci    void SetMultiUserConfigurationMgr(const std::shared_ptr<MultiUserConfigurationMgr>& multiUserConfigurationMgr);
352eace7efcSopenharmony_ci
353eace7efcSopenharmony_ci    int32_t CheckIsKiaProcess(pid_t pid, bool &isKia);
354eace7efcSopenharmony_ci
355eace7efcSopenharmony_ciprivate:
356eace7efcSopenharmony_ci    std::shared_ptr<AbilityRunningRecord> GetAbilityRunningRecord(const int64_t eventId);
357eace7efcSopenharmony_ci    int32_t AssignRunningProcessInfoByAppRecord(
358eace7efcSopenharmony_ci        std::shared_ptr<AppRunningRecord> appRecord, AppExecFwk::RunningProcessInfo &info) const;
359eace7efcSopenharmony_ci    bool isCollaboratorReserveType(const std::shared_ptr<AppRunningRecord> &appRecord);
360eace7efcSopenharmony_ci    void NotifyAppPreCache(const std::shared_ptr<AppRunningRecord>& appRecord,
361eace7efcSopenharmony_ci        const std::shared_ptr<AppMgrServiceInner>& appMgrServiceInner);
362eace7efcSopenharmony_ci
363eace7efcSopenharmony_ciprivate:
364eace7efcSopenharmony_ci    std::mutex runningRecordMapMutex_;
365eace7efcSopenharmony_ci    std::map<const int32_t, const std::shared_ptr<AppRunningRecord>> appRunningRecordMap_;
366eace7efcSopenharmony_ci
367eace7efcSopenharmony_ci    std::mutex uiExtensionMapLock_;
368eace7efcSopenharmony_ci    std::map<int32_t, std::pair<pid_t, pid_t>> uiExtensionLauncherMap_;
369eace7efcSopenharmony_ci
370eace7efcSopenharmony_ci    std::shared_ptr<Configuration> configuration_;
371eace7efcSopenharmony_ci    std::mutex updateConfigurationDelayedLock_;
372eace7efcSopenharmony_ci    std::map<const int32_t, bool> updateConfigurationDelayedMap_;
373eace7efcSopenharmony_ci    std::shared_ptr<MultiUserConfigurationMgr> multiUserConfigurationMgr_;
374eace7efcSopenharmony_ci};
375eace7efcSopenharmony_ci}  // namespace AppExecFwk
376eace7efcSopenharmony_ci}  // namespace OHOS
377eace7efcSopenharmony_ci
378eace7efcSopenharmony_ci#endif  // OHOS_ABILITY_RUNTIME_APP_RUNNING_MANAGER_H
379