1# Application Freeze Detection 2 3## Overview 4 5AppFreeze (application freeze) means that an application does not respond to user operations (for example, clicking) for a specified period of time. In this case, the system detects AppFreeze faults and generates AppFreeze logs for fault analysis. 6 7> **NOTE** 8> 9> This guide applies only to applications in the stage model. Before using this guide, you must have basic knowledge about the JS applications, C++ program stacks, and application-related subsystems. 10 11## Detection Principles 12 13Currently, AppFreeze detection supports the fault types listed in the following table. 14 15> **NOTE** 16> 17> AppFreeze detection takes effect only for [applications of the release version](performance-analysis-kit-terminology.md#applications-of-the-release-version), but not for [applications of the debug version](performance-analysis-kit-terminology.md#applications-of-the-debug-version) 18 19| Fault| Description| 20| -------- | -------- | 21| THREAD_BLOCK_6S | The application main thread times out.| 22| APP_INPUT_BLOCK | The user input response times out.| 23| LIFECYCLE_TIMEOUT | Ability lifecycle switching times out.| 24 25When any of the preceding faults occurs in an application, the application is killed to ensure that it is recoverable and the application freeze event is reported. You can subscribe to the [application freeze event](hiappevent-watcher-freeze-events.md) by using HiAppEvent. 26 27### THREAD_BLOCK_6S Application Main Thread Timeout 28 29**Description**: This fault indicates that the main thread of this application is suspended or too many tasks are executed, affecting task execution smoothness and experience. 30 31**Detection principle**: The watchdog thread of the application periodically inserts an activation detection to the main thread. If the activity detection is not executed within 3s, the **THREAD_BLOCK_3S** warning event is reported. If the activity detection is not executed within 6s, the **THREAD_BLOCK_6S** main thread timeout event is reported. The two events constitute an AppFreeze log. 32 33The following figure shows the detection principle. 34 35**Figure 1** 36 37 38### APP_INPUT_BLOCK User Input Response Timeout 39 40**Description**: This fault occurs when the tap event is not responded within 5 seconds. 41 42**Detection principle**: When a user taps an application, the input system sends a tap event to the application. If the application response times out, this fault is reported. 43 44The following figure shows the detection principle. 45 46**Figure 2** 47 48 49### Lifecycle Switching Timeout 50 51**Description**: Lifecycle switching timeouts include [ability lifecycle](../application-models/uiability-lifecycle.md) switching timeout and [page lifecycle](../application-models/pageability-lifecycle.md) switching timeout. 52 53This fault occurs during lifecycle switching and affects Ability switching and PageAbility switching of the application. 54 55**Detection principle**: The AMS service of foundation sends a lifecycle switching instruction to the application process, and then waits for the application to return the result. If the task is not completed within a specified period of time, a fault is reported. 56 57The lifecycle switching timeout event consists of the **LIFECYCLE_HALF_TIMEOUT** and **LIFECYCLE_TIMEOUT** events. **LIFECYCLE_HALF_TIMEOUT** is used as the warning event of **LIFECYCLE_TIMEOUT** to capture the binder information. 58 59**Figure 3** 60 61 62 63Timeout durations vary with lifecycles. For details, see the following table. 64 65| Lifecycle| Timeout Duration| 66| -------- | -------- | 67| Load | 10s | 68| Foreground | 5s | 69 70## Obtaining Logs 71 72Both application freeze logs and process crash logs are managed by the FaultLogger module and can be obtained using any of the following methods: 73 74**Method 1: DevEco Studio** 75 76DevEco Studio collects process crash logs from **/data/log/faultlog/faultlogger/** to FaultLog, where logs are displayed by process name and fault time. For details about how to obtain logs, see [Fault Log](https://developer.huawei.com/consumer/en/doc/harmonyos-guides/ide-fault-log). 77 78**Method 2: HiAppEvent APIs** 79 80HiAppEvent provides APIs for subscribing to faults. For details, see [Introduction to HiAppEvent](hiappevent-intro.md). Subscribe to the application freeze event by referring to [Subscribing to Application Freeze Events (ArkTS)](hiappevent-watcher-freeze-events-arkts.md) or [Subscribing to Application Freeze Events (C/C++)](hiappevent-watcher-freeze-events-ndk.md), and read the fault log file content based on the [external_log](hiappevent-watcher-crash-events.md#fields) field of the event. 81 82**Method 3: hdc** 83 84Enable the developer option and run the **hdc file recv /data/log/faultlog/faultlogger D:\** command to export fault logs to the local device. The fault log file name is in the format of **appfreeze-process name-process UID-millisecond-level timestamp.log**. 85 86## Log Specifications 87 88You need to analyze AppFreeze problems based on AppFreeze logs and HiLog logs. 89 90The following example is for reference only. You should analyze the problem based on the actual situation. 91 92AppFreeze logs consist of the following information: 93 94### Header Information 95 96``` 97Generated by HiviewDFX@OpenHarmony 98================================================================ 99Device info:HUAWEI Mate 60 Pro 100Build info:ALN-AL00 6.0.0.328(C00E1R4P3DEVDUlog) 101Fingerprint:e18a33c12e1361173ec9ac1c93f2bd0c2daa88f03c7f76b228cca14bdc6a21b1 102Module name:com.samples.freezedebug 103Version:1.0.0 104VersionCode:1000000 105PreInstalled:No 106Foreground:Yes 107Pid:13680 108Uid:20020177 109Reason:THREAD_BLOCK_6S 110appfreeze: com.samples.freezedebug THREAD_BLOCK_6S at 20250628140837 111DisplayPowerInfo:powerState:UNKNOWN 112>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> 113DOMAIN:AAFWK 114STRINGID:THREAD_BLOCK_6S 115TIMESTAMP:2025/06/28-14:08:37:360 116PID:13680 117UID:20020177 118PACKAGE_NAME:com.samples.freezedebug 119PROCESS_NAME:com.samples.freezedebug 120*** 121``` 122 123All the three types of AppFreeze events include the following information. 124 125| Field| Description| 126| -------- | -------- | 127| Reason | Reason why the application freezes, corresponding to the application freeze detection capability.| 128| PID | PID of the faulty process.| 129| PACKAGE_NAME | Application process package name.| 130 131### General Information in the Log Body 132 133``` 134start time: 2025/06/28-14:08:34:318 135DOMAIN = AAFWK 136EVENTNAME = THREAD_BLOCK_3S 137TIMESTAMP = 2025/06/28-14:08:34:310 138PID = 13680 139UID = 20020177 140TID = 13680 141PACKAGE_NAME = com.samples.freezedebug 142PROCESS_NAME = com.samples.freezedebug 143eventLog_action = ffrt,t,GpuStack,cmd:m,hot 144eventLog_interval = 10 145MSG = 146Fault time:2025/06/28-14:08:34 147App main thread is not response! 148Main handler dump start time: 2025-06-28 14:08:34.067 149mainHandler dump is: 150 EventHandler dump begin curTime: 2025-06-28 14:08:34.067 151 Event runner (Thread name = , Thread ID = 13680) is running 152 Current Running: start at 2025-06-28 14:08:27.354, Event { send thread = 13680, send time = 2025-06-28 14:08:22.353, handle time = 2025-06-28 14:08:27.353, trigger time = 2025-06-28 14:08:27.354, task name = uv_timer_task, caller = [ohos_loop_handler.cpp(OnTriggered:72)] } 153 History event queue information: 154 No. 0 : Event { send thread = 13856, send time = 2025-06-28 14:08:22.336, handle time = 2025-06-28 14:08:22.336, trigger time = 2025-06-28 14:08:22.336, completeTime time = 2025-06-28 14:08:22.337, priority = VIP, task name = MMITask, caller = [deamon_io_waiter.cpp(HandleFileDescriptorEvent:225)] } 155... 156 No. 31 : Event { send thread = 13856, send time = 2025-06-28 14:08:22.330, handle time = 2025-06-28 14:08:22.380, trigger time = 2025-06-28 14:08:22.330, completeTime time = 2025-06-28 14:08:22.331, priority = VIP, task name = vSyncTask, caller = [deamon_io_waiter.cpp(PostTaskForVsync:159)] } 157 VIP priority event queue information: 158 No.1 : Event { send thread = 13843, send time = 2025-06-28 14:08:31.066, handle time = 2025-06-28 14:08:31.066, id = 1, caller = [watchdog.cpp(Timer:233)] } 159 No.2 : Event { send thread = 13843, send time = 2025-06-28 14:08:34.067, handle time = 2025-06-28 14:08:34.067, id = 1, caller = [watchdog.cpp(Timer:233)] } 160 Total size of VIP events : 2 161 Immediate priority event queue information: 162 Total size of Immediate events : 0 163 High priority event queue information: 164 Total size of High events : 0 165 Low priority event queue information: 166 Total size of Low events : 0 167 Idle priority event queue information: 168 Total size of Idle events : 0 169 Total event size : 2 170``` 171 172All the three types of AppFreeze events include the following information. 173 174| Field| Description| 175| -------- | -------- | 176| EVENTNAME | Name of the fault event.| 177| TIMESTAMP | Time when the fault event reported. You can narrow down the time range to view HiLog logs based on the timeout duration described in the application freeze detection capability.| 178| PID | PID of the faulty process.| 179| UID | UID of the faulty process.| 180| TID | TID of the faulty process.| 181| PACKAGE_NAME | Application process package name.| 182| PROCESS_NAME | Application process name.| 183| MSG | Time when the fault occurs and **EventHandler** information.| 184| task name | Task name in the task queue.| 185| trigger time | Task execution time| 186| completeTime time | Time when the task is complete. (If no information is displayed, the task is not complete.)| 187 188### Stack Information 189 190Stack information of the faulty process is displayed. 191 192``` 193Tid:13680, Name:les.freezedebug 194#00 pc 000000000000186c [shmm](__kernel_gettimeofday+72) 195#01 pc 00000000001d887c /system/lib/ld-musl-aarch64.so.1(gettimeofday+40)(f1a940981720250b920ee26d2d76af5b) 196#02 pc 000000000058fb5c /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::builtins::BuiltinsDate::Now(panda::ecmascript::EcmaRuntimeCallInfo*)+48)(0f1928b77d36d27edb5512bd89806a6f) 197#03 pc 0000000000cff5dc /system/lib64/module/arkcompiler/stub.an(RTStub_PushCallArgsAndDispatchNative+40) 198#04 pc 000000000036aaf4 /system/lib64/module/arkcompiler/stub.an(BCStub_HandleCallthis0Imm8V8StwCopy+380) 199#05 at wait15s (entry/src/main/ets/pages/Index.ets:16:10) 200#06 pc 000000000026b1dc /system/lib64/platformsdk/libark_jsruntime.so(panda::ecmascript::InterpreterAssembly::Execute(panda::ecmascript::EcmaRuntimeCallInfo*)+536)(0f1928b77d36d27edb5512bd89806a6f) 201#07 pc 000000000096b188 /system/lib64/platformsdk/libark_jsruntime.so(panda::FunctionRef::CallForNapi(panda::ecmascript::EcmaVM const*, panda::JSValueRef*, panda::JSValueRef* const*, int)+1432)(0f1928b77d36d27edb5512bd89806a6f) 202#08 pc 000000000006b7a4 /system/lib64/platformsdk/libace_napi.z.so(napi_call_function+212)(eaa639519e67e8495ca596293a0d33cd) 203#09 pc 000000000000b17c /system/lib64/platformsdk/libtimer.z.so(OHOS::JsSysModule::Timer::TimerCallback(uv_timer_s*) (.cfi)+528)(764291289e89523cdbe9c3c78c1cca35) 204#10 pc 0000000000013ea8 /system/lib64/platformsdk/libuv.so(uv__run_timers+68)(9e7eb59ca1a45f4230b641a7c940a20b) 205#11 pc 000000000001a344 /system/lib64/platformsdk/libuv.so(uv_run+376)(9e7eb59ca1a45f4230b641a7c940a20b) 206#12 pc 00000000000895a8 /system/lib64/platformsdk/libruntime.z.so(OHOS::AbilityRuntime::OHOSLoopHandler::OnTriggered()+140)(daf29e377c47e3e26282e745dd1b3488) 207#13 pc 0000000000089b4c /system/lib64/platformsdk/libruntime.z.so(std::__h::__function::__func<OHOS::AbilityRuntime::OHOSLoopHandler::OnTriggered()::$_0, std::__h::allocator<OHOS::AbilityRuntime::OHOSLoopHandler::OnTriggered()::$_0>, void ()>::operator()() (.9efded9864dc55830f61b3b92d59beab)+52)(daf29e377c47e3e26282e745dd1b3488) 208#14 pc 000000000001ff6c /system/lib64/chipset-sdk-sp/libeventhandler.z.so(OHOS::AppExecFwk::(anonymous namespace)::EventRunnerImpl::ExecuteEventHandler(std::__h::unique_ptr<OHOS::AppExecFwk::InnerEvent, void (*)(OHOS::AppExecFwk::InnerEvent*)>&)+2228)(475713336c2720d372d5aeb99dda5f9f) 209#15 pc 000000000001a7d8 /system/lib64/chipset-sdk-sp/libeventhandler.z.so(OHOS::AppExecFwk::(anonymous namespace)::EventRunnerImpl::Run()+648)(475713336c2720d372d5aeb99dda5f9f) 210#16 pc 000000000003f5f4 /system/lib64/chipset-sdk-sp/libeventhandler.z.so(OHOS::AppExecFwk::EventRunner::Run()+404)(475713336c2720d372d5aeb99dda5f9f) 211#17 pc 00000000000a50f0 /system/lib64/platformsdk/libappkit_native.z.so(OHOS::AppExecFwk::MainThread::Start()+504)(e794b687fdf46631ae5144eba250f8c0) 212#18 pc 0000000000005278 /system/lib64/appspawn/appspawn/libappspawn_ace.z.so(RunChildProcessor(AppSpawnContent*, AppSpawnClient*)+568)(143c05087e9460f0fd794b9dce5dec29) 213#19 pc 000000000000baa8 /system/bin/appspawn(AppSpawnChild+648)(25ab88f6e04b1d2c8feb5d3eebfb4664) 214#20 pc 0000000000016478 /system/bin/appspawn(ProcessSpawnReqMsg+3260)(25ab88f6e04b1d2c8feb5d3eebfb4664) 215#21 pc 0000000000013aac /system/bin/appspawn(OnReceiveRequest+724)(25ab88f6e04b1d2c8feb5d3eebfb4664) 216#22 pc 0000000000017844 /system/lib64/chipset-sdk-sp/libbegetutil.z.so(HandleRecvMsg_+384)(a9ddb8b84cc09183cc6bd2e5bb875f30) 217#23 pc 000000000001715c /system/lib64/chipset-sdk-sp/libbegetutil.z.so(HandleStreamEvent_+152)(a9ddb8b84cc09183cc6bd2e5bb875f30) 218#24 pc 000000000001444c /system/lib64/chipset-sdk-sp/libbegetutil.z.so(ProcessEvent+380)(a9ddb8b84cc09183cc6bd2e5bb875f30) 219#25 pc 0000000000013edc /system/lib64/chipset-sdk-sp/libbegetutil.z.so(RunLoop_.llvm.16927440879641410339+656)(a9ddb8b84cc09183cc6bd2e5bb875f30) 220#26 pc 0000000000010dcc /system/bin/appspawn(AppSpawnRun+212)(25ab88f6e04b1d2c8feb5d3eebfb4664) 221#27 pc 000000000000eb90 /system/bin/appspawn(main+728)(25ab88f6e04b1d2c8feb5d3eebfb4664) 222#28 pc 00000000000a9804 /system/lib/ld-musl-aarch64.so.1(libc_start_main_stage2+84)(f1a940981720250b920ee26d2d76af5b) 223``` 224 225> **NOTE** 226> When the system is heavily loaded (for example, high CPU load), the function name and **build-id** information may be lost if the call stack is obtained in low-overhead mode. If the user stack fails to be obtained, **build-id** is empty. As a result, the freeze stack contains only the SO-level stack. 227 228### Peer Information (Information About the Process That Communicates with the Faulty Process) 229 230(1) **BinderCatcher**: Displays the IPC call information and cases where the waiting time is excessive. 231 232``` 233PeerBinderCatcher -- pid==13680 234BinderCatcher -- 235 13840:14102 to 901:4079 code 16 wait:0.25653125 s frz_state:3, ns:-1:-1 to -1:-1, debug:13840:14102 to 901:4079, active_code:0, active_thread=0, pending_async_proc=0 236 3712:3712 to 13967:14076 code d2 wait:0.703385417 s frz_state:3, ns:-1:-1 to -1:-1, debug:3712:3712 to 13967:14076, active_code:0, active_thread=0, pending_async_proc=0 237 1733:2285 to 3712:3712 code b wait:1.365925521 s frz_state:3, ns:-1:-1 to -1:-1, debug:1733:2285 to 3712:3712, active_code:0, active_thread=0, pending_async_proc=0 238... 239pid context request started max ready free_async_space 24014072 binder 0 2 16 3 520192 24114103 binder 0 4 16 6 520192 24213967 binder 0 3 16 3 520192 24313878 binder 0 2 16 3 520192 24413840 binder 0 2 16 3 520192 24513863 binder 0 1 16 3 520192 24613680 binder 0 2 16 3 520192 24713770 binder 0 3 16 5 520192 24813749 binder 0 3 16 5 520192 249... 250 251``` 252 253The IPC information is described as follows. 254 255| | | 256| -------- | -------- | 257| xxx:xxx to xxx:xxx | Client process ID, thread ID to server process ID, thread ID. **async** indicates asynchronous; no **async** indicates synchronous. | 258| code | Service code agreed by the client and server. | 259| wait | Communication waiting duration. | 260| frz_state | Process freeze status.<br>**-1**: Unknown.<br>**1**: Default.<br>**2**: The binder status information is being sent to the user mode.<br>**3**: The binder receiving thread is reached. | 261| ns | Client process ID, thread ID to server process ID, thread ID (-1 for non-DroiTong processes). | 262| debug | Supplementary information about the IPC parties. | 263| active_code | The asynchronous message code being processed. | 264| active_thread | Thread that processes the asynchronous message. | 265| pending_async_proc | Process blocked by the asynchronous message. | 266| pid | Process ID. | 267| context | Communication mode. | 268| request | Number of IPC threads requested. | 269| started | Number of started IPC threads. | 270| max | Maximum number of IPC threads that can be requested. | 271| ready | Free IPC thread. | 272| free_async_space | Free asynchronous space, which is used to observe asynchronous information blocking. | 273 274(2) **PeerBinder Stacktrace**: Stack traces of unresponsive peer processes communicating with the faulty process. 275 276``` 277Tid:48841, Name:xxx 278#00 pc 000000000016adf4 /system/lib/ld-musl-aarch64.so.1 279#01 pc 000000000001c0d4 /system/lib64/chipset-sdk-sp/libeventhandler.z.so 280#02 pc 000000000001a7f4 /system/lib64/chipset-sdk-sp/libeventhandler.z.so 281#03 pc 000000000003f5f4 /system/lib64/chipset-sdk-sp/libeventhandler.z.so 282#04 pc 00000000000a50f0 /system/lib64/platformsdk/libappkit_native.z.so 283#05 pc 0000000000005278 /system/lib64/appspawn/appspawn/libappspawn_ace.z.so 284#06 pc 000000000000baa8 /system/bin/appspawn 285#07 pc 0000000000016478 /system/bin/appspawn 286#08 pc 0000000000013aac /system/bin/appspawn 287#09 pc 0000000000017844 /system/lib64/chipset-sdk-sp/libbegetutil.z.so 288#10 pc 000000000001715c /system/lib64/chipset-sdk-sp/libbegetutil.z.so 289#11 pc 000000000001444c /system/lib64/chipset-sdk-sp/libbegetutil.z.so 290#12 pc 0000000000013edc /system/lib64/chipset-sdk-sp/libbegetutil.z.so 291#13 pc 0000000000010dcc /system/bin/appspawn 292#14 pc 000000000000eb90 /system/bin/appspawn 293#15 pc 00000000000a9804 /system/lib/ld-musl-aarch64.so.1 294#16 pc 000000000000b754 /system/bin/appspawn 295``` 296 297### CPU Information 298 299The system CPU information is as follows: 300 301``` 302Load average: 14.3 / 12.9 / 11.4; the cpu load average in 1 min, 5 min and 15 min 303CPU usage from 2025-06-28 14:08:36 to 2025-06-28 14:08:37 304Total: 22.45%; User Space: 13.64%; Kernel Space: 8.81%; iowait: 0.33%; irq: 0.07%; idle: 77.15% 305Details of Processes: 306 PID Total Usage User Space Kernel Space Page Fault Minor Page Fault Major Name 307 13680 8.86% 8.31% 0.55% 4711 6637 com.samples.freezedebug 308 644 2.55% 1.40% 1.15% 210104 7391 hiview 309 600 0.89% 0.78% 0.10% 60192 514 hilogd 310 1685 0.53% 0.31% 0.22% 879838 59636 foundation 311``` 312 313| | | 314| -------- | -------- | 315| PID | Process ID. | 316| Total Usage | CPU usage. **Total Usage** = **User Space** + **Kernel Space**. | 317| User Space | User space usage. | 318| Kernel Space | Kernel space usage. | 319| Page Fault Minor | Minor page fault. | 320| Page Fault Major | Major page fault. | 321| Name | Process name. | 322 323### Memory Information 324 325``` 326Get freeze memory start time: 2025-06-28 14:08:37.112 327some avg10=56.81 avg60=56.81 avg300=56.81 total=56 328full avg10=56.81 avg60=56.81 avg300=56.81 total=56 329... 330ReclaimAvailBuffer: 4676608 kB 331... 332``` 333 334The preceding shows the system memory information. **ReclaimAvailBuffer** indicates the remaining available system memory, which is used to check whether the memory is low. 335 336## Log Differences 337 3381. Lifecycle timeout event. 339 340``` 341DOMAIN:AAFWK 342STRINGID:LIFECYCLE_TIMEOUT 343TIMEOUT TIMESTAMP:2025/02/10-21:40:59:113 344PID:1561 345UID:20010039 346PACKAGE_NAME:com.example.myapplication 347PROCESS_NAME:com.example.myapplication 348MSG:ability:EntryAbility background timeout 349server actions for ability: 3502025-02-10 21:40:56.376; AbilityRecord::ProcessForegroundAbility; the ProcessForegroundAbility lifecycle starts. 3512025-02-10 21:40:56.377; ServiceInner::UpdateAbilityState 352server actions for app: 3532025-02-10 21:40:56.397; AppRunningRecord::OnWindowVisibilityChanged 3542025-02-10 21:40:56.851; AppRunningRecord::OnWindowVisibilityChanged 3552025-02-10 21:40:58.668; AppRunningRecord::OnWindowVisibilityChanged 356client actions for ability: 3572025-02-10 21:40:56.378; AbilityThread::ScheduleAbilityTransaction 3582025-02-10 21:40:56.378; AbilityThread::HandleAbilityTransaction 3592025-02-10 21:40:56.382; JsUIAbility::OnStart begin 3602025-02-10 21:40:56.382; JsUIAbility::OnStart end 3612025-02-10 21:40:56.387; JsUIAbility::OnSceneCreated begin 3622025-02-10 21:40:56.388; JsUIAbility::OnSceneCreated end 3632025-02-10 21:40:56.388; JsUIAbility::WindowScene::GoForeground begin 3642025-02-10 21:40:56.389; UIAbilityImpl::WindowLifeCycleImpl::AfterForeground 3652025-02-10 21:40:56.390; JsUIAbility::OnForeground begin 366client actions for app: 367``` 368 369The following describes the MSG information with two complete lifecycle switchover examples. 370 371(1) Events in the load phase (when the application process is not created) 372 373| | | | 374| -------- | -------- | -------- | 375| server | client | Description | 376| AbilityRecord::LoadAbility; the LoadAbility lifecycle starts. |- | Start. | 377| AppMgrServiceInner::LoadAbility | -| The process is yet to be created. | 378| AppMgrService::AttachApplication | -| The process is successfully created and attached. | 379| ServiceInner::AttachApplication | -| The process is attached. | 380| ServiceInner::LaunchApplication | -| The application is scheduled to execute the loading process. | 381| AppRunningRecord::LaunchApplication | -| The application is scheduled to execute the loading process. | 382| AppScheduler::ScheduleLaunchApplication | -| The application is scheduled to execute the loading process. | 383| -| ScheduleLaunchApplication | The application receives a loading scheduling request. | 384| -| HandleLaunchApplication begin | The application loading starts. | 385| -| HandleLaunchApplication end | The application loading ends. | 386| AppRunningRecord::LaunchPendingAbilities | -| The application is scheduled to start ability. | 387| -| MainThread::ScheduleLaunchAbility | The application receives a request to load ability. | 388| -| MainThread::HandleLaunchAbility | The main thread processes the request. | 389| -| JsAbilityStage::Create | An AbilityStage is loaded. | 390| -| JsAbilityStage::OnCreate begin | The **onCreate** lifecycle of AbilityStage starts. | 391| -| JsAbilityStage::OnCreate end | The **onCreate** lifecycle of **AbilityStage** ends. | 392| -| AbilityThread::Attach | The ability is attached to AMS, and the loading process ends. | 393 394 (2) Foreground phase event – cold start 395 396| | | | 397| -------- | -------- | -------- | 398| server | client | Description | 399| AbilityRecord::ProcessForegroundAbility; the ProcessForegroundAbility lifecycle starts. | | Start. | 400| ServiceInner::UpdateAbilityState | -| The application frontend is scheduled first. | 401| AppRunningRecord::ScheduleForegroundRunning | -| The application foreground is scheduled. | 402| AppScheduler::ScheduleForegroundApplication | -| The application foreground is scheduled. | 403| -| ScheduleForegroundApplication | The application receives a scheduling request. | 404| -| HandleForegroundApplication | The main thread executes the scheduling request. | 405| AppMgrService::AppForegrounded | -| The application enters the foreground. | 406| ServiceInner::AppForegrounded | -| The application enters the foreground. | 407| -| AbilityThread::ScheduleAbilityTransaction | The application receives an ability foreground scheduling request. | 408| -| AbilityThread::HandleAbilityTransaction | The main thread executes the ability foreground scheduling. | 409| -| JsUIAbility::OnStart begin | The **onCreate** lifecycle starts. | 410| -| JsUIAbility::OnStart end | The **onCreate** lifecycle ends. | 411| -| JsUIAbility::OnSceneCreated begin | The window scene creation starts. | 412| -| JsUIAbility::OnSceneCreated end | The window scene creation ends. | 413| -| JsUIAbility::OnWillForeground begin | -| 414| -| JsUIAbility::OnWillForeground end |- | 415| -| JsUIAbility::WindowScene::GoForeground begin | The window API is called to execute **goForeground**. | 416| -| UIAbilityImpl::WindowLifeCycleImpl::AfterForeground | The callback after the window migration. | 417| -| JsUIAbility::OnForeground begin | The **onForeground** lifecycle starts. | 418| -| JsUIAbility::OnForeground end | The **onForeground** lifecycle ends. | 419| -| | The foreground lifecycle ends after both the window callback and **onForeground** are complete. | 420 421You can analyze other log information by referring to [Log Specifications](#log-specifications). Note that the main thread is suspended during lifecycle switching in most cases. You can compare the stack and BinderCatcher information in the two event logs. 422