openharmony 鸿蒙 hiappevent-watcher-app-killed-events

2026-08-25 浏览 (1)

Application Killed Event Overview

Overview

Since API version 20, HiAppEvent provides APIs for subscribing to application killed events.

The killed event refers to a phenomenon that an application is forced to exit by the system. Unlike an application crash, an application killed event is triggered not by an exception in the application's own code, but by the system's resource-management policy.

HiAppEvent APIs for subscribing to application killed events:

NOTE

Application killed events can be subscribed to using HiAppEvent in application clones and atomic services. Since API version 22, application killed events can be subscribed to using HiAppEvent in input method applications.

The params attribute in the application killed event is described as follows.

Field Description

params

The params attribute in the application killed event is described as follows.

NameTypeDescription
timenumberEvent triggering time, in ms.
reasonstringKilled reason. For details, see reason.
foregroundbooleanWhether the application is in the foreground. The value true indicates that the application is in the foreground, and the value false indicates the opposite.

reason

TypeDescription
IllegalAudioRendererBySuspendNo proper background task is applied for the application, but a large amount of audio is played in the background.
LowMemoryKillLow system memory.
OomKillerThe system memory is used up and cannot be allocated.
PowerSaveCleanThe device is switched to the power saving mode or emergency mode.
ResourceLeak(AshmemLeak)The Ashmem memory usage of the application exceeds the threshold.
ResourceLeak(GpuLeak)The GPU memory usage of the application exceeds the threshold.
ResourceLeak(GpuRsLeak)The GPU memory usage of the application in the Render Service process exceeds the threshold.
ResourceLeak(IonLeak)The ION memory usage of the application exceeds the threshold.
RssThresholdKillerThe Resident Size Set (RSS) usage of the application exceeds the threshold.
SwapFullThe swap space of the system is used up.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 hiappevent-intro

openharmony 鸿蒙 hicollie-guidelines-ndk

openharmony 鸿蒙 event-subscription-overview

openharmony 鸿蒙 hiappevent-watcher-mainthreadjank-events-arkts

openharmony 鸿蒙 hiappevent-watcher-resourceleak-events-ndk

openharmony 鸿蒙 hilog-guidelines-arkts

openharmony 鸿蒙 hiappevent-watcher-apphicollie-events-ndk

openharmony 鸿蒙 hitracechain-guidelines-arkts

openharmony 鸿蒙 hiappevent-watcher-freeze-events

openharmony 鸿蒙 hicollie-settimer-guidelines-ndk

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/qdGe3Mdq