1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef OHOS_ABILITY_RUNTIME_APP_MGR_PROXY_H
17 #define OHOS_ABILITY_RUNTIME_APP_MGR_PROXY_H
18 
19 #include "app_jsheap_mem_info.h"
20 #include "app_malloc_info.h"
21 #include "app_mgr_interface.h"
22 #include "bundle_info.h"
23 #include "iremote_proxy.h"
24 #include "memory_level_info.h"
25 #include "running_process_info.h"
26 #include "want.h"
27 
28 namespace OHOS {
29 namespace AppExecFwk {
30 class AppMgrProxy : public IRemoteProxy<IAppMgr> {
31 public:
32     explicit AppMgrProxy(const sptr<IRemoteObject> &impl);
33     virtual ~AppMgrProxy() = default;
34 
35     /**
36      * AttachApplication, call AttachApplication() through proxy object,
37      * get all the information needed to start the Application (data related to the Application ).
38      *
39      * @param app, information needed to start the Application.
40      * @return
41      */
42     virtual void AttachApplication(const sptr<IRemoteObject> &obj) override;
43 
44     /**
45      * Preload application.
46      *
47      * @param bundleName The bundle name of the application to preload.
48      * @param userId Indicates the user identification.
49      * @param preloadMode Preload application mode.
50      * @param appIndex The index of application clone.
51      * @return Returns ERR_OK on success, others on failure.
52      */
53     virtual int32_t PreloadApplication(const std::string &bundleName, int32_t userId,
54         AppExecFwk::PreloadMode preloadMode, int32_t appIndex = 0) override;
55 
56     /**
57      * ApplicationForegrounded, call ApplicationForegrounded() through proxy object,
58      * set the application to Foreground State.
59      *
60      * @param recordId, a unique record that identifies this Application from others.
61      * @return
62      */
63     virtual void ApplicationForegrounded(const int32_t recordId) override;
64 
65     /**
66      * ApplicationBackgrounded, call ApplicationBackgrounded() through proxy object,
67      * set the application to Backgrounded State.
68      *
69      * @param recordId, a unique record that identifies this Application from others.
70      * @return
71      */
72     virtual void ApplicationBackgrounded(const int32_t recordId) override;
73 
74     /**
75      * ApplicationTerminated, call ApplicationTerminated() through proxy object,
76      * terminate the application.
77      *
78      * @param recordId, a unique record that identifies this Application from others.
79      * @return
80      */
81     virtual void ApplicationTerminated(const int32_t recordId) override;
82 
83     /**
84      * AbilityCleaned,call through AbilityCleaned() proxy project, clean Ability record.
85      *
86      * @param token, a unique record that identifies AbilityCleaned from others.
87      * @return
88      */
89     virtual void AbilityCleaned(const sptr<IRemoteObject> &token) override;
90 
91     /**
92      * GetAmsMgr, call GetAmsMgr() through proxy object, get AMS interface instance.
93      *
94      * @return sptr<IAmsMgr>, return to AMS interface instance.
95      */
96     virtual sptr<IAmsMgr> GetAmsMgr() override;
97 
98     /**
99      * ClearUpApplicationData, call ClearUpApplicationData() through proxy project,
100      * clear the application data.
101      *
102      * @param bundleName, bundle name in Application record.
103      * @param appCloneIndex the app clone id.
104      * @param userId the user id.
105      * @return ErrCode
106      */
107     virtual int32_t ClearUpApplicationData(const std::string &bundleName, int32_t appCloneIndex,
108         int32_t userId = -1) override;
109 
110     /**
111      * ClearUpApplicationData, call ClearUpApplicationData() through proxy project,
112      * clear the application data.
113      *
114      * @param bundleName, bundle name in Application record.
115      * @return
116      */
117     virtual int32_t ClearUpApplicationDataBySelf(int32_t userId = -1) override;
118 
119     /**
120      * GetAllRunningProcesses, call GetAllRunningProcesses() through proxy project.
121      * Obtains information about application processes that are running on the device.
122      *
123      * @param info, app name in Application record.
124      * @return ERR_OK ,return back success,others fail.
125      */
126     virtual int32_t GetAllRunningProcesses(std::vector<RunningProcessInfo> &info) override;
127 
128     /**
129      * GetALLRunningMultiAppInfo, call GetALLRunningMultiAppInfo() through proxy project.
130      * Obtains information about multiapp that are running on the device.
131      *
132      * @param info, app name in multiappinfo.
133      * @return ERR_OK ,return back success,others fail.
134      */
135     virtual int32_t GetRunningMultiAppInfoByBundleName(const std::string &bundleName,
136         RunningMultiAppInfo &info) override;
137 
138     /**
139      * GetAllRunningInstanceKeysBySelf, call GetAllRunningInstanceKeysBySelf() through proxy project.
140      * Obtains running instance keys of multi-instance app that are running on the device.
141      *
142      * @param instanceKeys, output instance keys of the multi-instance app.
143      * @return ERR_OK ,return back success,others fail.
144      */
145     virtual int32_t GetAllRunningInstanceKeysBySelf(std::vector<std::string> &instanceKeys) override;
146 
147     /**
148      * GetAllRunningInstanceKeysByBundleName, call GetAllRunningInstanceKeysByBundleName() through proxy project.
149      * Obtains running isntance keys of multi-instance app that are running on the device.
150      *
151      * @param bundlename, bundle name in Application record.
152      * @param instanceKeys, output instance keys of the multi-insatnce app.
153      * @param userId, user id.
154      * @return ERR_OK ,return back success,others fail.
155      */
156     virtual int32_t GetAllRunningInstanceKeysByBundleName(const std::string &bundleName,
157         std::vector<std::string> &instanceKeys, int32_t userId = -1) override;
158 
159     /**
160      * GetRunningProcessesByBundleType, call GetRunningProcessesByBundleType() through proxy project.
161      * Obtains information about application processes by bundle type that are running on the device.
162      *
163      * @param bundleType, bundle type of the processes
164      * @param info, app name in Application record.
165      * @return ERR_OK ,return back success,others fail.
166      */
167     virtual int GetRunningProcessesByBundleType(const BundleType bundleType,
168         std::vector<RunningProcessInfo> &info) override;
169 
170     /**
171      * GetAllRenderProcesses, call GetAllRenderProcesses() through proxy project.
172      * Obtains information about render processes that are running on the device.
173      *
174      * @param info, render process info.
175      * @return ERR_OK, return back success, others fail.
176      */
177     virtual int32_t GetAllRenderProcesses(std::vector<RenderProcessInfo> &info) override;
178 
179     /**
180      * GetAllChildrenProcesses, call GetAllChildrenProcesses() through proxy project.
181      * Obtains information about children processes that are running on the device.
182      *
183      * @param info, child process info.
184      * @return ERR_OK, return back success, others fail.
185      */
186     virtual int GetAllChildrenProcesses(std::vector<ChildProcessInfo> &info) override;
187 
188     /**
189      * JudgeSandboxByPid, call JudgeSandboxByPid() through proxy project.
190      * Obtains information about application processes that are running on the device.
191      *
192      * @param pid, the pid of current app running record.
193      * @param isSandbox, current app is or not a sandbox.
194      * @return ERR_OK ,return back success,others fail.
195      */
196     virtual int32_t JudgeSandboxByPid(pid_t pid, bool &isSandbox) override;
197 
198     /**
199      * IsTerminatingByPid, call IsTerminatingByPid() through proxy project.
200      * Obtains information about application processes that are running on the device.
201      *
202      * @param pid, the pid of current app running record.
203      * @param isTerminating, current app is or not terminating.
204      * @return ERR_OK, return back success, others fail.
205      */
206     virtual int32_t IsTerminatingByPid(pid_t pid, bool &isTerminating) override;
207 
208     /**
209      * GetProcessRunningInfosByUserId, call GetProcessRunningInfosByUserId() through proxy project.
210      * Obtains information about application processes that are running on the device.
211      *
212      * @param info, app name in Application record.
213      * @return ERR_OK ,return back success,others fail.
214      */
215     virtual int32_t GetProcessRunningInfosByUserId(std::vector<RunningProcessInfo> &info, int32_t userId) override;
216 
217     /**
218      * GetProcessRunningInformation, call GetProcessRunningInformation() through proxy project.
219      * Obtains information about current application process which is running on the device.
220      *
221      * @param info, app name in Application record.
222      * @return ERR_OK ,return back success,others fail.
223      */
224     virtual int32_t GetProcessRunningInformation(RunningProcessInfo &info) override;
225 
226     /**
227      * NotifyMemoryLevel, call NotifyMemoryLevel() through proxy project.
228      * Notify abilities background the current memory level.
229      *
230      * @param level, the current memory level
231      * @return ERR_OK ,return back success,others fail.
232      */
233     virtual int32_t NotifyMemoryLevel(int32_t level) override;
234 
235     /**
236      * NotifyProcMemoryLevel, call NotifyMemoryLevel() through proxy project.
237      * Notify abilities the current memory level.
238      *
239      * @param procLevelMap ,<pid, level> map;
240      * @return ERR_OK ,return back success,others fail.
241      */
242     virtual int32_t NotifyProcMemoryLevel(const std::map<pid_t, MemoryLevel> &procLevelMap) override;
243 
244     /**
245      * DumpHeapMemory, call DumpHeapMemory() through proxy project.
246      * Get the application's memory allocation info.
247      *
248      * @param pid, pid input.
249      * @param mallocInfo, dynamic storage information output.
250      * @return ERR_OK ,return back success,others fail.
251      */
252     virtual int32_t DumpHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo) override;
253 
254     /**
255      * DumpJsHeapMemory, call DumpJsHeapMemory() through proxy project.
256      * triggerGC and dump the application's jsheap memory info.
257      *
258      * @param info, pid tid needGc needSnapshot
259      * @return ERR_OK ,return back success, others fail.
260      */
261     virtual int32_t DumpJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info) override;
262 
263     /**
264      * Notify that the ability stage has been updated
265      * @param recordId, the app record.
266      */
267     virtual void AddAbilityStageDone(const int32_t recordId) override;
268 
269     /**
270      * Start a resident process
271      */
272     virtual void StartupResidentProcess(const std::vector<AppExecFwk::BundleInfo> &bundleInfos) override;
273 
274     /**
275      * Register application or process state observer.
276      * @param observer, ability token.
277      * @return Returns ERR_OK on success, others on failure.
278      */
279     virtual int32_t RegisterApplicationStateObserver(const sptr<IApplicationStateObserver> &observer,
280         const std::vector<std::string> &bundleNameList = {}) override;
281 
282     /**
283      * Unregister application or process state observer.
284      * @param observer, ability token.
285      * @return Returns ERR_OK on success, others on failure.
286      */
287     virtual int32_t UnregisterApplicationStateObserver(const sptr<IApplicationStateObserver> &observer) override;
288 
289     /**
290      * Register application or process state observer.
291      * @param observer, Is ability foreground state observer
292      * @return Returns ERR_OK on success, others on failure.
293      */
294     int32_t RegisterAbilityForegroundStateObserver(const sptr<IAbilityForegroundStateObserver> &observer) override;
295 
296     /**
297      * Unregister application or process state observer.
298      * @param observer, Is ability foreground state observer
299      * @return Returns ERR_OK on success, others on failure.
300      */
301     int32_t UnregisterAbilityForegroundStateObserver(const sptr<IAbilityForegroundStateObserver> &observer) override;
302 
303     /**
304      * Get foreground applications.
305      * @param list, foreground apps.
306      * @return Returns ERR_OK on success, others on failure.
307      */
308     virtual int32_t GetForegroundApplications(std::vector<AppStateData> &list) override;
309 
310     /**
311      * Start user test process.
312      * @param want, want object.
313      * @param observer, test observer remote object.
314      * @param bundleInfo, bundle info.
315      * @param userId the user id.
316      * @return Returns ERR_OK on success, others on failure.
317      */
318     virtual int StartUserTestProcess(const AAFwk::Want &want, const sptr<IRemoteObject> &observer,
319         const BundleInfo &bundleInfo, int32_t userId) override;
320 
321     /**
322      * @brief Finish user test.
323      * @param msg user test message.
324      * @param resultCode user test result Code.
325      * @param bundleName user test bundleName.
326      *
327      * @return Returns ERR_OK on success, others on failure.
328      */
329     virtual int FinishUserTest(
330         const std::string &msg, const int64_t &resultCode, const std::string &bundleName) override;
331 
332     virtual void ScheduleAcceptWantDone(
333         const int32_t recordId, const AAFwk::Want &want, const std::string &flag) override;
334 
335     virtual void ScheduleNewProcessRequestDone(
336         const int32_t recordId, const AAFwk::Want &want, const std::string &flag) override;
337 
338     /**
339      *  Get the token of ability records by process ID.
340      *
341      * @param pid The process id.
342      * @param tokens The token of ability records.
343      * @return Returns true on success, others on failure.
344      */
345     virtual int GetAbilityRecordsByProcessID(const int pid, std::vector<sptr<IRemoteObject>> &tokens) override;
346 
347     /**
348      * Prestart nwebspawn process.
349      *
350      * @return Returns ERR_OK on success, others on failure.
351      */
352     virtual int PreStartNWebSpawnProcess() override;
353 
354     /**
355      * Start nweb render process, called by nweb host.
356      *
357      * @param renderParam, params passed to renderprocess.
358      * @param ipcFd, ipc file descriptior for web browser and render process.
359      * @param sharedFd, shared memory file descriptior.
360      * @param crashFd, crash signal file descriptior.
361      * @param renderPid, created render pid.
362      * @param isGPU, is or not GPU process
363      * @return Returns ERR_OK on success, others on failure.
364      */
365     virtual int StartRenderProcess(const std::string &renderParam,
366                                    int32_t ipcFd, int32_t sharedFd,
367                                    int32_t crashFd, pid_t &renderPid, bool isGPU = false) override;
368 
369     /**
370      * Render process call this to attach app manager service.
371      *
372      * @param renderApp, information needed to start the Application.
373      */
374     virtual void AttachRenderProcess(const sptr<IRemoteObject> &renderApp) override;
375 
376     /**
377      * Get render process termination status, called by nweb host.
378      *
379      * @param renderPid, target render pid.
380      * @param status, termination status of the render process.
381      * @return Returns ERR_OK on success, others on failure.
382      */
383     virtual int GetRenderProcessTerminationStatus(pid_t renderPid, int &status) override;
384 
385     /**
386      * Notify Fault Data
387      *
388      * @param faultData the fault data.
389      * @return Returns ERR_OK on success, others on failure.
390      */
391     virtual int32_t NotifyAppFault(const FaultData &faultData) override;
392 
393     /**
394      * Notify App Fault Data By SA
395      *
396      * @param faultData the fault data notified by SA.
397      * @return Returns ERR_OK on success, others on failure.
398      */
399     virtual int32_t NotifyAppFaultBySA(const AppFaultDataBySA &faultData) override;
400 
401     /**
402      * Set Appfreeze Detect Filter
403      *
404      * @param pid the process pid.
405      * @return Returns true on success, others on failure.
406      */
407     virtual bool SetAppFreezeFilter(int32_t pid) override;
408 
409     virtual int32_t GetConfiguration(Configuration& config) override;
410 
411     virtual int32_t UpdateConfiguration(const Configuration &config, const int32_t userId = -1) override;
412 
413     virtual int32_t UpdateConfigurationByBundleName(const Configuration &config, const std::string &name) override;
414 
415     virtual int32_t RegisterConfigurationObserver(const sptr<IConfigurationObserver> &observer) override;
416 
417     virtual int32_t UnregisterConfigurationObserver(const sptr<IConfigurationObserver> &observer) override;
418 
419     bool GetAppRunningStateByBundleName(const std::string &bundleName) override;
420 
421     int32_t NotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback) override;
422 
423     int32_t NotifyHotReloadPage(const std::string &bundleName, const sptr<IQuickFixCallback> &callback) override;
424 
425     int32_t NotifyUnLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback) override;
426 
427 #ifdef BGTASKMGR_CONTINUOUS_TASK_ENABLE
428     int32_t SetContinuousTaskProcess(int32_t pid, bool isContinuousTask) override;
429 #endif
430 
431     /**
432      * @brief Check whether the shared bundle is running.
433      *
434      * @param bundleName Shared bundle name.
435      * @param versionCode Shared bundle version code.
436      * @return Returns the shared bundle running result. The result is true if running, false otherwise.
437      */
438     virtual bool IsSharedBundleRunning(const std::string &bundleName, uint32_t versionCode) override;
439 
440     virtual int32_t StartNativeProcessForDebugger(const AAFwk::Want &want) override;
441 
442     /**
443      * Get bundleName by pid.
444      *
445      * @param pid process id.
446      * @param bundleName Output parameters, return bundleName.
447      * @param uid Output parameters, return userId.
448      * @return Returns ERR_OK on success, others on failure.
449      */
450     virtual int32_t GetBundleNameByPid(const int pid, std::string &bundleName, int32_t &uid) override;
451 
452     /**
453      * Get running process information by pid.
454      *
455      * @param pid process id.
456      * @param info Output parameters, return runningProcessInfo.
457      * @return Returns ERR_OK on success, others on failure.
458      */
459     virtual int32_t GetRunningProcessInfoByPid(const pid_t pid, OHOS::AppExecFwk::RunningProcessInfo &info) override;
460 
461     /**
462      * get memorySize by pid.
463      *
464      * @param pid process id.
465      * @param memorySize Output parameters, return memorySize in KB.
466      * @return Returns ERR_OK on success, others on failure.
467      */
468     virtual int32_t GetProcessMemoryByPid(const int32_t pid, int32_t &memorySize) override;
469 
470     /**
471      * get application processes information list by bundleName.
472      *
473      * @param bundleName Bundle name.
474      * @param userId user Id in Application record.
475      * @param info Output parameters, return running process info list.
476      * @return Returns ERR_OK on success, others on failure.
477      */
478     virtual int32_t GetRunningProcessInformation(
479         const std::string &bundleName, int32_t userId, std::vector<RunningProcessInfo> &info) override;
480 
481     /**
482      * @brief Notify AbilityManagerService the page show.
483      * @param token Ability identify.
484      * @param pageStateData The data of ability's page state.
485      * @return Returns ERR_OK on success, others on failure.
486      */
487     virtual int32_t NotifyPageShow(const sptr<IRemoteObject> &token, const PageStateData &pageStateData) override;
488 
489     /**
490      * @brief Notify AbilityManagerService the page hide.
491      * @param token Ability identify.
492      * @param pageStateData The data of ability's page state.
493      * @return Returns ERR_OK on success, others on failure.
494      */
495     virtual int32_t NotifyPageHide(const sptr<IRemoteObject> &token, const PageStateData &pageStateData) override;
496 
497     /**
498      * @brief Notify NativeEngine GC of status change.
499      *
500      * @param state GC state
501      * @param pid pid
502      * @return Returns ERR_OK on success, others on failure.
503      */
504     virtual int32_t ChangeAppGcState(pid_t pid, int32_t state) override;
505 
506     /**
507      * Register appRunning status listener.
508      *
509      * @param listener Running status listener.
510      * @return Returns ERR_OK on success, others on failure.
511      */
512     int32_t RegisterAppRunningStatusListener(const sptr<IRemoteObject> &listener) override;
513 
514     /**
515      * Unregister appRunning status listener.
516      *
517      * @param listener Running status listener.
518      * @return Returns ERR_OK on success, others on failure.
519      */
520     int32_t UnregisterAppRunningStatusListener(const sptr<IRemoteObject> &listener) override;
521 
522     /**
523      * Register application foreground state observer.
524      * @param observer, app Is app foreground state observer
525      * @return Returns ERR_OK on success, others on failure.
526      */
527     int32_t RegisterAppForegroundStateObserver(const sptr<IAppForegroundStateObserver> &observer) override;
528 
529     /**
530      * Unregister application foreground state observer.
531      * @param observer, app Is app foreground state observer
532      * @return Returns ERR_OK on success, others on failure.
533      */
534     int32_t UnregisterAppForegroundStateObserver(const sptr<IAppForegroundStateObserver> &observer) override;
535 
536     /**
537      * Check whether the bundle is running.
538      *
539      * @param bundleName Indicates the bundle name of the bundle.
540      * @param isRunning Obtain the running status of the application, the result is true if running, false otherwise.
541      * @return Return ERR_OK if success, others fail.
542      */
543     int32_t IsApplicationRunning(const std::string &bundleName, bool &isRunning) override;
544 
545     /**
546      * Check whether the bundle is running.
547      *
548      * @param bundleName Indicates the bundle name of the bundle.
549      * @param appCloneIndex the appindex of the bundle.
550      * @param isRunning Obtain the running status of the application, the result is true if running, false otherwise.
551      * @return Return ERR_OK if success, others fail.
552      */
553     int32_t IsAppRunning(const std::string &bundleName, int32_t appCloneIndex, bool &isRunning) override;
554 
555     /**
556      * Start child process, called by ChildProcessManager.
557      *
558      * @param childPid Created child process pid.
559      * @param request Child process start request params.
560      * @return Returns ERR_OK on success, others on failure.
561      */
562     int32_t StartChildProcess(pid_t &childPid, const ChildProcessRequest &request) override;
563 
564     /**
565      * Get child process record for self.
566      *
567      * @return child process info.
568      */
569     int32_t GetChildProcessInfoForSelf(ChildProcessInfo &info) override;
570 
571     /**
572      * Attach child process scheduler to app manager service.
573      *
574      * @param childScheduler scheduler of child process.
575      */
576     void AttachChildProcess(const sptr<IRemoteObject> &childScheduler) override;
577 
578     /**
579      * Exit child process, called by itself.
580      */
581     void ExitChildProcessSafely() override;
582 
583     /**
584      * Whether the current application process is the last surviving process.
585      *
586      * @return Returns true is final application process, others return false.
587      */
588     bool IsFinalAppProcess() override;
589 
590     /**
591      * Register render state observer.
592      * @param observer Render process state observer.
593      * @return Returns ERR_OK on success, others on failure.
594      */
595     virtual int32_t RegisterRenderStateObserver(const sptr<IRenderStateObserver> &observer) override;
596 
597     /**
598      * Unregister render state observer.
599      * @param observer Render process state observer.
600      * @return Returns ERR_OK on success, others on failure.
601      */
602     virtual int32_t UnregisterRenderStateObserver(const sptr<IRenderStateObserver> &observer) override;
603 
604     /**
605      * Update render state.
606      * @param renderPid Render pid.
607      * @param state foreground or background state.
608      * @return Returns ERR_OK on success, others on failure.
609      */
610     virtual int32_t UpdateRenderState(pid_t renderPid, int32_t state) override;
611 
612     int32_t SignRestartAppFlag(int32_t uid) override;
613 
614     int32_t GetAppRunningUniqueIdByPid(pid_t pid, std::string &appRunningUniqueId) override;
615 
616     /*
617      * Get all uiextension root host process id, need apply permission ohos.permission.GET_RUNNING_INFO.
618      * If specified pid mismatch UIExtensionAbility type, return empty vector.
619      * @param pid Process id.
620      * @param hostPids All host process id.
621      * @return Returns 0 on success, others on failure.
622      */
623     int32_t GetAllUIExtensionRootHostPid(pid_t pid, std::vector<pid_t> &hostPids) override;
624 
625     /**
626      * Get all uiextension provider process id, need apply permission ohos.permission.GET_RUNNING_INFO.
627      * If specified hostPid didn't start any UIExtensionAbility, return empty vector.
628      * @param hostPid Host process id.
629      * @param providerPids All provider process id started by specified hostPid.
630      * @return Returns 0 on success, others on failure.
631      */
632     int32_t GetAllUIExtensionProviderPid(pid_t hostPid, std::vector<pid_t> &providerPids) override;
633 
634     /**
635      * @brief Notify memory size state changed to sufficient or insufficent.
636      * @param isMemorySizeSufficent Indicates the memory size state.
637      * @return Returns ERR_OK on success, others on failure.
638      */
639     virtual int32_t NotifyMemorySizeStateChanged(bool isMemorySizeSufficent) override;
640 
641     /**
642      * Set application assertion pause state.
643      *
644      * @param flag assertion pause state.
645      */
646     void SetAppAssertionPauseState(bool flag) override;
647 
648     int32_t SetSupportedProcessCacheSelf(bool isSupport) override;
649 
650     int32_t SetSupportedProcessCache(int32_t pid, bool isSupport) override;
651 
652     virtual void SaveBrowserChannel(sptr<IRemoteObject> browser) override;
653 
654     /**
655      * Check caller is test ability
656      *
657      * @param pid, the pid of ability.
658      * @return Returns ERR_OK is test ability, others is not test ability.
659      */
660     int32_t CheckCallingIsUserTestMode(const pid_t pid, bool &isUserTest) override;
661 
662     /**
663      * Start native child process, callde by ChildProcessManager.
664      * @param libName lib file name to be load in child process
665      * @param childProcessCount current started child process count
666      * @param callback callback for notify start result
667      * @return Returns ERR_OK on success, others on failure.
668      */
669     int32_t StartNativeChildProcess(const std::string &libName, int32_t childProcessCount,
670         const sptr<IRemoteObject> &callback) override;
671 
672     virtual int32_t NotifyProcessDependedOnWeb() override;
673 
674     virtual void KillProcessDependedOnWeb() override;
675 
676     virtual void RestartResidentProcessDependedOnWeb() override;
677 
678     virtual int32_t GetAppIndexByPid(pid_t pid, int32_t &appIndex) override;
679 
680     /**
681      * Get pids of processes which belong to specific bundle name and support process cache feature.
682      * @param bundleName bundle name.
683      * @param pidList pid list of processes that support process cache..
684      * @return Returns ERR_OK on success, others on failure.
685      */
686     virtual int32_t GetSupportedProcessCachePids(const std::string &bundleName,
687         std::vector<int32_t> &pidList) override;
688 private:
689     bool SendTransactCmd(AppMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply);
690     bool WriteInterfaceToken(MessageParcel &data);
691     int32_t SendRequest(AppMgrInterfaceCode code, MessageParcel &data, MessageParcel &reply,
692         MessageOption& option);
693     template<typename T>
694     int GetParcelableInfos(MessageParcel &reply, std::vector<T> &parcelableInfos);
695     static inline BrokerDelegator<AppMgrProxy> delegator_;
696 };
697 }  // namespace AppExecFwk
698 }  // namespace OHOS
699 #endif  // OHOS_ABILITY_RUNTIME_APP_MGR_PROXY_H
700