A vehicle-mounted power management method, device and electronic equipment

By offloading tasks from external storage devices asynchronously to an independent thread pool and performing high-priority state compensation when interrupted by sleep, the problems of main thread blocking and state discarding in vehicle power management are solved, achieving fast consistency of vehicle power state and low-power operation.

CN123129882APending Publication Date: 2026-11-20镁佳(北京)科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611286702.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-24
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

In existing technologies, the vehicle power management service is prone to blocking the main thread during the hibernation preparation period due to long-term peripheral operations, which may cause the real-time operating system to time out and crash or abandon hibernation. Furthermore, critical compensation states are easily discarded when hibernation is interrupted, resulting in a false dead state of the vehicle system.

Method used

The offloading task of external storage devices is asynchronously executed in an independent thread pool. When hibernation is interrupted, a look-ahead scan and high-priority state priority compensation are performed on the state waiting queue to ensure that critical states are not discarded. The wake-up action is performed by querying the current power state of the real-time operating system.

Benefits of technology

It avoids main thread blocking, ensures data security of external storage devices, maintains low power consumption of the whole vehicle, and achieves rapid consistency of power status between the two systems, thus avoiding the vehicle's infotainment system from freezing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123129882A_ABST
    Figure CN123129882A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of vehicles and discloses a vehicle-mounted power management method and device and electronic equipment, the method comprising the following steps: when entering a hibernation preparation state, a main thread encapsulates an external storage device unloading task as an asynchronous task and submits the asynchronous task to an independent peripheral thread pool for execution, without waiting for an execution result of the asynchronous task, and meanwhile, a deferred power-off instruction is cyclically sent to a real-time operating system until a readiness confirmation signal is issued after the asynchronous task is executed; when hibernation interruption occurs, a state waiting queue is traversed before state extraction, and a high-priority state is searched; if the high-priority state is searched, the high-priority state is directly taken as a target power state to be executed and the queue is emptied; a hibernation cancellation compensation operation is executed, a power state is inquired from the real-time operating system, and a wake-up action is executed. Therefore, the main thread is prevented from being blocked by a long-time peripheral operation, key compensation states are ensured not to be discarded when hibernation interruption occurs, and the power states of the two systems are quickly and uniformly consistent.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of vehicle technology, specifically to an on-board power management method, device, and electronic device. Background Technology

[0002] With the development of automotive intelligence, cockpit domain controllers generally adopt a cross-domain heterogeneous computing architecture of "one chip, multiple systems": deploying an automotive-grade real-time operating system to manage the vehicle's power status, network communication, and core safety functions, while the upper layer runs an Android operating system through a virtualization layer to manage the central control display, navigation, multimedia playback, and application ecosystem. The Android side runs a power management service, which, based on power status commands pushed by the vehicle's hardware abstraction layer, coordinates and controls the mounting / unmounting of display, audio, and external storage devices, ensuring that the behavior of each subsystem is consistent with the vehicle's current physical state.

[0003] In related technologies, the power management service synchronously calls the storage management service to unload external storage devices in the main thread. When the external storage device has file system fragmentation, bad sectors, excessive capacity, or occupied file descriptors, the unloading operation may last for tens of seconds, causing the main thread to be blocked for a long time and unable to respond to the hibernation handshake. This can easily cause the real-time operating system's timeout watchdog to misjudge and crash, cutting off the main control board's power supply, resulting in damage to the external storage device and system data, or even infinite restarts, or abandoning the hibernation process, leading to long-term high power consumption of the whole vehicle and battery depletion.

[0004] Furthermore, when hibernation is interrupted, the real-time operating system will push multiple mixed transition state instructions intensively within a very short time window and push them into the state waiting queue. However, when the related technology retrieves the state from the queue, it only reads the state at the head of the queue and then clears the entire queue. This causes the key states that represent canceling hibernation and waking up to be discarded. The main thread only performs the switching according to the state at the head of the queue, causing the state machines of the two operating systems to become disconnected. As a result, the vehicle system appears to be in a black screen, silent and unresponsive state.

[0005] Therefore, how to avoid long-running peripheral operations blocking the main thread during the hibernation preparation period, and how to ensure that critical compensation states are not discarded when hibernation is interrupted, and how to achieve rapid consistency of power states between the two systems, have become urgent technical problems to be solved. Summary of the Invention

[0006] This application provides an on-board power management method, device, and electronic device to solve the problem of how to avoid long-running peripheral operations blocking the main thread during the hibernation preparation period, and how to ensure that critical compensation states are not discarded when hibernation is interrupted, thereby achieving fast consistency of power states between the two systems.

[0007] In a first aspect, this application provides an on-board power management method applied to a cockpit domain controller. The power management service in the cockpit domain controller is configured with a state waiting queue, which is used to receive power status commands pushed by the vehicle hardware abstraction layer. The method includes: In response to entering the hibernation preparation state, the main thread of the power management service encapsulates the offloading task of the external storage device into an asynchronous task and submits it to an independent peripheral thread pool for execution. The main thread does not wait for the execution result of the asynchronous task; and during the execution of the asynchronous task, it sends delayed power-down instructions to the real-time operating system in a loop until the asynchronous task is completed and then sends a ready confirmation signal. In response to a sleep interruption, the state wait queue is traversed before retrieving the state from the state wait queue, and a high-priority state representing canceling or exiting sleep is retrieved. If a high-priority state is found, it will be used as the target power state to be executed, and the state waiting queue will be cleared. Execute the hibernation compensation cancellation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform the wake-up action according to the current power state.

[0008] In one alternative implementation, the offloading task of the external storage device is encapsulated as an asynchronous task and submitted to a separate peripheral thread pool for execution, including: The external storage device and its corresponding unloading operation are encapsulated into a runnable task and submitted to a peripheral thread pool built on a blocking queue and a thread pool executor. In one alternative implementation, the main thread returns immediately after submitting the asynchronous task and sends delayed power-down instructions cyclically at a preset frequency until the asynchronous task is completed.

[0009] In one alternative implementation, retrieving high-priority states includes: Retrieve the cancel shutdown state and hibernation exit state; where cancel shutdown state is used to characterize canceling the hibernation preparation process, and hibernation exit state is used to characterize exiting the deep hibernation state from suspension to memory.

[0010] In one alternative implementation, traversing the state waiting queue includes: The truncation process of the state waiting queue is masked, and each state element in the state waiting queue is traversed in turn; the truncation process is the process of reading the head state of the state waiting queue and then clearing the state waiting queue.

[0011] In one alternative implementation, the status waiting queue is a doubly linked list-based waiting queue.

[0012] In one optional implementation, the current power state is queried from the real-time operating system, and a wake-up action is performed based on the current power state, including: After clearing the state waiting queue, query the real-time operating system for the latest power state that is in a steady state; When the current power state indicator is fully enabled, the screen is turned on, the audio output focus is restored, and the peripheral thread pool is notified to remount the external storage device.

[0013] In one alternative implementation, the cockpit domain controller runs a real-time operating system and an upper-layer operating system. The real-time operating system is the QNX operating system, and the upper-layer operating system is the Android operating system. The cyclic sending of power-down delay instructions to the real-time operating system and the querying of the current power status to the real-time operating system are both performed through inter-process communication between the daemon process of the vehicle hardware abstraction layer and the power management service.

[0014] Secondly, this application provides an on-board power management device, comprising: The asynchronous decoupling module is used to encapsulate the unloading task of the external storage device into an asynchronous task and submit it to an independent peripheral thread pool for execution in response to entering the hibernation preparation state. It does not wait for the execution result of the asynchronous task, and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task until the asynchronous task is completed before sending a ready confirmation signal. The look-ahead scanning module is used to traverse the state waiting queue and retrieve high-priority states that indicate cancellation of sleep or exit from sleep in response to a sleep interruption. If a high-priority state is found, it will be used as the target power state to be executed, and the state waiting queue will be cleared. The secondary synchronization module is used to perform the cancellation of hibernation compensation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform the wake-up action according to the current power state.

[0015] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the vehicle power management method of the first aspect or any corresponding embodiment described above.

[0016] The on-board power management method provided in this application achieves the following beneficial technical effects compared to the prior art: By encapsulating the unloading task of external storage devices into asynchronous tasks and submitting them to an independent peripheral thread pool for execution, the main thread does not wait for the result of the asynchronous task execution and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task. This prevents long-running unloading operations from blocking the main thread, and the real-time operating system from crashing due to timeout errors and violently shutting down or abandoning hibernation, thereby ensuring the data security of external storage devices and maintaining low power consumption of the entire vehicle. By traversing the state waiting queue to retrieve high-priority states when hibernation is interrupted and directly using high-priority states as the target power states to be executed, and clearing the state waiting queue, key compensation states such as canceling hibernation and waking up are not discarded, and the power state machines of the two systems do not become disconnected. By executing the cancellation of hibernation compensation operation and querying the current power state of the real-time operating system to execute the wake-up action, the system can quickly restore to a working state consistent with the current physical state of the vehicle, thereby avoiding the vehicle's infotainment system from appearing in a black screen, silent, and unresponsive state. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a flowchart of an on-board power management method according to an embodiment of this application; Figure 2 This is a structural block diagram of an on-board power management device according to an embodiment of this application; Figure 3 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0021] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0022] Before introducing the technical solutions of the embodiments of this application, we will first analyze the problems faced by vehicle power management in related technologies. With the development of automotive intelligence, cockpit domain controllers generally adopt a cross-domain heterogeneous computing architecture of "one chip, multiple systems": deploying a microkernel real-time operating system (such as the QNX operating system) that has been certified for automotive-grade use, responsible for the management of the vehicle's power status, network communication, and core safety functions; the upper layer runs an Android operating system (such as Android Automotive OS) through a virtualization layer, responsible for central control display, navigation, multimedia playback, and application ecosystem. The vehicle microcontroller collects the physical power status, which is abstracted into a digital power status enumeration by the real-time operating system, and pushed to the Android side in real time through the vehicle hardware abstraction layer (VHAL) via a cross-domain communication channel. The Android side runs a power management service (such as the CarPower service), whose main thread receives the power status instructions pushed by the vehicle hardware abstraction layer, and coordinates the control of various subsystems and peripherals such as display, audio, network connection, and mounting / unmounting of external storage devices, so that the behavior of each subsystem is consistent with the current physical state of the vehicle. Before the system enters hibernation, the external storage devices connected to the vehicle's infotainment system must be safely unloaded to ensure that the file system cache is flushed to the physical storage medium and to prevent data corruption.

[0023] However, in related technologies, after the main thread receives the hibernation preparation instruction, the power management service synchronously calls the storage management service to unload all external storage devices via inter-process communication. This call is strongly synchronous and blocking. When external storage devices have file system fragmentation, bad sectors, excessive capacity, or occupied file descriptors, the unloading operation may last for tens of seconds, causing the main thread to be blocked for a long time and unable to respond to other system events. At this time, the real-time operating system starts a timeout watchdog while waiting for the ready confirmation signal. After the timeout, it determines that the system has crashed and directly cuts off the power supply to the main control board, causing damage to external storage devices and system data, and even triggering an infinite restart when the system starts up again; or it abandons the hibernation process, causing the entire vehicle to be in a high power consumption state for a long time, resulting in battery depletion.

[0024] Furthermore, when a vehicle's hibernation preparation process is interrupted, the real-time operating system (RTOS) continuously and intensively pushes multiple mixed transition state instructions to the vehicle's hardware abstraction layer within a very short time window. These instructions include states such as canceling hibernation, transitional standby, and full power-on. These state instructions are sequentially pushed into the state waiting queue, which is based on a linked list structure, within the power management service. However, when the existing power management service retrieves states from this waiting queue, it only performs a single read operation from the head of the queue and then immediately clears the entire queue. This causes all critical states after the head of the queue to be discarded, especially those representing the cancellation of hibernation and wake-up. The main thread then only performs state switching based on the retrieved head of the queue, causing an irreversible disconnect between the two operating system state machines. As a result, the vehicle's infotainment system appears to be in a black screen, silent, and unresponsive state.

[0025] To address the aforementioned technical problems, this application provides an in-vehicle power management method. This method asynchronously offloads the task of external storage devices to an independent thread pool. During hibernation interruption, it performs look-ahead scanning and high-priority state elevation compensation on the state waiting queue, and queries the real-time operating system for power status. This avoids long-running peripheral operations blocking the main thread during the hibernation preparation period and ensures that critical compensation states are not discarded during hibernation interruption, achieving rapid consistency of power status between the two systems. The technical solution of this application embodiment is described in detail below with reference to the accompanying drawings.

[0026] According to an embodiment of this application, an embodiment of an on-board power management method is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0027] This embodiment provides an on-board power management method that can be used in the vehicle's cockpit domain controller. Figure 1 This is a flowchart of an on-board power management method according to an embodiment of this application, such as... Figure 1 As shown, the process includes the following steps: In step S101, in response to entering the hibernation preparation state, the main thread of the power management service encapsulates the unloading task of the external storage device into an asynchronous task and submits it to an independent peripheral thread pool for execution. The main thread does not wait for the execution result of the asynchronous task and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task until the asynchronous task is completed and then sends a ready confirmation signal.

[0028] Specifically, a cockpit domain controller refers to a controller installed in the vehicle cockpit for controlling cockpit display, audio, and power management systems. A power management service (e.g., CarPower service) is a service running in the cockpit domain controller that manages the vehicle's power status based on power status commands pushed by the vehicle hardware abstraction layer. The vehicle hardware abstraction layer is the hardware abstraction layer in the cockpit domain controller that provides a unified vehicle hardware interface for accessing upper-layer services. A hibernation ready state is a state issued by the real-time operating system after the vehicle is turned off and locked, instructing the system to perform final preparations before entering a deep hibernation mode suspended from memory. An asynchronous task is a task object that encapsulates the unloading operation of an external storage device. A peripheral thread pool is a thread pool independent of the main thread, specifically used for executing the mounting and unloading operations of external storage devices. A power-down delay instruction is an instruction used to request the real-time operating system to maintain power for a preset duration, temporarily delaying the power-down action. A readiness confirmation signal is a signal used to indicate that the external storage device has been safely unloaded, allowing the real-time operating system to perform the power-down action.

[0029] In this step, after the real-time operating system issues a hibernation preparation state (such as SHUTDOWN_PREPARE), the main thread of the power management service no longer synchronously calls the storage management service to unload the external storage device via inter-process communication. Instead, it encapsulates the external storage device and its corresponding unloading operation into an asynchronous task and submits it to an independent peripheral thread pool for execution. The main thread returns immediately after submission without waiting for the result of the asynchronous task. During the execution of the asynchronous task, the main thread sends delayed power-down instructions to the real-time operating system's daemon process in a high-frequency heartbeat manner to inform the real-time operating system that the system is still safely refreshing data and has not crashed, requesting that power be maintained. After the peripheral thread pool completes the unloading of the external storage device and cache refresh, the power management service issues a ready confirmation signal to allow the real-time operating system to perform the power-down action. Thus, the time-consuming external storage device unloading operation no longer blocks the main thread. The real-time operating system will not directly cut off the power supply to the main control board due to a timeout error and misjudgment of a system crash, nor will it abandon the hibernation process, causing the entire vehicle to remain in a high-power state for a long time. This ensures the data security of the external storage device and maintains the low power consumption of the entire vehicle.

[0030] In one possible implementation, after the vehicle is turned off and locked, the real-time operating system issues a sleep preparation state to the power management service. The main thread of the power management service encapsulates the external storage devices mounted on the vehicle's infotainment system and their corresponding unloading operations into asynchronous tasks (such as unMountRunnable), and submits them to the peripheral thread pool built based on a blocking queue and a thread pool executor for execution. The main thread immediately returns and remains on standby. During the asynchronous unloading of external storage devices by the peripheral thread pool, the main thread sends delayed power-down instructions to the real-time operating system at a preset frequency. After all external storage devices have been safely unloaded and the cache has been refreshed, the main thread issues a ready confirmation signal.

[0031] In step S102, in response to a sleep interruption, before retrieving a state from the state waiting queue, the state waiting queue is traversed to retrieve a high-priority state that represents canceling or exiting sleep. If a high-priority state is found, it is used as the target power state to be executed, and the state waiting queue is cleared.

[0032] Specifically, a hibernation interruption refers to a situation where, during the system's hibernation preparation process, a user operation such as opening a vehicle door triggers an immediate interruption of hibernation and a system wake-up. The state wait queue is a queue used to serially cache power status instructions pushed by the real-time operating system through the vehicle's hardware abstraction layer. High-priority states represent states that indicate cancellation of hibernation or exit from hibernation, including the power-off cancellation state and hibernation exit state in the program code. The target power state refers to the power state that the current main thread prioritizes for execution.

[0033] In this step, when a hibernation interruption occurs during the vehicle's hibernation preparation process, the real-time operating system continuously and intensively pushes multiple mixed transition state instructions to the vehicle's hardware abstraction layer within a very short time window. These instructions include canceling the shutdown state, transitional standby state, and fully powered-on state. These state instructions are sequentially pushed into the state waiting queue. When the power management service's processing thread is awakened to retrieve a state from the state waiting queue, it first traverses the entire queue to check for high-priority states before retrieval. Since high-priority states may be pushed to any position in the queue by other states, traversing the queue before retrieval ensures that high-priority states representing canceling or exiting hibernation are not overlooked. Once a high-priority state is found at any depth in the state waiting queue, it is directly used as the target power state to be executed. Only after the target power state is determined and successfully retrieved is the state waiting queue allowed to be cleared. This avoids the problem of critical states being discarded when the entire queue is cleared after reading the head state, as seen in related technologies, ensuring that high-priority states representing canceling or exiting hibernation can be retrieved and executed.

[0034] In one possible implementation, after the driver locks the car and closes the door, the system begins the hibernation preparation process. Within a few seconds, the driver opens the driver's door again, and the real-time operating system continuously and intensively pushes three mixed transition state instructions—cancellation of shutdown state, transitional standby state, and fully powered-on state—to the vehicle hardware abstraction layer within tens of milliseconds. These instructions are pushed into the state waiting queue in sequence. Before retrieving the state from the state waiting queue, the processing thread of the power management service first traverses the entire state waiting queue to search for the existence of high-priority states.

[0035] Step S103: Execute the cancellation of hibernation compensation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform a wake-up action according to the current power state.

[0036] Specifically, canceling hibernation compensation operation refers to the operation used to stop the system hibernation process and restore the working mode.

[0037] In this step, the power management service prioritizes executing the sleep cancellation compensation operation corresponding to the target power state. This includes stopping all ongoing sleep cleanup tasks within the system and broadcasting globally to indicate that sleep has been interrupted and to immediately resume operating mode. Since the status wait queue has been cleared, the latest status updates may be lost. Therefore, the service proactively queries the real-time operating system (RTOS) for the latest and stable power state and performs wake-up actions based on this state. For example, when fully powered on, the screen is illuminated, audio output focus is restored, and external storage devices are remounted. Thus, by querying and confirming the latest and stable power state on the ROS side, the power management service and the ROS achieve rapid consistency of power states, preventing the vehicle's infotainment system from displaying a black screen, no sound, and no response – a state of apparent freezing.

[0038] In one possible implementation, the current latest and steady-state power state of the real-time operating system is fully powered on. The power management service lights up the screen, restores the audio output focus, and notifies the peripheral thread pool to remount the external storage device.

[0039] The vehicle power management method provided in this embodiment encapsulates the unloading task of the external storage device into an asynchronous task and submits it to an independent peripheral thread pool for execution. The main thread does not wait for the execution result of the asynchronous task and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task. This prevents long-running unloading operations from blocking the main thread and prevents the real-time operating system from crashing due to timeout errors and violently shutting down or abandoning hibernation, thereby ensuring the data security of the external storage device and maintaining low power consumption of the entire vehicle. In response to hibernation interruption, the method traverses the state waiting queue to retrieve high-priority states before retrieving the state and directly uses the high-priority states as the target power states to be executed, and then clears the state waiting queue, so that key compensation states such as canceling hibernation and waking up are not discarded. By executing the hibernation compensation operation and querying the current power state of the real-time operating system to execute the wake-up action, the system can quickly restore to a working state consistent with the current physical state of the vehicle, thereby avoiding the vehicle's infotainment system from appearing in a black screen, silent, and unresponsive state.

[0040] In some optional implementations, step S101 above includes the following steps: Step a1: Encapsulate the external storage device and the corresponding unloading operation into a runnable task.

[0041] Step a2: Submit the runnable task to the peripheral thread pool built on a blocking queue and a thread pool executor.

[0042] In step a3, the main thread returns immediately after submitting the asynchronous task.

[0043] Step a4: Send delayed power-off instructions cyclically at a preset frequency until the asynchronous task is completed.

[0044] Specifically, a runnable task refers to a task object (such as a task object implementing a runnable interface) that encapsulates an external storage device and its corresponding unloading operation, and can be executed by the thread pool. A blocking queue is a queue used to cache tasks to be executed. A thread pool executor is a thread pool execution component built on the thread pool framework (ThreadPoolExecutor).

[0045] In this embodiment, the main thread encapsulates the external storage device and its corresponding unloading operation into a runnable task and submits it to a peripheral thread pool built based on a blocking queue and a thread pool executor. The main thread returns immediately after submission, consuming only microseconds of packaging and submission time, while the main state machine remains highly sensitive and ready. During the execution of the asynchronous task, the main thread sends delayed power-down instructions cyclically at a preset frequency until the asynchronous task is completed. Thus, by decoupling the unloading operation of the external storage device to an independent thread pool for execution and sending delayed power-down instructions cyclically at a preset frequency, it is further ensured that long-running unloading operations do not block the main thread, and the real-time operating system will not mistakenly judge a crash and cut off power supply due to waiting timeout.

[0046] In one possible implementation, the main thread of the power management service encapsulates the external storage device and its corresponding unmounting operation into a runnable task (such as unMountRunnable), and submits the runnable task to the peripheral thread pool built on LinkedBlockingQueue and ThreadPoolExecutor for execution. The main thread returns immediately after submission and sends delayed power-down instructions cyclically at a preset frequency until the asynchronous task is completed.

[0047] In some optional implementations, step S102 above includes the following steps: Step b1: Retrieve the power off state and hibernation exit state.

[0048] Specifically, the "cancel shutdown" state refers to the state used to indicate the cancellation of the hibernation preparation process (e.g., SHUTDOWN_CANCELLED). The "hibernation exit" state refers to the state used to indicate the exit from the deep hibernation state suspended in memory (e.g., SUSPEND_EXIT).

[0049] In this implementation, high-priority states are defined in the program code as the "cancel shutdown" state and the "exit hibernation" state. When searching for high-priority states, the system checks the status waiting queue to see if either the "cancel shutdown" or "exit hibernation" state exists. Therefore, by explicitly defining high-priority states as the "cancel shutdown" and "exit hibernation" states, the system covers the critical compensation states in hibernation interruption scenarios while avoiding misidentification of other ordinary states as high-priority states.

[0050] In one possible implementation, a look-ahead scanning detector (such as the findStrExitStateInLinkedList function) traverses the state wait queue, retrieving only the cancel shutdown state and hibernation exit state.

[0051] In some optional implementations, step S102 above includes the following steps: Step c1: Disable the truncation process of the state waiting queue and iterate through each state element in the state waiting queue in turn.

[0052] Specifically, truncation refers to the process of clearing the entire state waiting queue after reading the state of the head of the queue.

[0053] In this implementation, before traversing the state waiting queue, the truncation process of clearing the entire state waiting queue immediately after reading the head state is disabled (e.g., the code that clears the queue immediately after reading the head state is disabled). Therefore, by disabling truncation before traversal, the state waiting queue is prevented from being cleared during traversal, ensuring that high-priority states at any position in the queue can be fully traversed.

[0054] In one possible implementation, before retrieving the state from the state waiting queue, the original processing of clearing the entire queue after reading the head state is masked, and instead, all element nodes of the state waiting queue are traversed.

[0055] In some alternative implementations, the status waiting queue is a doubly linked list-based waiting queue.

[0056] Specifically, a bidirectional wait queue is a wait queue built on a linked list structure (such as LinkedList) that supports bidirectional traversal and is used to cache power status instructions pushed by the real-time operating system.

[0057] In this embodiment, the state waiting queue is a bidirectional waiting queue based on a linked list structure, which supports bidirectional traversal, making it easy to fully traverse each state element in the queue to retrieve high-priority states.

[0058] In one possible implementation, the power management service builds a bidirectional wait queue (such as mPendingPowerStates) based on a LinkedList to support full traversal of the state wait queue.

[0059] In some optional implementations, step S103 above includes the following steps: Step d1: After clearing the state waiting queue, query the real-time operating system for the latest power state that is in a steady state.

[0060] Step d2: When the current power state is fully enabled, turn on the screen, restore audio output focus, and notify the peripheral thread pool to remount the external storage device.

[0061] Specifically, steady-state power state refers to the latest power state on the real-time operating system side that is already in a stable state.

[0062] In this implementation, after clearing the state waiting queue, the system queries the real-time operating system (RTOS) for the latest and finally stable hardware power state via the vehicle hardware abstraction layer's synchronization alignment interface. If the retrieved power state is fully powered on, the system performs a wake-up action: turning on the screen, restoring audio output focus, and notifying the peripheral thread pool to remount the external storage device. Thus, by querying and obtaining the latest and stable power state from the ROS side, the system ensures that the wake-up action is consistent with the vehicle's actual physical state.

[0063] In one possible implementation, the power management service queries the real-time operating system through the synchronization alignment interface of the vehicle hardware abstraction layer. After obtaining the fully powered-on status, it lights up the screen, restores the audio output focus, and notifies the peripheral thread pool to remount the external storage device.

[0064] In some alternative implementations, the cockpit domain controller runs a real-time operating system and an upper-level operating system, with the real-time operating system being the QNX operating system and the upper-level operating system being the Android operating system; both the power-down delay command and the query are executed through inter-process communication between the daemon of the vehicle hardware abstraction layer and the power management service.

[0065] In this embodiment, the cockpit domain controller adopts a cross-domain heterogeneous computing architecture with a single chip and multiple systems. It deploys an automotive-grade certified QNX real-time operating system, responsible for managing the vehicle's power status, network communication, and core safety functions. The upper layer runs an Android operating system through a hardware virtualization layer, responsible for central control display, navigation, multimedia playback, and application ecosystem. The real-time operating system pushes power status change requests to the Android side in real time through cross-domain communication channels and the vehicle hardware abstraction layer service on the Android side. Delayed power-down commands and queries are executed through inter-process communication between the vehicle hardware abstraction layer daemon and the power management service.

[0066] In one possible implementation, the power management service uses a cross-domain communication channel between the vehicle hardware abstraction layer daemon (HALDaemon) and the real-time operating system daemon to send delayed power-down commands in a cyclical manner via inter-process communication, and queries the real-time operating system for the latest and stable power state.

[0067] As an optional application scenario of this application embodiment, let's take the scenario where the vehicle's hibernation preparation process is interrupted as an example. The driver has a large-capacity external hard drive (such as a 1TB external hard drive) with bad sectors and file allocation table errors plugged into the Universal Serial Bus (USB) interface in the vehicle's armrest box. After the driver turns off the vehicle, locks it, and leaves, five seconds after locking the car, the driver discovers the files are still inside and quickly opens the driver's side door. At this time, the technical solution of this application embodiment is executed as follows: (1) When the real-time operating system issues a hibernation preparation state, the main thread of the power management service encapsulates the task of unloading the external hard drive into an asynchronous task and submits it to an independent peripheral thread pool for execution. At the same time, it sends the power-down instruction to the real-time operating system in a loop to request that the power supply be maintained. The main thread returns immediately and remains on standby. (2) At the 5th second, the driver opens the car door, and the real-time operating system continuously and intensively pushes three mixed transition state instructions: cancel the power-off state, transition standby state, and fully powered-on state, and pushes them into the state waiting queue. (3) The main thread of the power management service was not blocked by the unloading operation of the external hard drive, and promptly detected the status change of the status waiting queue. Before retrieving the status from the status waiting queue, it traversed the queue and retrieved the cancel shutdown status. (4) Directly use it as the target power state to be executed, and clear the state waiting queue; (5) Prioritize the forced execution of the hibernation compensation cancellation operation corresponding to the cancellation of the shutdown state, and notify all applications in the system to stop hibernation and cancel hibernation; (6) Actively query the real-time operating system to confirm that the latest and steady-state power supply is in a fully powered-on state; (7) Perform wake-up action: turn on the screen, restore audio output focus, and notify the peripheral thread pool to remount the mobile hard drive.

[0068] Through the above process, the vehicle's infotainment system quickly returned to normal operation after the driver opened the car door. Unloading the large-capacity faulty external hard drive did not cause any blockage to the main thread. The key state indicating the cancellation of hibernation was not discarded when hibernation was interrupted. The power states of the two systems remained consistent, avoiding the vehicle's infotainment system from appearing to be in a black screen, silent, and unresponsive state.

[0069] This embodiment also provides an on-board power management device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that implements a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0070] This embodiment provides an on-board power management device, such as... Figure 2 As shown, it includes: The asynchronous decoupling module 201 is used to encapsulate the unloading task of the external storage device into an asynchronous task and submit it to an independent peripheral thread pool for execution in response to entering the hibernation preparation state. It does not wait for the execution result of the asynchronous task and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task until the asynchronous task is completed and then sends a ready confirmation signal. The look-ahead scanning module 202 is used to respond to a sleep interruption by traversing the state waiting queue before retrieving the state from the state waiting queue, and searching for high-priority states that represent canceling or exiting sleep; if a high-priority state is found, the high-priority state is used as the target power state to be executed, and the state waiting queue is cleared. The secondary synchronization module 203 is used to perform the cancellation of hibernation compensation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform a wake-up action according to the current power state.

[0071] In one alternative implementation, the asynchronous decoupling module 201 includes: The task encapsulation unit is used to encapsulate external storage devices and their corresponding unloading operations into runnable tasks and submit them to the peripheral thread pool built based on blocking queues and thread pool executors. The instruction sending unit is used to return immediately after submitting the asynchronous task and to send delayed power-down instructions cyclically at a preset frequency until the asynchronous task is completed.

[0072] In one optional implementation, the look-ahead scanning module 202 includes: The status retrieval unit is used to retrieve the cancel shutdown status and hibernation exit status. The cancel shutdown status is used to characterize the cancellation hibernation preparation process, and the hibernation exit status is used to characterize the deep hibernation state that exits the suspend to memory. The truncation masking unit is used to mask the truncation process of the state waiting queue and sequentially traverse each state element in the state waiting queue. The truncation process is the process of reading the head state of the state waiting queue and then clearing the state waiting queue.

[0073] In one alternative implementation, the status waiting queue is a doubly linked list-based waiting queue.

[0074] In one optional implementation, the secondary synchronization module 203 includes: The status query unit is used to query the real-time operating system for the latest power state that is in a steady state after the status waiting queue is cleared. The wake-up execution unit is used to turn on the screen, restore audio output focus, and notify the peripheral thread pool to remount the external storage device when the current power state indicates that the device is fully powered on.

[0075] In one alternative implementation, the cockpit domain controller runs a real-time operating system and an upper-layer operating system. The real-time operating system is the QNX operating system, and the upper-layer operating system is the Android operating system. The cyclic sending of power-down delay instructions to the real-time operating system and the querying of the current power status to the real-time operating system are both performed through inter-process communication between the daemon process of the vehicle hardware abstraction layer and the power management service.

[0076] The vehicle power management device provided in this application embodiment can execute the vehicle power management method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the above modules are the same as in the corresponding embodiments described above, and will not be repeated here.

[0077] Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0078] The following is a detailed reference. Figure 3The diagram illustrates a structural schematic suitable for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 301, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 302 or a program loaded from memory 308 into random access memory (RAM) 303. The RAM 303 also stores various programs and data required for the operation of the electronic device. The processor 301, ROM 302, and RAM 303 are interconnected via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0079] Typically, the following devices can be connected to I / O interface 305: input devices 306 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 307 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 308 including, for example, magnetic tapes, hard disks, etc.; and communication devices 309. Communication device 309 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 3 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0080] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 309, or installed from memory 308, or installed from ROM 302. When the computer program is executed by processor 301, it performs the functions defined in the vehicle power management method of embodiments of this application.

[0081] Figure 3 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0082] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.

Claims

1. An on-board power management method, applied to a cockpit domain controller, wherein the power management service in the cockpit domain controller is configured with a status waiting queue, the status waiting queue being used to receive power status commands pushed by the vehicle hardware abstraction layer, characterized in that, The method includes: In response to entering the hibernation preparation state, the main thread of the power management service encapsulates the unloading task of the external storage device into an asynchronous task and submits it to an independent peripheral thread pool for execution. The main thread does not wait for the execution result of the asynchronous task, and during the execution of the asynchronous task, it sends a delayed power-down instruction to the real-time operating system in a loop until the asynchronous task is completed and then sends a ready confirmation signal. In response to a sleep interruption, before retrieving a state from the state waiting queue, the state waiting queue is traversed to retrieve a high-priority state representing the cancellation or exit from sleep. If the high-priority state is found, it is used as the target power state to be executed, and the state waiting queue is cleared. Execute the sleep compensation cancellation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform a wake-up action based on the current power state.

2. The method according to claim 1, characterized in that, The step of encapsulating the offloading task of the external storage device into an asynchronous task and submitting it to an independent peripheral thread pool for execution includes: The external storage device and its corresponding unloading operation are encapsulated into a runnable task and submitted to the peripheral thread pool, which is constructed based on a blocking queue and a thread pool executor.

3. The method according to claim 2, characterized in that, The main thread returns immediately after submitting the asynchronous task and sends the delayed power-off instruction repeatedly at a preset frequency until the asynchronous task is completed.

4. The method according to claim 1, characterized in that, The high-priority retrieval status includes: Retrieve the shutdown cancellation state and hibernation exit state; wherein, the shutdown cancellation state is used to characterize the cancellation of the hibernation preparation process, and the hibernation exit state is used to characterize the exit from the deep hibernation state from suspension to memory.

5. The method according to claim 1, characterized in that, The traversal of the state waiting queue includes: The truncation process of the state waiting queue is disabled, and each state element in the state waiting queue is traversed sequentially. The truncation process is the process of reading the head state of the state waiting queue and then clearing the state waiting queue.

6. The method according to claim 1, characterized in that, The status waiting queue is a bidirectional waiting queue based on a linked list structure.

7. The method according to claim 1, characterized in that, The step of querying the real-time operating system for the current power status and performing a wake-up action based on the current power status includes: After clearing the state waiting queue, query the real-time operating system for the latest power state that is in a steady state; When the current power state indicator is fully enabled, the screen is turned on, the audio output focus is restored, and the peripheral thread pool is notified to remount the external storage device.

8. The method according to claim 1, characterized in that, The cockpit domain controller runs a real-time operating system and an upper-layer operating system. The real-time operating system is the QNX operating system, and the upper-layer operating system is the Android operating system. The process of cyclically sending power-down delay commands to the real-time operating system and querying the real-time operating system for the current power status are both executed through inter-process communication between the daemon process of the vehicle hardware abstraction layer and the power management service.

9. A vehicle-mounted power management device, characterized in that, include: The asynchronous decoupling module is used to encapsulate the unloading task of the external storage device into an asynchronous task and submit it to an independent peripheral thread pool for execution in response to entering the hibernation preparation state. It does not wait for the execution result of the asynchronous task, and sends delayed power-down instructions to the real-time operating system in a loop during the execution of the asynchronous task until the asynchronous task is completed before sending a ready confirmation signal. The look-ahead scanning module is used to, in response to a sleep interruption, traverse the state waiting queue and retrieve high-priority states that represent canceling or exiting sleep before retrieving states from the state waiting queue. If the high-priority state is found, the high-priority state is taken as the target power state to be executed, and the state waiting queue is cleared. The secondary synchronization module is used to perform the cancellation of sleep compensation operation corresponding to the target power state, query the current power state from the real-time operating system, and perform a wake-up action according to the current power state.

10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the computer instructions to perform the vehicle power management method according to any one of claims 1 to 8.