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