System broadcast transmission method and electronic device
By combining static and dynamic broadcast queues, ensuring that the broadcast receivers of the same process are sorted together, solving the problem of frequent adjustment of CPU packets during system broadcast transmission, and achieving the effect of reducing mobile phone power consumption and improving system performance.
Patent Information
- Application Number
- CN202310801685.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2043-06-30
AI Technical Summary
In electronic devices, it is difficult to sort multiple broadcast receivers when the system broadcasts, resulting in frequent adjustment of CPU packets and increasing mobile phone power consumption.
By obtaining static and dynamic broadcast queues and combining them into one broadcast queue, ensuring that the broadcast receivers of the same process are lined up together, reducing the number of CPU packet adjustments and reducing power consumption.
It effectively reduces mobile phone power consumption, improves system performance, and reduces the number of CPU packet adjustments.
Smart Images

Figure CN117707754B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of terminal technology, and in particular to a system broadcast sending method and electronic equipment. Background Art
[0002] Electronic devices can notify various applications of various system status information by sending system broadcasts. For example, a mobile phone sends a power-on broadcast after it is turned on, a power change broadcast after the battery level of the mobile phone changes, a screen-on broadcast after the screen turns on, and a screen-off broadcast after the screen turns off.
[0003] If an application wants to receive system broadcasts, the application process needs to register a broadcast receiver (broadcast receiver) in the system in advance. For example, process A, process B, and process C have registered screen-on broadcast receivers in the system respectively. After the phone turns on the screen, the system will send a screen-on broadcast to the broadcast receivers of process A, process B, and process C. For example, process A, process D, and process E have registered screen-off broadcast receivers in the system respectively. After the phone turns off the screen, the system will send a screen-off broadcast to the broadcast receivers of process A, process D, and process E.
[0004] The application process receives the system broadcast through the broadcast receiver and can perform corresponding actions, such as displaying the preset interface, executing the preset command, etc.
[0005] Generally speaking, there are many processes that register broadcast receivers for the same system broadcast. When the system sends the same system broadcast to the broadcast receivers of each process, it needs to send them in a certain order. How to sort multiple broadcast receivers is a problem that needs to be solved. Summary of the invention
[0006] The embodiments of the present application provide a system broadcast sending method and an electronic device, which optimize the sorting method of broadcast receivers when sending system broadcasts to multiple broadcast receivers, thereby improving system performance.
[0007] To achieve the above objectives, the embodiments of the present application adopt the following technical solutions:
[0008] In a first aspect, a system broadcast sending method is provided, the method comprising: obtaining a first broadcast queue corresponding to a first system broadcast; the first broadcast queue comprises multiple broadcast receivers, and the multiple broadcast receivers with the same receiving priority and belonging to the same process are arranged together; and the first system broadcast is sent to each broadcast receiver in the first broadcast queue in sequence from first to last in the order of the broadcast receivers in the first broadcast queue.
[0009] In this method, the system sends a foreground broadcast to each broadcast receiver in order, and the broadcast receiver will perform the corresponding action after receiving the foreground broadcast. The broadcast receiver is registered by the application process. Sending a foreground broadcast to the broadcast receiver means sending a foreground broadcast to the process to which the broadcast receiver belongs. The CPU will set the CPU grouping for the process receiving the foreground broadcast in turn to increase the CPU priority of the process receiving the foreground broadcast. If the previous process receiving the foreground broadcast is the same process as the process receiving the foreground broadcast this time, the CPU grouping of the process will not be modified because the process is already in a CPU group with a higher CPU priority.
[0010] Setting CPU groups each time will result in a waste of power consumption. When sending system broadcasts, arranging multiple broadcast receivers with the same receiving priority and belonging to the same process together can reduce the number of times the CPU grouping is adjusted and reduce the power consumption of the mobile phone.
[0011] In combination with the first aspect, in one embodiment, a static broadcast queue and a dynamic broadcast queue corresponding to the first system broadcast are obtained; the static broadcast queue includes statically registered broadcast receivers, and the dynamic broadcast queue includes dynamically registered broadcast receivers; the static broadcast queue and the dynamic broadcast queue are merged into the first broadcast queue.
[0012] In combination with the first aspect, in one embodiment, merging the static broadcast queue and the dynamic broadcast queue into a first broadcast queue includes: inserting the broadcast receiver in the static broadcast queue into the dynamic broadcast queue to obtain the first broadcast queue; when inserting the broadcast receiver in the static broadcast queue into the dynamic broadcast queue, the broadcast receivers in the static broadcast queue and the dynamic broadcast queue that have the same receiving priority and belong to the same process are arranged together.
[0013] In conjunction with the first aspect, in one implementation, before the static broadcast queue and the dynamic broadcast queue are merged into the first broadcast queue, the broadcast receivers in the static broadcast queue that have the same receiving priority and belong to the same process are arranged together; and the broadcast receivers in the dynamic broadcast queue that have the same receiving priority and belong to the same process are arranged together. This makes it convenient to arrange the broadcast receivers in the static broadcast queue and the dynamic broadcast queue that have the same receiving priority and belong to the same process together when the static broadcast queue and the dynamic broadcast queue are merged into the first broadcast queue.
[0014] In combination with the first aspect, in one implementation, among the broadcast receivers in the first broadcast queue that have the same receiving priority and belong to the same process, dynamically registered broadcast receivers are arranged before statically registered broadcast receivers.
[0015] In combination with the first aspect, in one implementation, in the first broadcast queue, a broadcast receiver with a high reception priority precedes a broadcast receiver with a low reception priority.
[0016] In combination with the first aspect, in one implementation, the first broadcast queue includes a first broadcast receiver, the first broadcast receiver belongs to a first process, and the method further includes: when sending the first system broadcast to the first broadcast receiver, raising the CPU priority of the first process.
[0017] In combination with the first aspect, in one implementation, when sending a first system broadcast to a first broadcast receiver, the CPU priority of a second process is lowered; the second process is different from the first process, and the second process is a process to which the previous broadcast receiver of the first broadcast receiver in the first broadcast queue belongs.
[0018] In combination with the first aspect, in one implementation, the first system broadcast is a foreground broadcast.
[0019] In a second aspect, an electronic device is provided, which has the function of implementing the method described in the first aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions.
[0020] In a third aspect, an electronic device is provided, comprising: a processor and a memory; the memory is used to store computer execution instructions, and when the electronic device is running, the processor executes the computer execution instructions stored in the memory to enable the electronic device to perform a method as described in any one of the above-mentioned first aspects.
[0021] In a fourth aspect, an electronic device is provided, comprising: a processor; the processor is used to couple with a memory, and after reading instructions in the memory, execute a method as described in any one of the above-mentioned first aspects according to the instructions.
[0022] In a fifth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a computer, the computer can execute any of the methods described in the first aspect.
[0023] In a sixth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the methods described in the first aspect.
[0024] In a seventh aspect, a device (for example, the device may be a chip system) is provided, the device including a processor for supporting an electronic device to implement the functions involved in the first aspect above. In one possible design, the device also includes a memory for storing program instructions and data necessary for the electronic device. When the device is a chip system, it may be composed of a chip, or may include a chip and other discrete devices.
[0025] Among them, the technical effects brought about by any design method in the second to seventh aspects can refer to the technical effects brought about by different design methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 A schematic diagram of a process flow for adjusting the CPU grouping of processes in two implementation modes provided in the embodiments of the present application;
[0027] Figure 2 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0028] Figure 3 A flow chart showing a process of sending a front-end broadcast to the system;
[0029] Figure 4 A flow chart of implementation method 1 in the process of merging a static broadcast queue and a dynamic broadcast queue;
[0030] Figure 5 A flow chart of implementation method 2 in the process of merging a static broadcast queue and a dynamic broadcast queue;
[0031] Figure 6 A flowchart for arranging together broadcast receivers belonging to the same process among broadcast receivers with the same receiving priority;
[0032] Figure 7 A schematic diagram of an example of a method for merging a static broadcast queue and a dynamic broadcast queue into a foreground broadcast queue provided in an embodiment of the present application;
[0033] Figure 8 An example diagram of merging a static broadcast queue and a dynamic broadcast queue by using implementation mode 1 and implementation mode 2 respectively;
[0034] Fig. 9 A flowchart of the process of sending a foreground broadcast;
[0035] Fig.10 A schematic diagram of the structural composition of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0036] 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 to the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include such expressions 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: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are a kind of "or" relationship.
[0037] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear 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 other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0038] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0039] System broadcasts include foreground broadcasts and background broadcasts. The life cycle of foreground broadcasts is shorter (generally 10s), while the life cycle of background broadcasts is longer (generally 60s). For example, screen-on broadcasts and screen-off broadcasts are both foreground broadcasts. When the conditions for triggering a foreground broadcast are met, for example, the conditions for triggering a screen-on broadcast are met when the screen is on, and the conditions for triggering a screen-off broadcast are met when the screen is off, the system sends the foreground broadcast to each process that has registered the corresponding broadcast receiver.
[0040] When the system sends the same foreground broadcast to the broadcast receivers of each process, it needs to send them in a certain order. Generally speaking, the broadcast receivers of each process are sorted in the order of registration time, that is, the earlier the broadcast receiver is registered, the earlier it receives the foreground broadcast. It is understandable that a process can register multiple broadcast receivers, for example, interface 1 of process 1 registers a screen-on broadcast receiver, and interface 2 of process 1 registers a screen-on broadcast receiver.
[0041] For example, take multiple processes registering screen-lit broadcast receivers as an example. The order of registering screen-lit broadcast receivers by each process from first to last is as follows:
[0042] 1. Process A registers the screen-lit broadcast receiver A1.
[0043] 2. Process B registers the screen-lit broadcast receiver B1.
[0044] 3. Process A registers the screen-lit broadcast receiver A2.
[0045] 4. Process B registers the screen-lit broadcast receiver B2.
[0046] 5. Process C registers the screen-lit broadcast receiver C1.
[0047] 6. Process A registers the screen-lit broadcast receiver A3.
[0048] 7. Process D registers the screen-lit broadcast receiver D1.
[0049] 8. Process B registers the screen-lit broadcast receiver B3.
[0050] Among them, A1, A2 and A3 are three different screen-on broadcast receivers registered by process A; B1, B2 and B3 are three different screen-on broadcast receivers registered by process B.
[0051] The system sends a foreground broadcast to each broadcast receiver in sequence, and the broadcast receiver will perform corresponding actions when receiving the foreground broadcast. For example, displaying a preset interface, executing preset instructions, etc. The broadcast receiver is registered by the application process, and sending a foreground broadcast to the broadcast receiver is sending a foreground broadcast to the process to which the broadcast receiver belongs. In one embodiment, the central processing unit (CPU) will set CPU groups for the processes of non-system applications that receive the foreground broadcast in turn to increase the CPU priority of the process that is receiving the foreground broadcast. In one implementation, the rule for setting the CPU grouping is that when a process receives a foreground broadcast while running in the background, the process is added to a CPU group with a higher CPU priority, and the previous process that receives the foreground broadcast is added to a CPU group with a lower CPU priority. If the previous process that receives the foreground broadcast is the same process as the process that receives the foreground broadcast this time, since the process is already in a CPU group with a higher CPU priority, the CPU grouping of the process is not modified.
[0052] In some scenarios, when a process registers different broadcast receivers for the same foreground broadcast, other processes register the broadcast receivers for the foreground broadcast. For example, in the above example, after process A registers screen broadcast receiver A1, process B registers screen broadcast receiver B1, then process A registers screen broadcast receiver A2, and then process B registers screen broadcast receiver B2. The CPU will repeatedly set the CPU grouping for the same process.
[0053] For example, in the above example, process A, process B, process C, and process D have registered one or more screen broadcast receivers respectively. After the phone turns on the screen, the system starts to distribute the screen broadcast. Each time the system sends a screen broadcast to a screen broadcast receiver, it sets the CPU group of the current screen broadcast receiver process to 2, and sets the CPU group of the previous screen broadcast receiver process to 1. Among them, the CPU priority of CPU group 2 is higher than the CPU priority of CPU group 1. For example:
[0054] 1. First send a screen-on broadcast to the screen-on broadcast receiver A1 of process A, and set the CPU group of process A to 2.
[0055] 2. Then send a screen-lit broadcast to the screen-lit broadcast receiver B1 of process B, set the CPU group of process B to 2, and set the CPU group of process A to 1.
[0056] 3. Then send a screen-on broadcast to the screen-on broadcast receiver A2 of process A, set the CPU group of process A to 2, and set the CPU group of process B to 1.
[0057] 4. Then send a screen-lighting broadcast to the screen-lighting broadcast receiver B2 of process B, set the CPU group of process B to 2, and set the CPU group of process A to 1.
[0058] …
[0059] Each time the CPU grouping is set, the power consumption of the mobile phone will increase. For example, it takes about 6.7ms on average to set the CPU grouping once more. In this process, the CPU grouping of process A and process B is repeatedly set, which leads to increased power consumption of the mobile phone.
[0060] An embodiment of the present application provides a system broadcast sending method, which sorts broadcast receivers registered for the same system broadcast, adjusts broadcast receivers of the same process together, reduces the frequency of repeatedly setting CPU groups for the same process, reduces the number of times CPU groups are set, and achieves reduction in mobile phone power consumption.
[0061] For example, Figure 1 The flowchart of adjusting the process CPU grouping in two implementation modes, one in which the broadcast receivers of the same process are not adjusted together and the other in which the broadcast receivers of the same process are adjusted together, is shown.
[0062] Still taking the above example, the registration order of the screen broadcast receiver is A1, B1, A2, B2, C1, A3, D1, B3 from first to last. After the phone turns on the screen, the system starts to distribute the screen broadcast. When the system sends a screen broadcast to the screen broadcast receiver, it adjusts the CPU grouping of the screen broadcast receiver's process. When a screen broadcast is sent to a process running in the background, the process is added to a CPU group with a higher CPU priority (exemplarily, the CPU grouping is set to 2), and the previous process that receives the screen broadcast is added to a CPU group with a lower CPU priority (exemplarily, the CPU grouping is set to 0). If the previous process that received the screen broadcast is the same process as the process that receives the screen broadcast this time, the CPU grouping of the process will not be modified.
[0063] like Figure 1As shown in (a), if the broadcast receivers of the same process are not adjusted together, the order in which the screen broadcast receiver receives the screen broadcast is A1, B1, A2, B2, C1, A3, D1, and B3 from first to last. Correspondingly, when sending a screen broadcast to A1 of process A, the CPU group of process A is set to 2. Then, when sending a screen broadcast to B1 of process B, the CPU group of process B is set to 2, and the CPU group of process A is set to 0. Then, when sending a screen broadcast to A2 of process A, the CPU group of process A is set to 2, and the CPU group of process B is set to 0. Then, when sending a screen broadcast to B2 of process B, the CPU group of process B is set to 2, and the CPU group of process A is set to 0. Then, when sending a screen broadcast to C1 of process C, the CPU group of process C is set to 2, and the CPU group of process B is set to 0. Then, when sending a screen broadcast to A3 of process A, the CPU group of process A is set to 2, and the CPU group of process C is set to 0. Then, when sending a screen-lit broadcast to D1 of process D, the CPU group of process D is set to 2, and the CPU group of process A is set to 0. Then, when sending a screen-lit broadcast to B3 of process B, the CPU group of process B is set to 2, and the CPU group of process D is set to 0. After receiving the screen-lit broadcast, B3 of process B sets the CPU group of process B to 0. It can be seen that in this implementation, each time the screen-lit broadcast is sent to a process, the CPU group of the process needs to be adjusted once. Each time the CPU group is set, the power consumption of the mobile phone increases, resulting in an increase in the power consumption of the mobile phone.
[0064] like Figure 1As shown in (b), if the broadcast receivers of the same process are adjusted together, the order in which the screen broadcast receiver receives the screen broadcast is A1, A2, A3, B1, B2, B3, C1, and D1 from first to last. Correspondingly, when sending a screen broadcast to A1 of process A, the CPU group of process A is set to 2. Then, when sending a screen broadcast to A2 of process A, since A2 and A1 belong to the same process, the CPU group of process A has been set to 2 when the screen broadcast was sent last time, and no adjustment is required. Then, when sending a screen broadcast to A3 of process A, since A3 and A2 belong to the same process, no adjustment is required. Then, when sending a screen broadcast to B1 of process B, the CPU group of process B is set to 2, and the CPU group of process A is set to 0. Then, when sending a screen broadcast to B2 of process B, since B2 and B1 belong to the same process, the CPU group of process B has been set to 2 when the screen broadcast was sent last time, and no adjustment is required. Then, when sending a screen-lighting broadcast to B3 of process B, since B3 and B2 belong to the same process, there is no need to adjust the CPU grouping. Then, when sending a screen-lighting broadcast to C1 of process C, set the CPU grouping of process C to 2, and set the CPU grouping of process B to 0. Then, when sending a screen-lighting broadcast to D1 of process D, set the CPU grouping of process D to 2, and set the CPU grouping of process C to 0. After receiving the screen-lighting broadcast, D1 of process D sets the CPU grouping of process D to 0. In this implementation, since the broadcast receivers of the same process are arranged together, the number of times the CPU grouping is adjusted is reduced, and the power consumption of the mobile phone is reduced.
[0065] The system broadcast sending method provided in the embodiment of the present application can be applied to electronic devices that support sending system broadcasts. The above-mentioned electronic devices may include mobile phones, tablet computers, laptops, personal computers (PCs), ultra-mobile personal computers (UMPCs), handheld computers, netbooks, smart home devices (e.g., smart TVs, smart screens, large screens, smart speakers, smart air conditioners, etc.), personal digital assistants (PDAs), wearable devices (e.g., smart watches, smart bracelets, etc.), vehicle-mounted devices, virtual reality devices, etc., and the embodiments of the present application do not impose any restrictions on this.
[0066] In the embodiment of the present application, the electronic device is an electronic device that can run an operating system and install application programs. Optionally, the operating system running on the electronic device can be Android. system, system, System, etc. The system described in the embodiments of the present application refers to an operating system running on an electronic device.
[0067] For example, please refer to Figure 2 , which shows a schematic diagram of the structure of an electronic device 100. The electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor, a fingerprint sensor, a temperature sensor, a touch sensor, etc.
[0068] It is to be understood that the structure illustrated in this embodiment does not constitute a specific limitation on the electronic device 100. In other embodiments, the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0069] The processor 110 may include one or more processing units, for example, the processor 110 may include a central processing unit (CPU), an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0070] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0071] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0072] In some embodiments, the processor 110 may include one or more interfaces. The interface 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, etc.
[0073] It is understandable that the interface connection relationship between the modules illustrated in this embodiment is only a schematic illustration and does not constitute a structural limitation of the electronic device. In other embodiments, the electronic device may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0074] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of an electronic device. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.
[0075] The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0076] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0077] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 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 150 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 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.
[0078] The wireless communication module 160 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 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering processing, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0079] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.
[0080] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0081] The display screen 194 is used to display images, videos, etc. The display screen 194 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 or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Mini-LED, Micro-OLED, Micro-OLED, quantum dot light-emitting diodes (QLED), etc.
[0082] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.
[0083] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.
[0084] Camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device may include 1 or N cameras 193, where N is a positive integer greater than 1. In the embodiment of the present application, the camera 193 can be used to capture video images.
[0085] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals. For example, when an electronic device selects a frequency point, a digital signal processor is used to perform Fourier transform on the frequency point energy.
[0086] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. In this way, the electronic device can play or record videos in multiple coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0087] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and continuously self-learn. NPU can realize applications such as intelligent cognition of electronic devices, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0088] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0089] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, audio, video and other files are stored in the external memory card.
[0090] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device by running the instructions stored in the internal memory 121. For example, in an embodiment of the present application, the processor 110 can execute instructions stored in the internal memory 121, and the internal memory 121 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 a sound playback function, an image playback function, etc.). The data storage area may store data (such as video files) created during the use of the electronic device, etc. In addition, the internal memory 121 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.
[0091] The pressure sensor is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor can be arranged on the display screen 194. There are many types of pressure sensors, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor. The electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor.
[0092] The touch sensor is also called a "touch panel". The touch sensor can be arranged on the display screen 194, and the touch sensor and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In other embodiments, the touch sensor can also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.
[0093] The button 190 includes a power button, a volume button, etc. The button 190 can be a mechanical button. It can also be a touch button. The motor 191 can generate a vibration prompt. The motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power changes, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect the SIM card. The SIM card can be inserted into the SIM card interface 195, or pulled out from the SIM card interface 195 to achieve contact and separation with the electronic device. The electronic device can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc.
[0094] The system broadcast sending method provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.
[0095] For example, Figure 3 Figure 1 shows a schematic diagram of the process of the system sending a front-end broadcast. Figure 3 As shown, the method may include:
[0096] S301, triggering the process of sending the foreground broadcast.
[0097] When the conditions for triggering the foreground broadcast are met, the system triggers the process of sending the foreground broadcast. For example, when the screen is turned on, the system triggers the sending of the screen-on broadcast; when the screen is turned off, the system triggers the sending of the screen-off broadcast.
[0098] S302: Get the foreground broadcast queue.
[0099] The application process that needs to receive the foreground broadcast has pre-registered the corresponding broadcast receiver in the system. For example, the process that needs to receive the screen-on broadcast has pre-registered the screen-on broadcast receiver in the system; for example, the process that needs to receive the screen-off broadcast has pre-registered the screen-off broadcast receiver in the system.
[0100] When registering a broadcast receiver, you can use static registration or dynamic registration. Static registration can be understood as registration through a manifest file. Statically registered broadcast receivers are handled uniformly by the system, and their life cycle will always exist during the entire process of the process running and will not be deregistered. Dynamic registration is registered through code. The dynamically registered broadcast receiver is written as an inner class in the Activity, such as registering in the Activity's onCreate or onResume, and deregistering in the Activity's onDestory; the life cycle of the dynamically registered broadcast receiver is consistent with the life cycle of the Activity. When the Activity is destroyed, the dynamically registered broadcast receiver becomes invalid.
[0101] In one implementation, statically registered broadcast receivers are added to the static broadcast queue, and dynamically registered broadcast receivers are added to the dynamic broadcast queue. That is, the static broadcast queue includes at least one statically registered broadcast receiver, and the dynamic broadcast queue includes at least one dynamically registered broadcast receiver. The static broadcast queue and the dynamic broadcast queue are merged to obtain the foreground broadcast queue of the foreground broadcast.
[0102] S303, sending the foreground broadcast according to the order of the broadcast receivers in the foreground broadcast queue.
[0103] In one implementation, the foreground broadcast is sent to the processes of the broadcast receivers in the foreground broadcast queue in sequence. For example, a foreground broadcast (such as a screen-on broadcast) is sent to the process of the i-th broadcast receiver in the foreground broadcast queue.
[0104] S304: Determine whether the process of the current broadcast receiver is the same as the process of the previous broadcast receiver. If the process of the current broadcast receiver is the same as the process of the previous broadcast receiver, execute S305; if the process of the current broadcast receiver is different from the process of the previous broadcast receiver, execute S306.
[0105] Exemplarily, the current broadcast receiver is the i-th broadcast receiver in the foreground broadcast queue, and the previous broadcast receiver is the i-1-th broadcast receiver in the foreground broadcast queue. Determine whether the process of the i-th broadcast receiver in the foreground broadcast queue is the same as the process of the i-1-th broadcast receiver. If the process of the i-th broadcast receiver in the foreground broadcast queue is the same as the process of the i-1-th broadcast receiver, it indicates that the process is already in a CPU group with a higher CPU priority, and there is no need to update the CPU group of the process. If the process of the i-th broadcast receiver in the foreground broadcast queue is different from the process of the i-1-th broadcast receiver, then the process of the i-th broadcast receiver in the foreground broadcast queue is added to the CPU group with a higher CPU priority, and the process of the i-1-th broadcast receiver in the foreground broadcast queue is added to the CPU group with a lower CPU priority.
[0106] S305: Do not update the CPU group of the current broadcast receiver process.
[0107] S306: Update the CPU grouping of the process of the current broadcast receiver and the CPU grouping of the process of the previous broadcast receiver.
[0108] S307, determine whether the current broadcast receiver is the last one in the foreground broadcast queue. If it is the last one, end. If not, execute S303.
[0109] In this way, the foreground broadcast is sent to all broadcast receivers that have registered for the foreground broadcast.
[0110] When the foreground broadcast queue is obtained in step S302, the static broadcast queue and the dynamic broadcast queue are merged into one foreground broadcast queue. When the static broadcast queue and the dynamic broadcast queue are merged, the broadcast receivers added to the foreground broadcast queue are sorted, so that the broadcast receivers in the front order receive the foreground broadcast first, and the broadcast receivers in the back order receive the foreground broadcast later.
[0111] Usually, each broadcast receiver has a corresponding receiving priority. For example, you can specify the receiving priority of the broadcast receiver when registering the broadcast receiver; for example, the system can assign the receiving priority of the broadcast receiver. Broadcast receivers with high receiving priorities can receive foreground broadcasts first.
[0112] In one implementation (referred to as implementation one in the embodiments of the present application), the rule for sorting broadcast receivers added to the foreground broadcast queue is: broadcast receivers with higher receiving priorities are given priority; when the receiving priorities are the same, dynamically registered broadcast receivers take precedence over statically registered broadcast receivers.
[0113] For example, Figure 4FIG. 2 shows a flow chart of implementation method 1 in the process of merging static broadcast queues and dynamic broadcast queues (S302). Figure 4 As shown, the method may include:
[0114] S401. Obtain a static broadcast queue and a dynamic broadcast queue respectively.
[0115] In one implementation, when a process registers a broadcast receiver, if static registration is used, the broadcast receiver is added to the static broadcast queue; if dynamic registration is used, the broadcast receiver is added to the dynamic broadcast queue. The broadcast receivers in the static broadcast queue are arranged in the order of registration time; the broadcast receivers in the dynamic broadcast queue are arranged in the order of registration time.
[0116] When the system reads a static broadcast queue, it sorts the broadcast receivers in the static broadcast queue according to the receiving priority of the broadcast receivers from high to low; when the system reads a dynamic broadcast queue, it sorts the broadcast receivers in the dynamic broadcast queue according to the receiving priority of the broadcast receivers from high to low.
[0117] That is, the broadcast receivers in the static broadcast queue obtained by the system are arranged in descending order of receiving priority; the broadcast receivers in the dynamic broadcast queue obtained by the system are arranged in descending order of receiving priority. Optionally, in the static broadcast queue or dynamic broadcast queue, the broadcast receivers with the same receiving priority are arranged in the order of registration time.
[0118] After obtaining the static broadcast queue and the dynamic broadcast queue, you can merge the static broadcast queue and the dynamic broadcast queue into a foreground broadcast queue. Before merging the static broadcast queue and the dynamic broadcast queue, the foreground broadcast queue is empty.
[0119] S402. According to the order of the broadcast receivers in the static broadcast queue from front to back and the order of the broadcast receivers in the dynamic broadcast queue from front to back, a broadcast receiver in the static broadcast queue is compared with a broadcast receiver in the dynamic broadcast queue in sequence.
[0120] S403, compare the receiving priority of a broadcast receiver in the static broadcast queue with that of a broadcast receiver in the dynamic broadcast queue. If the receiving priority of the broadcast receiver in the static broadcast queue is higher than that of the broadcast receiver in the dynamic broadcast queue, execute S404; otherwise, that is, the receiving priority of the broadcast receiver in the static broadcast queue is lower than that of the broadcast receiver in the dynamic broadcast queue, or the receiving priority of the broadcast receiver in the static broadcast queue is the same as that of the broadcast receiver in the dynamic broadcast queue, execute S405.
[0121] S404: Add the broadcast receiver in the static broadcast queue to the foreground broadcast queue.
[0122] S405: Add the broadcast receiver in the dynamic broadcast queue to the foreground broadcast queue.
[0123] S406: Determine whether it is the last broadcast receiver in the static broadcast queue. If it is the last broadcast receiver in the static broadcast queue, execute S407. If it is not the last broadcast receiver in the static broadcast queue, execute S408.
[0124] S407: Add the remaining broadcast receivers in the dynamic broadcast queue to the foreground broadcast queue.
[0125] After the remaining broadcast receivers in the dynamic broadcast queue are added to the foreground broadcast queue, the merging process ends.
[0126] S408, determine whether it is the last broadcast receiver in the dynamic broadcast queue. If it is the last broadcast receiver in the dynamic broadcast queue, execute S409. If it is not the last broadcast receiver in the dynamic broadcast queue, execute S402.
[0127] S409: Add the remaining broadcast receivers in the static broadcast queue to the foreground broadcast queue.
[0128] After the remaining broadcast receivers in the static broadcast queue are added to the foreground broadcast queue, the merging process ends.
[0129] After S401-S409, the static broadcast queue and the dynamic broadcast queue are merged into a foreground broadcast queue. In the foreground broadcast queue, the broadcast receivers are sorted in the order of receiving priority from high to low, with the dynamically registered broadcast receivers in front and the statically registered broadcast receivers in the back when the receiving priorities are the same.
[0130] In another implementation (referred to as implementation mode two in the embodiments of the present application), the rules for sorting broadcast receivers added to the foreground broadcast queue are: broadcast receivers with higher receiving priority are given priority; broadcast receivers with the same receiving priority and belonging to the same process are sorted together; among broadcast receivers with the same receiving priority and belonging to the same process, dynamically registered broadcast receivers take precedence over statically registered broadcast receivers.
[0131] For example, Figure 5 FIG. 2 shows a flow chart of the second implementation method in the process of merging the static broadcast queue and the dynamic broadcast queue (S302). Figure 5 As shown, the method may include:
[0132] S501. Obtain a static broadcast queue and a dynamic broadcast queue respectively.
[0133] In one implementation, when a process registers a broadcast receiver, if static registration is used, the broadcast receiver is added to the static broadcast queue; if dynamic registration is used, the broadcast receiver is added to the dynamic broadcast queue. The broadcast receivers in the static broadcast queue are arranged in the order of registration time; the broadcast receivers in the dynamic broadcast queue are arranged in the order of registration time.
[0134] When the system reads a static broadcast queue, it sorts the broadcast receivers in the static broadcast queue according to the receiving priority of the broadcast receivers from high to low; when the system reads a dynamic broadcast queue, it sorts the broadcast receivers in the dynamic broadcast queue according to the receiving priority of the broadcast receivers from high to low.
[0135] That is, the broadcast receivers in the static broadcast queue obtained by the system are arranged in descending order of receiving priority; the broadcast receivers in the dynamic broadcast queue obtained by the system are arranged in descending order of receiving priority. Optionally, in the static broadcast queue or dynamic broadcast queue, the broadcast receivers with the same receiving priority are arranged in the order of registration time.
[0136] After obtaining the static broadcast queue and the dynamic broadcast queue, you can merge the static broadcast queue and the dynamic broadcast queue into a foreground broadcast queue. Before merging the static broadcast queue and the dynamic broadcast queue, the foreground broadcast queue is empty.
[0137] S502. Sort the broadcast receivers in the static broadcast queue, and put together the broadcast receivers with the same receiving priority and belonging to the same process; sort the broadcast receivers in the dynamic broadcast queue, and put together the broadcast receivers with the same receiving priority and belonging to the same process.
[0138] For example, Figure 6 A flow chart showing how to arrange together broadcast receivers belonging to the same process among broadcast receivers with the same reception priority.
[0139] like Figure 6 As shown, A1, A2 and A3 are three different broadcast receivers belonging to process A, B1, B2 and B3 are three different broadcast receivers belonging to process B, C1 and C2 are two different broadcast receivers belonging to process C, and D1 is a broadcast receiver belonging to process D. The initial order of the 9 broadcast receivers is A1, A2, B1, B2, A3, C1, D1, B3, C2. In this example, A1, A2, B1, B2, A3, C1, D1, B3, C2 have the same reception priority.
[0140] Through pointers i and j, the broadcast receivers belonging to the same process among the 9 broadcast receivers with the same receiving priority are arranged together. Pointer i is used to find the last broadcast receiver among the broadcast receivers that are arranged together and belong to the same process; pointer j is used to find the broadcast receiver in the queue behind that belongs to the same process as the broadcast receiver pointed to by pointer i. In other words, pointer i is used to find the tail of the queue of broadcast receivers that have been arranged together and belong to a process; pointer j is used to find the broadcast receiver that belongs to the process and is in the queue of broadcast receivers that have not yet been arranged into the process.
[0141] like Figure 6 As shown, pointer i first points to the first broadcast receiver A1. The next broadcast receiver (A2) of A1 belongs to the same process A as A1, and A1 is not the tail of the broadcast receiver queue belonging to process A. Then pointer i moves to A2. The next broadcast receiver of A2 is B1. B1 and A2 belong to different processes. A2 is the tail of the broadcast receiver queue belonging to process A, and pointer i stays at A2.
[0142] Pointer j searches backward from B1, moves to B2, and then moves to A3. A3 and A2 pointed to by pointer i both belong to process A, that is, pointer j finds a broadcast receiver that has not yet been arranged in the broadcast receiver queue of process A and belongs to process A. Then, A3 pointed to by pointer j is inserted after A2 pointed to by pointer i. The tail of the broadcast receiver queue belonging to process A becomes A3, and pointer i moves to A3. Pointer j searches backward from B1 and does not find a broadcast receiver belonging to process A. In other words, the broadcast receivers belonging to process A have been arranged together.
[0143] Then, pointer i moves backwards to point to B1, and starts to search for the tail of the broadcast receiver queue belonging to process B. The next broadcast receiver of B1 is B2. B2 and B1 belong to the same process B, and B1 is not the tail of the broadcast receiver queue belonging to process B. Pointer i moves to the next broadcast receiver B2. The next broadcast receiver of B2 is C1. C1 and B2 belong to different processes. B2 is the tail of the broadcast receiver queue belonging to process B, and pointer i stays at B2.
[0144] Pointer j searches backward from C1, moves to D1, and then moves to B3. B3 and B2 pointed to by pointer i both belong to process B. B3 pointed to by pointer j is inserted after B2 pointed to by pointer i. The tail of the queue of broadcast receivers belonging to process B becomes B3, and pointer i moves to B3. Pointer j searches backward from C1, and no broadcast receiver belonging to process B is found. In other words, the broadcast receivers belonging to process B have been arranged together.
[0145] Then, pointer i moves backward to point to C1 and starts looking for the tail of the broadcast receiver queue belonging to process C. The next broadcast receiver of C1 is D1, which belongs to different processes than C1. C1 is the tail of the broadcast receiver queue belonging to process C, and pointer i stays at C1.
[0146] Pointer j searches backward from D1 and moves to C2. C2 and C1 pointed to by pointer i both belong to process C. C2 pointed to by pointer j is inserted after C1 pointed to by pointer i. The tail of the queue of broadcast receivers belonging to process C becomes C2, and pointer i moves to C2. Pointer j searches backward from D1 and does not find any broadcast receivers belonging to process C. In other words, the broadcast receivers belonging to process C have been arranged together.
[0147] Then, pointer i moves backward to point to D1 and starts looking for the tail of the broadcast receiver queue belonging to process D. D1 is the last broadcast receiver in the queue and does not need to be moved.
[0148] After the sequence is adjusted, the order of the 9 broadcast receivers becomes A1, A2, A3, B1, B2, B3, C1, C2, D1. Multiple broadcast receivers belonging to the same process are arranged together.
[0149] You can use static broadcast queues and dynamic broadcast queues separately Figure 6 The method shown is used to sort the broadcast receivers with the same receiving priority and belonging to the same process in the static broadcast queue, and to sort the broadcast receivers with the same receiving priority and belonging to the same process in the dynamic broadcast queue.
[0150] It should be noted that steps S501 and S502 can be combined. For example, in a sorting of a static broadcast queue or a dynamic broadcast queue, broadcast receivers with high receiving priorities can be arranged in front, and broadcast receivers with low receiving priorities can be arranged in the back; and broadcast receivers with the same receiving priority and belonging to the same process can be arranged together.
[0151] S503: Start merging the static broadcast queue and the dynamic broadcast queue according to the order of the broadcast receivers in the dynamic broadcast queue from front to back and the order of the broadcast receivers in the static broadcast queue from front to back.
[0152] In one implementation, the sorted dynamic broadcast queue is used as a reference, and the sorted static broadcast queue is inserted into the sorted dynamic broadcast queue to obtain the foreground broadcast queue. The merging rule is: broadcast receivers with high receiving priority are in front, and broadcast receivers with low receiving priority are in the back; broadcast receivers with the same receiving priority and belonging to the same process are arranged together, among which dynamically registered broadcast receivers are in front, and statically registered broadcast receivers are in the back.
[0153] S504: Add a broadcast receiver in the static broadcast queue whose receiving priority is higher than the highest receiving priority in the dynamic broadcast queue to the foreground broadcast queue.
[0154] In one implementation, the foreground broadcast queue is empty.
[0155] First, if it is determined that there is a broadcast receiver with a receiving priority higher than the highest receiving priority in the dynamic broadcast queue in the static broadcast queue, the broadcast receiver with a receiving priority higher than the highest receiving priority in the dynamic broadcast queue is added to the foreground broadcast queue. In this way, the broadcast receiver with a high receiving priority is guaranteed to be at the front of the foreground broadcast queue, before the broadcast receiver with the highest receiving priority in the dynamic broadcast queue.
[0156] Optionally, if there is no broadcast receiver in the static broadcast queue whose receiving priority is higher than the highest receiving priority in the dynamic broadcast queue, S505 is directly executed.
[0157] S505. Determine, in order from front to back, whether the current broadcast receiver and the previous broadcast receiver in the dynamic broadcast queue have the same receiving priority and belong to the same process. If the current broadcast receiver and the previous broadcast receiver in the dynamic broadcast queue have the same receiving priority and belong to the same process, execute S506. If the current broadcast receiver and the previous broadcast receiver in the dynamic broadcast queue do not have the same receiving priority or do not belong to the same process, execute S507.
[0158] In one implementation, if the current broadcast receiver is the first broadcast receiver in the dynamic broadcast queue, it is determined that the current broadcast receiver and the previous broadcast receiver in the dynamic broadcast queue have the same receiving priority and belong to the same process.
[0159] S506: Add the current broadcast receiver in the dynamic broadcast queue to the foreground broadcast queue.
[0160] S507, determine whether there is a broadcast receiver in the static broadcast queue that has the same reception priority as the previous broadcast receiver in the dynamic broadcast queue and belongs to the same process. If there is a broadcast receiver in the static broadcast queue that has the same reception priority as the previous broadcast receiver in the dynamic broadcast queue and belongs to the same process, execute S508. If there is no broadcast receiver in the static broadcast queue that has the same reception priority as the previous broadcast receiver in the dynamic broadcast queue and belongs to the same process, execute S509.
[0161] S508: Add a broadcast receiver in the static broadcast queue that has the same receiving priority as the previous broadcast receiver in the dynamic broadcast queue and belongs to the same process to the foreground broadcast queue.
[0162] S509: Add the current broadcast receiver in the dynamic broadcast queue to the foreground broadcast queue.
[0163] S510, determine whether it is the last broadcast receiver in the static broadcast queue. If it is the last broadcast receiver in the static broadcast queue, execute S511. If it is not the last broadcast receiver in the static broadcast queue, execute S512.
[0164] S511. Add the remaining broadcast receivers in the dynamic broadcast queue to the foreground broadcast queue.
[0165] After the remaining broadcast receivers in the dynamic broadcast queue are added to the foreground broadcast queue, the merging process ends.
[0166] S512, determine whether it is the last broadcast receiver in the dynamic broadcast queue. If it is the last broadcast receiver in the dynamic broadcast queue, execute S513. If it is not the last broadcast receiver in the dynamic broadcast queue, execute S503.
[0167] S513: Add the remaining broadcast receivers in the static broadcast queue to the foreground broadcast queue.
[0168] After the remaining broadcast receivers in the static broadcast queue are added to the foreground broadcast queue, the merging process ends.
[0169] In this way, the static broadcast queue and the dynamic broadcast queue are merged into a foreground broadcast queue. In the foreground broadcast queue, the broadcast receivers are sorted in order of receiving priority from high to low; when the receiving priority is the same, the broadcast receivers belonging to the same process are arranged together; among the broadcast receivers with the same receiving priority and belonging to the same process, the dynamically registered broadcast receivers are in front and the statically registered broadcast receivers are in the back. Because when sending a foreground broadcast, the CPU grouping of the process is not modified when the process that previously received the foreground broadcast is the same process as the process that receives the foreground broadcast this time; in the method provided in the embodiment of the present application, the broadcast receivers belonging to the same process in the foreground broadcast queue are arranged together, which reduces the number of CPU adjustments and reduces power consumption.
[0170] For example, Figure 7 An example schematic diagram of a method for merging a static broadcast queue and a dynamic broadcast queue into a foreground broadcast queue provided in an embodiment of the present application is shown.
[0171] like Figure 7As shown, the dynamic broadcast queue is as follows: broadcast receiver A1 of process A, with a receiving priority of 1000; broadcast receiver A2 of process A, with a receiving priority of 1000; broadcast receiver B1 of process B, with a receiving priority of 1000; broadcast receiver B2 of process B, with a receiving priority of 500; broadcast receiver C1 of process C, with a receiving priority of 500. In the dynamic broadcast queue, broadcast receivers are arranged in descending order according to the receiving priority (for example, the larger the value of the receiving priority, the higher the receiving priority); broadcast receivers belonging to the same process with the same receiving priority are arranged together. The static broadcast queue is as follows: broadcast receiver A① of process A, with a receiving priority of 1000; broadcast receiver A② of process A, with a receiving priority of 1000; broadcast receiver B① of process B, with a receiving priority of 1000; broadcast receiver B② of process B, with a receiving priority of 500; broadcast receiver C① of process C, with a receiving priority of 500. In the static broadcast queue, broadcast receivers are arranged in descending order of receiving priority (for example, a larger receiving priority value indicates a higher receiving priority); broadcast receivers with the same receiving priority and belonging to the same process are arranged together.
[0172] Through pointers i and j, the broadcast receiver in the static broadcast queue is inserted into the dynamic broadcast queue and becomes the foreground broadcast queue. Pointer i is used to find the last broadcast receiver in the dynamic broadcast queue (including the queue after the broadcast receiver is inserted into the static broadcast queue) that has the same receiving priority and belongs to the same process; pointer j is used to find the broadcast receiver in the static broadcast queue that has the same receiving priority and belongs to the same process as the broadcast receiver pointed to by pointer i. Insert the broadcast receiver in the static broadcast queue that has the same receiving priority and belongs to the same process as the broadcast receiver pointed to by pointer i after the broadcast receiver pointed to by pointer i. In this way, the broadcast receivers with the same receiving priority and belonging to the same process can be arranged together; and the dynamically registered broadcast receivers are in front, and the statically registered broadcast receivers are in the back.
[0173] For example, Figure 7 As shown, pointer i first points to A1, then searches backward in the sorted broadcast queue (dynamic broadcast queue or the queue after the broadcast receiver inserted in the static broadcast queue) to find the last broadcast receiver with the same receiving priority as A1 and belonging to the same process, that is, A2; pointer i moves to A2. Pointer j first points to the first broadcast receiver A① in the static broadcast queue, and determines that A① and A2 pointed to by pointer i have the same receiving priority (1000) and belong to the same process (A); A① is inserted after A2 pointed to by pointer i.
[0174] Through pointer i, we search backward to find the last broadcast receiver with the same receiving priority as A1 and belonging to the same process, that is, we find A①; pointer j points to the first broadcast receiver A② in the static broadcast queue, and it is determined that A② and A① pointed to by pointer i have the same receiving priority (1000) and belong to the same process (A); insert A② after A① pointed to by pointer i. Through pointer i, we search backward to find the last broadcast receiver with the same receiving priority as A1 and belonging to the same process, that is, we find A②; through pointer j, we continue to search in the static broadcast queue to determine that there is no broadcast receiver with the same receiving priority as A② pointed to by pointer i and belonging to the same process.
[0175] Pointer i moves to the next broadcast receiver, pointing to B1. Searching backward in the sorted broadcast queue, no broadcast receiver with the same receiving priority as B1 and belonging to the same process is found, and pointer i stops at B1. Pointer j points to the first broadcast receiver B① in the static broadcast queue, and determines that B① and B1 pointed to by pointer i have the same receiving priority (1000) and belong to the same process (B); insert B① after B1 pointed to by pointer i.
[0176] Searching backward through pointer i, it is determined that there is no broadcast receiver with the same receiving priority (1000) and the same process (B) as B1 pointed to by pointer i in the sorted broadcast queue (the queue after the broadcast receiver is inserted into the static broadcast queue). Continue searching in the static broadcast queue through pointer j to determine that there is no broadcast receiver with the same receiving priority and the same process as B1 pointed to by pointer i.
[0177] Pointer i moves to the next broadcast receiver in the sorted broadcast queue (the queue after the broadcast receiver inserted in the static broadcast queue), pointing to B2. Searching backward in the sorted broadcast queue, no broadcast receiver with the same receiving priority as B2 and belonging to the same process is found, and pointer i stops at B2. Pointer j points to the first broadcast receiver B② in the static broadcast queue, and determines that B② and B2 pointed to by pointer i have the same receiving priority (500) and belong to the same process (B); insert B② after B2 pointed to by pointer i.
[0178] Searching backward through pointer i, it is determined that there is no broadcast receiver with the same receiving priority (500) and the same process (B) as B2 pointed to by pointer i in the sorted broadcast queue (the queue after the broadcast receiver is inserted into the static broadcast queue). Continue searching in the static broadcast queue through pointer j, and it is determined that there is no broadcast receiver with the same receiving priority and the same process as B2 pointed to by pointer i.
[0179] Pointer i moves to the next broadcast receiver in the sorted broadcast queue (the queue after the broadcast receiver inserted in the static broadcast queue), pointing to C1. C1 is the last broadcast receiver in the dynamic broadcast queue, and the remaining C① in the static broadcast queue is inserted after C1 pointed to by pointer i.
[0180] This completes the merging of the static broadcast queue and the dynamic broadcast queue. In the merged foreground broadcast queue, broadcast receivers with the same receiving priority and belonging to the same process are arranged together; among broadcast receivers with the same receiving priority and belonging to the same process, dynamically registered broadcast receivers are in front and statically registered broadcast receivers are in the back.
[0181] In summary, in implementation mode 1, the ordering rule of broadcast receivers in the foreground broadcast queue is: broadcast receivers with higher receiving priorities are given priority; when the receiving priorities are the same, dynamically registered broadcast receivers take precedence over statically registered broadcast receivers.
[0182] In implementation mode two, the sorting rules for broadcast receivers in the foreground broadcast queue are as follows: broadcast receivers with higher receiving priority are given priority; broadcast receivers with the same receiving priority and belonging to the same process are sorted together; among broadcast receivers with the same receiving priority and belonging to the same process, dynamically registered broadcast receivers take precedence over statically registered broadcast receivers.
[0183] For example, Figure 8 An example of merging a static broadcast queue and a dynamic broadcast queue by using implementation mode 1 and implementation mode 2 respectively is shown.
[0184] like Figure 8 As shown, the dynamic broadcast queues are as follows: broadcast receiver A1 of process A, with a receiving priority of 1000; broadcast receiver A2 of process A, with a receiving priority of 1000; broadcast receiver B1 of process B, with a receiving priority of 1000; broadcast receiver B2 of process B, with a receiving priority of 500; broadcast receiver C1 of process C, with a receiving priority of 500. The static broadcast queues are as follows: broadcast receiver A① of process A, with a receiving priority of 1000; broadcast receiver A② of process A, with a receiving priority of 1000; broadcast receiver B① of process B, with a receiving priority of 1000; broadcast receiver B② of process B, with a receiving priority of 500; broadcast receiver C① of process C, with a receiving priority of 500.
[0185] If implementation method one is adopted to merge the static broadcast queue and the dynamic broadcast queue, the broadcast receivers in the merged foreground broadcast queue are, from first to last, respectively: broadcast receiver A1 of process A, broadcast receiver A2 of process A, broadcast receiver B1 of process B, broadcast receiver A① of process A, broadcast receiver A② of process A, broadcast receiver B① of process B, broadcast receiver B2 of process B, broadcast receiver C1 of process C, broadcast receiver B② of process B, and broadcast receiver C① of process C.
[0186] After sorting using implementation method 1, for broadcast receivers with the same receiving priority, their sorting is independent of the process to which the broadcast receiver belongs. For example, broadcast receivers with the same receiving priority are sorted in the order of registration time. Broadcast receivers belonging to the same process may not be sorted together. When sending foreground broadcasts, it is necessary to repeatedly set the CPU grouping of a process, resulting in increased power consumption of the mobile phone. For example, in Figure 8 In the example shown, the CPU grouping is set once when a foreground broadcast is sent to A1, the CPU grouping is set once when a foreground broadcast is sent to B1, the CPU grouping is set once when a foreground broadcast is sent to A①, the CPU grouping is set once when a foreground broadcast is sent to B①, the CPU grouping is set once when a foreground broadcast is sent to C1, the CPU grouping is set once when a foreground broadcast is sent to B②, and the CPU grouping is set once when a foreground broadcast is sent to C①.
[0187] If implementation method 2 is adopted to merge the static broadcast queue and the dynamic broadcast queue, the broadcast receivers in the merged foreground broadcast queue are, from first to last: broadcast receiver A1 of process A, broadcast receiver A2 of process A, broadcast receiver A① of process A, broadcast receiver A② of process A, broadcast receiver B1 of process B, broadcast receiver B① of process B, broadcast receiver B2 of process B, broadcast receiver B② of process B, broadcast receiver C1 of process C, and broadcast receiver C① of process C.
[0188] After sorting using implementation method 2, for broadcast receivers with the same receiving priority, those belonging to the same process are sorted together. When sending a foreground broadcast, if the process that previously received the foreground broadcast is the same as the process that receives the foreground broadcast this time, the CPU grouping of the process will not be modified. Broadcast receivers belonging to the same process are sorted together, which reduces the number of times the CPU grouping is set. For example, Figure 8 In the example shown, a CPU group is set once when a foreground broadcast is sent to A1, a CPU group is set once when a foreground broadcast is sent to B1, and a CPU group is set once when a foreground broadcast is sent to C1; compared with the sorting method in the first implementation mode, the number of CPU group settings is greatly reduced. For example, Figure 8As shown, compared with the sorting by using the first embodiment, the sorting by using the second embodiment reduces the CPU grouping process by 4 times, thereby effectively reducing the power consumption of the mobile phone.
[0189] For example, Fig. 9 A flowchart of the process of sending a foreground broadcast is shown. In one example, the operating system of the electronic device (such as the Android system) includes a broadcast queue management module, an activity management service (AMS) and a priority management module. For example, the broadcast queue management module, AMS and the priority management module are located in the framework layer of the Android system. Fig. 9 As shown, the method may include:
[0190] S901. AMS notifies the broadcast queue management module to send a foreground broadcast.
[0191] AMS is responsible for the startup, switching, and scheduling of the four major components in the Android system and the management and scheduling of application processes. In some implementations, AMS determines that the conditions for triggering the foreground broadcast (such as the phone screen turning on or off) are met, and notifies the broadcast queue management module to send the corresponding foreground broadcast.
[0192] The broadcast queue management module obtains the foreground broadcast queue; and sends the foreground broadcast to each broadcast receiver in the foreground broadcast queue in order from first to last.
[0193] Exemplarily, the broadcast queue management module triggers sending a foreground broadcast to a first broadcast receiver, and the first broadcast receiver belongs to a first process.
[0194] S902: The broadcast queue management module notifies the AMS to prepare to update the CPU priority of the first process.
[0195] The broadcast queue management module notifies the AMS to prepare to update the CPU priority of the first process.
[0196] S903: The AMS notifies the priority management module to prepare to update the CPU priority of the first process.
[0197] S904: The broadcast queue management module notifies the AMS to update the CPU priority of the first process.
[0198] S905. The AMS notifies the priority management module to update the CPU priority of the first process.
[0199] S906: The priority management module calculates the Adj value of the first process.
[0200] In one implementation, the Adj value is used to represent the CPU priority of the process, and the smaller the Adj value, the higher the CPU priority of the process. The priority management module can calculate the Adj value of the first process according to the running time of the process, the process type, etc.
[0201] S907: The priority management module determines the CPU grouping of the first process.
[0202] In an embodiment of the present application, when a foreground broadcast is sent to a broadcast receiver of a first process, it is determined that the first process is added to a CPU group with a higher CPU priority. Exemplarily, the CPU group of the first process is set to 2.
[0203] S908. The priority management module determines the CPU grouping of the process to which the previous broadcast receiver in the foreground broadcast queue belongs.
[0204] Optionally, if the current broadcast receiver is not the first broadcast receiver in the foreground broadcast queue, the priority management module determines the CPU group of the process to which the previous broadcast receiver in the foreground broadcast queue belongs. In one embodiment, the process to which the previous broadcast receiver belongs is added to a CPU group with a lower CPU priority. Exemplarily, the CPU group of the process to which the previous broadcast receiver belongs is set to 0. The CPU priority of CPU group 2 is higher than the CPU priority of CPU group 0.
[0205] S909: The priority management module notifies the kernel to set the CPU grouping of the first process and the CPU grouping of the process to which the previous broadcast receiver belongs.
[0206] Exemplarily, the priority management module notifies the kernel to set the CPU group of the first process to 2 and to set the CPU group of the process to which the previous broadcast receiver belongs to 0.
[0207] Further, after completing the sending of the foreground broadcast to the first broadcast receiver, the AMS receives a foreground broadcast sending completion event. The AMS triggers the sending of the foreground broadcast to the next broadcast receiver in the foreground broadcast queue. Exemplarily, the method may also include:
[0208] S910. The AMS notifies the broadcast queue management module to send a foreground broadcast.
[0209] The broadcast queue management module sends the foreground broadcast to the broadcast receivers in the foreground broadcast queue in sequence from front to back.
[0210] S911. The broadcast queue management module notifies the AMS to prepare to update the CPU priority of the second process.
[0211] In one implementation, the broadcast queue management module searches backward in the foreground broadcast queue in sequence to find the second broadcast receiver, which is the first broadcast receiver that meets a preset condition, wherein the preset condition is that the process to which the broadcast receiver belongs is different from the first process. The second broadcast receiver belongs to the second process.
[0212] Exemplarily, the broadcast queue management module notifies the AMS to prepare to update the CPU priority of the second process.
[0213] S912: The AMS notifies the priority management module to prepare to update the CPU priority of the second process.
[0214] S913: The broadcast queue management module notifies the AMS to update the CPU priority of the second process.
[0215] S914. The AMS notifies the priority management module to update the CPU priority of the second process.
[0216] S915. The priority management module calculates the Adj value of the second process.
[0217] S916. The priority management module determines the CPU grouping of the second process.
[0218] In an embodiment of the present application, when sending a foreground broadcast to the broadcast receiver of the second process, it is determined to add the second process to a CPU group with a higher CPU priority. Exemplarily, the CPU group of the second process is set to 2.
[0219] S917. The priority management module determines the CPU grouping of the process to which the previous broadcast receiver in the foreground broadcast queue belongs.
[0220] Exemplarily, the process to which the previous broadcast receiver in the foreground broadcast queue belongs is the first process. In one embodiment, the process to which the previous broadcast receiver belongs (the first process) is added to a CPU group with a lower CPU priority, and exemplary, the CPU group of the process to which the previous broadcast receiver belongs (the first process) is set to 0.
[0221] S918. The priority management module notifies the kernel to set the CPU grouping of the second process and the CPU grouping of the process to which the previous broadcast receiver belongs.
[0222] Exemplarily, the priority management module notifies the kernel to set the CPU group of the second process to 2, and to set the CPU group of the process (the first process) to which the previous broadcast receiver belongs to to 0.
[0223] The system broadcast sending method provided in the embodiment of the present application sorts the order of broadcast receivers when sending system broadcasts, and arranges broadcast receivers belonging to the same process together, effectively reducing the number of times the CPU grouping is set. For example, Fig. 9 S911-S918 is the process of setting a CPU group. Each time the process of setting a CPU group takes about 6.7 milliseconds. Through tracking and statistics of 11143 sorting processes, it takes an average of about 0.0712733 milliseconds each time the sorting process using Implementation Method 2 is performed. It can be seen that the time consumed by using Implementation Method 2 for sorting when sending a foreground broadcast is much less than the time consumed by setting a CPU group. The system broadcast sending method provided in the embodiment of the present application effectively reduces the number of times the CPU group is set by arranging broadcast receivers belonging to the same process together.
[0224] It is understandable that the electronic device provided in the embodiment of the present application includes a hardware structure and / or software module corresponding to each function in order to realize the above functions. Those skilled in the art should easily realize that, in conjunction with the units and algorithm steps of each example described in the embodiment disclosed herein, the embodiment of the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware 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 to exceed the scope of the embodiment of the present application.
[0225] The embodiment of the present application can divide the functional modules of the above-mentioned electronic device according to the above-mentioned method example. For example, each functional module can be divided corresponding to each function, or two or more functions can be integrated into one processing module. The above-mentioned integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.
[0226] In one example, see Fig.10 , which shows a possible structural diagram of an electronic device involved in the above embodiment. The electronic device 1000 includes: a processing unit 1010 and a storage unit 1020.
[0227] The processing unit 1010 is used to control and manage the actions of the electronic device 1000 .
[0228] The storage unit 1020 is used to store program codes and data of the electronic device 1000 .
[0229] Of course, the unit modules in the above-mentioned electronic device 1000 include but are not limited to the above-mentioned processing unit 1010 and storage unit 1020.
[0230] Optionally, the electronic device 1000 may further include a display unit, an audio unit, a communication unit, etc. The display unit is used to display the user interface of the electronic device 1000. The audio unit is used to collect audio, play audio, etc. The communication unit is used to support the electronic device 1000 to communicate with other devices.
[0231] The processing unit 1010 may be a processor or a controller, for example, a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The storage unit 1020 may be a memory. The display unit may be a display screen, etc. The audio unit may include a microphone, a speaker, etc. The communication unit may include a mobile communication unit and / or a wireless communication unit.
[0232] For example, the processing unit 1010 is a processor (such as Figure 2 The processor 110 shown in FIG. 10A ) and the storage unit 1020 may be a memory (such as Figure 2 The internal memory 121 shown in FIG. 1 ) and the display unit may be a display screen (such as Figure 2 The audio unit may be an audio module (such as Figure 2 The communication unit may include a mobile communication unit (such as Figure 2 The mobile communication module 150 shown) and the wireless communication unit (such as Figure 2 The electronic device 1000 provided in the embodiment of the present application may be Figure 2 The electronic device 100 shown in FIG. The processor, memory, display screen, etc. mentioned above may be connected together, for example, via a bus.
[0233] The embodiment of the present application also provides a chip system, which includes at least one processor and at least one interface circuit. The processor and the interface circuit can be interconnected by lines. For example, the interface circuit can be used to receive signals from other devices (such as a memory of an electronic device). For another example, the interface circuit can be used to send signals to other devices (such as a processor). Exemplarily, the interface circuit can read instructions stored in the memory and send the instructions to the processor. When the instructions are executed by the processor, the electronic device can perform the various steps in the above embodiments. Of course, the chip system can also include other discrete devices, which are not specifically limited in the embodiment of the present application.
[0234] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step executed by the mobile phone in the above-mentioned method embodiment.
[0235] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute each function or step executed by the mobile phone in the above method embodiment.
[0236] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0237] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, 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 through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0238] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0239] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0240] 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 readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0241] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A system broadcast sending method, It is characterized in that include: Obtain a first broadcast queue corresponding to the first system broadcast; The first broadcast queue includes a plurality of broadcast receivers, and the plurality of broadcast receivers having the same receiving priority and belonging to the same process are arranged together; The first system broadcast is sent to each broadcast receiver in the first broadcast queue in sequence according to the order of the broadcast receivers in the first broadcast queue from first to last.
2. The method according to claim 1, It is characterized in that The method further comprises: Acquire a static broadcast queue and a dynamic broadcast queue corresponding to the first system broadcast; the static broadcast queue includes statically registered broadcast receivers, and the dynamic broadcast queue includes dynamically registered broadcast receivers; The static broadcast queue and the dynamic broadcast queue are merged into the first broadcast queue.
3. The method according to claim 2, It is characterized in that The merging the static broadcast queue and the dynamic broadcast queue into the first broadcast queue comprises: Insert the broadcast receiver in the static broadcast queue into the dynamic broadcast queue to obtain the first broadcast queue; when inserting the broadcast receiver in the static broadcast queue into the dynamic broadcast queue, arrange the broadcast receivers in the static broadcast queue and the dynamic broadcast queue that have the same receiving priority and belong to the same process together.
4. The method according to claim 2 or 3, It is characterized in that Before merging the static broadcast queue and the dynamic broadcast queue into the first broadcast queue, the method further includes: Sorting the static broadcast queue, arranging together the broadcast receivers in the static broadcast queue that have the same receiving priority and belong to the same process; The dynamic broadcast queue is sorted, and broadcast receivers in the dynamic broadcast queue that have the same receiving priority and belong to the same process are arranged together.
5. The method according to any one of claims 1 to 4, It is characterized in that In the first broadcast queue, among the broadcast receivers having the same receiving priority and belonging to the same process, the dynamically registered broadcast receivers are arranged before the statically registered broadcast receivers.
6. The method according to any one of claims 1 to 5, It is characterized in that In the first broadcast queue, a broadcast receiver with a high reception priority precedes a broadcast receiver with a low reception priority.
7. The method according to any one of claims 1 to 6, It is characterized in that The first broadcast queue includes a first broadcast receiver, and the first broadcast receiver belongs to a first process. The method further includes: When sending the first system broadcast to the first broadcast receiver, the CPU priority of the first process is increased.
8. The method according to claim 7, It is characterized in that The method further comprises: When sending the first system broadcast to the first broadcast receiver, lower the CPU priority of a second process; the second process is different from the first process, and the second process is a process to which a previous broadcast receiver of the first broadcast receiver in the first broadcast queue belongs.
9. The method according to any one of claims 1 to 8, It is characterized in that The first system broadcast is a foreground broadcast.
10. An electronic device, It is characterized in that The electronic device comprises: a processor and a memory, the processor being coupled to the memory; one or more computer programs are stored in the memory, the one or more computer programs comprising instructions, and when the instructions are executed by the electronic device, the electronic device executes the method as described in any one of claims 1-9.
11. A computer-readable storage medium, It is characterized in that The method comprises computer instructions; when the computer instructions are executed on an electronic device, the electronic device is caused to execute the method as claimed in any one of claims 1 to 9.
Citation Information
Patent Citations
Job scheduling management system and method
CN103324539A
Broadcast processing method and device and computer system
CN112052101A
Broadcast message processing method and device and terminal equipment
CN113132121A
Method for Arranging Broadcast Message in Operating System and Electronic Device
US20200008174A1
