• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 FOUNDATION_APPEXECFWK_OHOS_CONTEXT_DEAL_H
17 #define FOUNDATION_APPEXECFWK_OHOS_CONTEXT_DEAL_H
18 
19 #include "context.h"
20 #include "profile.h"
21 #include "lifecycle_state_info.h"
22 
23 namespace OHOS {
24 namespace AppExecFwk {
25 class ContextDeal : public Context, public std::enable_shared_from_this<ContextDeal> {
26 public:
27     ContextDeal() = default;
28     virtual ~ContextDeal() = default;
29 
30     /**
31      * Called when getting the ProcessInfo
32      *
33      * @return ProcessInfo
34      */
35     std::shared_ptr<ProcessInfo> GetProcessInfo() const override;
36 
37     /**
38      * Called when setting the ProcessInfo
39      *
40      * @param info ProcessInfo instance
41      */
42     void SetProcessInfo(const std::shared_ptr<ProcessInfo> &info);
43 
44     /**
45      * @brief Obtains information about the current application. The returned application information includes basic
46      * information such as the application name and application permissions.
47      *
48      * @return Returns the ApplicationInfo for the current application.
49      */
50     std::shared_ptr<ApplicationInfo> GetApplicationInfo() const override;
51 
52     /**
53      * @brief Set ApplicationInfo
54      *
55      * @param info ApplicationInfo instance.
56      */
57     void SetApplicationInfo(const std::shared_ptr<ApplicationInfo> &info);
58 
59     /**
60      * @brief Obtains the Context object of the application.
61      *
62      * @return Returns the Context object of the application.
63      */
64     std::shared_ptr<Context> GetApplicationContext() const override;
65 
66     /**
67      * @brief Set ApplicationContext
68      *
69      * @param context ApplicationContext instance.
70      */
71     void SetApplicationContext(const std::shared_ptr<Context> &context);
72 
73     /**
74      * @brief Obtains the path of the package containing the current ability. The returned path contains the resources,
75      *  source code, and configuration files of a module.
76      *
77      * @return Returns the path of the package file.
78      */
79     std::string GetBundleCodePath() override;
80 
81     /**
82      * @brief SetBundleCodePath
83      *
84      * @param Returns string path
85      */
86     void SetBundleCodePath(std::string &path);
87 
88     /**
89      * @brief Obtains information about the current ability.
90      * The returned information includes the class name, bundle name, and other information about the current ability.
91      *
92      * @return Returns the AbilityInfo object for the current ability.
93      */
94     const std::shared_ptr<AbilityInfo> GetAbilityInfo() override;
95 
96     /**
97      * @brief Set AbilityInfo
98      *
99      * @param info AbilityInfo instance.
100      */
101     void SetAbilityInfo(const std::shared_ptr<AbilityInfo> &info);
102 
103     /**
104      * @brief Obtains the Context object of the ability.
105      *
106      * @return Returns the Context object of the ability.
107      */
108     std::shared_ptr<Context> GetContext() override;
109 
110     /**
111      * @brief Set Ability context
112      *
113      * @param context Ability object
114      */
115     void SetContext(const std::shared_ptr<Context> &context);
116 
117     /**
118      * @brief Obtains an IBundleMgr instance.
119      * You can use this instance to obtain information about the application bundle.
120      *
121      * @return Returns an IBundleMgr instance.
122      */
123     sptr<IBundleMgr> GetBundleManager() const override;
124 
125     /**
126      * @brief Obtains a resource manager.
127      *
128      * @return Returns a ResourceManager object.
129      */
130     std::shared_ptr<Global::Resource::ResourceManager> GetResourceManager() const override;
131 
132     /**
133      * @brief Set Profile instance.
134      *
135      * @param Profile instance.
136      */
137     void SetProfile(const std::shared_ptr<Profile> &profile);
138 
139     /**
140      * @brief Obtains an Profile instance.
141      *
142      * @return Returns an Profile instance.
143      */
144     std::shared_ptr<Profile> GetProfile() const;
145 
146     /**
147      * @brief Deletes the specified private file associated with the application.
148      *
149      * @param fileName Indicates the name of the file to delete. The file name cannot contain path separators.
150      *
151      * @return Returns true if the file is deleted successfully; returns false otherwise.
152      */
153     bool DeleteFile(const std::string &fileName) override;
154 
155     /**
156      * @brief Destroys another ability that uses the AbilityInfo.AbilityType.SERVICE template.
157      * The current ability using either the AbilityInfo.AbilityType.SERVICE or AbilityInfo.AbilityType.PAGE
158      * template can call this method to destroy another ability that uses the AbilityInfo.AbilityType.SERVICE
159      * template. The current ability itself can be destroyed by calling the terminateAbility() method.
160      *
161      * @param want Indicates the Want containing information about the ability to destroy.
162      *
163      * @return Returns true if the ability is destroyed successfully; returns false otherwise.
164      */
165     bool StopAbility(const AAFwk::Want &want) override;
166 
167     /**
168      * @brief Obtains the application-specific cache directory on the device's internal storage. The system
169      * automatically deletes files from the cache directory if disk space is required elsewhere on the device.
170      * Older files are always deleted first.
171      *
172      * @return Returns the application-specific cache directory.
173      */
174     std::string GetCacheDir() override;
175 
176     /**
177      * @brief Obtains the application-specific code-cache directory on the device's internal storage.
178      * The system will delete any files stored in this location both when your specific application is upgraded,
179      * and when the entire platform is upgraded.
180      *
181      * @return Returns the application-specific code-cache directory.
182      */
183     std::string GetCodeCacheDir() override;
184 
185     /**
186      * @brief Obtains the local database path.
187      * If the local database path does not exist, the system creates one and returns the created path.
188      *
189      * @return Returns the local database file.
190      */
191     std::string GetDatabaseDir() override;
192 
193     /**
194      * @brief Obtains the absolute path where all private data files of this application are stored.
195      *
196      * @return Returns the absolute path storing all private data files of this application.
197      */
198     std::string GetDataDir() override;
199 
200     /**
201      * @brief Obtains the directory for storing custom data files of the application.
202      * You can use the returned File object to create and access files in this directory. The files
203      * can be accessible only by the current application.
204      *
205      * @param name Indicates the name of the directory to retrieve. This directory is created as part
206      * of your application data.
207      * @param mode Indicates the file operating mode. The value can be 0 or a combination of MODE_PRIVATE.
208      *
209      * @return Returns a File object for the requested directory.
210      */
211     std::string GetDir(const std::string &name, int mode) override;
212 
213     /**
214      * @brief Obtains the absolute path to the application-specific cache directory
215      * on the primary external or shared storage device.
216      *
217      * @return Returns the absolute path to the application-specific cache directory on the external or
218      * shared storage device; returns null if the external or shared storage device is temporarily unavailable.
219      */
220     std::string GetExternalCacheDir() override;
221 
222     /**
223      * @brief Obtains the absolute path to the directory for storing files for the application on the
224      * primary external or shared storage device.
225      *
226      * @param type Indicates the type of the file directory to return
227      *
228      * @return Returns the absolute path to the application file directory on the external or shared storage
229      * device; returns null if the external or shared storage device is temporarily unavailable.
230      */
231     std::string GetExternalFilesDir(std::string &type) override;
232 
233     /**
234      * @brief Obtains the directory for storing files for the application on the device's internal storage.
235      *
236      * @return Returns the application file directory.
237      */
238     std::string GetFilesDir() override;
239 
240     /**
241      * @brief Obtains the absolute path which app created and will be excluded from automatic backup to remote storage.
242      * The returned path maybe changed if the application is moved to an adopted storage device.
243      *
244      * @return The path of the directory holding application files that will not be automatically backed up to remote
245      * storage.
246      */
247     std::string GetNoBackupFilesDir() override;
248 
249     /**
250      * @brief Checks whether the calling process for inter-process communication has the given permission.
251      * The calling process is not the current process.
252      *
253      * @param permission Indicates the permission to check. This parameter cannot be null.
254      *
255      * @return Returns 0 (IBundleManager.PERMISSION_GRANTED) if the calling process has the permission;
256      * returns -1 (IBundleManager.PERMISSION_DENIED) otherwise.
257      */
258     int VerifyCallingPermission(const std::string &permission) override;
259 
260     /**
261      * @brief Checks whether the current process has the given permission.
262      * You need to call requestPermissionsFromUser(java.lang.std::string[],int) to request a permission only
263      * if the current process does not have the specific permission.
264      *
265      * @param permission Indicates the permission to check. This parameter cannot be null.
266      *
267      * @return Returns 0 (IBundleManager.PERMISSION_GRANTED) if the current process has the permission;
268      * returns -1 (IBundleManager.PERMISSION_DENIED) otherwise.
269      */
270     int VerifySelfPermission(const std::string &permission) override;
271 
272     /**
273      * @brief Obtains the bundle name of the current ability.
274      *
275      * @return Returns the bundle name of the current ability.
276      */
277     std::string GetBundleName() override;
278 
279     /**
280      * @brief Obtains the path of the OHOS Ability Package (HAP} containing this ability.
281      *
282      * @return Returns the path of the HAP containing this ability.
283      */
284     std::string GetBundleResourcePath() override;
285 
286     /**
287      * @brief Starts a new ability.
288      * An ability using the AbilityInfo.AbilityType.SERVICE or AbilityInfo.AbilityType.PAGE template uses this method
289      * to start a specific ability. The system locates the target ability from installed abilities based on the value
290      * of the want parameter and then starts it. You can specify the ability to start using the want parameter.
291      *
292      * @param want Indicates the Want containing information about the target ability to start.
293      *
294      * @param requestCode Indicates the request code returned after the ability using the AbilityInfo.AbilityType.PAGE
295      * template is started. You can define the request code to identify the results returned by abilities. The value
296      * ranges from 0 to 65535. This parameter takes effect only on abilities using the AbilityInfo.AbilityType.PAGE
297      * template.
298      *
299      */
300     void StartAbility(const AAFwk::Want &want, int requestCode) override;
301 
302     /**
303      * @brief Remove permissions for all users who have access to specific permissions
304      *
305      * @param permission Indicates the permission to unauth. This parameter cannot be null.
306      * @param uri Indicates the URI to unauth. This parameter cannot be null.
307      * @param uid Indicates the UID of the unauth to check.
308      *
309      */
310     void UnauthUriPermission(const std::string &permission, const Uri &uri, int uid) override;
311 
312     /**
313      * @brief Obtains an ability manager.
314      * The ability manager provides information about running processes and memory usage of an application.
315      *
316      * @return Returns an IAbilityManager instance.
317      */
318     sptr<AAFwk::IAbilityManager> GetAbilityManager() override;
319 
320     /**
321      * @brief Obtains the type of this application.
322      *
323      * @return Returns system if this application is a system application;
324      * returns normal if it is released in OHOS AppGallery;
325      * returns other if it is released by a third-party vendor;
326      * returns an empty string if the query fails.
327      */
328     std::string GetAppType() override;
329 
330     /**
331      * @brief Destroys another ability you had previously started by calling Ability.startAbilityForResult
332      * (ohos.aafwk.content.Want, int, ohos.aafwk.ability.startsetting.AbilityStartSetting) with the same requestCode
333      * passed.
334      *
335      * @param requestCode Indicates the request code passed for starting the ability.
336      *
337      */
338     void TerminateAbility(int requestCode) override;
339 
340     /**
341      * @brief Confirms with the permission management module to check whether a request prompt is required for granting
342      * a certain permission. You need to call the current method to check whether a prompt is required before calling
343      * requestPermissionsFromUser(java.lang.String[],int) to request a permission. If a prompt is not required,
344      * permission request will not be initiated.
345      *
346      * @param requestCode Indicates the permission to be queried. This parameter cannot be null.
347      *
348      * @return Returns true if the current application does not have the permission and the user does not turn off
349      * further requests; returns false if the current application already has the permission, the permission is rejected
350      * by the system, or the permission is denied by the user and the user has turned off further requests.
351      */
352     bool CanRequestPermission(const std::string &permission) override;
353 
354     /**
355      * @brief When there is a remote call to check whether the remote has permission, otherwise check whether it has
356      * permission
357      *
358      * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null.
359      * @return Returns 0 (IBundleManager.PERMISSION_GRANTED) if the current process has the permission;
360      * returns -1 (IBundleManager.PERMISSION_DENIED) otherwise.
361      */
362     virtual int VerifyCallingOrSelfPermission(const std::string &permission) override;
363 
364     /**
365      * @brief Query whether the application of the specified PID and UID has been granted a certain permission
366      *
367      * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null.
368      * @param pid Process id
369      * @param uid
370      * @return Returns 0 (IBundleManager.PERMISSION_GRANTED) if the current process has the permission;
371      * returns -1 (IBundleManager.PERMISSION_DENIED) otherwise.
372      */
373     virtual int VerifyPermission(const std::string &permission, int pid, int uid) override;
374 
375     /**
376      * @brief Obtains the distributed file path.
377      * If the distributed file path does not exist, the system creates one and returns the created path. This method is
378      * applicable only to the context of an ability rather than that of an application.
379      *
380      * @return Returns the distributed file.
381      */
382     std::string GetDistributedDir() override;
383 
384     /**
385      * @brief Sets the pattern of this Context based on the specified pattern ID.
386      *
387      * @param patternId Indicates the resource ID of the pattern to set.
388      */
389     void SetPattern(int patternId) override;
390 
391     /**
392      * @brief Obtains the Context object of this ability.
393      *
394      * @return Returns the Context object of this ability.
395      */
396     std::shared_ptr<Context> GetAbilityPackageContext() override;
397 
398     /**
399      * @brief Obtains the HapModuleInfo object of the application.
400      *
401      * @return Returns the HapModuleInfo object of the application.
402      */
403     std::shared_ptr<HapModuleInfo> GetHapModuleInfo() override;
404 
405     /**
406      * @brief Obtains the name of the current process.
407      *
408      * @return Returns the current process name.
409      */
410     std::string GetProcessName() override;
411 
412     /**
413      * @brief Obtains the bundle name of the ability that called the current ability.
414      * You can use the obtained bundle name to check whether the calling ability is allowed to receive the data you will
415      * send. If you did not use Ability.startAbilityForResult(ohos.aafwk.content.Want, int,
416      * ohos.aafwk.ability.startsetting.AbilityStartSetting) to start the calling ability, null is returned.
417      *
418      * @return Returns the bundle name of the calling ability; returns null if no calling ability is available.
419      */
420     std::string GetCallingBundle() override;
421 
422     /**
423      * @brief Requests certain permissions from the system.
424      * This method is called for permission request. This is an asynchronous method. When it is executed,
425      * the Ability.onRequestPermissionsFromUserResult(int, String[], int[]) method will be called back.
426      *
427      * @param permissions Indicates the list of permissions to be requested. This parameter cannot be null.
428      * @param requestCode Indicates the request code to be passed to the Ability.onRequestPermissionsFromUserResult(int,
429      * String[], int[]) callback method. This code cannot be a negative number.
430      *
431      */
432     void RequestPermissionsFromUser(std::vector<std::string> &permissions, int requestCode) override;
433 
434     /**
435      * @brief Starts a new ability with special ability start setting.
436      *
437      * @param want Indicates the Want containing information about the target ability to start.
438      * @param requestCode Indicates the request code returned after the ability is started. You can define the request
439      * code to identify the results returned by abilities. The value ranges from 0 to 65535.
440      * @param abilityStartSetting Indicates the special start setting used in starting ability.
441      *
442      */
443     void StartAbility(const Want &want, int requestCode, const AbilityStartSetting &abilityStartSetting) override;
444 
445     /**
446      * @brief Destroys the current ability.
447      *
448      */
449     void TerminateAbility() override;
450 
451     /**
452      * @brief Connects the current ability to an ability using the AbilityInfo.AbilityType.SERVICE template.
453      *
454      * @param want Indicates the want containing information about the ability to connect
455      *
456      * @param conn Indicates the callback object when the target ability is connected.
457      *
458      * @return True means success and false means failure
459      */
460     bool ConnectAbility(const Want &want, const sptr<AAFwk::IAbilityConnection> &conn) override;
461 
462     /**
463      * @brief Disconnects the current ability from an ability
464      *
465      * @param conn Indicates the IAbilityConnection callback object passed by connectAbility after the connection
466      *              is set up. The IAbilityConnection object uniquely identifies a connection between two abilities.
467      */
468     void DisconnectAbility(const sptr<AAFwk::IAbilityConnection> &conn) override;
469 
470     /**
471      * @brief init the ResourceManager for ContextDeal.
472      *
473      * @param the ResourceManager has been inited.
474      *
475      */
476     void initResourceManager(const std::shared_ptr<Global::Resource::ResourceManager> &resourceManager);
477 
478     /**
479      * @brief Obtains information about the caller of this ability.
480      *
481      * @return Returns the caller information.
482      */
483     Uri GetCaller() override;
484 
485     /**
486      * @brief SerUriString
487      */
488     void SerUriString(const std::string &uri);
489 
490     /**
491      * @brief Get the string of this Context based on the specified resource ID.
492      *
493      * @param resId Indicates the resource ID of the string to get.
494      *
495      * @return Returns the string of this Context.
496      */
497     std::string GetString(int resId) override;
498 
499     /**
500      * @brief Get the string array of this Context based on the specified resource ID.
501      *
502      * @param resId Indicates the resource ID of the string array to get.
503      *
504      * @return Returns the string array of this Context.
505      */
506     std::vector<std::string> GetStringArray(int resId) override;
507 
508     /**
509      * @brief Get the integer array of this Context based on the specified resource ID.
510      *
511      * @param resId Indicates the resource ID of the integer array to get.
512      *
513      * @return Returns the integer array of this Context.
514      */
515     std::vector<int> GetIntArray(int resId) override;
516 
517     /**
518      * @brief Obtains the theme of this Context.
519      *
520      * @return theme Returns the theme of this Context.
521      */
522     std::map<std::string, std::string> GetTheme() override;
523 
524     /**
525      * @brief Sets the theme of this Context based on the specified theme ID.
526      *
527      * @param themeId Indicates the resource ID of the theme to set.
528      */
529     void SetTheme(int themeId) override;
530 
531     /**
532      * @brief Obtains the pattern of this Context.
533      *
534      * @return getPattern in interface Context
535      */
536     std::map<std::string, std::string> GetPattern() override;
537 
538     /**
539      * @brief Get the color of this Context based on the specified resource ID.
540      *
541      * @param resId Indicates the resource ID of the color to get.
542      *
543      * @return Returns the color value of this Context.
544      */
545     int GetColor(int resId) override;
546 
547     /**
548      * @brief Obtains the theme id of this Context.
549      *
550      * @return int Returns the theme id of this Context.
551      */
552     int GetThemeId() override;
553 
554     /**
555      * @brief
556      * Destroys this Service ability if the number of times it has been started equals the number represented by the
557      * given {@code startId}. This method is the same as calling {@link #terminateAbility} to destroy this Service
558      * ability, except that this method helps you avoid destroying it if a client has requested a Service
559      * ability startup in {@link ohos.aafwk.ability.Ability#onCommand} but you are unaware of it.
560      *
561      * @param startId Indicates the number of startup times of this Service ability passed to
562      *                {@link ohos.aafwk.ability.Ability#onCommand}. The {@code startId} is
563      *                incremented by 1 every time this ability is started. For example,
564      *                if this ability has been started for six times, the value of {@code startId} is {@code 6}.
565      *
566      * @return Returns {@code true} if the {@code startId} matches the number of startup times
567      *         and this Service ability will be destroyed; returns {@code false} otherwise.
568      */
569     bool TerminateAbilityResult(int startId) override;
570 
571     /**
572      * @brief Obtains the current display orientation of this ability.
573      *
574      * @return Returns the current display orientation.
575      */
576     int GetDisplayOrientation() override;
577 
578     /**
579      * @brief Obtains the path storing the preference file of the application.
580      *        If the preference file path does not exist, the system creates one and returns the created path.
581      *
582      * @return Returns the preference file path .
583      */
584     std::string GetPreferencesDir() override;
585 
586     /**
587      * @brief Set color mode
588      *
589      * @param the value of color mode.
590      */
591     void SetColorMode(int mode) override;
592 
593     /**
594      * @brief Obtains color mode.
595      *
596      * @return Returns the color mode value.
597      */
598     int GetColorMode() override;
599 
600     /**
601      * @brief Set the LifeCycleStateInfo to the deal.
602      *
603      * @param info the info to set.
604      */
605     void SetLifeCycleStateInfo(const AAFwk::LifeCycleStateInfo &info);
606 
607     /**
608      * @brief Obtains the unique ID of the mission containing this ability.
609      *
610      * @return Returns the unique mission ID.
611      */
612     int GetMissionId() override;
613 
614     /**
615      * @brief Call this when your ability should be closed and the mission should be completely removed as a part of
616      * finishing the root ability of the mission.
617      */
618     void TerminateAndRemoveMission() override;
619 
620     /**
621      * @brief Starts multiple abilities.
622      *
623      * @param wants Indicates the Want containing information array about the target ability to start.
624      */
625     void StartAbilities(const std::vector<AAFwk::Want> &wants) override;
626 
627     /**
628      * @brief Checks whether this ability is the first ability in a mission.
629      *
630      * @return Returns true is first in Mission.
631      */
632     bool IsFirstInMission() override;
633 
634     /**
635      * @brief Obtains a task dispatcher that is bound to the UI thread.
636      *
637      * @return Returns the task dispatcher that is bound to the UI thread.
638      */
639     std::shared_ptr<TaskDispatcher> GetUITaskDispatcher() final override;
640 
641     /**
642      * @brief Obtains a task dispatcher that is bound to the application main thread.
643      *
644      * @return Returns the task dispatcher that is bound to the application main thread.
645      */
646     std::shared_ptr<TaskDispatcher> GetMainTaskDispatcher() override;
647 
648     /**
649      * @brief Creates a parallel task dispatcher with a specified priority.
650      *
651      * @param name Indicates the task dispatcher name. This parameter is used to locate problems.
652      * @param priority Indicates the priority of all tasks dispatched by the parallel task dispatcher.
653      *
654      * @return Returns a parallel task dispatcher.
655      */
656     std::shared_ptr<TaskDispatcher> CreateParallelTaskDispatcher(
657         const std::string &name, const TaskPriority &priority) override;
658 
659     /**
660      * @brief Creates a serial task dispatcher with a specified priority.
661      *
662      * @param name Indicates the task dispatcher name. This parameter is used to locate problems.
663      * @param priority Indicates the priority of all tasks dispatched by the created task dispatcher.
664      *
665      * @return Returns a serial task dispatcher.
666      */
667     std::shared_ptr<TaskDispatcher> CreateSerialTaskDispatcher(
668         const std::string &name, const TaskPriority &priority) override;
669 
670     /**
671      * @brief Obtains a global task dispatcher with a specified priority.
672      *
673      * @param priority Indicates the priority of all tasks dispatched by the global task dispatcher.
674      *
675      * @return Returns a global task dispatcher.
676      */
677     std::shared_ptr<TaskDispatcher> GetGlobalTaskDispatcher(const TaskPriority &priority) override;
678     /**
679      * @brief Requires that tasks associated with a given capability token be moved to the background
680      *
681      * @param nonFirst If nonfirst is false and not the lowest ability of the mission, you cannot move mission to end
682      *
683      * @return Returns true on success, others on failure.
684      */
685     bool MoveMissionToEnd(bool nonFirst) override;
686 
687     /**
688      * @brief Sets the application to start its ability in lock mission mode.
689      */
690     void LockMission() override;
691 
692     /**
693      * @brief Unlocks this ability by exiting the lock mission mode.
694      */
695     void UnlockMission() override;
696 
697     /**
698      * @brief Sets description information about the mission containing this ability.
699      *
700      * @param MissionInformation Indicates the object containing information about the
701      *                               mission. This parameter cannot be null.
702      * @return Returns true on success, others on failure.
703      */
704     bool SetMissionInformation(const MissionInformation &missionInformation) override;
705 
706     /**
707      * @brief Set EventRunner for main thread.
708      *
709      * @param runner The EventRunner.
710      */
711     void SetRunner(const std::shared_ptr<EventRunner> &runner);
712 
713 public:
714     static const std::string CONTEXT_DEAL_FILE_SEPARATOR;
715     static const std::string CONTEXT_DEAL_CODE_CACHE;
716     static const std::string CONTEXT_DEAL_Files;
717     static const std::string CONTEXT_DEAL_NO_BACKUP_Files;
718     static const std::string CONTEXT_DEAL_DIRNAME;
719 
720 protected:
721     sptr<IRemoteObject> GetToken() override;
722     bool HapModuleInfoRequestInit();
723 
724 private:
725     std::shared_ptr<ProcessInfo> processInfo_ = nullptr;
726     std::shared_ptr<ApplicationInfo> applicationInfo_ = nullptr;
727     std::shared_ptr<AbilityInfo> abilityInfo_ = nullptr;
728     std::shared_ptr<Profile> profile_ = nullptr;
729     std::shared_ptr<Context> appContext_ = nullptr;
730     std::shared_ptr<Context> abilityContext_ = nullptr;
731     std::shared_ptr<Global::Resource::ResourceManager> resourceManager_ = nullptr;
732     std::string path_ = "";
733     std::string uriString_ = "";
734     std::string preferenceDir_ = "";
735     std::map<std::string, std::string> pattern_;
736     std::map<std::string, std::string> theme_;
737     AAFwk::LifeCycleStateInfo lifeCycleStateInfo_;
738     std::shared_ptr<TaskDispatcher> mainTaskDispatcher_;
739     std::shared_ptr<EventRunner> mainEventRunner_;
740     std::shared_ptr<HapModuleInfo> hapModuleInfoLocal_ = nullptr;
741 };
742 
743 }  // namespace AppExecFwk
744 }  // namespace OHOS
745 #endif  // FOUNDATION_APPEXECFWK_OHOS_CONTEXT_DEAL_H
746