A broadcast processing method, device and computer system

By introducing receiver blacklist and parallel processing mechanism, the stability problems and time waste caused by orderly broadcast serial dispatch in the Android system are solved, the system robustness and processing efficiency are improved, and the broadcast queue is blocked.

CN112052101BActive Publication Date: 2024-12-13SUNING INTELLIGENT TERMINAL CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010693790.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-17
Publication Date
2024-12-13
Estimated Expiration
2040-07-17

AI Technical Summary

Technical Problem

The orderly broadcast mechanism of the existing Android system has serial dispatch that leads to system stability problems and waste of time. In particular, the unresponsiveness of third-party applications may lead to blockage of broadcast queues, affecting the normal operation of system functions.

Method used

Introduce a receiver blacklist mechanism, judge the preset sequence and skip unresponsive receivers, and receivers with the same priority process broadcasts in parallel, avoid queue blockage caused by unresponsive receivers, and improve processing efficiency through concurrent startup of processes.

Benefits of technology

Improves the robustness of the system, avoids broadcast queue paralysis, saves processing time, and ensures the stability and response speed of system functions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112052101B_ABST
    Figure CN112052101B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device and computer system for processing a broadcast, the method comprising obtaining a receiver corresponding to a target broadcast; judging whether each of the corresponding receivers is in a receiver blacklist in a preset order, the receiver blacklist being used to record receivers that have been unresponsive; dispatching the receivers that are not in the receiver blacklist to process the target broadcast, by recording the unresponsive receivers in the receiver blacklist, the unresponsive receivers can be skipped when processing subsequent broadcasts, thereby avoiding the same receiver being unresponsive multiple times and causing the broadcast queue to be paralyzed, thereby improving the robustness of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a broadcast processing method, device and computer system. Background Art

[0002] In the framework layer of the Android system, great emphasis is placed on decoupling. In the framework layer, broadcasts are sent using Intent, fuzzy matching action (string) is performed on the broadcast, and then the broadcast is sent to the matched receiver to complete the decoupling. The organization of broadcasts is to generate a broadcast record (BroadcastRecord) based on the Intent of the broadcast, and then save the broadcast record in the broadcast record queue. The AMS processing service and the specific thread of the broadcast will process the broadcast records in the broadcast record queue in turn.

[0003] Each broadcast record can have one or more receivers (BroadcastReceiver), and the receiver can register the corresponding receiver. Each receiver is represented by a BpBinder on the server side, and its dispatch will be called through the binder, and then called to the BroadcastReceiver on the application side. In an ordered broadcast, this process is completely serial. The previous receiver is called, and returns after processing. AMS receives the return value before dispatching to the next receiver.

[0004] However, the existing ordered broadcast mechanism has the following defects:

[0005] 1. Serial dispatch expands the scope of application problems and turns them into system stability issues;

[0006] Since the registrant of the broadcast receiver may be the system, a system application, or even a third-party application. When it comes to third-party applications, the quality of the receiver is no longer controllable, and various bad codes and even malicious attacks must be considered. In the broadcast mechanism of the Android system, the system's broadcast receiver and the third-party application's broadcast receiver are processed in a blocking queue, which is a big problem: when the third-party broadcast receiver is unresponsive (ANR), the entire broadcast receiver sequence will be blocked.

[0007] For example, in a broadcast that is distributed in a loop, a receiver of a third-party application becomes unresponsive during one of its distributions, which takes a long time and causes the receiving queue of the broadcast to be blocked. When the broadcast is distributed the next time, the receiver becomes unresponsive again, causing the receiver queue to be blocked again. If this situation repeats several times, the entire broadcast record queue will be blocked. When the broadcast record queue is blocked, the problem of the receiver of this third-party application will spread to the entire system, and a large number of main functions of the entire Android system called by the broadcast will be paralyzed, such as turning on and off the screen, making and receiving calls, and updating the time, causing problems such as the entire machine freezing, unresponsiveness, and broadcast loss.

[0008] 2. The completely serial dispatch of ordered broadcasts causes a lot of time waste;

[0009] Ordered broadcasting is to divide the order of broadcasting according to the priority in the IntentFilter of the Android system. If the developer does not set the priority of the receiver in the code logic or sets each receiver to be equal, then these receivers with equal priority will be dispatched serially according to the order of application installation / registration. This will cause the receivers that do not have a logical order to be dispatched in a non-existent order and be forcibly arranged in a logical order, resulting in a huge waste of time. Summary of the invention

[0010] In order to solve the deficiencies of the prior art, the main purpose of the present invention is to provide a broadcast processing method, device and computer system to solve the system stability problem and time waste caused by the serial dispatch of ordered broadcasts.

[0011] In order to achieve the above object, the present invention provides a broadcast processing method in a first aspect, the method comprising:

[0012] Get the receiver corresponding to the target broadcast;

[0013] According to a preset order, determining whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive;

[0014] The receiver which is not in the receiver blacklist is dispatched to process the target broadcast.

[0015] In some embodiments, the receivers include corresponding priorities, and dispatching the receivers that are not in the receiver blacklist to process the target broadcast includes:

[0016] The receivers with the same dispatch priority are dispatched to process the target broadcast in parallel.

[0017] In some embodiments, the determining, in a preset order, whether each of the corresponding receivers is in a receiver blacklist comprises:

[0018] According to the order of the priorities from high to low, it is determined whether each of the corresponding receivers is in the receiver blacklist.

[0019] In some embodiments, the method comprises:

[0020] The processing results of the target broadcast by the receivers processed in parallel are integrated.

[0021] In some embodiments, each receiver includes a corresponding process, and the method includes:

[0022] When the process of the receiver for parallel processing is not started, the process of the receiver for parallel processing is concurrently started.

[0023] In some embodiments, the method comprises:

[0024] When the dispatched receiver does not respond, the non-responding receiver is stored in the receiver blacklist.

[0025] In some embodiments, when the dispatched receiver does not respond, storing the unresponsive dispatched receiver into the receiver blacklist comprises:

[0026] When the dispatched receiver does not respond, a no-response record corresponding to the no-response receiver is generated;

[0027] The receivers whose number of unresponsive records exceeds a preset number threshold are stored in a receiver blacklist.

[0028] In a second aspect, the present application discloses a broadcast processing device, the device comprising:

[0029] An acquisition module is used to obtain the receiver corresponding to the target broadcast;

[0030] A judgment module, used for judging whether each of the corresponding receivers is in a receiver blacklist according to a preset order, wherein the receiver blacklist is used for recording receivers that have been unresponsive;

[0031] The processing module is used to dispatch the receiver that is not in the receiver blacklist to process the target broadcast.

[0032] 9. The device according to claim 8, wherein the receivers include corresponding priorities, and the processing module can be further used to dispatch the receivers with the same priority to process the target broadcast in parallel.

[0033] In a third aspect, the present application discloses a computer system, the system comprising:

[0034] one or more processors;

[0035] and a memory associated with the one or more processors, the memory being used to store program instructions, the program instructions when read and executed by the one or more processors performing the following operations:

[0036] Get the receiver corresponding to the target broadcast;

[0037] According to a preset order, determining whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive;

[0038] The receiver which is not in the receiver blacklist is dispatched to process the target broadcast.

[0039] The beneficial effects achieved by the present invention are:

[0040] The present application provides a method for processing a broadcast, the method comprising: obtaining a receiver corresponding to a target broadcast; judging whether each of the corresponding receivers is in a receiver blacklist according to a preset order, the receiver blacklist being used to record receivers that have been unresponsive; dispatching the receivers that are not in the receiver blacklist to process the target broadcast, by recording the unresponsive receivers in the receiver blacklist, the receivers that have been unresponsive can be skipped when processing subsequent broadcasts, thereby avoiding the same receiver from being unresponsive multiple times and causing the broadcast queue to be paralyzed, thereby improving the robustness of the system;

[0041] Furthermore, the present application proposes dispatching the receivers with the same priority to process the target broadcast in parallel, so as to allow the receivers with the same priority to process the same broadcast at the same time, thereby avoiding the situation where the receivers that do not have a logical order are forced to be dispatched in a non-existent order and forced to be arranged in a logical order of processing, thereby saving a lot of time.

[0042] Not all products of the present invention need to have all the above effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0044] Figure 1 is a screening flow chart of unresponsive receivers provided in an embodiment of the present application;

[0045] Figure 2 is a flow chart of the method provided in the embodiment of the present application;

[0046] Figure 3 is a structural diagram of a device provided in an embodiment of the present application;

[0047] Figure 4 is a computer system structure diagram provided in an embodiment of the present application;

[0048] Figure 5 It is a receiver processing flow chart provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution in the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiment of the present invention. Obviously, the described embodiment is only a part of the embodiment of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0050] As described in the background technology, the broadcast of the Android system is dispatched serially. When a receiver does not respond in multiple broadcasts, it may cause the broadcast record queue to be blocked, affecting the normal operation of the Android system. At the same time, the native Android system dispatches receivers with equal priority in serial order according to the order of application installation / registration, causing receivers that do not have a logical order to be dispatched in a non-existent order and forcibly arranged in a logical order of processing, resulting in a huge waste of time.

[0051] To solve the above technical problems, this application customizes the code in the Android vendor and proposes a broadcast processing system, which includes a transmitter and a receiver. There can be one or more transmitters for sending broadcasts; there can be one or more receivers for receiving broadcasts and processing. The receiver has one or more receivers, and the receivers can register corresponding receivers. Each broadcast can specify a corresponding receiver and receiver. The transmitter and receiver can also be the same device.

[0052] On the sending end, each receiver is represented by a corresponding BpBinder agent. The call to the receiver by the sending end will be made through the Binder call, and the corresponding receiver on the receiving end will be called through the Binder call. In the native ordered broadcast, this process is completely serial. The previous receiver is called and returns after processing. The AMS on the sending end receives the return value before it can be dispatched to the next receiver.

[0053] The sender can generate a corresponding broadcast record (BroadcastRecord) to be broadcast according to the Intent to be sent, and then save the broadcast record in the broadcast record queue. The broadcast records in the broadcast record queue are processed in sequence by a specific thread in the AMS that handles services and broadcasts.

[0054] In order to implement the technical solution disclosed in this application, Figure 1 As shown in FIG. 1 , the process of sending a broadcast from the sender to the receiver specifically includes:

[0055] Step 1: The sender obtains the target broadcast record from the broadcast record queue and obtains the receiver corresponding to the target broadcast record;

[0056] The sender can obtain the broadcast records from the broadcast record queue in the order in which they are stored and process them.

[0057] Specifically, each receiver may correspond to a receiving end, and the transmitting end may pre-store the receiving end corresponding to each broadcast record, and then obtain the corresponding receiver according to the receiving end, or directly store the receiver corresponding to the broadcast record. Each broadcast record may also store a corresponding receiving end or receiver, and when the broadcast record stores the receiving end, the corresponding receiver may be obtained according to the stored receiving end.

[0058] The priority of each receiver may be pre-stored in the transmitting end so as to be obtained when needed, or the priorities of all receivers corresponding to the broadcast record may be stored in each broadcast record.

[0059] Step 2: The sender traverses all corresponding receivers in order of priority to determine whether the receiver is in the receiver blacklist;

[0060] Preferably, the sender can traverse all receivers in order of priority from high to low. Figure 5 As shown, the sender traverses all receivers and processes the receivers with the same priority at the same time. When the processes of all receivers are started, the receiver dispatches the receiver to receive the target broadcast record.

[0061] Preferably, the sending end can concurrently determine whether the receivers with the same priority are in the receiver blacklist.

[0062] Each receiver blacklist stores receivers that have experienced no response (ANR, Application Not Responding) and the number of occurrences exceeds a preset threshold.

[0063] Preferably, the preset threshold is 3.

[0064] For a receiver that is determined to be in the receiver blacklist, the sender will skip the receiver and will not send the receiver to receive the target broadcast record.

[0065] Step 3: The sender processes the receivers that are not in the receiver blacklist in order of priority;

[0066] Preferably, the sending end can process all receivers in order of priority from high to low, and process receivers with the same priority at the same time.

[0067] Specifically, the above processing procedure includes determining whether the receiver can receive the broadcast record, including determining whether the receiver has the receiving authority, whether the process corresponding to the receiver has been started, and the like.

[0068] The sender concurrently processes receivers with the same priority. For example, when the process corresponding to the receiver is not started, the sender concurrently starts the corresponding process.

[0069] Step 3: When a receiver that is not in the receiver blacklist times out, a non-response record of the receiver is generated;

[0070] When the number of unresponsive records of the receiver exceeds a preset threshold, the receiver is recorded in the receiver blacklist.

[0071] When the number of unresponse records of the receiver does not exceed a preset threshold, the receiver triggers an ANR, and the sender skips the receiver and stops sending target broadcast records to the receiver.

[0072] Step 4: The sender dispatches a receiver that has started the corresponding process to receive the target broadcast record.

[0073] When all receivers except those that have not responded and those in the receiver blacklist have completed receiving the target broadcast record, the sender determines that the broadcast transmission is completed and processes the next broadcast record in the broadcast record queue.

[0074] The sending end may integrate the processing results of the parallel processing receiver on the target broadcast, and analyze or process the processing results.

[0075] Embodiment 2

[0076] Corresponding to the above embodiment, the present application provides a method for processing broadcast, such as Figure 2 As shown, the method includes:

[0077] 210. Obtain the receiver corresponding to the target broadcast;

[0078] 220. Determine, in a preset order, whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive;

[0079] Preferably, judging whether each of the corresponding receivers is in the receiver blacklist in a preset order includes:

[0080] 221. Determine whether each of the corresponding receivers is in the receiver blacklist in descending order of priority.

[0081] 230. Dispatch the receiver that is not in the receiver blacklist to process the target broadcast.

[0082] Preferably, the receiver includes a corresponding priority, and the dispatching of the receiver not in the receiver blacklist to process the target broadcast includes:

[0083] 231. Dispatch the receivers with the same priority to process the target broadcast in parallel.

[0084] Preferably, each receiver includes a corresponding process, and the method includes:

[0085] 232. When the process of the receiver for parallel processing is not started, concurrently start the process of the receiver for parallel processing.

[0086] Preferably, the method comprises:

[0087] 240. Integrate the processing results of the target broadcast by the receivers processed in parallel.

[0088] Preferably, the method comprises:

[0089] 250. When the dispatched receiver does not respond, store the unresponsive receiver into the receiver blacklist.

[0090] Preferably, when the dispatched receiver does not respond, storing the dispatched receiver that does not respond into the receiver blacklist comprises:

[0091] 251. When the dispatched receiver does not respond, generate a no-response record corresponding to the no-response receiver;

[0092] The receivers whose number of unresponsive records exceeds a preset number threshold are stored in a receiver blacklist.

[0093] Embodiment 3

[0094] Corresponding to the above method embodiment, Figure 3 As shown, the present application provides a broadcast processing device, the device comprising:

[0095] An acquisition module 310 is used to acquire a receiver corresponding to a target broadcast;

[0096] A determination module 320, configured to determine whether each of the corresponding receivers is in a receiver blacklist according to a preset order, wherein the receiver blacklist is used to record receivers that have been unresponsive;

[0097] The processing module 330 is used to dispatch the receiver that is not in the receiver blacklist to process the target broadcast.

[0098] Preferably, the receivers include corresponding priorities, and the processing module 330 can also be used to dispatch the receivers with the same priority to process the target broadcast in parallel.

[0099] According to the order of the priorities from high to low, it is determined whether each of the corresponding receivers is in the receiver blacklist.

[0100] Preferably, the processing module 330 may also be used to integrate the processing results of the receivers for the target broadcast in parallel.

[0101] Preferably, each receiver includes a corresponding process, and the processing module 330 can also be used to concurrently start the process of the receiver for parallel processing when the process of the receiver for parallel processing is not started.

[0102] Preferably, the processing module 330 may also be used to store the unresponsive receiver into the receiver blacklist when the dispatched receiver does not respond.

[0103] Preferably, the processing module 330 can also be used to generate a non-response record corresponding to the non-responding receiver when the dispatched receiver does not respond; and store the receivers whose number of non-response records exceeds a preset number threshold into a receiver blacklist.

[0104] Embodiment 4

[0105] Corresponding to the above methods, devices and systems, a fourth embodiment of the present application provides a computer system, including: one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, and the program instructions, when read and executed by the one or more processors, perform the following operations:

[0106] Get the receiver corresponding to the target broadcast;

[0107] According to a preset order, determining whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive;

[0108] The receiver which is not in the receiver blacklist is dispatched to process the target broadcast.

[0109] in, Figure 4The computer system architecture is shown as an example, which may include a processor 1510, a video display adapter 1511, a disk drive 1512, an input / output interface 1513, a network interface 1514, and a memory 1520. The processor 1510, the video display adapter 1511, the disk drive 1512, the input / output interface 1513, the network interface 1514, and the memory 1520 may be communicatively connected via a communication bus 1530.

[0110] Among them, the processor 1510 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solution provided in this application.

[0111] The memory 1520 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1520 can store an operating system 1521 for controlling the operation of the computer system 1500, and a basic input and output system (BIOS) for controlling the low-level operation of the computer system 1500. In addition, a web browser 1523, a data storage management system 1524, and an icon font processing system 1525, etc. can also be stored. The above-mentioned icon font processing system 1525 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 1520 and is called and executed by the processor 1510. The input / output interface 1513 is used to connect the input / output module to realize information input and output. The input / output / module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.

[0112] The network interface 1514 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).

[0113] The bus 1530 comprises a pathway for transmitting information between the various components of the device (eg, the processor 1510, the video display adapter 1511, the disk drive 1512, the input / output interface 1513, the network interface 1514, and the memory 1520).

[0114] In addition, the computer system 1500 can also obtain information on specific collection conditions from the virtual resource object collection condition information database 1541 for use in condition judgment, etc.

[0115] It should be noted that, although the above device only shows a processor 1510, a video display adapter 1511, a disk drive 1512, an input / output interface 1513, a network interface 1514, a memory 1520, a bus 1530, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.

[0116] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a cloud server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.

[0117] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system or system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without creative work.

[0118] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for processing broadcast, characterized in that: The method comprises: Get the receiver corresponding to the target broadcast; According to a preset order, determining whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive; dispatching the receiver which is not in the receiver blacklist to process the target broadcast; The receiver includes a corresponding priority, and the dispatching the receiver that is not in the receiver blacklist to process the target broadcast includes: dispatching the receivers with the same priority to process the target broadcast in parallel; Each receiver includes a corresponding process, and when the process of the receiver for parallel processing is not started, the process of the receiver for parallel processing is started concurrently; The dispatched receiver has started the corresponding process; The processing results of the target broadcast by the receivers processed in parallel are integrated.

2. The method according to claim 1, characterized in that The step of determining, in accordance with a preset order, whether each of the corresponding receivers is included in the receiver blacklist: According to the order of the priorities from high to low, it is determined whether each of the corresponding receivers is in the receiver blacklist.

3. The method according to any one of claims 1-2, characterized in that: The method comprises: When the dispatched receiver does not respond, the non-responding receiver is stored in the receiver blacklist.

4. The method according to claim 3, characterized in that When the dispatched receiver does not respond, storing the dispatched receiver that does not respond into the receiver blacklist includes: When the dispatched receiver does not respond, a no-response record corresponding to the no-response receiver is generated; The receivers whose number of unresponsive records exceeds a preset number threshold are stored in a receiver blacklist.

5. A broadcast processing device for implementing the broadcast processing method according to any one of claims 1 to 4, characterized in that: The device comprises: An acquisition module is used to obtain the receiver corresponding to the target broadcast; A judgment module, used for judging whether each of the corresponding receivers is in a receiver blacklist according to a preset order, wherein the receiver blacklist is used for recording receivers that have been unresponsive; A processing module, used for dispatching the receiver that is not in the receiver blacklist to process the target broadcast; the dispatched receiver has started a corresponding process; The receivers include corresponding priorities, and the processing module can also be used to dispatch the receivers with the same priority to process the target broadcast in parallel.

6. A computer system for implementing the broadcast processing method according to any one of claims 1 to 4, characterized in that: The system comprises: one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions, the program instructions when read and executed by the one or more processors performing the following operations: Get the receiver corresponding to the target broadcast; According to a preset order, determining whether each of the corresponding receivers is in a receiver blacklist, wherein the receiver blacklist is used to record receivers that have been unresponsive; The receiver which is not in the receiver blacklist is dispatched to process the target broadcast; the dispatched receiver has started the corresponding process.