1 /*
2  * Copyright (c) 2023 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_FA_ABILITY_THREAD_H
17 #define OHOS_ABILITY_RUNTIME_FA_ABILITY_THREAD_H
18 
19 #include "ability.h"
20 #include "ability_manager_client.h"
21 #include "ability_manager_interface.h"
22 #include "ability_thread.h"
23 #include "context.h"
24 #include "extension_impl.h"
25 #include "ipc_singleton.h"
26 #include "ohos_application.h"
27 #include "pac_map.h"
28 #include "want.h"
29 
30 namespace OHOS {
31 namespace AppExecFwk {
32 class AbilityImpl;
33 class AbilityHandler;
34 class AbilityLocalRecord;
35 } // namespace AppExecFwk
36 namespace AbilityRuntime {
37 using LifeCycleStateInfo = OHOS::AAFwk::LifeCycleStateInfo;
38 class FAAbilityThread : public AppExecFwk::AbilityThread {
39 public:
40     /**
41      * @brief Default constructor used to create a FAAbilityThread instance.
42      */
43     FAAbilityThread();
44     ~FAAbilityThread() override;
45 
46     /**
47      * @brief Attach The ability thread to the main process.
48      * @param application Indicates the main process.
49      * @param abilityRecord current running ability record
50      * @param mainRunner The runner which main_thread holds.
51      * @param appContext the AbilityRuntime context
52      */
53     void Attach(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
54         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
55         const std::shared_ptr<AppExecFwk::EventRunner> &mainRunner,
56         const std::shared_ptr<Context> &appContext) override;
57 
58     /**
59      * @brief Attach The ability thread to the main process.
60      * @param application Indicates the main process.
61      * @param abilityRecord current running ability record
62      * @param appContext the AbilityRuntime context
63      */
64     void Attach(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
65         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
66         const std::shared_ptr<Context> &appContext) override;
67 
68     /**
69      * @brief Provide operating system AbilityTransaction information to the observer
70      * @param want Indicates the structure containing Transaction information about the ability.
71      * @param targetState Indicates the lifecycle state.
72      * @param sessionInfo Indicates the session info.
73      */
74     bool ScheduleAbilityTransaction(const Want &want, const LifeCycleStateInfo &targetState,
75         sptr<AAFwk::SessionInfo> sessionInfo = nullptr) override;
76 
77     /**
78      * @brief Provide operating system ShareData information to the observer
79      * @param requestCode Indicates the Ability request code.
80      */
81     void ScheduleShareData(const int32_t &requestCode) override;
82 
83     /**
84      * @brief Provide operating system ConnectAbility information to the observer
85      * @param want Indicates the structure containing connect information about the ability.
86      */
87     void ScheduleConnectAbility(const Want &want) override;
88 
89     /**
90      * @brief Provide operating system DisconnectAbility information to the observer
91      * @param want Indicates the structure containing connect information about the ability.
92      */
93     void ScheduleDisconnectAbility(const Want &want) override;
94 
95     /**
96      * @brief Provide operating system CommandAbility information to the observer
97      * @param want The Want object to command to.
98      * @param restart Indicates the startup mode. The value true indicates that Service is restarted after being
99      * destroyed, and the value false indicates a normal startup.
100      * @param startId Indicates the number of times the Service ability has been started. The startId is incremented by
101      * 1 every time the ability is started. For example, if the ability has been started for six times, the value of
102      * startId is 6.
103      */
104     void ScheduleCommandAbility(const Want &want, bool restart, int startId) override;
105 
106     /**
107      * @brief Schedule Command AbilityWindow
108      * @param want The Want object to command to.
109      * @param sessionInfo Indicates the session info.
110      * @param winCmd Indicates the WindowCommand of winCmd
111      */
112     void ScheduleCommandAbilityWindow(
113         const Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo, AAFwk::WindowCommand winCmd) override;
114 
115     /**
116      * @brief Provide operating system PrepareTerminateAbility information to the observer
117      */
118     bool SchedulePrepareTerminateAbility() override;
119 
120     /**
121      * @brief Provide operating system SaveabilityState information to the observer
122      */
123     void ScheduleSaveAbilityState() override;
124 
125     /**
126      * @brief Provide operating system RestoreAbilityState information to the observer
127      * @param state Indicates resotre ability state used to dispatchRestoreAbilityState.
128      */
129     void ScheduleRestoreAbilityState(const AppExecFwk::PacMap &state) override;
130 
131     /**
132      * @brief ScheduleUpdateConfiguration, scheduling update configuration.
133      * @param config Indicates the updated configuration information
134      */
135     void ScheduleUpdateConfiguration(const AppExecFwk::Configuration &config) override;
136 
137     /**
138      * @brief Send the result code and data to be returned by this Page ability to the caller.
139      * When a Page ability is destroyed, the caller overrides the AbilitySlice#onAbilityResult(int32_t, int32_t, Want)
140      * method to receive the result set in the current method. This method can be called only after the ability has
141      * been initialized.
142      * @param requestCode Indicates the request code for send.
143      * @param resultCode Indicates the result code returned after the ability is destroyed. You can define the result
144      * code to identify an error.
145      * @param want Indicates the data returned after the ability is destroyed. You can define the data returned. This
146      * parameter can be null.
147      */
148     void SendResult(int requestCode, int resultCode, const Want &resultData) override;
149 
150     /**
151      * @brief Obtains the MIME types of files supported.
152      * @param uri Indicates the path of the files to obtain.
153      * @param mimeTypeFilter Indicates the MIME types of the files to obtain. This parameter cannot be null.
154      * @return Returns the matched MIME types. If there is no match, null is returned.
155      */
156     std::vector<std::string> GetFileTypes(const Uri &uri, const std::string &mimeTypeFilter) override;
157 
158     /**
159      * @brief Opens a file in a specified remote path.
160      * @param uri Indicates the path of the file to open.
161      * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access
162      * (erasing whatever data is currently in the file), "wt" for write access that truncates any existing file,
163      * "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing data,
164      * or "rwt" for read and write access that truncates any existing file.
165      * @return Returns the file descriptor.
166      */
167     int OpenFile(const Uri &uri, const std::string &mode) override;
168 
169     /**
170      * @brief This is like openFile, open a file that need to be able to return sub-sections of files often assets
171      * inside of their .hap.
172      * @param uri Indicates the path of the file to open.
173      * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access
174      * (erasing whatever data is currently in the file), "wt" for write access that truncates any existing file,
175      * "wa" for write-only access to append to any existing data, "rw" for read and write access on any existing
176      * data, or "rwt" for read and write access that truncates any existing file.
177      * @return Returns the RawFileDescriptor object containing file descriptor.
178      */
179     int OpenRawFile(const Uri &uri, const std::string &mode) override;
180 
181     /**
182      * @brief Inserts a single data record into the database.
183      * @param uri Indicates the path of the data to operate.
184      * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted.
185      * @return Returns the index of the inserted data record.
186      */
187     int Insert(const Uri &uri, const NativeRdb::ValuesBucket &value) override;
188 
189     /**
190      * @brief Calls the method of the Data ability.
191      * @param method Indicates the method to call
192      * @param arg Indicates the parameter of the String type.
193      * @param pacMap Defines a PacMap object for storing a series of values.
194      * @return Returns the call result.
195      */
196     std::shared_ptr<AppExecFwk::PacMap> Call(
197         const Uri &uri, const std::string &method, const std::string &arg, const AppExecFwk::PacMap &pacMap) override;
198 
199     /**
200      * @brief Updates data records in the database.
201      * @param uri Indicates the path of data to update.
202      * @param value Indicates the data to update. This parameter can be null.
203      * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
204      * @return Returns the number of data records updated.
205      */
206     int Update(const Uri &uri, const NativeRdb::ValuesBucket &value,
207         const NativeRdb::DataAbilityPredicates &predicates) override;
208 
209     /**
210      * @brief Deletes one or more data records from the database.
211      * @param uri Indicates the path of the data to operate.
212      * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
213      * @return Returns the number of data records deleted.
214      */
215     int Delete(const Uri &uri, const NativeRdb::DataAbilityPredicates &predicates) override;
216 
217     /**
218      * @brief Deletes one or more data records from the database.
219      * @param uri Indicates the path of data to query.
220      * @param columns Indicates the columns to query. If this parameter is null, all columns are queried.
221      * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null.
222      * @return Returns the query result.
223      */
224     std::shared_ptr<NativeRdb::AbsSharedResultSet> Query(
225         const Uri &uri, std::vector<std::string> &columns, const NativeRdb::DataAbilityPredicates &predicates) override;
226 
227     /**
228      * @brief Obtains the MIME type matching the data specified by the URI of the Data ability. This method should be
229      * implemented by a Data ability. Data abilities supports general data types, including text, HTML, and JPEG.
230      * @param uri Indicates the URI of the data.
231      * @return Returns the MIME type that matches the data specified by uri.
232      */
233     std::string GetType(const Uri &uri) override;
234 
235     /**
236      * @brief Reloads data in the database.
237      * @param uri Indicates the position where the data is to reload. This parameter is mandatory.
238      * @param extras Indicates the PacMap object containing the additional parameters to be passed in this call. This
239      * parameter can be null. If a custom Sequenceable object is put in the PacMap object and will be transferred across
240      * processes, you must call BasePacMap.setClassLoader(ClassLoader) to set a class loader for the custom object.
241      * @return Returns true if the data is successfully reloaded; returns false otherwise.
242      */
243     bool Reload(const Uri &uri, const AppExecFwk::PacMap &extras) override;
244 
245     /**
246      * @brief Inserts multiple data records into the database.
247      * @param uri Indicates the path of the data to operate.
248      * @param values Indicates the data records to insert.
249      * @return Returns the number of data records inserted.
250      */
251     int BatchInsert(const Uri &uri, const std::vector<NativeRdb::ValuesBucket> &values) override;
252 
253     /**
254      * @brief continue ability to target device.
255      * @param deviceId target deviceId
256      * @param versionCode Target bundle version.
257      */
258     void ContinueAbility(const std::string &deviceId, uint32_t versionCode) override;
259 
260     /**
261      * @brief notify this ability continuation result.
262      * @param result: Continuation result
263      */
264     void NotifyContinuationResult(int32_t result) override;
265 
266     /**
267      * @brief notify this ability current memory level.
268      * @param level Current memory level
269      */
270     void NotifyMemoryLevel(int32_t level) override;
271 
272     /**
273      * @brief Converts the given uri that refer to the Data ability into a normalized URI. A normalized URI can be used
274      * across devices, persisted, backed up, and restored. It can refer to the same item in the Data ability even if the
275      * context has changed. If you implement URI normalization for a Data ability, you must also implement
276      * denormalizeUri(ohos.utils.net.Uri) to enable URI denormalization. After this feature is enabled, URIs passed to
277      * any method that is called on the Data ability must require normalization verification and denormalization. The
278      * default implementation of this method returns null, indicating that this Data ability does not support URI
279      * normalization.
280      * @param uri Indicates the Uri object to normalize.
281      * @return Returns the normalized Uri object if the Data ability supports URI normalization; returns null otherwise.
282      */
283     Uri NormalizeUri(const Uri &uri) override;
284 
285     /**
286      * @brief Converts the given normalized uri generated by normalizeUri(ohos.utils.net.Uri) into a denormalized one.
287      * The default implementation of this method returns the original URI passed to it.
288      * @param uri uri Indicates the Uri object to denormalize.
289      * @return Returns the denormalized Uri object if the denormalization is successful; returns the original Uri passed
290      * to this method if there is nothing to do; returns null if the data identified by the original Uri cannot be found
291      * in the current environment.
292      */
293     Uri DenormalizeUri(const Uri &uri) override;
294 
295     /**
296      * @brief Registers an observer to DataObsMgr specified by the given Uri.
297      * @param uri Indicates the path of the data to operate.
298      * @param dataObserver Indicates the IDataAbilityObserver object.
299      */
300     bool ScheduleRegisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver) override;
301 
302     /**
303      * @brief Deregisters an observer used for DataObsMgr specified by the given Uri.
304      * @param uri Indicates the path of the data to operate.
305      * @param dataObserver Indicates the IDataAbilityObserver object.
306      */
307     bool ScheduleUnregisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver) override;
308 
309     /**
310      * @brief Notifies the registered observers of a change to the data resource specified by Uri.
311      * @param uri Indicates the path of the data to operate.
312      */
313     bool ScheduleNotifyChange(const Uri &uri) override;
314 
315     /**
316      * @brief Dump ability runner info.
317      * @param params the params need to be Dumped
318      * @param info ability runner info.
319      */
320     void DumpAbilityInfo(const std::vector<std::string> &params, std::vector<std::string> &info) override;
321 
322     /**
323      * @brief Call Request
324      */
325     void CallRequest() override;
326 
327     /**
328      * @brief Performs batch operations on the database
329      * @param operations Indicates a list of database operations on the database.
330      * @return Returns the result of each operation, in array.
331      */
332     std::vector<std::shared_ptr<AppExecFwk::DataAbilityResult>> ExecuteBatch(
333         const std::vector<std::shared_ptr<AppExecFwk::DataAbilityOperation>> &operations) override;
334 
335     /**
336      * @brief create modal UIExtension.
337      * @param want Create modal UIExtension with want object.
338      */
339     int CreateModalUIExtension(const Want &want) override;
340 
341     /**
342      * @brief Update sessionToken.
343      * @param sessionToken The token of session.
344      */
345     void UpdateSessionToken(sptr<IRemoteObject> sessionToken) override;
346 
347 private:
348     /**
349      * @brief Dump Ability Runner info.
350      * @param params the params need to be Dumped
351      * @param info ability runner info
352      */
353     void DumpAbilityInfoInner(const std::vector<std::string> &params, std::vector<std::string> &info);
354 
355     /**
356      * @brief Dump other Ability Runner info.
357      * @param info ability runner info
358      */
359     void DumpOtherInfo(std::vector<std::string> &info);
360 
361     /**
362      * @brief Attach The ability thread to the main process.
363      * @param application Indicates the main process.
364      * @param abilityRecord current running ability record
365      * @param mainRunner The runner which main_thread holds.
366      */
367     void AttachExtension(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
368         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
369         const std::shared_ptr<AppExecFwk::EventRunner> &mainRunner);
370 
371     /**
372      * @brief Init extension Ability flag.
373      * @param abilityRecord current running ability record
374      */
375     void InitExtensionFlag(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord);
376 
377     /**
378      * @brief Attach The ability thread to the main process.
379      * @param application Indicates the main process.
380      * @param abilityRecord current running ability record
381      */
382     void AttachExtension(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
383         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord);
384 
385     /**
386      * @brief To continue attaching The ability thread to the main process.
387      * @param application Indicates the main process.
388      * @param abilityRecord current running ability record
389      * @param stageContext the AbilityRuntime context
390      */
391     void AttachInner(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
392         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
393         const std::shared_ptr<Context> &stageContext);
394 
395     /**
396      * @brief Create the abilityname.
397      * @param abilityRecord current running ability record
398      * @param application Indicates the application.
399      * @return Returns the abilityname.
400      */
401     std::string CreateAbilityName(const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
402         const std::shared_ptr<AppExecFwk::OHOSApplication> &application);
403 
404     /**
405      * @brief Create the extension abilityname.
406      * @param application Indicates the application.
407      * @param abilityInfo Indicates the abilityInfo.
408      * @param abilityName Indicates the parameter about abilityName.
409      */
410     void CreateExtensionAbilityName(const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
411         const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo, std::string &abilityName);
412 
413     /**
414      * @brief Create the extension abilityname which support graphics.
415      * @param abilityInfo Indicates the abilityInfo.
416      * @param abilityName Indicates the parameter about abilityName.
417      */
418     void CreateExtensionAbilityNameSupportGraphics(const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo,
419         std::string &abilityName);
420 
421     /**
422      * @brief Create and init contextDeal.
423      * @param application Indicates the main process.
424      * @param abilityRecord current running ability record
425      * @param abilityObject Indicates the abilityObject.
426      * @return Returns the contextDeal.
427      */
428     std::shared_ptr<AppExecFwk::ContextDeal> CreateAndInitContextDeal(
429         const std::shared_ptr<AppExecFwk::OHOSApplication> &application,
430         const std::shared_ptr<AppExecFwk::AbilityLocalRecord> &abilityRecord,
431         const std::shared_ptr<AppExecFwk::AbilityContext> &abilityObject);
432 
433     /**
434      * @brief Handle the life cycle of Ability.
435      * @param want Indicates the structure containing lifecycle information about the ability.
436      * @param lifeCycleStateInfo Indicates the lifeCycleStateInfo.
437      * @param sessionInfo Indicates the sessionInfo.
438      */
439     void HandleAbilityTransaction(const Want &want, const LifeCycleStateInfo &lifeCycleStateInfo,
440         sptr<AAFwk::SessionInfo> sessionInfo = nullptr);
441 
442     /**
443      * @brief Handle the life cycle of Extension.
444      * @param want Indicates the structure containing lifecycle information about the extension.
445      * @param lifeCycleStateInfo Indicates the lifeCycleStateInfo.
446      * @param sessionInfo Indicates the sessionInfo.
447      */
448     void HandleExtensionTransaction(const Want &want, const LifeCycleStateInfo &lifeCycleStateInfo,
449         sptr<AAFwk::SessionInfo> sessionInfo = nullptr);
450 
451     /**
452      * @brief Handle the current connection of Ability.
453      * @param want Indicates the structure containing connection information about the ability.
454      */
455     void HandleConnectAbility(const Want &want);
456 
457     /**
458      * @brief Handle the current disconnection of Ability.
459      * @param want Indicates the structure containing connection information about the ability.
460      */
461     void HandleDisconnectAbility(const Want &want);
462 
463     /**
464      * @brief Handle the current command of Ability.
465      * @param want The Want object to command to.
466      * @param restart Indicates the startup mode. The value true indicates that Service is restarted after being
467      * destroyed, and the value false indicates a normal startup.
468      * @param startId Indicates the number of times the Service ability has been started. The startId is incremented by
469      * 1 every time the ability is started. For example, if the ability has been started for six times, the value of
470      * startId is 6.
471      */
472     void HandleCommandAbility(const Want &want, bool restart, int32_t startId);
473 
474     /**
475      * @brief Handle the current connection of Extension.
476      * @param want Indicates the structure containing connection information about the extension.
477      */
478     void HandleConnectExtension(const Want &want);
479 
480     /**
481      * @brief Handle the current disconnection of Extension.
482      * @param want Indicates the structure containing connection information about the extension.
483      */
484     void HandleDisconnectExtension(const Want &want);
485 
486     /**
487      * @brief Handle the current command of Extension.
488      * @param want The Want object to command to.
489      * @param restart Indicates the startup mode. The value true indicates that Service is restarted after being
490      * destroyed, and the value false indicates a normal startup.
491      * @param startId Indicates the number of times the Service extension has been started. The startId is incremented
492      * by 1 every time the extension is started. For example, if the extension has been started for six times, the
493      * value of startId is 6.
494      */
495     void HandleCommandExtension(const Want &want, bool restart, int32_t startId);
496 
497     /**
498      * @brief Handle Command Extension Window
499      * @param want The Want object to command to.
500      * @param sessionInfo Indicates the sessionInfo
501      * @param winCmd Indicates the winCmd
502      */
503     void HandleCommandExtensionWindow(
504         const Want &want, const sptr<AAFwk::SessionInfo> &sessionInfo, AAFwk::WindowCommand winCmd);
505 
506     /**
507      * @brief Handle the restoreAbility state.
508      * @param state Indicates save ability state used to dispatchRestoreAbilityState.
509      */
510     void HandleRestoreAbilityState(const AppExecFwk::PacMap &state);
511 
512     /**
513      * @brief Handle the scheduling update configuration
514      * @param config Indicates the updated configuration information
515      */
516     void HandleUpdateConfiguration(const AppExecFwk::Configuration &config);
517 
518     /**
519      * @brief Handle the scheduling update configuration of extension.
520      * @param config Indicates the updated configuration information
521      */
522     void HandleExtensionUpdateConfiguration(const AppExecFwk::Configuration &config);
523 
524     /**
525      * @brief Handle the scheduling prepare terminate ability.
526      */
527     void HandlePrepareTermianteAbility();
528 
529     /**
530      * @brief Provide operating system ShareData information to the observer
531      * @param requestCode Indicates the Ability request code.
532      */
533     void HandleShareData(const int32_t &requestCode);
534 
535     /**
536      * @brief Registers an observer to DataObsMgr specified by the given Uri.
537      * @param uri Indicates the path of the data to operate.
538      * @param dataObserver Indicates the IDataAbilityObserver object.
539      * @return The operation succeeded or failed. Procedure
540      */
541     bool HandleRegisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver);
542 
543     /**
544      * @brief Deregisters an observer used for DataObsMgr specified by the given Uri.
545      * @param uri Indicates the path of the data to operate.
546      * @param dataObserver Indicates the IDataAbilityObserver object.
547      */
548     bool HandleUnregisterObserver(const Uri &uri, const sptr<AAFwk::IDataAbilityObserver> &dataObserver);
549 
550     /**
551      * @brief Notifies the registered observers of a change to the data resource specified by Uri.
552      * @param uri Indicates the path of the data to operate.
553      */
554     bool HandleNotifyChange(const Uri &uri);
555 
556     /**
557      * @brief Build Ability Context
558      * @param abilityInfo Indicate the Ability information.
559      * @param application Indicates the main process.
560      * @param token the remote token
561      * @param stageContext Indicates the stage of Context
562      */
563     std::shared_ptr<AbilityContext> BuildAbilityContext(const std::shared_ptr<AppExecFwk::AbilityInfo> &abilityInfo,
564         const std::shared_ptr<AppExecFwk::OHOSApplication> &application, const sptr<IRemoteObject> &token,
565         const std::shared_ptr<Context> &stageContext);
566 
567     void AddLifecycleEvent(uint32_t state, std::string &methodName) const;
568 
569     std::shared_ptr<AppExecFwk::AbilityImpl> abilityImpl_;
570     std::shared_ptr<AppExecFwk::Ability> currentAbility_;
571     std::shared_ptr<ExtensionImpl> extensionImpl_;
572     std::shared_ptr<Extension> currentExtension_;
573     bool isExtension_ = false;
574     bool isUIAbility_ = false;
575     bool isPrepareTerminate_ = false;
576     std::atomic_bool isPrepareTerminateAbilityDone_ = false;
577     std::mutex mutex_;
578     std::condition_variable cv_;
579 };
580 } // namespace AbilityRuntime
581 } // namespace OHOS
582 #endif // OHOS_ABILITY_RUNTIME_FA_ABILITY_THREAD_H
583