harmony 鸿蒙background_process_manager.h

  • 2025-06-12
  • 浏览 (4)

background_process_manager.h

Overview

The background_process_manager.h file declares the APIs for background child process management. You can use these APIs to suppress and unsuppress child processes to prevent child processes from occupying too many system resources and causing system stuttering. The APIs take effect only for the child processes created through OH_Ability_StartNativeChildProcess.

Library: libbackground_process_manager.z.so

System capability: SystemCapability.Resourceschedule.BackgroundProcessManager

Since: 15

Related module: BackgroundProcessManager

Summary

Types

Name Description
typedef enum BackgroundProcessManager_ProcessPriority BackgroundProcessManager_ProcessPriority Defines an enum for the child process priority.
typedef enum BackgroundProcessManager_ErrorCode BackgroundProcessManager_ErrorCode Defines an enum for the error codes used by the background child process management.

Enums

Name Description
BackgroundProcessManager_ProcessPriority { PROCESS_BACKGROUND = 1, PROCESS_INACTIVE = 2 } Enumerates child process priorities.
BackgroundProcessManager_ErrorCode { ERR_BACKGROUND_PROCESS_MANAGER_SUCCESS = 0, ERR_BACKGROUND_PROCESS_MANAGER_INVALID_PARAM = 401, ERR_BACKGROUND_PROCESS_MANAGER_REMOTE_ERROR = 31800001 } Enumerates the error codes used by the background child process management.

Function

Name Description
int OH_BackgroundProcessManager_SetProcessPriority (int pid, BackgroundProcessManager_ProcessPriority priority) Sets the child process priority. After a child process is suppressed, the CPU resources that can be obtained will be limited. If the scheduling policy of the main process changes, for example, from the background to the foreground, the child process changes with the main process. To suppress the child process, call this API again.
int OH_BackgroundProcessManager_ResetProcessPriority (int pid) Unsuppresses the child process. In this case, the child process follows the scheduling policy of the main process. If the scheduling policy of the main process changes, for example, from the background to the foreground, the child process changes with the main process. The effect is the same as calling resetProcessPriority.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Background Tasks Kit

harmony 鸿蒙BackgroundProcessManager

harmony 鸿蒙TransientTask

harmony 鸿蒙TransientTask_DelaySuspendInfo

harmony 鸿蒙DeviceUsageStatistics Error Codes

harmony 鸿蒙backgroundTaskManager Error Codes

harmony 鸿蒙reminderAgentManager Error Codes

harmony 鸿蒙workScheduler Error Codes

harmony 鸿蒙@ohos.WorkSchedulerExtensionAbility (Deferred Task Scheduling Callbacks)

harmony 鸿蒙@ohos.resourceschedule.backgroundProcessManager (Background Child Process Management)

0  赞