• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_MAIN_THREAD_H
17 #define OHOS_ABILITY_RUNTIME_MAIN_THREAD_H
18 
19 #include <string>
20 #include <signal.h>
21 #include <mutex>
22 
23 #include "ability_record_mgr.h"
24 #include "app_jsheap_mem_info.h"
25 #include "app_malloc_info.h"
26 #include "app_mgr_interface.h"
27 #include "app_scheduler_host.h"
28 #include "application_impl.h"
29 #include "assert_fault_task_thread.h"
30 #include "common_event_subscriber.h"
31 #include "event_handler.h"
32 #include "extension_config_mgr.h"
33 #include "idle_time.h"
34 #include "inner_event.h"
35 #include "ipc_singleton.h"
36 #include "js_runtime.h"
37 #include "native_engine/native_engine.h"
38 #include "overlay_event_subscriber.h"
39 #include "resource_manager.h"
40 #include "runtime.h"
41 #include "watchdog.h"
42 
43 #ifdef CJ_FRONTEND
44 #include "cj_envsetup.h"
45 #endif
46 #define ABILITY_LIBRARY_LOADER
47 
48 #if defined(NWEB) && defined(NWEB_GRAPHIC)
49 #include "nweb_preload.h"
50 #include "ui/rs_surface_node.h"
51 #endif
52 
53 class Runtime;
54 namespace OHOS {
55 namespace AppExecFwk {
56 using namespace OHOS::Global;
57 using OHOS::AbilityRuntime::Runtime;
58 struct BaseSharedBundleInfo;
59 using HspList = std::vector<BaseSharedBundleInfo>;
60 enum class MainThreadState { INIT, ATTACH, READY, RUNNING };
61 struct BundleInfo;
62 class ContextDeal;
63 // class Global::Resource::ResourceManager;
64 class AppMgrDeathRecipient : public IRemoteObject::DeathRecipient {
65 public:
66     /**
67      *
68      * @brief Notify the AppMgrDeathRecipient that the remote is dead.
69      *
70      * @param remote The remote which is dead.
71      */
72     virtual void OnRemoteDied(const wptr<IRemoteObject> &remote) override;
73     AppMgrDeathRecipient() = default;
74     ~AppMgrDeathRecipient() override = default;
75 };
76 
77 class MainThread : public AppSchedulerHost {
78     DECLARE_DELAYED_IPCSINGLETON(MainThread);
79 
80 public:
81     /**
82      *
83      * @brief Get the current MainThreadState.
84      *
85      * @return Returns the current MainThreadState.
86      */
87     MainThreadState GetMainThreadState() const;
88 
89     /**
90      *
91      * @brief Get the runner state of mainthread.
92      *
93      * @return Returns the runner state of mainthread.
94      */
95     bool GetRunnerStarted() const;
96 
97     /**
98      *
99      * @brief Get the newThreadId.
100      *
101      * @return Returns the newThreadId.
102      */
103     int GetNewThreadId();
104 
105     /**
106      *
107      * @brief Get the application.
108      *
109      * @return Returns the application.
110      */
111     std::shared_ptr<OHOSApplication> GetApplication() const;
112 
113     /**
114      *
115      * @brief Get the applicationInfo.
116      *
117      * @return Returns the applicationInfo.
118      */
119     std::shared_ptr<ApplicationInfo> GetApplicationInfo() const;
120 
121     /**
122      *
123      * @brief Get the applicationImpl.
124      *
125      * @return Returns the applicationImpl.
126      */
127     std::shared_ptr<ApplicationImpl> GetApplicationImpl();
128 
129     /**
130      *
131      * @brief Get the eventHandler of mainthread.
132      *
133      * @return Returns the eventHandler of mainthread.
134      */
135     std::shared_ptr<EventHandler> GetMainHandler() const;
136 
137     /**
138      *
139      * @brief Schedule the foreground lifecycle of application.
140      *
141      */
142     bool ScheduleForegroundApplication() override;
143 
144     /**
145      *
146      * @brief Schedule the background lifecycle of application.
147      *
148      */
149     void ScheduleBackgroundApplication() override;
150 
151     /**
152      *
153      * @brief Schedule the terminate lifecycle of application.
154      *
155      * @param isLastProcess When it is the last application process, pass in true.
156      */
157     void ScheduleTerminateApplication(bool isLastProcess = false) override;
158 
159     /**
160      *
161      * @brief Shrink the memory which used by application.
162      *
163      * @param level Indicates the memory trim level, which shows the current memory usage status.
164      */
165     void ScheduleShrinkMemory(const int level) override;
166 
167     /**
168      *
169      * @brief Notify the current memory.
170      *
171      * @param level Indicates the memory trim level, which shows the current memory usage status.
172      */
173     void ScheduleMemoryLevel(const int level) override;
174 
175     /**
176      *
177      * @brief Get the application's memory allocation info.
178      *
179      * @param pid, pid input.
180      * @param mallocInfo, dynamic storage information output.
181      */
182     void ScheduleHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo) override;
183 
184     /**
185      *
186      * @brief triggerGC and dump the application's jsheap memory info.
187      *
188      * @param info, pid, tid, needGc, needSnapshot.
189      */
190     void ScheduleJsHeapMemory(OHOS::AppExecFwk::JsHeapDumpInfo &info) override;
191 
192     /**
193      *
194      * @brief Low the memory which used by application.
195      *
196      */
197     void ScheduleLowMemory() override;
198 
199     /**
200      *
201      * @brief Launch the application.
202      *
203      * @param data The launchdata of the application witch launced.
204      *
205      */
206     void ScheduleLaunchApplication(const AppLaunchData &data, const Configuration &config) override;
207 
208     /**
209      *
210      * @brief update the application info after new module installed.
211      *
212      * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext.
213      *
214      */
215     void ScheduleUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo, const std::string &moduleName) override;
216 
217     /**
218      * Notify application to launch ability stage.
219      *
220      * @param The resident process data value.
221      */
222     void ScheduleAbilityStage(const HapModuleInfo &abilityStage) override;
223 
224     void ScheduleLaunchAbility(const AbilityInfo &info, const sptr<IRemoteObject> &token,
225         const std::shared_ptr<AAFwk::Want> &want, int32_t abilityRecordId) override;
226 
227     /**
228      *
229      * @brief clean the ability by token.
230      *
231      * @param token The token belong to the ability which want to be cleaned.
232      *
233      */
234     void ScheduleCleanAbility(const sptr<IRemoteObject> &token, bool isCacheProcess = false) override;
235 
236     /**
237      *
238      * @brief send the new profile.
239      *
240      * @param profile The updated profile.
241      *
242      */
243     void ScheduleProfileChanged(const Profile &profile) override;
244 
245     /**
246      *
247      * @brief send the new config to the application.
248      *
249      * @param config The updated config.
250      *
251      */
252     void ScheduleConfigurationUpdated(const Configuration &config) override;
253 
254     /**
255      *
256      * @brief Starts the mainthread.
257      *
258      */
259     static void Start();
260 
261     static void StartChild(const std::map<std::string, int32_t> &fds);
262 
263     /**
264      *
265      * @brief Preload extensions in appspawn.
266      *
267      */
268     static void PreloadExtensionPlugin();
269 
270     /**
271      *
272      * @brief Schedule the application process exit safely.
273      *
274      */
275     void ScheduleProcessSecurityExit() override;
276 
277     void ScheduleClearPageStack() override;
278 
279     void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override;
280 
281     void SchedulePrepareTerminate(const std::string &moduleName) override;
282 
283     void ScheduleNewProcessRequest(const AAFwk::Want &want, const std::string &moduleName) override;
284 
285     /**
286      *
287      * @brief Check the App main thread state.
288      *
289      */
290     void CheckMainThreadIsAlive();
291 
292     int32_t ScheduleNotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback,
293         const int32_t recordId) override;
294 
295     int32_t ScheduleNotifyHotReloadPage(const sptr<IQuickFixCallback> &callback, const int32_t recordId) override;
296 
297     int32_t ScheduleNotifyUnLoadRepairPatch(const std::string &bundleName,
298         const sptr<IQuickFixCallback> &callback, const int32_t recordId) override;
299 
300     int32_t ScheduleNotifyAppFault(const FaultData &faultData) override;
301 #ifdef CJ_FRONTEND
302     CJUncaughtExceptionInfo CreateCjExceptionInfo(const std::string &bundleName, uint32_t versionCode,
303         const std::string &hapPath);
304 #endif
305     /**
306      * @brief Notify NativeEngine GC of status change.
307      *
308      * @param state GC state
309      *
310      * @return Is the status change completed.
311      */
312     int32_t ScheduleChangeAppGcState(int32_t state) override;
313 
314     void AttachAppDebug(bool isDebugFromLocal) override;
315     void DetachAppDebug() override;
316     bool NotifyDeviceDisConnect();
317 
318     void AssertFaultPauseMainThreadDetection();
319     void AssertFaultResumeMainThreadDetection();
320 
321     /**
322      * ScheduleDumpIpcStart, call ScheduleDumpIpcStart(std::string& result) through proxy project,
323      * Start querying the application's IPC payload info.
324      *
325      * @param result, start IPC dump result output.
326      *
327      * @return Returns 0 on success, error code on failure.
328      */
329     int32_t ScheduleDumpIpcStart(std::string& result) override;
330 
331     /**
332      * ScheduleDumpIpcStop, call ScheduleDumpIpcStop(std::string& result) through proxy project,
333      * Stop querying the application's IPC payload info.
334      *
335      * @param result, stop IPC dump result output.
336      *
337      * @return Returns 0 on success, error code on failure.
338      */
339     int32_t ScheduleDumpIpcStop(std::string& result) override;
340 
341     /**
342      * ScheduleDumpIpcStat, call ScheduleDumpIpcStat(std::string& result) through proxy project,
343      * Collect the application's IPC payload info.
344      *
345      * @param result, IPC payload result output.
346      *
347      * @return Returns 0 on success, error code on failure.
348      */
349     int32_t ScheduleDumpIpcStat(std::string& result) override;
350 
351     void ScheduleCacheProcess() override;
352     /**
353      * ScheduleDumpFfrt, call ScheduleDumpFfrt(std::string& result) through proxy project,
354      * Start querying the application's ffrt usage.
355      *
356      * @param result, ffrt dump result output.
357      *
358      * @return Returns 0 on success, error code on failure.
359      */
360     int32_t ScheduleDumpFfrt(std::string& result) override;
361 
362     /**
363      *
364      * @brief Set watchdog background status of application.
365      *
366      */
367     void SetWatchdogBackgroundStatus(bool status) override;
368 
369 private:
370     /**
371      *
372      * @brief Terminate the application but don't notify ams.
373      *
374      */
375     void HandleTerminateApplicationLocal();
376 
377     void HandleScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName);
378 
379     void HandleScheduleNewProcessRequest(const AAFwk::Want &want, const std::string &moduleName);
380 
381     void HandleJsHeapMemory(const OHOS::AppExecFwk::JsHeapDumpInfo &info);
382 
383     void HandleSchedulePrepareTerminate(const std::string &moduleName);
384 
385     void PreloadModule(const AppExecFwk::HapModuleInfo &entryHapModuleInfo,
386         const std::unique_ptr<AbilityRuntime::Runtime>& runtime);
387 
388     void ProcessMainAbility(const AbilityInfo &info, const std::unique_ptr<AbilityRuntime::Runtime>& runtime);
389 
390     /**
391      *
392      * @brief Schedule the application process exit safely.
393      *
394      */
395     void HandleProcessSecurityExit();
396 
397     /**
398      *
399      * @brief Clean the ability but don't notify ams.
400      *
401      * @param token The token which belongs to the ability launched.
402      *
403      */
404     void HandleCleanAbilityLocal(const sptr<IRemoteObject> &token);
405 
406     /**
407      *
408      * @brief Launch the application.
409      *
410      * @param appLaunchData The launchdata of the application witch launced.
411      *
412      */
413     void HandleLaunchApplication(const AppLaunchData &appLaunchData, const Configuration &config);
414 
415     /**
416      *
417      * @brief update the application info after new module installed.
418      *
419      * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext.
420      *
421      */
422     void HandleUpdateApplicationInfoInstalled(const ApplicationInfo &appInfo, const std::string &moduleName);
423 
424     /**
425      *
426      * @brief Launch the application.
427      *
428      * @param appLaunchData The launchdata of the application witch launced.
429      *
430      */
431     void HandleAbilityStage(const HapModuleInfo &abilityStage);
432 
433     /**
434      *
435      * @brief Launch the ability.
436      *
437      * @param abilityRecord The abilityRecord which belongs to the ability launched.
438      *
439      */
440     void HandleLaunchAbility(const std::shared_ptr<AbilityLocalRecord> &abilityRecord);
441 
442     /**
443      *
444      * @brief Clean the ability.
445      *
446      * @param token The token which belongs to the ability launched.
447      *
448      */
449     void HandleCleanAbility(const sptr<IRemoteObject> &token, bool isCacheProcess = false);
450 
451     /**
452      *
453      * @brief Foreground the application.
454      *
455      */
456     void HandleForegroundApplication();
457 
458     /**
459      *
460      * @brief Background the application.
461      *
462      */
463     void HandleBackgroundApplication();
464 
465     /**
466      *
467      * @brief Terminate the application.
468      *
469      */
470     void HandleTerminateApplication(bool isLastProcess = false);
471 
472     /**
473      *
474      * @brief Shrink the memory which used by application.
475      *
476      * @param level Indicates the memory trim level, which shows the current memory usage status.
477      *
478      */
479     void HandleShrinkMemory(const int level);
480 
481     /**
482      *
483      * @brief Notify the memory.
484      *
485      * @param level Indicates the memory trim level, which shows the current memory usage status.
486      *
487      */
488     void HandleMemoryLevel(int level);
489 
490     /**
491      *
492      * @brief send the new config to the application.
493      *
494      * @param config The updated config.
495      *
496      */
497     void HandleConfigurationUpdated(const Configuration &config);
498 
499     /**
500      *
501      * @brief remove the deathRecipient from appMgr.
502      *
503      */
504     void RemoveAppMgrDeathRecipient();
505 
506     /**
507      *
508      * @brief Attach the mainthread to the AppMgr.
509      *
510      */
511     void Attach();
512 
513     /**
514      *
515      * @brief Set the runner state of mainthread.
516      *
517      * @param runnerStart whether the runner is started.
518      */
519     void SetRunnerStarted(bool runnerStart);
520 
521     /**
522      *
523      * @brief Connect the mainthread to the AppMgr.
524      *
525      */
526     bool ConnectToAppMgr();
527 
528     /**
529      *
530      * @brief Check whether the appLaunchData is legal.
531      *
532      * @param appLaunchData The appLaunchData should be checked.
533      *
534      * @return if the appLaunchData is legal, return true. else return false.
535      */
536     bool CheckLaunchApplicationParam(const AppLaunchData &appLaunchData) const;
537 
538     /**
539      *
540      * @brief Check whether the record is legal.
541      *
542      * @param record The record should be checked.
543      *
544      * @return if the record is legal, return true. else return false.
545      */
546     bool CheckAbilityItem(const std::shared_ptr<AbilityLocalRecord> &record) const;
547 
548     /**
549      *
550      * @brief Init the mainthread.
551      *
552      * @param runner the runner belong to the mainthread.
553      *
554      */
555     void Init(const std::shared_ptr<EventRunner> &runner);
556 
557     /**
558      *
559      * @brief Task in event handler timeout detected.
560      *
561      * @param runner the runner belong to the mainthread.
562      *
563      */
564     void TaskTimeoutDetected(const std::shared_ptr<EventRunner>& runner);
565 
566     /**
567      *
568      * @brief Check whether the OHOSApplication is ready.
569      *
570      * @return if the OHOSApplication is ready, return true. else return false.
571      *
572      */
573     bool IsApplicationReady() const;
574 
575     /**
576      * @brief Load all extension so
577      *
578      * @param nativeEngine nativeEngine instance
579      */
580     void LoadAllExtensions(NativeEngine &nativeEngine);
581 
582     void LoadAllExtensions();
583     /**
584      *
585      * @brief Ability Delegator Prepare.
586      *
587      * @param record User Test info.
588      *
589      */
590     bool PrepareAbilityDelegator(const std::shared_ptr<UserTestRecord> &record, bool isStageBased,
591         const AppExecFwk::HapModuleInfo &entryHapModuleInfo, uint32_t targetVersion);
592 
593     /**
594      * @brief Set current process extension type
595      *
596      * @param abilityRecord current running ability record
597      */
598     void SetProcessExtensionType(const std::shared_ptr<AbilityLocalRecord> &abilityRecord);
599 
600     /**
601      * @brief Add Extension block item
602      *
603      * @param extensionName extension name
604      * @param type extension type
605      */
606     void AddExtensionBlockItem(const std::string &extensionName, int32_t type);
607 
608     /**
609      * @brief Update runtime module checker
610      *
611      * @param runtime runtime the ability runtime
612      */
613     void UpdateRuntimeModuleChecker(const std::unique_ptr<AbilityRuntime::Runtime> &runtime);
614 
615     static void HandleDumpHeapPrepare();
616     static void HandleDumpHeap(bool isPrivate);
617     static void DestroyHeapProfiler();
618     static void ForceFullGC();
619     static void HandleSignal(int signal, siginfo_t *siginfo, void *context);
620 
621     void NotifyAppFault(const FaultData &faultData);
622 
623     void OnOverlayChanged(const EventFwk::CommonEventData &data,
624         const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
625         const std::string &moduleName, const std::string &loadPath);
626 
627     void HandleOnOverlayChanged(const EventFwk::CommonEventData &data,
628         const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager, const std::string &bundleName,
629         const std::string &moduleName, const std::string &loadPath);
630 
631     int GetOverlayModuleInfos(const std::string &bundleName, const std::string &moduleName,
632         std::vector<OverlayModuleInfo> &overlayModuleInfos) const;
633 
634     std::vector<std::string> GetAddOverlayPaths(const std::vector<OverlayModuleInfo> &overlayModuleInfos);
635 
636     std::vector<std::string> GetRemoveOverlayPaths(const std::vector<OverlayModuleInfo> &overlayModuleInfos);
637 
638     int32_t ChangeAppGcState(int32_t state);
639 
640     void HandleCacheProcess();
641 
642     bool IsBgWorkingThread(const AbilityInfo &info);
643 
644     /**
645      * @brief parse app configuration params
646      *
647      * @param configuration input configuration
648      * @config the config of application
649      */
650     void ParseAppConfigurationParams(const std::string configuration, Configuration &config);
651 
652     int32_t OnAttachLocalDebug(bool isDebugFromLocal);
653 
654 #if defined(NWEB) && defined(NWEB_GRAPHIC)
655     void HandleNWebPreload();
656 #endif
657 
658 #if defined(NWEB)
659     void PreLoadWebLib();
660 #endif
661 
662     class MainHandler : public EventHandler {
663     public:
664         MainHandler(const std::shared_ptr<EventRunner> &runner, const sptr<MainThread> &thread);
665         virtual ~MainHandler() = default;
666 
667         /**
668          *
669          * @brief Process the event.
670          *
671          * @param event the event want to be processed.
672          *
673          */
674         void ProcessEvent(const OHOS::AppExecFwk::InnerEvent::Pointer &event) override;
675 
676     private:
677         wptr<MainThread> mainThreadObj_ = nullptr;
678     };
679 
680     bool isRunnerStarted_ = false;
681     int newThreadId_ = -1;
682     std::shared_ptr<ApplicationInfo> applicationInfo_ = nullptr;
683     std::shared_ptr<ProcessInfo> processInfo_ = nullptr;
684     std::shared_ptr<OHOSApplication> application_ = nullptr;
685     std::shared_ptr<ApplicationImpl> applicationImpl_ = nullptr;
686     static std::shared_ptr<MainHandler> mainHandler_;
687     std::shared_ptr<AbilityRecordMgr> abilityRecordMgr_ = nullptr;
688     std::shared_ptr<Watchdog> watchdog_ = nullptr;
689     std::unique_ptr<AbilityRuntime::ExtensionConfigMgr> extensionConfigMgr_ = nullptr;
690     MainThreadState mainThreadState_ = MainThreadState::INIT;
691     sptr<IAppMgr> appMgr_ = nullptr;  // appMgrService Handler
692     sptr<IRemoteObject::DeathRecipient> deathRecipient_ = nullptr;
693     std::string pathSeparator_ = "/";
694     std::string abilityLibraryType_ = ".so";
695     static std::weak_ptr<OHOSApplication> applicationForDump_;
696     bool isDeveloperMode_ = false;
697 #if defined(NWEB) && defined(NWEB_GRAPHIC)
698     Rosen::RSSurfaceNode::SharedPtr preloadSurfaceNode_ = nullptr;
699     std::shared_ptr<NWeb::NWeb> preloadNWeb_ = nullptr;
700 #endif
701 
702 #ifdef ABILITY_LIBRARY_LOADER
703     /**
704      *
705      * @brief Load the ability library.
706      *
707      * @param libraryPaths the library paths.
708      *
709      */
710     void LoadAbilityLibrary(const std::vector<std::string> &libraryPaths);
711     void LoadAceAbilityLibrary();
712 
713     void CalcNativeLiabraryEntries(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
714     void LoadNativeLibrary(const BundleInfo &bundleInfo, std::string &nativeLibraryPath);
715 
716     void LoadAppDetailAbilityLibrary(std::string &nativeLibraryPath);
717 
718     void LoadAppLibrary();
719 
720     void ChangeToLocalPath(const std::string &bundleName,
721         const std::vector<std::string> &sourceDirs, std::vector<std::string> &localPath);
722 
723     void ChangeToLocalPath(const std::string &bundleName,
724         const std::string &sourcDir, std::string &localPath);
725 
726     bool ScanDir(const std::string &dirPath, std::vector<std::string> &files);
727 
728     /**
729      *
730      * @brief Check the fileType.
731      *
732      * @param fileName The fileName of the lib.
733      * @param extensionName The extensionName of the lib.
734      *
735      * @return if the FileType is legal, return true. else return false.
736      *
737      */
738     bool CheckFileType(const std::string &fileName, const std::string &extensionName);
739 
740     bool InitCreate(std::shared_ptr<ContextDeal> &contextDeal, ApplicationInfo &appInfo, ProcessInfo &processInfo);
741     bool CheckForHandleLaunchApplication(const AppLaunchData &appLaunchData);
742     bool InitResourceManager(std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
743         const AppExecFwk::HapModuleInfo &entryHapModuleInfo, const std::string &bundleName,
744         const Configuration &config, const ApplicationInfo &appInfo);
745     void OnStartAbility(const std::string& bundleName,
746         std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
747         const AppExecFwk::HapModuleInfo &entryHapModuleInfo, const bool isDebugApp);
748     std::vector<std::string> GetOverlayPaths(const std::string &bundleName,
749         const std::vector<OverlayModuleInfo> &overlayModuleInfos);
750     void SubscribeOverlayChange(const std::string &bundleName, const std::string &loadPath,
751         std::shared_ptr<Global::Resource::ResourceManager> &resourceManager,
752         const AppExecFwk::HapModuleInfo &entryHapModuleInfo);
753     void HandleInitAssertFaultTask(bool isDebugModule, bool isDebugApp);
754     void HandleCancelAssertFaultTask();
755 
756     bool GetHqfFileAndHapPath(const std::string &bundleName,
757         std::vector<std::pair<std::string, std::string>> &fileMap);
758     void GetNativeLibPath(const BundleInfo &bundleInfo, const HspList &hspList, AppLibPathMap &appLibPaths);
759     void SetAppDebug(uint32_t modeFlag, bool isDebug);
760 
761     std::vector<std::string> fileEntries_;
762     std::vector<std::string> nativeFileEntries_;
763     std::vector<void *> handleAbilityLib_;  // the handler of ACE Library.
764     std::shared_ptr<IdleTime> idleTime_ = nullptr;
765     std::vector<AppExecFwk::OverlayModuleInfo> overlayModuleInfos_;
766     std::weak_ptr<AbilityRuntime::AssertFaultTaskThread> assertThread_;
767 #endif                                      // ABILITY_LIBRARY_LOADER
768 #ifdef APPLICATION_LIBRARY_LOADER
769     void *handleAppLib_ = nullptr;  // the handler of ACE Library.
770     constexpr static std::string applicationLibraryPath = "/hos/lib/libapplication_native.z.so";
771 #endif  // APPLICATION_LIBRARY_LOADER
772 
773     DISALLOW_COPY_AND_MOVE(MainThread);
774 };
775 }  // namespace AppExecFwk
776 }  // namespace OHOS
777 #endif  // OHOS_ABILITY_RUNTIME_MAIN_THREAD_H
778