Broadcast distribution method and electronic equipment
By determining the joining method based on the broadcast message attributes and receiver attributes in the Android operating system, the broadcast blockage problem is solved, and the broadcast distribution efficiency and system stability are improved.
Patent Information
- Application Number
- CN202410039981.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-10
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2044-01-10
AI Technical Summary
In Android operating systems, large number of broadcasts or frequent sending can easily lead to broadcast blockage, resulting in terminal application lag, information update timeout, and poor system stability.
By determining the message enqueue method of the target broadcast message based on the broadcast message attributes in the broadcast message queue and the receiver attributes of the broadcast receiver, the message enqueue method of direct enqueue or replacement enqueue is adopted to introduce the target broadcast message queue into the broadcast message queue. , to avoid broadcast blockage and priority reverse order, and ensure broadcast distribution efficiency.
It effectively improves broadcast distribution efficiency, reduces the use of CPU and memory resources, avoids terminal screen stuttering and information update timeout, and ensures the stability of system functions.
Smart Images

Figure CN119292801A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminal devices, and in particular, to a broadcast distribution method and electronic device. Background Art
[0002] Broadcast is a widely used information transmission mechanism between applications in the Android operating system. Broadcast in the Android operating system can be used to transmit system event information or application event information, such as for transmitting boot completion information issued by system services.
[0003] In scenarios where there are a large number of broadcasts or broadcasts are sent frequently, broadcast congestion is likely to occur, causing application freezes, information update timeouts, and poor system stability on the terminal. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a broadcast distribution method and an electronic device. In the method, the electronic device determines a message enqueueing mode of a target broadcast message according to a broadcast message attribute in a broadcast message queue and a receiver attribute of at least one broadcast receiver, and introduces the target broadcast message into the broadcast message queue according to the message enqueueing mode, so as to distribute the target broadcast message to the corresponding broadcast receiver.
[0005] It can effectively improve the efficiency of broadcast distribution and avoid broadcast congestion. It is suitable for scenarios with a large number of broadcasts or frequent broadcasts. It can effectively ensure the stability of system functions and help improve user experience.
[0006] In the first aspect, an embodiment of the present application provides a broadcast distribution method. The method includes: receiving a target broadcast message sent by a broadcast publisher; determining a broadcast message queue matching the broadcast publisher, wherein the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver; determining a message enqueueing method of the target broadcast message according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver; and introducing the target broadcast message into the broadcast message queue according to the message enqueueing method so as to distribute the target broadcast message to the corresponding broadcast receiver.
[0007] The message enqueueing methods include direct enqueueing and replacement enqueueing. When the message enqueueing method is direct enqueueing, the target broadcast message is introduced to the tail position of the broadcast message queue. When the message enqueueing method is replacement enqueueing, the target broadcast message is used to replace the mergeable broadcast message in the broadcast message queue to achieve the introduction of the target broadcast into the replacement broadcast message queue.
[0008] According to the first aspect, the message enqueue mode of the target broadcast message is determined based on the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, including: determining whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue based on the broadcast message attributes and the receiver attributes; and determining that the message enqueue mode is replacement enqueue when the mergeable broadcast message exists in the broadcast message queue.
[0009] Replacing the mergeable broadcast messages with target broadcast messages can avoid the problem of priority inversion in the broadcast message queue, effectively alleviate broadcast congestion, and effectively ensure broadcast distribution efficiency.
[0010] According to the first aspect, or any implementation of the first aspect above, the broadcast message attributes include broadcast action attributes, and the receiver attributes include receiver identity and receiver priority.
[0011] In the Android operating system, the broadcast action may be a string used to uniquely identify the broadcast type.
[0012] According to the first aspect, or any implementation method of the first aspect above, determining whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue according to the broadcast message attributes and the receiver attributes includes: traversing the broadcast message queue in reverse order, and determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue according to the broadcast action attributes and the receiver identity, wherein the candidate broadcast message and the target broadcast message are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver; in the case where the candidate broadcast message exists in the broadcast message queue, determining whether the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, wherein the other broadcast messages are messages in the broadcast message queue that are located after the candidate broadcast message; in the case where the receiver priorities corresponding to the other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, the candidate broadcast message is used as the mergeable broadcast message.
[0013] According to the first aspect, or any one implementation method of the first aspect above, the target broadcast message is introduced into the broadcast message queue according to the message enqueuing method, including: when the message enqueuing method is replacement enqueuing, the target broadcast message is used to replace the mergeable broadcast message in the broadcast message queue to achieve the introduction of the target broadcast message into the broadcast message queue.
[0014] It can effectively improve the efficiency of broadcast distribution and reduce the occupation of CPU, memory and other system resources by broadcast distribution. It can effectively solve the problem of broadcast congestion, effectively avoid the problems of screen freeze, information update timeout and slow information processing efficiency on the terminal, which is conducive to ensuring the stability of system functions.
[0015] According to the first aspect, or any implementation method of the first aspect above, the message enqueuing method of the target broadcast message is determined based on the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, including: when the candidate broadcast message does not exist in the broadcast message queue, or when the receiver priority corresponding to the other broadcast message is greater than the receiver priority corresponding to the target broadcast message, determining that the message enqueuing method is direct enqueuing.
[0016] According to the first aspect, or any implementation method of the first aspect above, the target broadcast message is introduced into the broadcast message queue according to the message enqueuing method, including: when the message enqueuing method is direct enqueuing, the target broadcast message is introduced into the tail position of the broadcast message queue.
[0017] According to the first aspect, or any implementation method of the first aspect above, the reverse order traversal of the broadcast message queue, and based on the broadcast action attributes and the receiver identity, determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue, includes: for the first broadcast message in the reverse order in the broadcast message queue, determining whether the first broadcast message is the candidate broadcast message; in the case that the first broadcast message is not a candidate broadcast message, traversing the broadcast message queue in reverse order until it is determined that the nth broadcast message in the reverse order in the broadcast message queue is the candidate broadcast message, wherein 1<n≤N, N is an integer greater than 1, and N is the total number of broadcast messages in the broadcast message queue; the existence of the candidate broadcast message in the broadcast message queue In the case of a broadcast message, determining whether the receiver priorities corresponding to other broadcast messages are all smaller than the receiver priority corresponding to the target broadcast message, including: determining the maximum priority among the receiver priorities corresponding to the first n-1 broadcast messages in reverse order in the broadcast message queue, and determining whether the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message; in the case that the receiver priorities corresponding to the other broadcast messages are all smaller than or equal to the receiver priority corresponding to the target broadcast message, taking the candidate broadcast message as the mergeable broadcast message, including: in the case that the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message, taking the nth broadcast message as the mergeable broadcast message.
[0018] According to the first aspect, or any implementation of the first aspect above, the method further includes: when the first broadcast message is the candidate broadcast message, using the first broadcast message as the mergeable broadcast message.
[0019] According to the first aspect, or any implementation method of the first aspect above, the reverse order is the direction from the tail to the head of the broadcast message queue, and the broadcast message queue is a queue consisting of all undistributed broadcast messages issued by the broadcast publisher before the time node with the current moment as the time node.
[0020] In a second aspect, an embodiment of the present application provides an electronic device. The electronic device includes one or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored on the memory, and when the computer program is executed by the one or more processors, the electronic device performs the following steps: receiving a target broadcast message sent by a broadcast publisher; determining a broadcast message queue matching the broadcast publisher, wherein the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver; determining a message enqueueing method of the target broadcast message according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver; and introducing the target broadcast message into the broadcast message queue according to the message enqueueing method so as to distribute the target broadcast message to the corresponding broadcast receiver.
[0021] According to the second aspect, the message enqueue mode of the target broadcast message is determined based on the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, including: determining whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue based on the broadcast message attributes and the receiver attributes; and determining that the message enqueue mode is replacement enqueue when the mergeable broadcast message exists in the broadcast message queue.
[0022] According to the second aspect, or any implementation of the second aspect above, the broadcast message attributes include broadcast action attributes, and the receiver attributes include receiver identity and receiver priority.
[0023] According to the second aspect, or any implementation method of the second aspect above, determining whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue according to the broadcast message attributes and the receiver attributes includes: traversing the broadcast message queue in reverse order, and determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue according to the broadcast action attributes and the receiver identity, wherein the candidate broadcast message and the target broadcast message are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver; in the case where the candidate broadcast message exists in the broadcast message queue, determining whether the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, wherein the other broadcast messages are messages in the broadcast message queue that are located after the candidate broadcast message; in the case where the receiver priorities corresponding to the other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, the candidate broadcast message is used as the mergeable broadcast message.
[0024] According to the second aspect, or any one implementation method of the second aspect above, the target broadcast message is introduced into the broadcast message queue according to the message enqueuing method, including: when the message enqueuing method is replacement enqueuing, the target broadcast message is used to replace the mergeable broadcast message in the broadcast message queue to achieve the introduction of the target broadcast message into the broadcast message queue.
[0025] According to the second aspect, or any implementation method of the second aspect above, the message enqueuing method of the target broadcast message is determined based on the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, including: when the candidate broadcast message does not exist in the broadcast message queue, or when the receiver priority corresponding to the other broadcast message is greater than the receiver priority corresponding to the target broadcast message, determining that the message enqueuing method is direct enqueuing.
[0026] According to the second aspect, or any implementation method of the second aspect above, the target broadcast message is introduced into the broadcast message queue according to the message enqueuing method, including: when the message enqueuing method is direct enqueuing, the target broadcast message is introduced into the tail position of the broadcast message queue.
[0027] According to the second aspect, or any implementation method of the second aspect above, the reverse order traversal of the broadcast message queue, and based on the broadcast action attributes and the receiver identity, determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue, includes: for the first broadcast message in the reverse order in the broadcast message queue, determining whether the first broadcast message is the candidate broadcast message; if the first broadcast message is not a candidate broadcast message, traversing the broadcast message queue in reverse order until it is determined that the nth broadcast message in the reverse order in the broadcast message queue is the candidate broadcast message, wherein 1<n≤N, N is an integer greater than 1, and N is the total number of broadcast messages in the broadcast message queue; the existence of the candidate broadcast message in the broadcast message queue In the case of a broadcast message, determining whether the receiver priorities corresponding to other broadcast messages are all smaller than the receiver priority corresponding to the target broadcast message, including: determining the maximum priority among the receiver priorities corresponding to the first n-1 broadcast messages in reverse order in the broadcast message queue, and determining whether the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message; in the case that the receiver priorities corresponding to the other broadcast messages are all smaller than or equal to the receiver priority corresponding to the target broadcast message, taking the candidate broadcast message as the mergeable broadcast message, including: in the case that the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message, taking the nth broadcast message as the mergeable broadcast message.
[0028] According to the second aspect, or any implementation of the second aspect above, the method further includes: when the first broadcast message is the candidate broadcast message, using the first broadcast message as the mergeable broadcast message.
[0029] According to the second aspect, or any implementation method of the second aspect above, the reverse order is the direction from the tail to the head of the broadcast message queue, and the broadcast message queue is a queue consisting of all undistributed broadcast messages issued by the broadcast publisher before the time node with the current moment as the time node.
[0030] The second aspect and any implementation of the second aspect correspond to the first aspect and any implementation of the first aspect respectively. The technical effects corresponding to the second aspect and any implementation of the second aspect can refer to the technical effects corresponding to the above-mentioned first aspect and any implementation of the first aspect, which will not be repeated here.
[0031] In a third aspect, an embodiment of the present application provides a computer-readable medium, including a computer program, which, when executed on an electronic device, enables the electronic device to execute the first aspect or any possible broadcast distribution method of the first aspect.
[0032] In a fourth aspect, an embodiment of the present application provides a computer program, which includes instructions for executing the method in the first aspect or any possible implementation of the first aspect.
[0033] In a fifth aspect, an embodiment of the present application provides a chip, the chip comprising a processing circuit and a transceiver pin, wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the method in the first aspect or any possible implementation of the first aspect to control the receiving pin to receive a signal, and to control the transmitting pin to send a signal. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 A schematic diagram of an exemplary broadcast mechanism;
[0035] Figure 2 A schematic diagram of an exemplary broadcast queue is shown;
[0036] Figure 3 is a schematic diagram of another exemplary broadcast enqueue;
[0037] Figure 4 The figure is a schematic diagram showing exemplary broadcast congestion in multiple processes;
[0038] Figure 5 is a schematic diagram showing the effect of broadcast congestion as an example;
[0039] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0040] Figure 7 A software structure block diagram of an electronic device provided in an embodiment of the present application;
[0041] Figure 8 A schematic diagram of a broadcast distribution process provided by an embodiment of the present application;
[0042] Fig. 9 A schematic diagram of another broadcast distribution process provided by an embodiment of the present application;
[0043] Fig.10 A schematic diagram of another broadcast distribution process provided by an embodiment of the present application;
[0044] Fig.11 A schematic diagram of another broadcast distribution process provided in an embodiment of the present application;
[0045] Fig.12 A flowchart of a broadcast distribution method provided in an embodiment of the present application;
[0046] Fig.13 An interactive diagram of the broadcast distribution process provided for an embodiment of the present application. DETAILED DESCRIPTION
[0047] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0048] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0049] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0050] 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.
[0051] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0052] First, some technical terms involved in this application are explained.
[0053] like Figure 1 is a schematic diagram of an exemplary broadcast mechanism, such as Figure 1As shown in the figure, the broadcast mechanism is a message subscription / publishing mechanism. Broadcast receivers can register for broadcast in AMS (Activity Manager Service). Broadcast registration methods include static registration and dynamic registration. The broadcast publisher sends a broadcast message to AMS, and AMS searches for the broadcast receiver corresponding to the broadcast message based on the identity information of the registered broadcast receiver. In addition, AMS can also queue the broadcast message to be distributed to achieve the distribution of the broadcast message to the corresponding broadcast receiver.
[0054] like Figure 2 The figure is a schematic diagram of an exemplary broadcast enqueue. For ease of understanding, the symbols involved in this embodiment are explained. R1(0) indicates that the receiver is R1 and the priority is 0; R2(1000) indicates that the receiver is R2 and the priority is 1000; A(1) indicates the broadcast message A sent by the broadcast publisher for the first time, and A(2) indicates the broadcast message A sent by the broadcast publisher for the second time; A(1)->R1(0) indicates the broadcast message A sent for the first time and will be distributed to the broadcast receiver R1(0); A(2)->R1(0) indicates the broadcast message A sent for the second time and will be distributed to the broadcast receiver R1(0).
[0055] like Figure 2 As shown in A, in the initial state, there is a broadcast message queue in process P1, and a broadcast receiver R1(0) is registered. The broadcast receiver R1(0) can receive broadcast message A. Figure 2 As shown in B, the broadcast publisher sends a broadcast message A for the first time. Since there is a broadcast receiver R1(0) in process P1 that can receive broadcast message A, a broadcast message A is queued into the broadcast message queue of process P1 and recorded as A(1)->R1(0). The following is obtained: Figure 2 C shows the broadcast message queue.
[0056] like Figure 3 FIG. 2 is a schematic diagram of another exemplary broadcast queue. Figure 3 As shown in A, process P1 registers a broadcast receiver R2 (1000) again. The broadcast receiver R2 (1000) can receive broadcast message A and has a priority of 1000.
[0057] like Figure 3As shown in B, the broadcast publisher sends broadcast message A for the second time. Since there are two broadcast receivers (R1(0), R2(1000)) in process P1 that can receive broadcast message A, the two broadcast messages A are queued into the broadcast message queue of process P1, and are recorded as A(2)->R1(0) and A(2)->R2(1000) respectively. Moreover, since the priority of broadcast receiver R2(1000) is higher than that of broadcast receiver R1(0), broadcast message A(2)->R2(1000) is queued before broadcast message A(2)->R1(0).
[0058] like Figure 3 As shown in C, when the broadcast message A(2)->R2(1000) is enqueued into the broadcast message queue, since there is no other broadcast message A in the broadcast message queue for distribution to the broadcast receiver R2(1000), the broadcast message A(2)->R2(1000) is directly enqueued to the tail position of the broadcast message queue. When the broadcast message A(2)->R1(0) is enqueued into the broadcast message queue, since there is the same broadcast message A(A(1)->R1(0)) in the broadcast message queue for distribution to the broadcast receiver R1(0), the broadcast message A(2)->R1(0) is used to replace the broadcast message A(1)->R1(0) in the broadcast message queue, completing the replacement enqueuing of the broadcast message A(2)->R1(0), and obtaining the following: Figure 3 D shows the broadcast message queue.
[0059] exist Figure 3 In the broadcast message queue shown in D, broadcast message A(2)->R1(0) is located before broadcast message A(2)->R2(1000), and the priority of broadcast receiver R1(0) corresponding to broadcast message A(2)->R1(0) is lower than that of broadcast receiver R2(1000) corresponding to broadcast message A(2)->R2(1000). According to the broadcast reception rules, for the same broadcast message, the broadcast receiver with a higher priority should receive the broadcast first. Therefore, in Figure 3 In D, the theoretical distribution order of broadcast messages A(2)->R1(0) and A(2)->R2(1000) is to first distribute the broadcast message A(2)->R2(1000) to the broadcast receiver R2(1000), and then distribute the broadcast message A(2)->R1(0) to the broadcast receiver R1(0).
[0060] However, according to the broadcast message distribution rules, the broadcast message at the head of the broadcast message queue should be distributed first. Figure 3In D, the theoretical distribution order of broadcast messages A(2)->R1(0) and A(2)->R2(1000) is inconsistent with the actual arrangement order of the two broadcast messages in the broadcast message queue. The two broadcast messages cannot be distributed normally, resulting in broadcast message congestion, causing process P1 to be unable to receive broadcast messages.
[0061] like Figure 4 FIG. 1 is a schematic diagram showing an exemplary broadcast blocking in multiple processes. Figure 4 As shown, process P1 has registered broadcast receiver R3 (100), and process P2 has registered broadcast receiver R4 (0). Both broadcast receiver R3 (100) and broadcast receiver R4 (0) can receive broadcast message B. The priority of broadcast receiver R3 (100) is higher than that of broadcast receiver R4 (0).
[0062] Since the broadcast message queue of process P1 is blocked, process P1 cannot distribute broadcast message B(1)->R3(100) to broadcast receiver R3(100). According to the broadcast message distribution rule, the distribution of broadcast message B(1)->R4(0) in process P2 needs to wait for the distribution of broadcast message B(1)->R3(100). Therefore, the broadcast message congestion of process P1 leads to the broadcast message congestion of process P2.
[0063] By analogy, the jam of broadcast messages of a certain process in the system may cause the jam of broadcast messages of multiple processes, especially the jam of broadcast messages of system applications or even system service processes, leading to system malfunction until the system returns to normal after restart.
[0064] Exemplarily, when the state of the terminal changes, such as when the terminal is turned on or the network of the terminal changes, the system application can notify the receiver of the terminal's state change information by publishing a broadcast message. A single broadcast message sent by a broadcast publisher may correspond to multiple receivers who have subscribed to the broadcast. For example, the CONNECTIVITY_CHANGE broadcast is subscribed to frequently, and applications related to the network status may all subscribe to the broadcast. The CONNECTIVITY_CHANGE broadcast may correspond to hundreds of receivers waiting to process related services of the broadcast. When the network signal is unstable or the network switches frequently, the CONNECTIVITY_CHANGE broadcast may be published very frequently. For example, it can reach 700 per second. The terminal has to perform a large number of broadcast queuing and distribution operations in a short period of time, which may cause the terminal to experience screen freezes, information update timeouts, and slow processing rates, affecting the user experience.
[0065] The modern broadcast mechanism native to Google U version may cause broadcast congestion. For example, in Google U6 version, multiple receivers are registered for broadcast in the same application. Multiple receivers involve two or more priorities. Low-priority receivers need to wait for high-priority receivers to receive the broadcast first. When merging broadcast messages with the same broadcast action, a priority inversion may occur in the broadcast message queue. Combined with the modern broadcast mechanism that the last-queued broadcast message in the broadcast message queue needs to wait for the first-queued broadcast message to be distributed, this may cause broadcast congestion. Broadcast congestion affects the normal delivery of broadcast messages, resulting in subscribers being unable to receive broadcast messages normally. This may cause a series of serious problems such as WiFi list not being updated, time not being updated, and battery power not being updated, affecting the user experience.
[0066] Figure 5 The schematic diagram of the impact of broadcast congestion is schematically shown. For example, after the system application releases the CONNECTIVITY_CHANGE broadcast, the broadcast congestion problem may cause most applications in the terminal to be unable to receive the CONNECTIVITY_CHANGE broadcast and unable to obtain the change information of the terminal network status, as shown in 101, which may cause the terminal to have a network connection error. As shown in 102, broadcast congestion may also cause the terminal to have a problem of not updating the time. As shown in 103, broadcast congestion may also cause the terminal to have a problem of not updating the battery power.
[0067] An embodiment of the present application provides a broadcast distribution method, which is applied to an electronic device. After receiving a broadcast message to be distributed, the electronic device determines a broadcast message queue that matches the broadcast publisher. The electronic device determines whether there is a mergeable broadcast message matching the broadcast message to be distributed in the broadcast message queue, and determines whether replacing the mergeable broadcast message with the broadcast message to be distributed will cause a priority inversion in the broadcast message queue. When it is determined that the broadcast message queue will not have a priority inversion, the electronic device replaces the mergeable broadcast message with the broadcast message to be distributed, so as to introduce the broadcast message to be distributed into the broadcast message queue.
[0068] The situation where high-priority receivers in the broadcast message queue are arranged after low-priority receivers constitutes a reverse priority order. Combined with the modern broadcast mechanism in which the broadcast messages that enter the queue later need to wait for the broadcast messages that enter the queue earlier to be distributed, the reverse priority order can easily lead to broadcast congestion and affect the normal distribution of broadcast messages in the broadcast message queue.
[0069] When the electronic device determines that there will be no priority inversion, the electronic device merges the broadcast messages, which can effectively ensure the normal transmission of the broadcast messages and is conducive to optimizing the information processing efficiency in the electronic device.
[0070] like Figure 6 FIG. 1 is a schematic diagram showing the structure of an electronic device 100. Figure 6 The structure diagram of the electronic device 100 is shown. Optionally, the electronic device 100 can be called a terminal or a terminal device, and the specific product form can be a smart terminal, such as a mobile phone, a tablet, a DV, a smart watch, a smart wearable device, a portable computer, a laptop computer, a smart speaker, etc. Specifically, the functional modules involved in the present application can be deployed on the DSP chip of the relevant device, and specifically can be the application program or software therein. A broadcast distribution function can be provided through software installation or upgrade, and through the call and coordination of hardware.
[0071] It should be understood that Figure 6 The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have a different configuration of components. Figure 6 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0072] 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 gyroscope sensor, an acceleration sensor, a temperature sensor, a motion sensor, an air pressure sensor, a magnetic sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0073] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (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.
[0074] 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.
[0075] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory.
[0076] The USB interface 130 is an interface that complies with USB standard specifications, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
[0077] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 is charging the battery 142, it can also power the electronic device through the power management module 141. 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 powers the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
[0078] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
[0079] 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 the antennas.
[0080] The mobile communication module 150 may 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.
[0081] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, 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 technology (NFC), infrared technology (IR), etc.
[0082] 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.
[0083] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor, etc. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0084] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0085] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0086] The ISP is used to process data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted to the camera photosensitive element through the lens, and the light signal is converted into an electrical signal. The camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
[0087] The 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 to be converted 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 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0088] Among them, the camera 193 can be located in the edge area of the electronic device, can be an under-screen camera, or can be a liftable camera. The camera 193 can include a rear camera, and can also include a rear camera. The embodiment of the present application does not limit the specific position and form of the camera 193. The electronic device 100 can include cameras of one or more focal lengths. For example, cameras of different focal lengths can include a telephoto camera, a wide-angle camera, an ultra-wide-angle camera, or a panoramic camera.
[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 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement a data storage function.
[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 100 by running the instructions stored in the internal memory 121, such as enabling the electronic device 100 to implement the task processing method in the embodiment of the present application. 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.), etc. The data storage area may store data (such as audio data, a phone book, etc.) created during the use of the electronic device 100, 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 electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.
[0092] 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.
[0093] The touch sensor is also called a "touch panel". The touch sensor can be set on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor is used to detect a touch operation 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.
[0094] 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. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor.
[0095] The gyro sensor may be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor.
[0096] The accelerometer can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the accelerometer can detect the magnitude and direction of gravity. The accelerometer can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0097] The key 190 includes a power key (or power key), a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0098] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.
[0099] Figure 71 is a software structure diagram of the electronic device 100 of the embodiment of the present application. The layered architecture of the electronic device 100 divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android runtime), the system library, the hardware abstraction layer (HAL) and the kernel layer.
[0100] The application layer can include a series of application packages, such as Figure 5 As shown, the application package may include applications such as camera, map, navigation, WLAN, Bluetooth, payment application, taxi application, etc.
[0101] The application framework layer provides application programming interfaces (APIs) and programming frameworks for applications in the application layer, including various components and services to support developers' Android development. The application framework layer includes some predefined functions. Figure 5 As shown, the application framework layer may include a view system, a window manager, a resource manager, a content provider, a notification manager, and an AMS, etc.
[0102] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0103] Content providers are used to store and retrieve data and make it accessible to applications. The data can include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0104] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications, and the display interface can be composed of one or more views, such as a view for displaying a text message notification icon, a view for displaying text, and a view for displaying pictures.
[0105] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0106] The notification manager allows applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, notification information is used to inform the completion of downloads, message reminders, etc. Notification information can also appear in the system top status bar in the form of icons or scroll bar text, such as notifications of applications running in the background, or in the form of dialog windows on the screen. For example, text messages are displayed in the status bar, prompts sound, electronic devices vibrate, indicator lights flash, etc.
[0107] In the Android operating system, AMS (Activity Manager Service) is responsible for managing the activities of applications, handling activities' lifecycle management, task stack management, and application startup and shutdown tasks. AMS interacts with application components (such as activities, services, and broadcast receivers) to maintain the normal operation of the entire Android operating system. For example, AMS is responsible for coordinating and managing the delivery of broadcasts to ensure that broadcasts can be correctly delivered to the target broadcast receivers.
[0108] The system layer includes the system library and the Android Runtime. The system library can include multiple functional modules, such as the browser kernel, 3D graphics library (such as OpenGL ES), font library, etc. The browser kernel is responsible for interpreting the syntax of the web page (such as an application HTML, JavaScript under the standard generalized markup language) and rendering (displaying) the web page. The 3D graphics library is used to implement three-dimensional graphics drawing, image rendering, synthesis and layer processing. The font library is used to implement the input of different fonts. The Android runtime includes the core library and the virtual machine. The Android runtime is responsible for the scheduling and management of the Android system. The core library contains two parts: one part is the function function that the Java language needs to call, and the other part is the Android core library. The application layer and the application framework layer run in the virtual machine, and the virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0109] Understandably, Figure 7 The components included in the system framework layer, system library and runtime layer shown do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or combine some components, or split some components, or arrange the components differently.
[0110] The HAL layer is an interface layer between the operating system kernel and the hardware circuit. The HAL layer includes, for example, the audio hardware abstraction layer (Audio HAL), the camera hardware abstraction layer (Camera HAL), etc. Among them, the Audio HAL is used to process the audio stream, such as performing noise reduction and directional enhancement on the audio stream, and the Camera HAL is used to process the image stream.
[0111] The kernel layer is the layer between the hardware and the above software layers. The kernel layer contains at least display drivers, camera drivers, audio drivers, and sensor drivers. The hardware may include devices such as cameras, displays, microphones, processors, and memory.
[0112] Figure 8 to Figure 11 The schematic diagram schematically shows the broadcast distribution process of an embodiment of the present application.
[0113] like Figure 8 As shown, the broadcast publisher sends a broadcast message Broadcast(m) to be distributed to the AMS, and the AMS determines the broadcast receivers matching the broadcast message Broadcast(m). For example, the AMS can determine the broadcast receivers of the broadcast message Broadcast(m) based on information such as Internet matching, static registration list, dynamic registration list, priority of ordered broadcasts, and broadcast receiver permissions.
[0114] For example, a broadcast publisher creates an Intent object, which sets information such as action, data, and category. AMS can use the above information to match and determine which broadcast receivers have matching conditions with the Intent object. For another example, a broadcast receiver is statically registered in the manifest file of an application, that is, in <receiver>The element is declared <intent-filter>, the system will automatically register the corresponding receiver when the application starts. AMS can determine the broadcast receiver of the broadcast message Broadcast(m) based on the information of the Intent Filter in the manifest file. If the broadcast receiver is dynamically registered using registerReceiver() in the code, AMS can also determine the broadcast receiver of the broadcast message Broadcast(m) based on the information in the IntentFilter in the manifest file.
[0115] like Figure 8 As shown, AMS determines that the broadcast receiver matching the broadcast message Broadcast(m) is Rm. AMS traverses the broadcast message queue matching the broadcast publisher in reverse order, and the broadcast message queue includes Broadcast(a)->R1, Broadcast(b)->R2, ..., Broadcast(n)->Rn, ... Broadcast(x)->RN, a total of N broadcast messages to be distributed. For example, Broadcast(n)->Rn means the broadcast message Broadcast(n) to be distributed to the broadcast receiver Rn. The reverse direction is the direction from the tail to the head of the broadcast message queue, that is, the direction from Broadcast(a)->R1 to Broadcast(x)->RN.
[0116] AMS determines whether there is a candidate broadcast message matching Broadcast(m)->Rm in the broadcast message queue based on the broadcast message attributes in the broadcast message queue and the receiver attributes of at least one broadcast receiver. The candidate broadcast message and Broadcast(m)->Rm are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver. Exemplarily, the broadcast message attributes include broadcast action attributes. AMS determines whether there is a candidate broadcast message Broadcast(n)->Rn matching Broadcast(m)->Rm in the broadcast message queue based on the broadcast action attributes of Broadcast(m) and the identity information of the broadcast receiver Rm. That is, Rm and Rn are the same broadcast receivers, Broadcast(m) and Broadcast(n) have the same broadcast action, and the two can be understood as the same broadcast message.
[0117] like Fig. 9 As shown, the AMS determines whether the receiver priorities corresponding to other broadcast messages in the broadcast message queue that follow the candidate broadcast message Broadcast(n)->Rn are all less than or equal to the receiver priority corresponding to Broadcast(m)->Rm. Exemplarily, the AMS determines whether the maximum receiver priority maxpriority corresponding to Broadcast(a)->R1, Broadcast(b)->R2, ..., Broadcast(n-1)->Rn-1 is less than or equal to the receiver priority Rm priority corresponding to Broadcast(m)->Rm. When maxpriority is less than or equal to Rm priority, the AMS treats the candidate broadcast message Broadcast(n)->Rn as a mergeable broadcast message.
[0118] like Fig.10 As shown, the AMS replaces the mergeable broadcast message Broadcast(n)->Rn with Broadcast(m)->Rm to introduce Broadcast(m)->Rm into the broadcast message queue so as to distribute the broadcast message Broadcast(m) to the corresponding broadcast receivers.
[0119] Fig.12 A flowchart of the broadcast distribution method according to an embodiment of the present application is schematically shown. Fig.12 As shown, the broadcast distribution method, for example, includes operations S110 to S140.
[0120] In operation S110, the electronic device receives a target broadcast message transmitted by a broadcast publisher.
[0121] In operation S120, the electronic device determines a broadcast message queue that matches the broadcast publisher, and the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver.
[0122] In operation S130, the electronic device determines a message enqueuing mode of a target broadcast message according to attributes of the broadcast messages in the broadcast message queue and receiver attributes of at least one broadcast receiver.
[0123] In operation S140, the electronic device introduces the target broadcast message into a broadcast message queue according to a message enqueuing method, so as to distribute the target broadcast message to corresponding broadcast receivers.
[0124] The broadcast distribution method in the embodiment of the present application can be used for example in the AMS in an electronic device. The implementation process of each operation of the broadcast distribution method is schematically described below.
[0125] In operation S110, the electronic device receives a target broadcast message transmitted by a broadcast publisher.
[0126] Exemplarily, the broadcast message sent by the broadcast publisher to the AMS in the electronic device based on the current moment constitutes the target broadcast message to be distributed. Broadcast messages may include system broadcast messages and third-party broadcast messages. System broadcast messages include, for example, time update broadcast messages, screen-on broadcast messages, screen-off broadcast messages, network switching broadcast messages, power update broadcast messages, and boot completion broadcast messages. Third-party broadcast messages may be broadcast messages issued by third-party applications, and applications may include software, programs, components, etc. For example, when entering a certain interface, application A will send a broadcast message to AMS to enable information interaction between application A and other applications based on the interface.
[0127] In operation S120, the electronic device determines a broadcast message queue that matches the broadcast publisher, and the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver.
[0128] Exemplarily, before a system application or a third-party application publishes a broadcast message, other applications will subscribe to the broadcast message they need or are interested in. For example, most applications in an electronic device may subscribe to a network switching broadcast message. When a system application publishes a network switching broadcast message, it can publish the network switching broadcast message to AMS. AMS determines the application that has subscribed to the broadcast message as a broadcast receiver and reflects the broadcast receiver in the form of a queue.
[0129] There may be multiple broadcast receivers registered in the application process of the broadcast publisher. The broadcast messages to be distributed issued by the broadcast publisher are placed in the broadcast process queue. The broadcast process queue is responsible for delivering the broadcast messages to the subscribed broadcast receivers in a certain order.
[0130] After receiving the target broadcast message, AMS determines the broadcast message queue (i.e., broadcast process queue) that matches the broadcast publisher. The broadcast message queue is a queue composed of all undistributed broadcast messages before the current time node. Broadcast messages can be queued in the order of broadcast time to form a queue.
[0131] In operation S130, the electronic device determines a message enqueuing mode of a target broadcast message according to attributes of the broadcast messages in the broadcast message queue and receiver attributes of at least one broadcast receiver.
[0132] Exemplarily, the broadcast message attributes include, for example, broadcast action attributes. In the Android operating system, a broadcast action may be a string used to uniquely identify a broadcast type, such as a character string used to describe a purpose or behavior of a broadcast. For example, the broadcast action "android.intent.action.BOOT_COMPLETED" is used to indicate "device boot completed" or "boot completed action".
[0133] The receiver attributes of the broadcast receiver include, for example, the receiver identity and the receiver priority. The receiver priority can be the priority of the application receiving the broadcast message defined by the system for the broadcast mechanism. The priority can be reflected in the form of a specific level. For example, the priority of application A is 10, and the priority of application B is 15.
[0134] In actual applications, system applications or foreground applications have higher priorities, while underlying services or background applications have lower priorities. For example, the receiver priority includes 20 levels in total. The priority of system application receivers may be 18-20, the priority of foreground receivers may be 13-15, the priority of perceptible receivers may be 10, and the priority of background receivers may be 5-7.
[0135] As an optional embodiment, the AMS traverses the broadcast message queue in reverse order, and determines whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue according to the broadcast action attribute and the receiver identity. The candidate broadcast message and the target broadcast message are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver. The reverse order can be the direction from the end of the queue to the head of the queue in the broadcast message queue.
[0136] When candidate broadcast messages exist in the broadcast message queue, the AMS determines whether replacing the candidate broadcast message with the target broadcast message will cause a priority reversal in the broadcast message queue, which may cause broadcast message congestion and affect normal distribution of broadcast messages.
[0137] Therefore, the AMS continues to determine whether the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message. Other broadcast messages are messages that are located after the candidate broadcast message in the broadcast message queue, that is, messages that the AMS traverses before the candidate broadcast message in the broadcast message queue.
[0138] If the receiver priorities corresponding to other broadcast messages are less than or equal to the receiver priority corresponding to the target broadcast message, the AMS uses the candidate broadcast message as a mergeable broadcast message. In this case, the AMS replaces the candidate broadcast message with the target broadcast message, which will not cause a priority reversal in the broadcast message queue.
[0139] For example, when the broadcast message queue includes N broadcast messages to be distributed, the AMS determines whether the first broadcast message in reverse order in the broadcast message queue is a candidate broadcast message. When the first broadcast message is not a candidate broadcast message, the AMS traverses the broadcast message queue in reverse order until it determines that the nth broadcast message in reverse order in the broadcast message queue is a candidate broadcast message, 1<n≤N, and N is an integer greater than 1.
[0140] The AMS determines the maximum priority among the receiver priorities corresponding to the first n-1 broadcast messages in reverse order in the broadcast message queue, and determines whether the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message. In the case where the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message, the AMS regards the nth broadcast message as a mergeable broadcast message. In addition, in the case where the first broadcast message is a candidate broadcast message, the AMS regards the first broadcast message as a mergeable broadcast message.
[0141] When there are mergeable broadcast messages in the broadcast message queue, the AMS determines that the message enqueuing mode of the target broadcast message is replacement enqueuing.
[0142] When there is no candidate broadcast message in the broadcast message queue, or when there are other broadcast messages whose corresponding receiver priorities are greater than the corresponding receiver priority of the target broadcast message, the AMS determines that the message enqueuing mode of the target broadcast message is direct enqueuing.
[0143] In operation S140, the electronic device introduces the target broadcast message into a broadcast message queue according to a message enqueuing method, so as to distribute the target broadcast message to corresponding broadcast receivers.
[0144] Exemplarily, when the message enqueue mode is direct enqueue, the AMS introduces the target broadcast message into the tail position of the broadcast message queue. When the message enqueue mode is replacement enqueue, the AMS replaces the mergeable broadcast message in the broadcast message queue with the target broadcast message to introduce the target broadcast message into the broadcast message queue.
[0145] Fig.13 The interactive diagram of the broadcast distribution process of the embodiment of the present application is schematically shown. The broadcast distribution process can be performed by an AMS in an electronic device, for example, and the AMS can include a message queue determination module, a message queue traversal module, a candidate broadcast determination module, a mergeable broadcast determination module, and a broadcast enqueue module.
[0146] like Fig.13 As shown, the broadcast publisher sends the target broadcast message to be distributed to the AMS. The message queue determination module in the AMS determines the broadcast message queue that matches the broadcast publisher, and sends the broadcast message queue information to the message queue traversal module and the broadcast enqueue module. The broadcast message queue can be a queue consisting of all undistributed broadcast messages before the current time node.
[0147] The message queue traversal module reversely traverses the broadcast message queue to determine the broadcast message attributes and the receiver attributes of at least one broadcast receiver in the broadcast message queue. The message queue traversal module sends the broadcast message attributes and the receiver attributes to the candidate broadcast determination module. The candidate broadcast determination module determines whether there is a candidate broadcast message based on the target broadcast message in the broadcast message queue according to the broadcast message attributes and the receiver attributes. The candidate broadcast message and the target broadcast message are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver.
[0148] The candidate broadcast determination module notifies the mergeable broadcast determination module of the existence of a candidate broadcast message, and the mergeable broadcast determination module obtains the receiver priority corresponding to other broadcast information from the message queue traversal module. Other broadcast information is the information that is located after the candidate broadcast message in the broadcast message queue. The mergeable broadcast determination module determines whether the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message. In the case that the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, the mergeable broadcast determination module uses the candidate broadcast message as a mergeable broadcast message.
[0149] In addition, the candidate broadcast determination module may also notify the broadcast enqueue module that there is no candidate broadcast message in the broadcast message queue, and the broadcast enqueue module introduces the target broadcast message into the tail position of the broadcast message queue.
[0150] The mergeable broadcast determination module notifies the broadcast enqueue module whether there is a mergeable broadcast message in the broadcast message queue. If there is a mergeable broadcast message in the broadcast message queue, the broadcast enqueue module replaces the mergeable broadcast message with the target broadcast message to introduce the target broadcast message into the broadcast message queue. If there is no mergeable broadcast message in the broadcast message queue, the broadcast enqueue module introduces the target broadcast message into the tail position of the broadcast message queue.
[0151] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, 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. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0152] All relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module, and will not be repeated here.
[0153] This embodiment also provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the broadcast distribution method in the above-mentioned embodiment.
[0154] This embodiment also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the broadcast distribution method in the above-mentioned embodiment.
[0155] In addition, an embodiment of the present application also provides a device, which can specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer execution instructions, and when the device is running, the processor can execute the computer execution instructions stored in the memory so that the chip executes the broadcast distribution method in the above-mentioned method embodiments.
[0156] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.
[0157] Through the description of the above implementation methods, technical personnel in the relevant field can 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.
[0158] 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 modules or units is only a logical function division, and 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.
[0159] 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.
[0160] 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.
[0161] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.
[0162] 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 various embodiments 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.
[0163] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0164] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0165] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0166] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application. < / receiver>
Claims
1. A broadcast distribution method, applied to electronic equipment, characterized in that: include: Receive the target broadcast message sent by the broadcast publisher; Determine a broadcast message queue matching the broadcast publisher, wherein the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver; Determining a message enqueuing mode of the target broadcast message according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver; as well as According to the message enqueuing method, the target broadcast message is introduced into the broadcast message queue so as to distribute the target broadcast message to corresponding broadcast receivers.
2. The method according to claim 1, characterized in that The determining, according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, a message enqueueing mode of the target broadcast message comprises: Determining, according to the broadcast message attribute and the receiver attribute, whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue; and In the case that the mergeable broadcast message exists in the broadcast message queue, it is determined that the message enqueuing mode is replacement enqueuing.
3. The method according to claim 2, characterized in that The broadcast message attributes include broadcast action attributes, and the receiver attributes include receiver identity and receiver priority.
4. The method according to claim 3, characterized in that The determining, according to the broadcast message attribute and the receiver attribute, whether there is a mergeable broadcast message based on the target broadcast message in the broadcast message queue includes: Traversing the broadcast message queue in reverse order, and determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue according to the broadcast action attribute and the receiver identity, wherein the candidate broadcast message and the target broadcast message are messages with the same broadcast action sent by the broadcast publisher to the same broadcast receiver; In the case where the candidate broadcast message exists in the broadcast message queue, determining whether the receiver priorities corresponding to other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, wherein the other broadcast messages are messages in the broadcast message queue that are located after the candidate broadcast message; and In the case that the receiver priorities corresponding to the other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message, the candidate broadcast message is used as the mergeable broadcast message.
5. The method according to claim 2, characterized in that: The step of introducing the target broadcast message into the broadcast message queue according to the message enqueueing method includes: In the case where the message enqueueing mode is replacement enqueueing, the target broadcast message is used to replace the mergeable broadcast message in the broadcast message queue, so as to introduce the target broadcast message into the broadcast message queue.
6. The method according to claim 4, characterized in that The determining, according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver, a message enqueueing mode of the target broadcast message comprises: When the candidate broadcast message does not exist in the broadcast message queue, or when the receiver priority corresponding to the other broadcast message is greater than the receiver priority corresponding to the target broadcast message, the message enqueuing mode is determined to be direct enqueuing.
7. The method according to claim 6, characterized in that The step of introducing the target broadcast message into the broadcast message queue according to the message enqueueing method includes: When the message enqueueing mode is direct enqueueing, the target broadcast message is introduced into the tail position of the broadcast message queue.
8. The method according to claim 4, characterized in that The reverse traversing of the broadcast message queue and determining whether there is a candidate broadcast message matching the target broadcast message in the broadcast message queue according to the broadcast action attribute and the receiver identity includes: For the first broadcast message in reverse order in the broadcast message queue, determining whether the first broadcast message is the candidate broadcast message; In the case where the first broadcast message is not a candidate broadcast message, traverse the broadcast message queue in reverse order until the nth broadcast message in reverse order in the broadcast message queue is determined to be the candidate broadcast message, where 1<n≤N, N is an integer greater than 1, and N is the total number of broadcast messages in the broadcast message queue; In the case where the candidate broadcast message exists in the broadcast message queue, determining whether the receiver priorities corresponding to other broadcast messages are all smaller than the receiver priority corresponding to the target broadcast message includes: Determine the maximum priority among the receiver priorities corresponding to the first n-1 broadcast messages in reverse order in the broadcast message queue, and determine whether the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message; The step of using the candidate broadcast message as the mergeable broadcast message when the receiver priorities corresponding to the other broadcast messages are all less than or equal to the receiver priority corresponding to the target broadcast message includes: In a case where the maximum priority is less than or equal to the receiver priority corresponding to the target broadcast message, the nth broadcast message is used as the mergeable broadcast message.
9. The method according to claim 8, characterized in that The method further comprises: In the case that the first broadcast message is the candidate broadcast message, the first broadcast message is used as the mergeable broadcast message.
10. The method according to claim 4, characterized in that The reverse order is the direction from the tail to the head of the broadcast message queue. The broadcast message queue is a queue consisting of all undistributed broadcast messages issued by the broadcast publisher before the current time node.
11. An electronic device, characterized in that: include: One or more processors, a memory, and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the following steps: Receive the target broadcast message sent by the broadcast publisher; Determine a broadcast message queue matching the broadcast publisher, wherein the broadcast message in the broadcast message queue corresponds to at least one broadcast receiver; Determining a message enqueuing mode of the target broadcast message according to the broadcast message attributes in the broadcast message queue and the receiver attributes of the at least one broadcast receiver; as well as According to the message enqueuing method, the target broadcast message is introduced into the broadcast message queue so as to distribute the target broadcast message to corresponding broadcast receivers.
12. A computer-readable storage medium, characterized in that: It comprises a computer program, which, when executed on an electronic device, enables the electronic device to execute the broadcast distribution method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Method and device for adjusting broadcast message queue as well as terminal
CN106844069A
Broadcast information receiving method and device, computer equipment and storage medium
CN115712515A
Message processing method and device, medium and electronic equipment
CN117201437A
Method for Processing Ordered Broadcast and Electronic Device
US20180262707A1
Vector send operation for message-based communication
US20210011720A1