System shutdown control method and apparatus, electronic device, and readable storage medium

By a method of acquiring and processing pending tasks before the system shuts down, the problem that tasks in the prior art cannot be completed before the system shuts down is solved, and data security and system flexibility are improved.

WO2025118717A1PCT designated stage expired Publication Date: 2025-06-12HUAWEI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/115933
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-05
Filing Date
2024-08-30
Publication Date
2025-06-12

AI Technical Summary

Technical Problem

The existing system shutdown method cannot effectively handle all pending tasks, resulting in some tasks being unable to complete before the system shutdown, which may lead to data loss or corruption.

Method used

By responding to the shutdown operation, we obtain multiple target tasks and their task types that are pending before the system shutdown, determine the processing order based on the task type, and control the target application to process the corresponding tasks to ensure that all pending tasks are completed before the system shutdown.

Benefits of technology

It effectively avoids data loss or corruption during system shutdown, meets the pending needs of different types of tasks before the system shutdown, and improves the flexibility of the system shutdown method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024115933_12062025_PF_FP_ABST
    Figure CN2024115933_12062025_PF_FP_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of terminals, and provides a system shutdown control method and apparatus, an electronic device, and a readable storage medium. The control method comprises: in response to a shutdown operation, acquiring a plurality of target tasks to be processed before a system is shut down and the task types of the target tasks; on the basis of the task types of the target tasks, determining a processing sequence of the plurality of target tasks; on the basis of the processing sequence of the plurality of target tasks, controlling target applications corresponding to the target tasks to process the target tasks; and when the processing of the plurality of target tasks is completed, controlling the system to be shut down. Before a system is shut down, on the basis of the processing types of target tasks to be processed, target applications are controlled according to a certain sequence to process the corresponding target tasks, thereby meeting the processing requirements of different types of target tasks before system is shut down, and improving system shutdown flexibility.
Need to check novelty before this filing date? Find Prior Art

Description

System shutdown control method, device, electronic device and readable storage medium

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on December 5, 2023, with application number 2023116567586 and application name “System shutdown control method, device, electronic device and readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of terminal technology, and in particular to a method, device, electronic device, and readable storage medium for controlling system shutdown. Background Art

[0003] The system shutdown process is a power management technology used in mobile operating systems such as the iPhone operating system (iOS) and Android. For example, in the Android operating system for electronic devices, after detecting a user-triggered shutdown operation, the operating system typically first uses an asynchronous shutdown broadcast notification to notify applications that have subscribed to receiving shutdown broadcasts to handle pre-shutdown tasks. It then shuts down the activity management service (AMS), package management service (PMS), radio services, and the kernel system in a fixed order, completing the system shutdown.

[0004] Among them, the types of tasks that electronic devices need to process before shutting down are diverse, such as system or application upgrades, document saving, and data persistent storage. When shutting down based on the existing system shutdown method, only some applications can complete the processing of corresponding tasks before the system shuts down by listening to the shutdown broadcast, but other applications that cannot receive the listening broadcast will stop running when the system service is shut down, resulting in some tasks being unable to be processed before the system shuts down.

[0005] Summary of the Invention

[0006] The present application provides a system shutdown control method, device, electronic device and readable storage medium, which can to a certain extent solve the technical problem that some types of pending tasks cannot be processed before shutdown due to existing system shutdown methods.

[0007] To achieve the above objectives, this application adopts the following technical solutions:

[0008] In a first aspect, the present application provides a method for controlling system shutdown, the method comprising: in response to a shutdown operation, obtaining multiple target tasks to be processed before the system is shut down and the task type of each target task; determining the processing order of the multiple target tasks according to the task type of each target task; controlling the target application corresponding to each target task to process the target task according to the processing order of the multiple target tasks; and controlling the system shutdown after the processing of the multiple target tasks is completed.

[0009] Based on the system shutdown control method provided in the embodiment of the present application, after the user triggers the shutdown operation on the electronic device, the operating system of the electronic device can obtain all target tasks that need to be processed before the system shuts down, and according to the task type of different target tasks, control the target application corresponding to each target task in a certain processing order to complete the processing of the target task before the system shuts down, and then execute the subsequent system shutdown process. This control method can effectively avoid the loss or damage of data of various target applications in the running state in the electronic device when the system is shut down, meet the processing requirements of different types of target tasks before the system is shut down, and improve the flexibility of the system shutdown method.

[0010] Optionally, the operating system obtains multiple target tasks to be processed before the system shuts down and the task type of each target task in the following way: when the target application corresponding to each target task starts running, it can send one or more target tasks that it may need to process before the system shuts down to the operating system, and at the same time send the task type of the target task.

[0011] Illustratively, the target application may determine the task type of the corresponding target task according to the application type and / or the processing method of the target task.

[0012] The shutdown operation can be used to instruct the electronic device to shut down or restart. If the shutdown operation is used to instruct the electronic device to restart, then after the multiple target tasks are completed, the subsequent system shutdown process includes but is not limited to shutting down various system services, shutting down the system kernel, restarting the system kernel, and restarting various system services. If the shutdown operation is used to instruct the electronic device to shut down, then after the multiple target tasks are completed, the subsequent system shutdown process includes but is not limited to shutting down various system services, shutting down the system kernel, and powering off all hardware in the electronic device.

[0013] The electronic devices involved in the control method provided in the embodiments of the present application are mobile phones, tablet computers, wearable devices, and other devices that can be installed with mobile operating systems such as Android, Apple, or Hongmeng.

[0014] In a possible implementation of the first aspect, the method further includes: obtaining a priority level of each target task;

[0015] According to the task type of each target task, the processing order of multiple target tasks is determined, including: sorting the multiple target tasks according to the correspondence between the preset task type and the processing order to obtain a first sorting result; according to the priority level of each target task, adjusting the order of the target tasks with the same task type in the first sorting result to obtain a second sorting result; and determining the processing order of the multiple target tasks based on the second sorting result.

[0016] Based on this possible implementation, when each target application sends a corresponding target task to the operating system, it may also send the priority level of the corresponding target task to the operating system. The operating system may determine the processing order of multiple target tasks of the same task type according to the order of priority from high to low. For example, all tasks corresponding to all applications that can be run on the electronic device may be divided into at least two priority levels.

[0017] In a possible implementation of the first aspect, the processing order of multiple target tasks is determined based on the second sorting result, including: obtaining the generation time of each target task; adjusting the order of target tasks with the same priority level and the same task type in the second sorting result according to the generation time of each target task, to obtain the processing order of multiple target tasks.

[0018] Based on this possible implementation, the target task generation time may be the time when the operating system receives the target task from the target application corresponding to the target task. The operating system may determine the processing order of multiple target tasks of the same priority level and task type based on the order of their generation time from earliest to latest.

[0019] In a possible implementation of the first aspect, according to the processing order of multiple target tasks, the target application corresponding to each target task is controlled to process the target task, including: according to the processing order of multiple target tasks, a system shutdown notification is sent to the target application corresponding to each target task in turn, and the system shutdown notification is used to instruct the target application to process the corresponding target task.

[0020] In a possible implementation of the first aspect, the multiple target tasks include a first task whose task type is a shutdown-takeoverable task, and the target application corresponding to the first task is the first application. A system shutdown notification is sequentially sent to the target application corresponding to each target task according to the processing order of the multiple target tasks, including: sending a system shutdown notification to the first application; receiving a shutdown takeover notification sent by the first application, the shutdown takeover notification being used to instruct the first application to confirm continued processing of the first task based on the system shutdown notification; pausing system shutdown based on the shutdown takeover notification; receiving a task completion notification sent by the first application; and sending a system shutdown notification to the target application corresponding to the next target task after the first task based on the task completion notification and the processing order of the multiple target tasks.

[0021] The first task that can take over the shutdown is a task that takes a long time to process and cannot be forcibly terminated during the process. After taking over the system shutdown, the first application corresponding to the first task that can take over the shutdown can completely independently determine the execution of tasks before the system shutdown. For example, the first task that can take over the shutdown can be an operating system upgrade or an application software upgrade. Correspondingly, the first application can be an application such as system upgrade software or an application market. The operating system can only control one first application to process the corresponding first task at a time.

[0022] In a possible implementation of the first aspect, the multiple target tasks include a second task with an interactive task type, and the target application corresponding to the second task is the second application; according to the processing order of the multiple target tasks, a system shutdown notification is sent to the target application corresponding to each target task in turn, including: sending a system shutdown notification to the second application; receiving a task completion notification sent by the second application, which is sent after the second application detects the existence of the second task based on the system shutdown notification and processes the second task according to the trigger operation of the user on the interactive interface; according to the task completion notification and the processing order of the multiple target tasks, a system shutdown notification is sent to the target application corresponding to the next target task of the second task.

[0023] Among them, the interactive second task is a task that requires interaction with the user, and the second application corresponding to the second task needs to process the second task according to the user's interactive operation. Therefore, if the multiple target tasks obtained include multiple second tasks, the operating system needs to control the second application to synchronously process the corresponding second tasks in sequence according to the processing order, that is, the operating system can only control one second application to process the corresponding second task at the same time, thereby improving the rationality of interaction with the user when the system is shut down.

[0024] Exemplarily, the second task may be a task of saving documents, emails, etc. that the user has not saved. Correspondingly, the second application may be a word processing software, email software, etc., such as WPS Office and Microsoft Office.

[0025] In a possible implementation of the first aspect, the multiple target tasks include a third task whose task type is non-interactive, and the target application corresponding to the third task is a third application; according to the processing order of the multiple target tasks, the target application corresponding to each target task is controlled to process the target task, including: according to the processing order of the multiple target tasks, at every preset time interval, a system shutdown notification is simultaneously sent to the third application corresponding to the third task with the same priority level, and the system shutdown notification is used to instruct the third application to process the corresponding third task within the preset time.

[0026] The third task is a lightweight task that does not require user interaction and has a short processing time. Therefore, the operating system can control multiple third applications to asynchronously process the corresponding third tasks at the same time, thereby improving task processing efficiency and shortening the shutdown time of the electronic device. If a third application does not complete the corresponding third task within the preset time, it does not need to continue processing the unfinished portion of the third task.

[0027] Exemplarily, the third task may be a task such as data persistent storage.

[0028] In a second aspect, the present application provides a system shutdown control device, comprising: at least one unit for executing the method in any possible implementation manner of the first aspect.

[0029] In a third aspect, the present application provides an electronic device, comprising: a processor, the processor being configured to run a computer program stored in a memory to implement the method in any possible implementation manner of the first aspect.

[0030] In a fourth aspect, the present application provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the method in any possible implementation manner of the first aspect.

[0031] In a fifth aspect, the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes the method in any possible implementation manner of the first aspect.

[0032] The technical effects of the second to fifth aspects provided in this application can refer to the technical effects of the various possible implementation methods of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] FIG1 is a schematic diagram of a shutdown process of an existing operating system provided in an embodiment of the present application.

[0034] FIG2 is a schematic diagram of the operating system structure of an electronic device provided in an embodiment of the present application.

[0035] FIG3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

[0036] FIG4 is a flow chart of a method for controlling system shutdown provided in an embodiment of the present application.

[0037] FIG5 is a schematic diagram of a processing sequence of multiple target tasks provided in an embodiment of the present application.

[0038] FIG6 is a flowchart diagram 1 of controlling a target application to process a corresponding target task provided by an embodiment of the present application.

[0039] FIG7 is a second flow chart of a control target application processing corresponding target task provided by an embodiment of the present application.

[0040] FIG8 is a third flow chart of a control target application processing corresponding target task provided by an embodiment of the present application.

[0041] FIG9 is a schematic block diagram of a system shutdown control device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application are described below in conjunction with the drawings and related embodiments in the embodiments of the present application. Among them, in the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations on the present application. As used in the specification and claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include expressions such as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: the existence of A alone, the existence of A and B at the same time, and the existence of B alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in a kind of "or" relationship.

[0043] References to "one embodiment" or "some embodiments" etc. described in this specification mean that the specific features, structures or characteristics described in conjunction with the embodiment are included in one or more embodiments of the present application. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. appearing in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in another way. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in another way. The term "connected" includes direct and indirect connections, unless otherwise stated. "First" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.

[0044] In the embodiments of this application, words such as "exemplarily" or "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of this application should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplarily" or "for example" is intended to present the relevant concepts in a concrete manner.

[0045] The steps involved in the methods provided in the embodiments of the present application are merely examples. Not all steps are mandatory, nor are all information or messages required. They can be added or removed as needed during use. In the embodiments of the present application, the same step or steps or messages with the same function can be referenced and learned from each other in different embodiments.

[0046] The iPhone operating system (iOS), Android, and Harmony are commonly used mobile operating systems for electronic devices. System shutdown is a power management technology used in mobile operating systems. When a user shuts down or restarts an electronic device, the operating system first shuts down any processes running in user mode and then shuts down the system kernel to complete the system shutdown.

[0047] Specifically, see the shutdown process diagram of an existing operating system shown in Figure 1. Taking the Android system installed on an electronic device as an example, if a user triggers a shutdown operation on the electronic device, the operating system can issue a shutdown broadcast based on the shutdown operation. Applications pre-registered to receive the shutdown broadcast can then process pre-shutdown tasks after listening to the shutdown broadcast. Then, various system services are shut down in a fixed order, including the activity manager service (AMS), package manager service (PMS), and radios service. After completing the upper-layer shutdown process, the power manager service calls the lower layer and sets the system property to "SystemProperties.set("sys.powerctl", "shutdown")" to enter the lower-level shutdown process to shut down the system kernel. Finally, all hardware is powered off to shut down the electronic device.

[0048] Electronic devices run a wide variety of applications, each requiring execution of tasks before system shutdown to prevent data loss. These tasks, such as saving user-edited documents or application or system configuration information, can be performed before system shutdown using existing system shutdown methods by listening for shutdown broadcasts. However, other applications that are unable to listen for broadcasts cease execution when the operating system shuts down system services, preventing some tasks from being completed before system shutdown.

[0049] In addition, the existing system shutdown process is fixed and lacks scalability and flexibility. If there are new tasks to be processed before shutdown, system developers need to insert the new tasks to be processed before shutdown into the existing system shutdown process, which increases the development difficulty for system developers.

[0050] In order to solve the above problems, the embodiments of the present application provide a system shutdown control method, device, electronic device and readable storage medium. After the user triggers the shutdown operation on the electronic device, the operating system in the electronic device can first obtain all target tasks that need to be processed before the system shuts down, and determine the processing order of each type of target tasks according to the task type of the target task, and then control the target application corresponding to each target task to process its respective target task. This control method can meet the processing requirements of different types of target tasks before the system shuts down, thereby improving the flexibility of system shutdown.

[0051] The operating system involved in the system shutdown control method provided in the embodiment of the present application can be a mobile operating system such as Android, Apple, or Hongmeng. Referring to Figure 2, there is a schematic diagram of the operating system structure of the electronic device provided in the embodiment of the present application.

[0052] In some embodiments, the operating system of the electronic device can be divided into four layers, including a hardware layer, a kernel layer, a system service layer, and an application layer, and the layers communicate with each other through software interfaces.

[0053] As shown in Figure 2, the hardware layer includes physical devices that provide specific interactive responses, such as speakers, sensors, WLAN, modems, microphones, displays, and motors.

[0054] The kernel layer includes the kernel abstract layer (KAL) and the driver subsystem. The KAL includes multiple kernels, such as the Linux kernel and LiteOS, a lightweight IoT kernel. The multi-kernel kernel layer can select the appropriate kernel for processing based on system requirements. The driver subsystem can include the hardware driver foundation (HDF), such as audio drivers, wireless local area network (WLAN) drivers, and modem drivers. The hardware driver framework provides unified peripheral access capabilities and a driver development and management framework.

[0055] The system service layer is the core capability set of the operating system. It provides services to applications through the framework layer. This layer includes the system basic capability subsystem set, the basic software service subsystem set, the enhanced software service subsystem set, and the hardware service subsystem set.

[0056] The system's basic capability subsystems provide the fundamental capabilities for the operation, scheduling, and migration of distributed applications on devices within the operating system. These subsystems include distributed soft buses, distributed data management, distributed task scheduling, the Ark multi-language runtime, common base libraries, multi-modal input, graphics, security, artificial intelligence (AI), and user program frameworks. The Ark multi-language runtime provides C, C++, or JavaScript (JS) multi-language runtimes and basic system class libraries. It also provides a runtime for Java programs statically compiled using the Ark compiler (i.e., the Java language-developed portion of the application or framework layer).

[0057] The basic software service subsystem provides common and general software services for the operating system, including download services, multimedia services, power services, telephone services, etc.

[0058] The enhanced software service subsystem provides the operating system with differentiated, device-specific, capability-enhancing software services. This includes specialized services for smart screens, wearables, and the Internet of Things (IoT).

[0059] The hardware service subsystem provides hardware services for the operating system. This includes location services, biometric recognition, wearable hardware services, IoT hardware services, and other subsystems.

[0060] The application layer includes system applications and third-party applications (or extended applications). System applications may include applications installed by default on electronic devices such as the desktop, control bar, settings, and phone. Extended applications can be non-essential applications developed and designed by the manufacturer of the electronic device, such as electronic device managers, device migration, notes, weather, browsers, and other applications. Third-party non-system applications can be developed by other manufacturers but can run applications in the operating system, such as conference, game, navigation, social, shopping, music, and other applications.

[0061] Multiple electronic devices running operating systems can achieve hardware mutual assistance and resource sharing through distributed soft buses, distributed device virtualization, distributed data management and distributed task scheduling.

[0062] The electronic devices involved in the system shutdown control method provided in the embodiment of the present application are mobile phones, tablet computers, wearable devices, and other devices that can be installed with mobile operating systems such as Android, Apple, or Hongmeng. The embodiment of the present application does not impose any restrictions on the specific type of electronic device.

[0063] Next, the electronic device involved in the embodiment of the present application is introduced. Please refer to FIG3 , which shows a schematic structural diagram of an electronic device 300 .

[0064] The electronic device 300 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, a sensor module 370, a button 380, and a display screen 390. The sensor module 370 may include a pressure sensor 370A, a gyroscope sensor 370B, an acceleration sensor 370C, a temperature sensor 370D, a touch sensor 370E, and the like.

[0065] The processor 310 may include one or more processing units. For example, the processor 310 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0066] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0067] Processor 310 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 310 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 310. If processor 310 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 310 latency, and thus improves system efficiency.

[0068] In some embodiments, the processor 310 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface.

[0069] The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 310 may include multiple I2C bus lines. The processor 310 may be coupled to the touch sensor 370E, a charger, etc., via different I2C bus interfaces. For example, the processor 310 may be coupled to the touch sensor 370E via the I2C interface, enabling communication between the processor 310 and the touch sensor 370E via the I2C bus interface, thereby implementing the touch function of the electronic device 300.

[0070] The UART interface is a universal serial data bus for asynchronous communication. The bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is generally used to connect the processor 310 and the wireless communication module 360. For example, the processor 310 communicates with the Bluetooth module in the wireless communication module 360 ​​via the UART interface to implement the Bluetooth function. The MIPI interface can be used to connect the processor 310 to peripheral devices such as the display screen 390. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 310 and the display screen 390 communicate via the DSI interface to implement the display function of the electronic device 300.

[0071] The GPIO interface can be configured through software. The GPIO interface can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 310 to the display 390, the wireless communication module 360, the sensor module 370, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.

[0072] USB interface 330 is an interface that complies with USB standards and specifications, and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. USB interface 330 can be used to connect a charger to charge electronic device 300, or to transfer data between electronic device 300 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as AR devices.

[0073] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present application is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 300. In other embodiments of the present application, the electronic device 300 may also adopt a different interface connection method from the above embodiment, or a combination of multiple interface connection methods.

[0074] The charging management module 340 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 340 can receive charging input from the wired charger via the USB interface 330. In some wireless charging embodiments, the charging management module 340 can receive wireless charging input via the wireless charging coil of the electronic device 300. While charging the battery 342, the charging management module 340 can also provide power to the electronic device via the power management module 341.

[0075] The power management module 341 is used to connect the battery 342, the charging management module 340, and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340 and provides power to the processor 310, the internal memory 321, the display 390, and the wireless communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 341 can also be provided in the processor 310. In other embodiments, the power management module 341 and the charging management module 340 can also be provided in the same device.

[0076] The wireless communication function of the electronic device 300 can be implemented through the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor and the baseband processor.

[0077] Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 300 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0078] The mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 300. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 350 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the processor 310. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the same device as at least some of the modules of the processor 310.

[0079] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium- or high-frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor displays images or videos via the display screen 390. In some embodiments, the modem processor may be a standalone device. In other embodiments, the modem processor may be independent of the processor 310 and be provided in the same device as the mobile communication module 350 or other functional modules.

[0080] The wireless communication module 360 ​​can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 300. The wireless communication module 360 ​​can be one or more devices that integrate at least one communication processing module. The wireless communication module 360 ​​receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 310. The wireless communication module 360 ​​can also receive the signal to be sent from the processor 310, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0081] In some embodiments, antenna 1 of electronic device 300 is coupled to mobile communication module 350, and antenna 2 is coupled to wireless communication module 360, so that electronic device 300 can communicate with a network and other devices via wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0082] Electronic device 300 implements display functionality through a GPU, display screen 390, and an application processor. The GPU is a microprocessor for image processing that connects display screen 390 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 310 may include one or more GPUs that execute program instructions to generate or modify display information.

[0083] Display screen 390 is used to display images, videos, and the like. Display screen 390 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 300 may include one or N display screens 390, where N is a positive integer greater than one.

[0084] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 300 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0085] Video codecs are used to compress or decompress digital video. Electronic device 300 may support one or more video codecs. This allows electronic device 300 to play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, and MPEG4.

[0086] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU enables intelligent cognitive applications in electronic device 300, such as image recognition, face recognition, speech recognition, and text comprehension.

[0087] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 300. The external memory card communicates with the processor 310 via the external memory interface 320 to implement data storage functions. For example, files such as videos can be stored in the external memory card.

[0088] The internal memory 321 can be used to store computer executable program codes, which include instructions. The internal memory 321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 300 (such as a phone book, etc.), etc. In addition, the internal memory 321 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 310 executes various functional applications and data processing of the electronic device 300 by running instructions stored in the internal memory 321 and / or instructions stored in a memory provided in the processor.

[0089] Pressure sensor 370A is used to sense pressure signals and convert them into electrical signals. In some embodiments, pressure sensor 370A can be located on display screen 390. There are many types of pressure sensors 370A, such as resistive, inductive, and capacitive. A capacitive pressure sensor can include at least two parallel plates made of conductive material. When force acts on pressure sensor 370A, the capacitance between the electrodes changes. Electronic device 300 determines the intensity of the pressure based on this change in capacitance. When a touch operation is applied to display screen 390, electronic device 300 detects the touch intensity based on pressure sensor 370A. Electronic device 300 can also calculate the touch location based on the detection signal from pressure sensor 370A. In some embodiments, touch operations applied to the same touch location but with different touch intensities can correspond to different operation instructions. For example, when a touch operation with an intensity less than a first pressure threshold is applied to a short message application icon, an instruction to view short messages is executed. When a touch operation with an intensity greater than or equal to the first pressure threshold is applied to a short message application icon, an instruction to create a new short message is executed.

[0090] The gyroscope sensor 370B can be used to determine the motion of the electronic device 300. In some embodiments, the gyroscope sensor 370B can be used to determine the angular velocity of the electronic device 300 around three axes (i.e., the x, y, and z axes). The gyroscope sensor 370B can be used for navigation and somatosensory gaming scenarios.

[0091] Accelerometer 370C can detect the magnitude of acceleration of electronic device 300 in all directions (generally three axes). When electronic device 300 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the electronic device's posture, enabling applications such as switching between landscape and portrait modes and pedometers.

[0092] The temperature sensor 370D is used to detect temperature. In some embodiments, the electronic device 300 uses the temperature detected by the temperature sensor 370D to implement a temperature processing strategy. For example, when the temperature reported by the temperature sensor 370D exceeds a threshold, the electronic device 300 reduces the performance of the processor located near the temperature sensor 370D to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 300 heats the battery 342 to prevent the electronic device 300 from shutting down abnormally due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 300 boosts the output voltage of the battery 342 to prevent abnormal shutdown due to low temperature.

[0093] Touch sensor 370E, also known as a "touch device," can be disposed on display screen 390. Touch sensor 370E and display screen 390 form a touch screen, also known as a "touch screen." Touch sensor 370E is used to detect touch operations applied thereto or in the vicinity thereof. The touch sensor can transmit the detected touch operations to an application processor to determine the type of touch event. Visual output related to the touch operations can be provided via display screen 390. In other embodiments, touch sensor 370E can also be disposed on the surface of electronic device 300, at a location different from that of display screen 390.

[0094] The keys 380 include a power key, a volume key, etc. The keys 380 may be mechanical keys or touch keys. The electronic device 300 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 300.

[0095] It should be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 300. In other embodiments of the present application, the electronic device 300 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0096] Next, the system shutdown control method provided by the embodiment of the present application is introduced. Figure 4 is a flow chart of a system shutdown control method provided by the embodiment of the present application. The method can be applied to the electronic device installed with the mobile operating system described above. The method includes steps S410 to S440. Each step is described in detail below.

[0097] S410 , in response to a shutdown operation, obtaining a plurality of target tasks to be processed before the system is shut down and a task type of each target task.

[0098] In an embodiment of the present application, the triggering condition for the shutdown operation may be the automatic shutdown of the electronic device due to insufficient power, forced shutdown of the electronic device by the user, automatic shutdown of the electronic device at a preset time, or shutdown caused by restart of the electronic device, etc. For example, when the user forces shutdown, the user triggers a single mechanical button on the electronic device (for example, pressing the power button for a preset time), or triggers multiple mechanical buttons on the electronic device (for example, pressing the power button and the volume button simultaneously for a preset time), and triggers the shutdown button in the prompt message displayed on the display screen of the electronic device, thereby triggering the shutdown operation of the electronic device.

[0099] It should be noted that after a user triggers a shutdown operation on an electronic device, the operating system of the electronic device may obtain a target task that needs to be processed before the system shuts down, or may obtain multiple target tasks that need to be processed before the system shuts down. The multiple target tasks obtained by the operating system may include multiple tasks that need to be processed before the system shuts down by a target application running on the electronic device, and / or multiple different tasks that need to be processed before the system shuts down by multiple different target applications running on the electronic device.

[0100] Exemplarily, the target application can be system software installed on the electronic device, such as operating system software, language processing system software, database management system software, memo, etc.; the target application can also be third-party software installed on the electronic device, such as word processing software such as WPS Office, Microsoft Office, email software, etc.

[0101] In this application, the application software installed in the electronic device can communicate with the operating system of the electronic device through the software development kit (SDK) interface, where the SDK is developed based on the operating system of the electronic device. Specifically, it is a collection of development tools that software engineers use to create application software for specific software packages, software frameworks, hardware platforms, and operating systems. It can be simple files that provide application program interfaces for a certain programming language, but it may also include complex hardware that can communicate with a certain embedded system.

[0102] After the target application installed in the electronic device starts running, it can actively send one or more target tasks that the target application itself needs to process before the system shuts down, as well as the task type of each target task, to the operating system through the SDK interface, so that after the operating system detects that the user triggers the shutdown operation, it can control each target application to process the corresponding target task before the system shuts down.

[0103] For example, the target task may be a system upgrade task of an operating system software, a data persistent storage task of a database management system software, a document saving task of a word processing software, and the like.

[0104] In one embodiment, the task type of the task to be processed is related to the function of the corresponding application and the task processing method. Based on the application corresponding to the task to be processed and the task processing method, the multiple target tasks to be processed before the system is shut down can be divided into three categories. Specifically, the first category of target tasks may include one or more first tasks whose task type is to take over the shutdown, the second category of target tasks may include one or more second tasks whose task type is interactive, and the third category of target tasks may include one or more third tasks whose task type is non-interactive.

[0105] The first task that can take over the shutdown is a task that takes a long time to process and cannot be forcibly terminated during the process. The target application corresponding to the first task is the first application. For example, the first application can be an application such as system upgrade software or an application market. Accordingly, the first task can be an operating system upgrade or an application software upgrade. If the operating system or application software is forcibly terminated during the upgrade process, the operating system and the application may be damaged.

[0106] An interactive secondary task is a task that requires interaction with the user. The target application corresponding to the secondary task is the secondary application. The secondary application must respond to user interaction instructions to process the corresponding secondary task. The operating system can sequentially control each secondary application to synchronously process the corresponding secondary task. For example, the secondary application may be word processing software such as WPS Office or Microsoft Office, or email software. Accordingly, the secondary task may be a task such as saving a user's unsaved documents or emails.

[0107] A non-interactive third task is a lightweight task that requires no user interaction and has a short processing time. The target application for the third task is a third application. The operating system can simultaneously control multiple third applications to asynchronously process the corresponding third tasks. For example, the third application can be data persistence service software, and accordingly, the third task can be data persistence storage, etc.

[0108] It should be noted that the classification method of the task types of the target tasks and the number of task types in the embodiments of the present application are merely exemplary and do not constitute a specific limitation on the different task types of the target tasks. The task types of the target tasks can be divided based on other classification methods.

[0109] S420: Determine a processing order of the multiple target tasks according to the task type of each target task.

[0110] In one embodiment, if the target tasks acquired by the operating system of the electronic device have different task types, all the target tasks may be sorted according to a preset correspondence between the task types and the processing order to obtain the processing order of the target tasks.

[0111] Exemplarily, the target task may be processed in a preset processing order of a task type that can take over shutdown, an interactive task type, and a non-interactive task type.

[0112] In other embodiments, if the multiple target tasks acquired by the operating system of the electronic device include multiple target tasks with the same task type, the operating system can also obtain the priority level of each target task to further sort the processing order of multiple target tasks with the same task type according to the priority level of the target task.

[0113] Specifically, the operating system of the electronic device can sort the multiple target tasks obtained according to the correspondence between the task type and the processing order of the preset tasks to obtain a first sorting result; adjust the order of the target tasks with the same task type in the first sorting result according to the priority level of each target task to obtain a second sorting result; and determine the processing order of the multiple target tasks based on the second sorting result.

[0114] Among them, the priority level of the target task includes at least two. When the task types of multiple target tasks are the same, the operating system can give priority to controlling the target application corresponding to the target task with a higher priority to process the target task. In one example, the priority level of the target task can be determined by the operating system according to the type of the target application corresponding to the target task. For example, the type of the target application corresponding to the target task is third-party software installed on the electronic device or system-provided software. Accordingly, the priority level of the target task can include two, and the priority level of the target task corresponding to the system-provided software is higher than the priority level of the target task corresponding to the third-party application.

[0115] In another example, when each target application sends a corresponding target task to the operating system, it may also send a priority level of the corresponding target task to the operating system. For example, the target task may have three priority levels, and the three priority levels are arranged in descending order as first priority level, second priority level, and third priority level.

[0116] As an example and not a limitation, assuming that the multiple target tasks acquired by the operating system include multiple first tasks whose task type is capable of takeover shutdown, multiple second tasks whose task type is interactive, and multiple third tasks whose task type is non-interactive, and each target task type includes at least one target task with a first priority, at least one target task with a second priority, and at least one target task with a third priority, the processing order of the multiple target tasks acquired by the operating system may be as shown in FIG5. Referring to FIG5, the processing order of the multiple target tasks is: the first task whose task type is capable of takeover shutdown and has a first priority, the first task whose task type is capable of takeover shutdown and has a second priority, the first task whose task type is capable of takeover shutdown and has a third priority, the second task whose task type is interactive and has a first priority, the second task whose task type is interactive and has a second priority, the second task whose task type is interactive and has a third priority, the third task whose task type is non-interactive and has a first priority, the third task whose task type is non-interactive and has a second priority, and the third task whose task type is non-interactive and has a third priority.

[0117] It should be noted that the embodiment of the present application does not specifically limit the number of priority levels of the task. In other embodiments of the present application, the number of priority levels of the target task can be greater than three.

[0118] Furthermore, in other embodiments, if there are at least two target tasks with the same task type and priority among all the target tasks obtained by the operating system, the operating system can also obtain the generation time of each target task, and adjust the order of multiple target tasks with the same priority and the same task type in the above second sorting result according to the generation time of each target task, so as to further determine the processing order of all target tasks.

[0119] The target task generation time can be the specific moment when the operating system receives the corresponding target task sent by the target application. In the case where there are multiple target tasks with the same task type and priority, the operating system can determine the processing order of multiple target tasks with the same task type and priority among all the acquired target tasks in descending order of generation time, thereby giving priority to controlling the target application corresponding to the target task with the earlier generation time to process the target task.

[0120] Optionally, if among all the target tasks acquired by the operating system, there are at least two target tasks with the same task type, priority level and generation time, the operating system can randomly sort the at least two target tasks with the same priority level, task type and generation time in the above second sorting result.

[0121] S430 , controlling a target application corresponding to each target task to process the target task according to the processing order of the multiple target tasks.

[0122] In this step, the operating system controls the target application corresponding to the target task of each task type to process the target task differently. Specifically, for at least one task type among the multiple target tasks acquired by the operating system is a first task that can take over the shutdown, the following method 1 can be used to control the first application corresponding to the first task to process the first task. For at least one task type among the multiple target tasks acquired by the operating system is an interactive second task, the following method 2 can be used to control the second application corresponding to the second task to process the second task. For at least one task type among the multiple target tasks acquired by the operating system is a non-interactive third task, the following method 3 can be used to control the third application corresponding to the third task to process the third task.

[0123] The following specifically describes the process in which the operating system controls target applications corresponding to target tasks of different task types to process target tasks through different implementation methods in conjunction with corresponding flow charts.

[0124] Method 1

[0125] For one or more of the multiple target tasks obtained by the operating system, whose task type is the first task that can take over the shutdown, the operating system can send a system shutdown notification to the first application corresponding to each first task in turn according to the processing order of the first tasks. The system shutdown notification can be used to instruct the first application to process the corresponding first task.

[0126] In one implementation, referring to the flowchart diagram 1 of controlling a target application to process a corresponding target task shown in Figure 6 , the operating system can control any first application to process a corresponding first task through the steps in Figure 6 .

[0127] S610: The operating system sends a system shutdown notification to the first application.

[0128] S620: The first application determines whether to continue processing the first task based on the system shutdown notification.

[0129] It should be noted that, after the first application installed in the electronic device is started and running, it can send the first task to be processed before the system shuts down to the operating system. Therefore, it is possible that the first application has already processed the first task when the user triggers the shutdown operation of the electronic device, or it is possible that the first application has not yet completed the first task when the user triggers the shutdown operation of the electronic device. Therefore, after receiving the system shutdown notification sent by the operating system, the first application needs to determine whether the first task has been completed and whether it needs to continue processing if the first task has not been completed.

[0130] S630: If the first application determines to continue processing the first task, it sends a shutdown takeover notification to the operating system.

[0131] When the user triggers the shutdown operation of the electronic device and the first application has not completed processing the first task, the first application can determine that it needs to continue processing the first task based on the system shutdown notification. Accordingly, after determining that it needs to continue processing the first task, the first application can send a shutdown takeover notification to the operating system and continue processing the first task, wherein the shutdown takeover notification can be used to indicate that the first application needs to continue processing the first task and take over the system shutdown.

[0132] S640: The operating system suspends system shutdown according to the shutdown takeover notification.

[0133] In another implementation, after the operating system suspends system shutdown, it is necessary to restart the system shutdown process after the first application completes processing the corresponding first task, so as to control other target applications to process the corresponding target tasks. Therefore, after the above step S640, the method for the operating system to control the first application to process the corresponding first task also includes the following steps S650 and S660.

[0134] S650: After processing the first task, the first application sends a task completion notification to the operating system.

[0135] S660: The operating system sends a system shutdown notification to a target application corresponding to the next target task of the first task according to the task completion notification and the processing order of the multiple target tasks.

[0136] Among them, according to the processing order of all target tasks obtained by the operating system, the next target task of the first task can be the next first task whose generation time is the same as the generation time of the currently processed first task and has the same priority level, or the next first task whose generation time is later than the generation time of the currently processed first task and has the same priority level, or the first task with the next priority level, or the second task, or the third task.

[0137] It is understandable that in method one, when the user triggers the shutdown operation of the electronic device, if the first application has already processed the first task, the first application can determine that it does not need to continue processing the first task based on the system shutdown notification, and the first application can send a non-takeover notification to the operating system. The non-takeover notification can be used to instruct the first application not to continue processing the first task and not to take over the system shutdown. After receiving the non-takeover notification, the operating system can send a system shutdown notification to the target application corresponding to the next target task of the first task according to the processing order of the multiple target tasks determined in the above embodiment, so as to instruct the target application corresponding to the next target task to process the target task.

[0138] Method 2

[0139] For one or more interactive second tasks among the multiple target tasks obtained by the operating system, the operating system can perform synchronous processing on the second tasks according to the processing order of the second tasks. Specifically, the system shutdown notification can be sent to the second application corresponding to each second task in turn. The system shutdown notification can be used to instruct the second application to process the corresponding first task.

[0140] In one implementation, referring to the second flow diagram of controlling a target application to process a corresponding target task shown in Figure 7 , the operating system can control any second application to process a corresponding second task through the steps in Figure 7 . Each step is described in detail below.

[0141] S710: The operating system sends a system shutdown notification to the second application.

[0142] S720: The second application detects whether a second task exists according to the system shutdown notification.

[0143] It should be noted that the second task is a task that the second application needs to process based on the user's interactive instructions, and the second application installed in the electronic device can send the second task that may need to be processed before the system shuts down to the operating system after it is started. Therefore, when the user triggers the shutdown operation of the electronic device, the second application may have already processed the corresponding second task based on the user's interactive instructions; or when the user triggers the shutdown operation of the electronic device, the second application may not detect the user's interactive instructions and does not process the second task. Therefore, after receiving the system shutdown notification sent by the operating system, the second application can first detect whether there is a second task to be processed.

[0144] S730: If the second application detects the existence of the second task, it displays an interactive interface and processes the second task according to the user's triggering operation on the interactive interface.

[0145] Specifically, if the second application detects that there is a second task that needs to be processed based on the system shutdown notification, it can display an interactive interface on the display interface of the electronic device and process the second task according to the processing method indicated by the user's trigger operation on the interactive interface.

[0146] As an example and not a limitation, assume that the second task is to save a word document that the user has not saved, and the second application is WPS Office. If WPS Office detects that there is a first word document in editing state that has not been saved after receiving the system shutdown notification sent by the operating system, an interactive interface is displayed in the display interface of the electronic device. The interactive interface displays a prompt message "Do you want to save changes to the first word document", a "Yes" button and a "No" button. If the user triggers the "Yes" button, the second application can save the first word document to the preset storage space. If the user triggers the "No" button, the second application does not save the first word document.

[0147] It should be noted that if the second application does not detect the user's trigger operation on the interactive interface, it cannot process the corresponding second task, thereby blocking the system shutdown process of the operating system. The operating system can only continue to execute the next target task after the second application detects the user's trigger operation and processes the second task.

[0148] In another implementation, the operating system needs to continue executing the system shutdown process after the second application completes processing the corresponding second task. Therefore, after the above step S730, the method for the operating system to control the second application to process the corresponding second task also includes the following steps S740 and S750.

[0149] S740: After processing the second task, the second application sends a task completion notification to the operating system.

[0150] S750: The operating system sends a system shutdown notification to a target application corresponding to the next target task of the second task according to the task completion notification and the processing order of the multiple target tasks.

[0151] Among them, the next target task of the second task can be the next second task whose generation time is the same as the generation time of the currently processed second task and has the same priority level, or the next second task whose generation time is later than the generation time of the currently processed second task and has the same priority level, or the second task with the next priority level, or the third task.

[0152] It can be understood that in method two, if the second application detects that there is no second task to be processed based on the system shutdown notification, the second application can send a notification to the operating system to instruct the operating system to continue executing the system shutdown process, so that the operating system can send a system shutdown notification to the target application corresponding to the next target task of the second task according to the processing order of multiple target tasks.

[0153] Method 3

[0154] The non-interactive third task is a lightweight task that does not require interaction with the user and has a short processing time. Therefore, the operating system can control multiple third applications to asynchronously process the corresponding third tasks at the same time, thereby improving the processing efficiency of the task and shortening the shutdown time of the electronic device.

[0155] In one implementation, the operating system may simultaneously send a system shutdown notification to a third application corresponding to a third task with the same priority level at predetermined intervals based on the processing order of the multiple target tasks. The system shutdown notification instructs the third application to process the corresponding third task within the predetermined time period. To improve task processing efficiency, the predetermined time period should not be too long. For example, the predetermined time period may be 30 seconds.

[0156] As an example and not a limitation, refer to Figure 8 as a flowchart diagram three of a method for controlling a target application to process a corresponding target task. Assume that the multiple target tasks acquired by the operating system include multiple third tasks of non-interactive task type, and the multiple third tasks include at least one third task with a first priority level, at least one third task with a second priority level, and at least one third task with a third priority level (Figure 8 only shows multiple third applications corresponding to third tasks of each priority level). According to the priority level of the target task, the operating system can determine the processing order of the third tasks to be, in order, all third tasks with the first priority level, all third tasks with the second priority level, and all third tasks with the third priority level among the multiple target tasks acquired.

[0157] Based on this, the operating system can control the third application corresponding to all the third tasks in the acquired multiple target tasks to process the corresponding third tasks through steps S810 to S860 in FIG8 in the processing order. The specific steps are as follows:

[0158] S810: The operating system simultaneously sends a system shutdown notification to all third applications corresponding to the third tasks having the first priority level.

[0159] S820: The third application corresponding to the third task with the first priority level processes the corresponding third task within a preset time period according to the system shutdown notification.

[0160] S830: After a preset time interval, the operating system simultaneously sends a system shutdown notification to all third applications corresponding to the third tasks with the second priority level.

[0161] The preset interval duration refers to the time interval between the current moment and the moment when the system shutdown notification is sent to the third application corresponding to the third task with the first priority level.

[0162] S840: The third application corresponding to the third task with the second priority level processes the corresponding third task within a preset time period according to the system shutdown notification.

[0163] S850: After a preset time interval, the operating system sends a system shutdown notification to all third applications corresponding to the third tasks with the third priority level at the same time.

[0164] The so-called preset interval again refers to the time interval between the current moment and the moment when the system shutdown notification is sent to the third application corresponding to the third task with the second priority level.

[0165] S860: The third application corresponding to the third task with the third priority level processes the corresponding third task within a preset time period according to the system shutdown notification.

[0166] It should be noted that, when the operating system controls the third application to process the corresponding third task, the third application does not need to send a task completion notification to the operating system, and each third application can asynchronously process the corresponding third task in an independently running thread. If a third application fails to complete processing of the corresponding third task within the preset time, the unprocessed third task can be discarded (i.e., the corresponding thread stops running). The operating system will send a system shutdown notification to all third applications corresponding to the third task with the next priority level at the same time after a preset time interval from the last time the system shutdown notification was sent to the third application, according to the processing order of the target task determined in the above embodiment, until all third applications are controlled to complete processing of the corresponding third tasks.

[0167] Based on the above three different methods, the operating system can obtain all target tasks that need to be processed before the system shuts down, and determine the processing order of all target tasks according to the task type, priority level and generation time of the task. Before the system shuts down, the operating system uses different processing methods to control the corresponding target applications to process target tasks of different task types according to the determined processing order. The above control method can meet the processing requirements of pending tasks of different task types before the system shuts down, and can improve the flexibility of processing target tasks of different task types before the system shuts down.

[0168] In addition, it should be noted that in the method provided in the embodiment of the present application, the multiple target tasks obtained by the operating system may include tasks of one or more different task types, tasks of each task type may include tasks with one or more different priority levels, and tasks of the same priority level may include one or more tasks with different generation times. That is to say, the multiple target tasks obtained by the operating system may not completely include tasks of all task types and all priority levels. In this case, the operating system does not need to process tasks including all task types, all priority levels and all generation times in full accordance with the fixed processing flow shown in Figure 5 before the system shuts down.

[0169] Exemplarily, it is assumed that the multiple target tasks acquired by the operating system include a second task 1 and a second task 2 with a first priority level and an interactive task type, a third task 1 and a third task 2 with a first priority level and a non-interactive task type, and a third task 3 with a second priority level and a non-interactive task type, wherein the generation time of the first task 1 is earlier than the generation time of the second task 2. Based on this, the operating system can determine the processing order of the multiple target tasks as second task 1, second task 2, third task 1 and third task 2 that need to be processed simultaneously, and third task 3 according to the task types and priorities of the multiple target tasks.

[0170] Among them, the second task 1 and the second task 2 can both use the method of steps S710 to S750 in the above-mentioned method 2 to control the corresponding second application to process in sequence. After the processing of the second task 3 is completed, the operating system can simultaneously send a system shutdown notification to the third application 1 corresponding to the third task 1 and the third application 2 corresponding to the third task 2, so as to instruct the third application 1 and the third application 2 to process the third task 1 and the third task 2 respectively within a preset time period. After an interval of the preset time period, the operating system can send a system shutdown notification to the third application 3 corresponding to the third task 3, so as to instruct the third application 3 to process the third task 3 within the preset time period.

[0171] S440 , shutting down the control system after the processing of the plurality of target tasks is completed.

[0172] In one embodiment, if the last target task processed among multiple target tasks obtained by the operating system is the first task that can take over the shutdown or the interactive second task, the operating system can consider that all target tasks have been processed after obtaining the task completion notification sent by the target application corresponding to the last target task processed.

[0173] In other embodiments, if the last target task processed among multiple target tasks acquired by the operating system is a non-interactive third task, the operating system can consider that all target tasks have been processed after a preset time interval from the time when the system shutdown notification was last sent to the third application corresponding to the third task.

[0174] After the operating system determines that all acquired target tasks have been processed, it can execute the subsequent system shutdown process according to the shutdown operation triggered by the user on the electronic device. For example, if the shutdown operation is used to indicate the restart of the electronic device, the subsequent system shutdown process may include shutting down various system services, shutting down the system kernel, restarting the system kernel, and restarting various system services, wherein the various system services include but are not limited to activity management services, package management services, and radio frequency services. If the shutdown operation is used to indicate the shutdown of the electronic device, the subsequent system shutdown process may include shutting down various system services, shutting down the system kernel, and powering off all hardware in the electronic device.

[0175] Based on the system shutdown control method provided in the above-mentioned embodiment of the present application, for all target tasks to be processed of different task types and application scenarios before system shutdown, three different processing methods are set for target tasks of different task types, namely takeover shutdown processing, synchronous processing and asynchronous processing. Before the system is shut down, the operating system can first determine the processing order of all target tasks based on the task type, priority level and generation time of the target task, and then control the target application to process the corresponding target task in accordance with the processing order and using the processing method corresponding to the task type of each target task, and then execute the subsequent system shutdown process. This can effectively avoid the loss or damage of application data and system data. This control method is suitable for the processing requirements of different types of tasks to be processed before shutdown, and improves the flexibility of system shutdown.

[0176] The above describes the method embodiments provided by this application, and the following describes the device embodiments provided by this application. It should be understood that the description of the device embodiments corresponds to the description of the method embodiments. Therefore, for matters not described in detail, reference can be made to the method embodiments above. For the sake of brevity, they will not be repeated here.

[0177] Figure 9 is a schematic block diagram of a system shutdown control device provided in an embodiment of the present application. As shown in Figure 9, the system shutdown control device 900 may include a processing unit 910 and a communication unit 920. The communication unit 920 may implement a corresponding communication function, and the communication may be an internal communication of the system shutdown control device 900 or a communication between the system shutdown control device 900 and other devices; the processing unit 910 may implement a corresponding processing function. The communication unit 920 may also be referred to as a communication interface or a transceiver unit. Optionally, the system shutdown control device 900 may further include a storage unit, which may be used to store instructions and / or data, and the processing unit 910 may read the instructions and / or data in the storage unit so that the device implements the aforementioned method embodiment.

[0178] In a possible design, the system shutdown control device 900 can be a module or chip applied to an electronic device. The system shutdown control device 900 can be used to execute the steps or processes executed by the electronic device in the above-mentioned various embodiments.

[0179] Specifically, the communication unit 920 is configured to, in response to a shutdown operation, obtain multiple target tasks to be processed before the system shuts down, as well as the task type of each target task. The processing unit 910 is configured to determine the processing order of the multiple target tasks based on the task type of each target task; control the target application corresponding to each target task to process the target task based on the processing order of the multiple target tasks; and control the system to shut down after the multiple target tasks are processed.

[0180] Optionally, the communication unit 920 is further configured to obtain a priority level for each target task. The processing unit 910 is further configured to sort the multiple target tasks according to a preset correspondence between task types and processing orders to obtain a first sorting result; adjust the order of target tasks with the same task type in the first sorting result according to the priority level of each target task to obtain a second sorting result; and determine the processing order of the multiple target tasks based on the second sorting result.

[0181] Optionally, the communication unit 920 is further configured to obtain the generation time of each target task. The processing unit 910 is further configured to adjust the order of target tasks with the same priority level and task type in the second sorting result according to the generation time of each target task, so as to obtain a processing order of the multiple target tasks.

[0182] Optionally, the communication unit 920 is further configured to send a system shutdown notification to a target application corresponding to each target task in sequence according to a processing order of the multiple target tasks, wherein the system shutdown notification is used to instruct the target application to process the corresponding target task.

[0183] Optionally, the multiple target tasks include a first task whose task type is a task that can be taken over for shutdown, and the target application corresponding to the first task is the first application; the communication unit 920 is further specifically used to send a system shutdown notification to the first application; receive a shutdown takeover notification sent by the first application, and the shutdown takeover notification is used to instruct the first application to confirm to continue processing the first task based on the system shutdown notification. The processing unit 910 is also used to suspend the system shutdown based on the shutdown takeover notification. The communication unit 920 is also used to receive a task completion notification sent by the first application; based on the task completion notification and the processing order of the multiple target tasks, send a system shutdown notification to the target application corresponding to the next target task of the first task.

[0184] In a possible implementation of the first aspect, the multiple target tasks include a second task of interactive task type, and the target application corresponding to the second task is the second application; the communication unit 920 is also specifically used to send a system shutdown notification to the second application; receive a task completion notification sent by the second application, which is sent after the second application detects the existence of the second task based on the system shutdown notification and processes the second task according to the user's trigger operation on the interactive interface; according to the task completion notification and the processing order of the multiple target tasks, send a system shutdown notification to the target application corresponding to the next target task of the second task.

[0185] In a possible implementation of the first aspect, the multiple target tasks include a third task of non-interactive task type, and the target application corresponding to the third task is a third application; the communication unit 920 is also specifically used to send a system shutdown notification to the third application corresponding to the third task with the same priority level at intervals of a preset time according to the processing order of the multiple target tasks, and the system shutdown notification is used to instruct the third application to process the corresponding third task within the preset time.

[0186] It should be understood that the description of the device embodiment can refer to the relevant description of the various embodiments of the above-mentioned system shutdown control method. Its implementation principle and technical effects are similar to those of the above-mentioned method embodiments and will not be repeated here.

[0187] It should be understood that the "unit" in the device 900 can be implemented by hardware, can be implemented by software, and can also be implemented by hardware executing the corresponding software implementation. For example, the "unit" can refer to an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit and / or other suitable components that support the described functions. For another example, the communication unit 920 can be replaced by a transceiver transceiver circuit (for example, a receiving circuit and a transmitting circuit), and the processing unit 910 can be replaced by a processor or a processing circuit.

[0188] Based on the methods provided in the above embodiments, the embodiments of the present application also provide the following content:

[0189] An embodiment of the present application provides a computer program product, which includes: computer program code, which, when executed on a computer, enables the computer to execute each step or process in any of the above method embodiments.

[0190] An embodiment of the present application provides a computer-readable storage medium, which stores program code. When the program code runs on a computer, the computer executes each step or process in any of the above method embodiments.

[0191] An embodiment of the present application provides a chip, which includes a memory and a processor. The processor executes a computer program stored in the memory to implement the control method for controlling the above-mentioned electronic device to execute the system shutdown shown in the above-mentioned embodiments.

[0192] It should be understood that the processor mentioned in the embodiments of the present application may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor, etc.

[0193] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM).

[0194] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other and are not used to limit the scope of protection of this application. In the above embodiments, the description of each embodiment has its own focus. For the parts that are not described or recorded in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0195] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0196] In the embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0197] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.

[0198] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0199] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program, when executed by the processor, can implement the steps of the above-mentioned various method embodiments. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include at least: any entity or device capable of carrying the computer program code to a large-screen device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electric carrier signal, a telecommunication signal and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0200] Finally, it should be noted that the above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A system shutdown control method, characterized in that: The method comprises: In response to a shutdown operation, obtaining a plurality of target tasks to be processed before the system is shut down and a task type of each target task; Determining a processing order of the plurality of target tasks according to a task type of each target task; According to the processing order of the multiple target tasks, controlling the target application corresponding to each target task to process the target task; The control system is shut down after the processing of the plurality of target tasks is completed.

2. The method according to claim 1, characterized in that The method further comprises: obtaining a priority level of each target task; The step of determining the processing order of the plurality of target tasks according to the task type of each target task includes: Sorting the plurality of target tasks according to a correspondence between preset task types and processing orders to obtain a first sorting result; According to the priority level of each target task, the order of the target tasks with the same task type in the first sorting result is adjusted to obtain a second sorting result; The processing order of the plurality of target tasks is determined based on the second sorting result.

3. The method according to claim 2, characterized in that The determining the processing order of the plurality of target tasks based on the second sorting result includes: Get the generation time of each target task; According to the generation time of each target task, the order of the target tasks with the same priority level and the same task type in the second sorting result is adjusted to obtain the processing order of the multiple target tasks.

4. The method according to any one of claims 1 to 3, characterized in that The step of controlling the target application corresponding to each target task to process the target task according to the processing order of the multiple target tasks includes: According to the processing order of the multiple target tasks, a system shutdown notification is sent to the target application corresponding to each target task in turn, and the system shutdown notification is used to instruct the target application to process the corresponding target task.

5. The method according to claim 4, characterized in that The multiple target tasks include a first task whose task type is capable of taking over shutdown, and the target application corresponding to the first task is a first application; The sending of the system shutdown notification to the target application corresponding to each target task in sequence according to the processing order of the multiple target tasks includes: Sending the system shutdown notification to the first application; receiving a shutdown takeover notification sent by the first application, wherein the shutdown takeover notification is used to instruct the first application to confirm to continue processing the first task according to the system shutdown notification; suspending system shutdown according to the shutdown takeover notification; Receiving a task completion notification sent by the first application; The system shutdown notification is sent to a target application corresponding to a next target task of the first task according to the task completion notification and the processing order of the multiple target tasks.

6. The method according to claim 4, characterized in that The multiple target tasks include a second task whose task type is interactive, and the target application corresponding to the second task is a second application; The sending of the system shutdown notification to the target application corresponding to each target task in sequence according to the processing order of the multiple target tasks includes: sending the system shutdown notification to the second application; receiving a task completion notification sent by the second application, wherein the task completion notification is sent by the second application after the second application has processed the second task according to a triggering operation of the user on the interactive interface when the second application detects the existence of the second task based on the system shutdown notification; The system shutdown notification is sent to a target application corresponding to a next target task of the second task according to the task completion notification and the processing order of the multiple target tasks.

7. The method according to any one of claims 1 to 3, characterized in that The multiple target tasks include a third task whose task type is non-interactive, and the target application corresponding to the third task is a third application; The step of controlling the target application corresponding to each target task to process the target task according to the processing order of the multiple target tasks includes: According to the processing order of the multiple target tasks, at each preset time interval, a system shutdown notification is simultaneously sent to the third application corresponding to the third task with the same priority level, and the system shutdown notification is used to instruct the third application to process the corresponding third task within the preset time. Three tasks.

8. A system shutdown control device, characterized in that: include: At least one unit for performing the method according to any one of claims 1 to 7.

9. An electronic device, characterized in that: include: A processor, wherein the processor is configured to run a computer program stored in a memory to implement the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • System shutdown control method and device, electronic equipment and readable storage medium

    CN120104260A

  • Application management method and terminal

    CN102497471A

  • Intelligent television platform offline download method and system

    CN105025365A

  • Mobile terminal downloading method and device and mobile terminal

    CN105138107A

  • Method and device for sending shutdown broadcast, and terminal

    CN106936996A