1 /* 2 * Copyright (c) 2021-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_APP_RUNNING_RECORD_H 17 #define OHOS_ABILITY_RUNTIME_APP_RUNNING_RECORD_H 18 19 #include <list> 20 #include <map> 21 #include <memory> 22 #include <string> 23 #include "cpp/mutex.h" 24 #include "iremote_object.h" 25 #include "irender_scheduler.h" 26 #include "ability_running_record.h" 27 #include "ability_state_data.h" 28 #include "application_info.h" 29 #include "task_handler_wrap.h" 30 #include "app_mgr_service_event_handler.h" 31 #include "app_death_recipient.h" 32 #include "app_launch_data.h" 33 #include "app_mgr_constants.h" 34 #include "app_scheduler_proxy.h" 35 #include "app_record_id.h" 36 #include "fault_data.h" 37 #include "profile.h" 38 #include "priority_object.h" 39 #include "app_lifecycle_deal.h" 40 #include "module_running_record.h" 41 #include "app_spawn_msg_wrapper.h" 42 #include "app_malloc_info.h" 43 44 namespace OHOS { 45 namespace AppExecFwk { 46 class AbilityRunningRecord; 47 class AppMgrServiceInner; 48 class AppRunningRecord; 49 50 /** 51 * @class RenderRecord 52 * Record nweb render process info. 53 */ 54 class RenderRecord { 55 public: 56 RenderRecord(pid_t hostPid, const std::string &renderParam, int32_t ipcFd, 57 int32_t sharedFd, int32_t crashFd, 58 const std::shared_ptr<AppRunningRecord> &host); 59 60 virtual ~RenderRecord(); 61 62 static std::shared_ptr<RenderRecord> 63 CreateRenderRecord(pid_t hostPid, const std::string &renderParam, 64 int32_t ipcFd, int32_t sharedFd, int32_t crashFd, 65 const std::shared_ptr<AppRunningRecord> &host); 66 67 void SetPid(pid_t pid); 68 pid_t GetPid() const ; 69 pid_t GetHostPid() const; 70 void SetUid(int32_t uid); 71 int32_t GetUid() const; 72 int32_t GetHostUid() const; 73 std::string GetHostBundleName() const; 74 std::string GetRenderParam() const; 75 std::string GetProcessName() const; 76 int32_t GetIpcFd() const; 77 int32_t GetSharedFd() const; 78 int32_t GetCrashFd() const; 79 ProcessType GetProcessType() const; 80 std::shared_ptr<AppRunningRecord> GetHostRecord() const; 81 sptr<IRenderScheduler> GetScheduler() const; 82 void SetScheduler(const sptr<IRenderScheduler> &scheduler); 83 void SetDeathRecipient(const sptr<AppDeathRecipient> recipient); 84 void RegisterDeathRecipient(); 85 86 private: 87 void SetHostUid(const int32_t hostUid); 88 void SetHostBundleName(const std::string &hostBundleName); 89 void SetProcessName(const std::string &hostProcessName); 90 91 pid_t pid_ = 0; 92 pid_t hostPid_ = 0; 93 int32_t uid_ = 0; 94 int32_t hostUid_ = 0; 95 std::string hostBundleName_; 96 std::string renderParam_; 97 std::string processName_; 98 int32_t ipcFd_ = 0; 99 int32_t sharedFd_ = 0; 100 int32_t crashFd_ = 0; 101 ProcessType processType_ = ProcessType::RENDER; 102 std::weak_ptr<AppRunningRecord> host_; // nweb host 103 sptr<IRenderScheduler> renderScheduler_ = nullptr; 104 sptr<AppDeathRecipient> deathRecipient_ = nullptr; 105 }; 106 107 class AppRunningRecord : public std::enable_shared_from_this<AppRunningRecord> { 108 public: 109 static int64_t appEventId_; 110 public: 111 AppRunningRecord( 112 const std::shared_ptr<ApplicationInfo> &info, const int32_t recordId, const std::string &processName); 113 virtual ~AppRunningRecord() = default; 114 115 /** 116 * @brief Obtains the app record bundleName. 117 * 118 * @return Returns app record bundleName. 119 */ 120 const std::string &GetBundleName() const; 121 122 /** 123 * @brief Obtains the app record CallerPid. 124 * 125 * @return Returns app record CallerPid. 126 */ 127 int32_t GetCallerPid() const; 128 129 /** 130 * @brief Setting the Caller pid. 131 * 132 * @param CallerUid, the Caller pid. 133 */ 134 void SetCallerPid(int32_t pid); 135 136 /** 137 * @brief Obtains the app record CallerUid. 138 * 139 * @return Returns app record CallerUid. 140 */ 141 int32_t GetCallerUid() const; 142 143 /** 144 * @brief Setting the Caller uid. 145 * 146 * @param CallerUid, the Caller uid. 147 */ 148 void SetCallerUid(int32_t uid); 149 150 /** 151 * @brief Obtains the app record CallerTokenId. 152 * 153 * @return Returns app record CallerTokenId. 154 */ 155 int32_t GetCallerTokenId() const; 156 157 /** 158 * @brief Setting the Caller tokenId. 159 * 160 * @param CallerToken, the Caller tokenId. 161 */ 162 void SetCallerTokenId(int32_t tokenId); 163 164 /** 165 * @brief Obtains the app record isLauncherApp flag. 166 * 167 * @return Returns app record isLauncherApp flag. 168 */ 169 bool IsLauncherApp() const; 170 171 /** 172 * @brief Obtains the app record id. 173 * 174 * @return Returns app record id. 175 */ 176 int32_t GetRecordId() const; 177 178 /** 179 * @brief Obtains the app name. 180 * 181 * @return Returns the app name. 182 */ 183 const std::string &GetName() const; 184 185 /** 186 * @brief Obtains the process name. 187 * 188 * @return Returns the process name. 189 */ 190 const std::string &GetProcessName() const; 191 192 /** 193 * @brief Obtains the sign code. 194 * 195 * @return Returns the sign code. 196 */ 197 const std::string &GetSignCode() const; 198 199 /** 200 * @brief Setting the sign code. 201 * 202 * @param code, the sign code. 203 */ 204 void SetSignCode(const std::string &signCode); 205 206 /** 207 * @brief Obtains the jointUserId. 208 * 209 * @return Returns the jointUserId. 210 */ 211 const std::string &GetJointUserId() const; 212 213 /** 214 * @brief Setting the jointUserId. 215 * 216 * @param jointUserId, the jointUserId. 217 */ 218 void SetJointUserId(const std::string &jointUserId); 219 220 /** 221 * @brief Obtains the application uid. 222 * 223 * @return Returns the application uid. 224 */ 225 int32_t GetUid() const; 226 227 /** 228 * @brief Setting the application uid. 229 * 230 * @param state, the application uid. 231 */ 232 void SetUid(const int32_t uid); 233 234 // Get current state for this process 235 236 /** 237 * @brief Obtains the application state. 238 * 239 * @return Returns the application state. 240 */ 241 ApplicationState GetState() const; 242 243 // Set current state for this process 244 245 /** 246 * @brief Setting the application state. 247 * 248 * @param state, the application state. 249 */ 250 void SetState(const ApplicationState state); 251 252 // Get abilities_ for this process 253 /** 254 * @brief Obtains the abilities info for the application record. 255 * 256 * @return Returns the abilities info for the application record. 257 */ 258 const std::map<const sptr<IRemoteObject>, std::shared_ptr<AbilityRunningRecord>> GetAbilities(); 259 // Update appThread with appThread 260 261 /** 262 * @brief Setting the application client. 263 * 264 * @param thread, the application client. 265 */ 266 void SetApplicationClient(const sptr<IAppScheduler> &thread); 267 268 /** 269 * @brief Obtains the application client. 270 * 271 * @return Returns the application client. 272 */ 273 sptr<IAppScheduler> GetApplicationClient() const; 274 275 void AddModule(const std::shared_ptr<ApplicationInfo> &appInfo, const std::shared_ptr<AbilityInfo> &abilityInfo, 276 const sptr<IRemoteObject> &token, const HapModuleInfo &hapModuleInfo, 277 const std::shared_ptr<AAFwk::Want> &want); 278 279 void AddModules(const std::shared_ptr<ApplicationInfo> &appInfo, const std::vector<HapModuleInfo> &moduleInfos); 280 281 std::shared_ptr<ModuleRunningRecord> GetModuleRecordByModuleName( 282 const std::string bundleName, const std::string &moduleName); 283 284 std::shared_ptr<ModuleRunningRecord> GetModuleRunningRecordByToken(const sptr<IRemoteObject> &token) const; 285 286 std::shared_ptr<ModuleRunningRecord> GetModuleRunningRecordByTerminateLists(const sptr<IRemoteObject> &token) const; 287 288 std::shared_ptr<AbilityRunningRecord> GetAbilityRunningRecord(const int64_t eventId) const; 289 290 /** 291 * @brief Setting the Trim Memory Level. 292 * 293 * @param level, the Memory Level. 294 */ 295 void SetTrimMemoryLevel(int32_t level); 296 297 // Kill this process with a given reason 298 /** 299 * ForceKillApp, Kill this process with a given reason. 300 * 301 * @param reason, The reason to kill the process. 302 * 303 * @return 304 */ 305 void ForceKillApp(const std::string &reason) const; 306 307 // Schedule to crash this app with a given description 308 /** 309 * ScheduleAppCrash, Schedule to crash this app with a given description. 310 * 311 * @param description, the given description. 312 * 313 * @return 314 */ 315 void ScheduleAppCrash(const std::string &description) const; 316 317 /** 318 * LaunchApplication, Notify application to launch application. 319 * 320 * @return 321 */ 322 void LaunchApplication(const Configuration &config); 323 324 /** 325 * AddAbilityStage, Notify application to ability stage. 326 * 327 * @return 328 */ 329 void AddAbilityStage(); 330 331 void AddAbilityStageBySpecifiedAbility(const std::string &bundleName); 332 333 /** 334 * AddAbilityStage Result returned. 335 * 336 * @return 337 */ 338 void AddAbilityStageDone(); 339 340 /** 341 * update the application info after new module installed. 342 * 343 * @param appInfo The latest application info obtained from bms for update abilityRuntimeContext. 344 * 345 * @return 346 */ 347 void UpdateApplicationInfoInstalled(const ApplicationInfo &appInfo); 348 349 /** 350 * LaunchAbility, Notify application to launch ability. 351 * 352 * @param ability, the ability record. 353 * 354 * @return 355 */ 356 void LaunchAbility(const std::shared_ptr<AbilityRunningRecord> &ability); 357 358 /** 359 * LaunchPendingAbilities, Launch Pending Abilities. 360 * 361 * @return 362 */ 363 void LaunchPendingAbilities(); 364 365 /** 366 * LowMemoryWarning, Low memory warning. 367 * 368 * @return 369 */ 370 void LowMemoryWarning(); 371 372 /** 373 * ScheduleTerminate, Notify application to terminate. 374 * 375 * @return 376 */ 377 void ScheduleTerminate(); 378 379 /** 380 * ScheduleTerminate, Notify application process exit safely. 381 * 382 * @return 383 */ 384 void ScheduleProcessSecurityExit(); 385 386 /** 387 * ScheduleTrimMemory, Notifies the application of the memory seen. 388 * 389 * @return 390 */ 391 void ScheduleTrimMemory(); 392 393 /** 394 * ScheduleMemoryLevel, Notifies the application of the current memory. 395 * 396 * @return 397 */ 398 void ScheduleMemoryLevel(int32_t level); 399 400 /** 401 * ScheduleHeapMemory, Get the application's memory allocation info. 402 * 403 * @param pid, pid input. 404 * @param mallocInfo, dynamic storage information output. 405 * 406 * @return 407 */ 408 void ScheduleHeapMemory(const int32_t pid, OHOS::AppExecFwk::MallocInfo &mallocInfo); 409 410 /** 411 * GetAbilityRunningRecordByToken, Obtaining the ability record through token. 412 * 413 * @param token, the unique identification to the ability. 414 * 415 * @return 416 */ 417 std::shared_ptr<AbilityRunningRecord> GetAbilityRunningRecordByToken(const sptr<IRemoteObject> &token) const; 418 419 std::shared_ptr<AbilityRunningRecord> GetAbilityByTerminateLists(const sptr<IRemoteObject> &token) const; 420 421 /** 422 * UpdateAbilityState, update the ability status. 423 * 424 * @param token, the unique identification to update the ability. 425 * @param state, ability status that needs to be updated. 426 * 427 * @return 428 */ 429 void UpdateAbilityState(const sptr<IRemoteObject> &token, const AbilityState state); 430 431 /** 432 * PopForegroundingAbilityTokens, Extract the token record from the foreground tokens list. 433 * 434 * @return 435 */ 436 void PopForegroundingAbilityTokens(); 437 438 /** 439 * TerminateAbility, terminate the token ability. 440 * 441 * @param token, he unique identification to terminate the ability. 442 * 443 * @return 444 */ 445 void TerminateAbility(const sptr<IRemoteObject> &token, const bool isForce); 446 447 /** 448 * AbilityTerminated, terminate the ability. 449 * 450 * @param token, the unique identification to terminated the ability. 451 * 452 * @return 453 */ 454 void AbilityTerminated(const sptr<IRemoteObject> &token); 455 456 /** 457 * @brief Setting application service internal handler instance. 458 * 459 * @param serviceInner, application service internal handler instance. 460 */ 461 void SetAppMgrServiceInner(const std::weak_ptr<AppMgrServiceInner> &inner); 462 463 /** 464 * @brief Setting application death recipient. 465 * 466 * @param appDeathRecipient, application death recipient instance. 467 */ 468 void SetAppDeathRecipient(const sptr<AppDeathRecipient> &appDeathRecipient); 469 470 /** 471 * RegisterAppDeathRecipient, Register application death recipient. 472 * 473 * @return 474 */ 475 void RegisterAppDeathRecipient() const; 476 477 /** 478 * @brief Obtains application priority info. 479 * 480 * @return Returns the application priority info. 481 */ 482 std::shared_ptr<PriorityObject> GetPriorityObject(); 483 484 /** 485 * RegisterAppDeathRecipient, Remove application death recipient record. 486 * 487 * @return 488 */ 489 void RemoveAppDeathRecipient() const; 490 491 /** 492 * Notify application update system environment changes. 493 * 494 * @param config System environment change parameters. 495 * @return Returns ERR_OK on success, others on failure. 496 */ 497 int32_t UpdateConfiguration(const Configuration &config); 498 499 void SetTaskHandler(std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler); 500 void SetEventHandler(const std::shared_ptr<AMSEventHandler> &handler); 501 502 int64_t GetEventId() const; 503 504 bool IsLastAbilityRecord(const sptr<IRemoteObject> &token); 505 506 bool IsLastPageAbilityRecord(const sptr<IRemoteObject> &token); 507 508 void SetTerminating(); 509 510 bool IsTerminating(); 511 512 bool IsKeepAliveApp() const; 513 514 bool IsEmptyKeepAliveApp() const; 515 516 void SetKeepAliveAppState(bool isKeepAlive, bool isEmptyKeepAliveApp); 517 518 void SetEmptyKeepAliveAppState(bool isEmptyKeepAlive); 519 520 void SetStageModelState(bool isStageBasedModel); 521 522 std::list<std::shared_ptr<ModuleRunningRecord>> GetAllModuleRecord() const; 523 524 const std::list<std::shared_ptr<ApplicationInfo>> GetAppInfoList(); 525 GetApplicationInfo()526 inline const std::shared_ptr<ApplicationInfo> GetApplicationInfo() 527 { 528 return appInfo_; 529 } 530 531 void SetRestartResidentProcCount(int count); 532 void DecRestartResidentProcCount(); 533 int GetRestartResidentProcCount() const; 534 bool CanRestartResidentProc(); 535 536 /** 537 * Notify observers when state change. 538 * 539 * @param ability, ability or extension record. 540 * @param state, ability or extension state. 541 */ 542 void StateChangedNotifyObserver( 543 const std::shared_ptr<AbilityRunningRecord> &ability, int32_t state, bool isAbility); 544 545 void insertAbilityStageInfo(std::vector<HapModuleInfo> moduleInfos); 546 547 void GetBundleNames(std::vector<std::string> &bundleNames); 548 549 void SetUserTestInfo(const std::shared_ptr<UserTestRecord> &record); 550 std::shared_ptr<UserTestRecord> GetUserTestInfo(); 551 552 void SetProcessAndExtensionType(const std::shared_ptr<AbilityInfo> &abilityInfo); 553 void SetSpecifiedAbilityFlagAndWant(const bool flag, const AAFwk::Want &want, const std::string &moduleName); 554 bool IsStartSpecifiedAbility() const; 555 void ScheduleAcceptWant(const std::string &moduleName); 556 void ScheduleAcceptWantDone(); 557 void ApplicationTerminated(); 558 const AAFwk::Want &GetSpecifiedWant() const; 559 void SetDebugApp(bool isDebugApp); 560 bool IsDebugApp(); 561 void SetNativeDebug(bool isNativeDebug); 562 void AddRenderRecord(const std::shared_ptr<RenderRecord> &record); 563 void RemoveRenderRecord(const std::shared_ptr<RenderRecord> &record); 564 std::shared_ptr<RenderRecord> GetRenderRecordByPid(const pid_t pid); 565 std::map<int32_t, std::shared_ptr<RenderRecord>> GetRenderRecordMap(); 566 void SetStartMsg(const AppSpawnStartMsg &msg); 567 AppSpawnStartMsg GetStartMsg(); 568 569 void SendEventForSpecifiedAbility(uint32_t msg, int64_t timeOut); 570 571 void SendAppStartupTypeEvent(const std::shared_ptr<AbilityRunningRecord> &ability, const AppStartType startType); 572 void SetKilling(); 573 bool IsKilling() const; 574 void SetAppIndex(const int32_t appIndex); 575 int32_t GetAppIndex() const; 576 void SetSecurityFlag(bool securityFlag); 577 bool GetSecurityFlag() const; 578 579 using Closure = std::function<void()>; 580 void PostTask(std::string msg, int64_t timeOut, const Closure &task); 581 void RemoveTerminateAbilityTimeoutTask(const sptr<IRemoteObject>& token) const; 582 583 int32_t NotifyLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback, 584 const int32_t recordId); 585 586 int32_t NotifyHotReloadPage(const sptr<IQuickFixCallback> &callback, const int32_t recordId); 587 588 int32_t NotifyUnLoadRepairPatch(const std::string &bundleName, const sptr<IQuickFixCallback> &callback, 589 const int32_t recordId); 590 591 bool IsContinuousTask(); 592 593 void SetContinuousTaskAppState(bool isContinuousTask); 594 595 /** 596 * Update target ability focus state. 597 * 598 * @param token the token of target ability. 599 * @param isFocus focus state. 600 * 601 * @return true if process focus state changed, false otherwise. 602 */ 603 bool UpdateAbilityFocusState(const sptr<IRemoteObject> &token, bool isFocus); 604 605 bool GetFocusFlag() const; 606 607 int64_t GetAppStartTime() const; 608 609 void SetRestartTimeMillis(const int64_t restartTimeMillis); 610 void SetRequestProcCode(int32_t requestProcCode); 611 612 int32_t GetRequestProcCode() const; 613 614 void SetProcessChangeReason(ProcessChangeReason reason); 615 616 ProcessChangeReason GetProcessChangeReason() const; 617 618 bool IsUpdateStateFromService(); 619 620 void SetUpdateStateFromService(bool isUpdateStateFromService); 621 622 ExtensionAbilityType GetExtensionType() const; 623 ProcessType GetProcessType() const; 624 625 int32_t NotifyAppFault(const FaultData &faultData); 626 SetAbilityForegroundingFlag()627 inline void SetAbilityForegroundingFlag() 628 { 629 isAbilityForegrounding_.store(true); 630 } 631 GetAbilityForegroundingFlag()632 inline bool GetAbilityForegroundingFlag() 633 { 634 return isAbilityForegrounding_.load(); 635 } 636 SetSpawned()637 inline void SetSpawned() 638 { 639 isSpawned_.store(true); 640 } 641 GetSpawned()642 inline bool GetSpawned() const 643 { 644 return isSpawned_.load(); 645 } 646 private: 647 /** 648 * SearchTheModuleInfoNeedToUpdated, Get an uninitialized abilityStage data. 649 * 650 * @return If an uninitialized data is found return true,Otherwise return false. 651 */ 652 bool GetTheModuleInfoNeedToUpdated(const std::string bundleName, HapModuleInfo &info); 653 654 // drive application state changes when ability state changes. 655 /** 656 * ScheduleForegroundRunning, Notify application to switch to foreground. 657 * 658 * @return 659 */ 660 void ScheduleForegroundRunning(); 661 662 /** 663 * ScheduleBackgroundRunning, Notify application to switch to background. 664 * 665 * @return 666 */ 667 void ScheduleBackgroundRunning(); 668 669 /** 670 * AbilityForeground, Handling the ability process when switching to the foreground. 671 * 672 * @param ability, the ability info. 673 * 674 * @return 675 */ 676 void AbilityForeground(const std::shared_ptr<AbilityRunningRecord> &ability); 677 678 /** 679 * AbilityBackground, Handling the ability process when switching to the background. 680 * 681 * @param ability, the ability info. 682 * 683 * @return 684 */ 685 void AbilityBackground(const std::shared_ptr<AbilityRunningRecord> &ability); 686 // drive application state changes when ability state changes. 687 688 bool AbilityFocused(const std::shared_ptr<AbilityRunningRecord> &ability); 689 690 bool AbilityUnfocused(const std::shared_ptr<AbilityRunningRecord> &ability); 691 692 void SendEvent(uint32_t msg, int64_t timeOut); 693 694 void SendClearTask(uint32_t msg, int64_t timeOut); 695 696 void RemoveModuleRecord(const std::shared_ptr<ModuleRunningRecord> &record); 697 698 private: 699 bool isKeepAliveApp_ = false; // Only resident processes can be set to true, please choose carefully 700 bool isEmptyKeepAliveApp_ = false; // Only empty resident processes can be set to true, please choose carefully 701 bool isStageBasedModel_ = false; 702 ApplicationState curState_ = ApplicationState::APP_STATE_CREATE; // current state of this process 703 bool isFocused_ = false; // if process is focused. 704 /** 705 * If there is an ability is foregrounding, this flag will be true, 706 * and this flag will remain true until this application is background. 707 */ 708 std::atomic_bool isAbilityForegrounding_ = false; 709 710 std::shared_ptr<ApplicationInfo> appInfo_ = nullptr; // the application's info of this process 711 int32_t appRecordId_ = 0; 712 std::string appName_; 713 std::string processName_; // the name of this process 714 int64_t eventId_ = 0; 715 int64_t startProcessSpecifiedAbilityEventId_ = 0; 716 int64_t addAbilityStageInfoEventId_ = 0; 717 std::list<const sptr<IRemoteObject>> foregroundingAbilityTokens_; 718 std::weak_ptr<AppMgrServiceInner> appMgrServiceInner_; 719 sptr<AppDeathRecipient> appDeathRecipient_ = nullptr; 720 std::shared_ptr<PriorityObject> priorityObject_ = nullptr; 721 std::shared_ptr<AppLifeCycleDeal> appLifeCycleDeal_ = nullptr; 722 std::shared_ptr<AAFwk::TaskHandlerWrap> taskHandler_; 723 std::shared_ptr<AMSEventHandler> eventHandler_; 724 bool isTerminating = false; 725 std::string signCode_; // the sign of this hap 726 std::string jointUserId_; 727 std::map<std::string, std::shared_ptr<ApplicationInfo>> appInfos_; 728 ffrt::mutex appInfosLock_; 729 std::map<std::string, std::vector<std::shared_ptr<ModuleRunningRecord>>> hapModules_; 730 mutable ffrt::mutex hapModulesLock_; 731 int32_t mainUid_; 732 std::string mainBundleName_; 733 bool isLauncherApp_; 734 std::string mainAppName_; 735 int restartResidentProcCount_ = 0; 736 bool isSpecifiedAbility_ = false; 737 AAFwk::Want SpecifiedWant_; 738 std::string moduleName_; 739 bool isDebugApp_ = false; 740 bool isNativeDebug_ = false; 741 int64_t startTimeMillis_ = 0; // The time of app start(CLOCK_MONOTONIC) 742 int64_t restartTimeMillis_ = 0; // The time of last trying app restart 743 744 std::shared_ptr<UserTestRecord> userTestRecord_ = nullptr; 745 746 bool isKilling_ = false; 747 bool isContinuousTask_ = false; // Only continuesTask processes can be set to true, please choose carefully 748 std::atomic_bool isSpawned_ = false; 749 750 // render record 751 std::map<int32_t, std::shared_ptr<RenderRecord>> renderRecordMap_; 752 ffrt::mutex renderRecordMapLock_; 753 AppSpawnStartMsg startMsg_; 754 int32_t appIndex_ = 0; 755 bool securityFlag_ = false; 756 int32_t requestProcCode_ = 0; 757 ProcessChangeReason processChangeReason_ = ProcessChangeReason::REASON_NONE; 758 759 bool isUpdateStateFromService_ = false; 760 int32_t callerPid_ = -1; 761 int32_t callerUid_ = -1; 762 int32_t callerTokenId_ = -1; 763 ProcessType processType_ = ProcessType::NORMAL; 764 ExtensionAbilityType extensionType_ = ExtensionAbilityType::UNSPECIFIED; 765 }; 766 } // namespace AppExecFwk 767 } // namespace OHOS 768 #endif // OHOS_ABILITY_RUNTIME_APP_RUNNING_RECORD_H 769