CN108011860B - Method, device and terminal for processing broadcast message - Google Patents
Method, device and terminal for processing broadcast message Download PDFInfo
- Publication number
- CN108011860B CN108011860B CN201610964179.1A CN201610964179A CN108011860B CN 108011860 B CN108011860 B CN 108011860B CN 201610964179 A CN201610964179 A CN 201610964179A CN 108011860 B CN108011860 B CN 108011860B
- Authority
- CN
- China
- Prior art keywords
- broadcast message
- broadcast
- message
- rate
- application
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/40—Support for services or applications
- H04L65/403—Arrangements for multi-party communication, e.g. for conferences
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Multimedia (AREA)
- Human Computer Interaction (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
A method and a device for processing broadcast messages are provided, the method comprises the steps of determining that N applications in at least one application for receiving a first broadcast message meet a first preset condition, generating a second broadcast message aiming at each application in the N applications, respectively storing the generated N second broadcast messages into a proxy broadcast message queue, and then sequentially processing the second broadcast messages in the proxy broadcast message queue according to a preset first rate, wherein the first rate is smaller than the rate at which a system currently sends the first broadcast message to the applications. By introducing the first preset condition and the proxy broadcast message queue, the time for sending the first broadcast message aiming at the N applications is delayed, the number of applications receiving the first broadcast message at the same time is reduced, and the possibility of easily causing the shortage of system resources is reduced.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a broadcast message.
Background
In the Android system, Broadcast (Broadcast) is a mechanism for transferring information between systems and applications, or between applications and applications. For example, the broadcasted information may be information such as a usage status of a battery of the system statistics, a network connection status generated by an application for establishing a network connection, and the like.
Specifically, before receiving a broadcast message, an application needs to register on an AMS (Activity Manager Service), for example, if an application 1 needs to receive a broadcast message 1 and a broadcast message 2, the application 1 needs to register a broadcast receiver 1 on the AMS for the broadcast message 1 in advance, and the application 1 registers a broadcast receiver 2 on the AMS for the broadcast message 2, where currently, registering a broadcast receiver on the AMS includes two ways: one is static registration, that is, after the terminal is started, the application registers the broadcast receiver on the AMS for the broadcast message to be received; one is dynamic registration, in which an application registers a broadcast receiver with an AMS for the need to receive a broadcast message after the application is started, and the AMS releases the broadcast receiver registered with the application when the application is closed. An application may register broadcast receivers in different ways for different broadcast messages.
Fig. 1 is an example to describe in detail a specific process of sending a broadcast message in the current Android system. As shown in fig. 1, an application 1 generates a broadcast message 1, transmits the broadcast message 1 to an AMS through a binder, after receiving the broadcast message 1, the AMS stores the broadcast message 1 in a parallel broadcast message queue in the broadcast message queue according to a pre-configured policy, acquires a broadcast receiver 2, a broadcast receiver 3, and a broadcast receiver 4 registered in advance for the broadcast message 1 in the AMS for the broadcast message 1 for the application 2, the application 3, and the application 4, and stores the acquired broadcast receiver 2, the broadcast receiver 3, and the broadcast receiver 4 in the parallel broadcast receiver queue, respectively, the AMS transmits the broadcast message 1 to the application 2, the application 3, and the application 4 through the broadcast receiver 2, the broadcast receiver 3, and the broadcast receiver 4, respectively, when the broadcast message needs to be transmitted to more applications, a broadcast storm is easily caused, and a process of transmitting the broadcast message occupies a large amount of system resources, the system and the application running in the foreground are easy to be jammed.
Furthermore, after receiving the broadcast message 1, the AMS may further store the broadcast message 1 in an ordered broadcast message queue in the broadcast message queue according to a pre-configured policy, then acquire the broadcast receiver 2, the broadcast receiver 3, and the broadcast receiver 4 registered in advance by the application 2, the application 3, and the application 4 with respect to the AMS for the broadcast message 1, and store the acquired broadcast receiver 2, broadcast receiver 3, and broadcast receiver 4 in the ordered broadcast receiver queue, respectively, and then the AMS sequentially transmits the broadcast message 1 to the application 2, application 3, and application 4 in the order in which the broadcast receiver 2, broadcast receiver 3, and broadcast receiver 4 are stored in the ordered broadcast receiver queue, that is, it is assumed that the AMS previously transmits the broadcast message 1 to the application 2 through the broadcast receiver 2, and after the transmission is completed, transmits the broadcast message to the application 3 through the broadcast receiver 3, by analogy, if the application 3 registers a broadcast receiver on the AMS through static registration, and the application 3 is in an un-started state, the AMS needs to pull up the process of the application before sending a broadcast message to the application. Therefore, when a plurality of broadcast receivers included in the ordered broadcast receiver queue are registered in a static manner and the applications corresponding to the broadcast receivers are not started, the corresponding applications need to be frequently pulled up, which may cause a shortage of system resources, thereby causing a system and an application running in the foreground to be stuck.
To sum up, in the Android system, if a broadcast message needs to be sent to an application, for how many applications register broadcast receivers in the AMS for the broadcast message, the AMS sends the broadcast message to all applications that register broadcast receivers for the broadcast message.
Disclosure of Invention
The invention provides a method and a device for processing broadcast messages, which are used for solving the problem that in the prior art, when too many broadcast receivers are registered aiming at one broadcast message, the system resources are easy to be tense, and the system and a foreground are blocked.
The terms appearing in the embodiments of the present invention will be described first.
A first broadcast message: the broadcast message stored in the broadcast message queue in the prior art, for example, the broadcast message may be a message for turning on an airplane mode, a message for battery usage, or the like, wherein the type of the first broadcast message is BroadcastRecord type.
A second broadcast message: in an embodiment of the present invention, the broadcast message stored in the proxy broadcast message queue includes a correspondence between a broadcast receiver belonging to the application and a first broadcast message, where the second broadcast message type is a BroadcastRecord type, and in an example of application a, it is assumed that the first broadcast message is a message for opening a flight mode, the broadcast receiver belonging to the application is a broadcast receiver registered in the AMS for the message for opening the flight mode by application a, and the second broadcast message is a correspondence between a message for opening the flight mode and a broadcast receiver for opening the flight mode and belonging to application a.
Broadcast receivers belonging to the application: taking application a as an example, application a registers a broadcast receiver in AMS for a first broadcast message of the same type, it should be noted that the way in which application a registers a broadcast receiver may be BroadcastFilter (dynamic registration) or ResolveInfo (static registration). Wherein when the type of the first broadcast message includes a message to turn on or off the flight mode, a bright screen message, a battery use status message, and an input method change message, in general, for the same type of message, it is not possible at the same time, for example, to switch on or off the flight mode messages, at time 1 the terminal is in the flight mode state, the first broadcast message is a message to turn on the flight mode, and not a message to turn off the flight mode, so when the terminal is in the state of the flight mode at time 1, the application a registers the broadcast receiver 1 with the AMS for a message to open the flight mode at time 1, and when the terminal is in a normal communication state at time 2, the first broadcast message is a message to close the flight mode, and the application a registers the broadcast receiver 1 with the AMS for the message to close the flight mode at time 2. When the application a does not register a corresponding broadcast receiver in the AMS with respect to the generation of the input method change message or the highlight message, the generation of the input method change message or the highlight message is not transmitted to the application a.
Agent broadcast message queue: the queue for storing the second broadcast message, which is preset in the system in the embodiment of the invention, can control the speed of sending the first broadcast message to each application by changing the de-queuing speed, namely the preset first speed, of the second broadcast message in the agent broadcast message queue.
A broadcast message queue: a queue in the system for storing a first broadcast message, each broadcast message stored in the broadcast message queue requiring transmission, and the rate of transmission being non-modifiable.
Broadcast receiver queue: a broadcast receiver for storing any first broadcast message in a queue of received broadcast messages, wherein one broadcast receiver belongs to one application, but one application can register a plurality of different broadcast receivers.
In a first aspect, a method of processing a broadcast message is provided, which may be used in an android system. The method comprises the following steps: determining that N applications in at least one application for receiving the first broadcast message meet a first preset condition, generating a second broadcast message aiming at each application in the N applications, and respectively storing the generated N second broadcast messages into a proxy broadcast message queue, wherein the second broadcast messages comprise the corresponding relation between a broadcast receiver belonging to the application and the first broadcast message; and then, according to a preset first rate, sequentially processing second broadcast messages in the proxy broadcast message queue so that N applications can receive the first broadcast messages through broadcast receivers belonging to the applications, wherein the first rate is less than the rate at which the system currently sends the first broadcast messages to the applications, and N is a positive integer greater than zero. For example, for a first broadcast message, an application a, an application B, an application C, an application D, and an application E register a broadcast receiver a, a broadcast receiver B, a broadcast receiver C, a broadcast receiver D, and a broadcast receiver E, respectively, where the application a and the application B satisfy a first preset condition, respectively, then for the application a, a second broadcast message 1 is generated, the second broadcast message 1 includes a correspondence between the broadcast receiver a and the first broadcast message, for the application B, a second broadcast message 2 is generated, the second broadcast message 2 includes a correspondence between the broadcast receiver B and the first broadcast message, and then the second broadcast message 1 and the second broadcast message 2 are stored in a proxy broadcast message queue, respectively.
In the embodiment of the invention, the time for sending the first broadcast message aiming at the N applications is delayed by introducing the first preset condition and the proxy broadcast message queue, and compared with the prior art that the first broadcast message is directly sent to all the applications registered with the first broadcast message, the number of the applications receiving the first broadcast message at the same time is reduced, so that the possibility of easily causing the shortage of system resources when too many broadcast receivers are registered aiming at one broadcast message is reduced, and the user experience is improved.
It should be understood that the first broadcast message in the embodiment of the present invention may be a system broadcast message, and may also be a broadcast message of a certain application.
Based on the first aspect, in a first implementation manner, after generating the second broadcast message, it is determined that the same broadcast message as the generated second broadcast message already exists in the proxy broadcast message queue, and the existing broadcast message is deleted, where a broadcast receiver in the same broadcast message as the generated second broadcast message is the same as a broadcast receiver in the generated second broadcast message, and a message type of the first broadcast message is the same as a message type of the first broadcast message in the generated second broadcast message.
Taking fig. 2 as an example, the proxy broadcast message queue stores a second broadcast message 1, a second broadcast message 2, a second broadcast message 3, and a second broadcast message 4, wherein the generated second broadcast message is a second broadcast message 5, if the second broadcast message 1 includes a correspondence relationship between the first broadcast message 1 and the broadcast receiver 1, and the second broadcast message 5 includes a correspondence relationship between the first broadcast message 5 and the broadcast receiver 1, when the first broadcast message 1 and the first broadcast message 5 are broadcast messages of the same type, and since the broadcast receivers in the second broadcast message 1 and the second broadcast message 5 are both broadcast receivers 5, the second broadcast message 1 and the second broadcast message 5 are the same broadcast message, the second broadcast message 1 in the proxy broadcast message queue is deleted, for example, the remaining amount of the battery in the battery use state is 80%, if the first broadcast message 5 is a broadcast message whose battery usage status is 50% of the remaining battery level, the first broadcast message 1 and the first broadcast message 5 belong to the same type, and the broadcast receiver 1 is a broadcast receiver registered by the same application for the type of broadcast message.
It should be noted that, in a second possible implementation manner, after the second broadcast message 5 is stored in the proxy broadcast message queue, it may be determined whether a second broadcast message identical to the second broadcast message 5 exists in the proxy broadcast message queue, and then, if the second broadcast message exists, the second broadcast message identical to the second broadcast message 5 is deleted, or it may be determined whether a second broadcast message identical to the second broadcast message 5 exists in the proxy broadcast message queue first, and if the second broadcast message exists, the second broadcast message identical to the second broadcast message 5 is deleted, and then, the second broadcast message 5 is stored in the proxy broadcast message queue. In the embodiment of the present invention, the order of storing the generated second broadcast message is not limited.
When the agent broadcast message queue comprises the second broadcast message which is the same as the generated second broadcast message, the second broadcast message which is the same as the generated second broadcast message in the agent broadcast message queue is deleted, which is equivalent to that some meaningless second broadcast messages in the system are deleted, so that the frequency of sending the first broadcast message to the application in the system is reduced, and the possibility of system resource shortage caused by too many broadcast receivers registered aiming at the first broadcast message in the prior art is further reduced. For example, the second broadcast message 1 stored in the proxy broadcast message queue includes a correspondence relationship between the broadcast receiver 1 and a message with 80% of the remaining battery amount, where the message with 80% of the remaining battery amount is the first broadcast message at time 1, and the second broadcast message 2 generated at current time 2 includes a correspondence relationship between the broadcast receiver 1 and a message with 20% of the remaining battery amount, where the message with 20% of the remaining battery amount is the first broadcast message at time 2, and time 1 is before time 2, and the first broadcast message at time 1 loses invalidity compared with the first broadcast message at time 2, so that the second broadcast message 1 is a meaningless first broadcast message, and the second broadcast message 1 is a meaningless broadcast message, and does not need to be sent to the application for occupying resources.
Based on the first aspect or the first implementation manner of the first aspect, in a second implementation manner, while second broadcast messages in the proxy broadcast message queue are sequentially processed according to a preset first rate, it is determined whether a second broadcast message meeting a second preset condition exists in the proxy broadcast message queue, and when it is determined that the second broadcast message meeting the second preset condition exists in the proxy broadcast message queue, the processing of the second broadcast message in the proxy broadcast message queue processed according to the preset first rate is stopped, and the second broadcast message meeting the second preset condition is directly processed, so that an application corresponding to the second broadcast message meeting the preset condition can receive the first broadcast message in advance. Thereby improving the stability of the normal operation of the system.
For example, the second broadcast message 1 stored in the proxy broadcast message queue includes a corresponding relationship between the first broadcast message 1 and the broadcast receiver 1, if the application to which the broadcast receiver 1 belongs is application a, the application a is in an inactive state before being stored in the proxy broadcast message queue, in order to avoid that the application a needs to pull up the application a to receive the broadcast message, the second broadcast message 1 is generated and stored in the proxy broadcast message queue, but the user starts application a at this time, the system detects that application a runs in the foreground, application a needs to receive the broadcast message to ensure normal running of the application in the system, after detecting that application a runs in the foreground, the flow of processing the second broadcast message in the proxy broadcast message queue according to a preset first rate is skipped, the second broadcast message 1 is directly processed, so that application a can receive the first broadcast message 1 in time, therefore, the second preset condition may include a state in which the application is converted into a foreground operation state, or other conditions, where the second preset condition may be set according to the needs of the actual situation.
Based on the first aspect or the first implementation manner or the second implementation manner of the first aspect, in a third implementation manner, it is determined that the number of the second broadcast messages stored in the proxy broadcast message queue is greater than a preset threshold, and the proxy broadcast message queue is emptied. Further reducing the likelihood of broadcast storms.
For example, the number of the second broadcast messages stored in the proxy broadcast message queue is 11, the preset threshold is 11, when the generated second broadcast message is stored in the proxy broadcast message queue, the number of the second broadcast messages stored in the proxy broadcast message queue is updated to 12, and if the number of the second broadcast messages stored in the proxy broadcast message queue is greater than the preset threshold 11, the 12 second broadcast messages in the proxy broadcast message queue are deleted.
Based on the first aspect or the first implementation manner, the second implementation manner, or the third implementation manner of the first aspect, in a fourth implementation manner, a second rate is determined, where the second rate is a preferred rate for the system to currently process the second broadcast message; and if the second rate is different from the preset first rate, modifying the preset first rate into the second rate so as to process the second broadcast messages in the proxy broadcast message queue in sequence according to the second rate.
Because the running state in the system is changed continuously, the running state of the system is optimized by adjusting the first speed of the second broadcast message in the agent broadcast message queue, and the user experience is further improved.
In a fifth implementation form, based on the fourth implementation form of the first aspect, the second rate is determined by:
determining the number of broadcast receivers used for receiving broadcast messages in unit time within a preset time period;
determining the number of system frame loss in a preset time period;
determining the average time length required for starting the application within a preset time period;
and determining a second rate based on a preset algorithm according to the number of broadcast receivers used for receiving the broadcast messages in unit time, the number of system frame loss and the average time length required for starting the application.
Since the number of broadcast receivers used for receiving broadcast messages in unit time, the number of system frame loss and the duration of starting application are closely related to the rate of processing the second broadcast message in the proxy broadcast message queue in the preset time period, if the rate of processing the second broadcast message in the proxy broadcast message queue is too high, the number of broadcast receivers used for receiving broadcast messages in unit time is increased, the number of system frame loss is increased, the duration of starting application is lengthened, and user experience is affected, if the rate of processing the second broadcast message in the proxy broadcast message queue is too low, although the number of broadcast receivers used for receiving broadcast messages in unit time is reduced, the number of system frame loss is reduced, the duration of starting application is shortened, but the utilization rate of resources is reduced, therefore, the second rate is determined by a preset algorithm in the system, under the condition of not reducing user experience, the utilization rate of resources is improved.
It should be noted that the preset algorithm may be a correspondence relationship between (a range of the number of broadcast receivers for receiving the broadcast message per unit time, a range of the number of system dropped frames, and a range of the duration of starting the application) and the second rate.
Based on the first aspect or the first implementation manner, the second implementation manner, the third implementation manner, the fourth implementation manner, or the fifth implementation manner of the first aspect, in a sixth implementation manner, after receiving a first broadcast message, it is determined that a rate of receiving the first broadcast message is greater than a preset third rate, and a message type of the first broadcast message is within a range of a preset message type.
The sequence of determining whether the rate of receiving the first broadcast message is greater than the preset third rate and determining whether the message type of the first broadcast message is within the range of the preset message type is not limited.
Whether the first broadcast message meets the set corresponding conditions or not is judged firstly, the condition that the system or the application cannot run and the user experience is influenced due to the fact that the important application is sent in a delayed mode is avoided by setting the range of the type of the preset message, the condition of the rate of receiving the first broadcast message can be judged in advance by setting the preset third rate, then proper adjustment is carried out, and the possibility of causing the system resource shortage is further reduced.
When the rate of receiving the first broadcast message is not greater than the preset third rate or the message type of the first broadcast message is not within the range of the preset message type, the first broadcast message may be sent to the application according to the prior art.
Based on the first aspect or the first implementation manner, the second implementation manner, the third implementation manner, the fourth implementation manner, the fifth implementation manner, or the sixth implementation manner of the first aspect, in a seventh implementation manner, the second broadcast message is processed in the following manner, so that the N applications can receive the first broadcast message:
storing a first broadcast message in the second broadcast message into a broadcast message queue, and storing a broadcast receiver in the second broadcast message into a broadcast receiver queue; and acquiring the first broadcast message from the broadcast message queue, acquiring the broadcast receiver from the broadcast receiver queue, and sending the first broadcast message to an application to which the broadcast receiver belongs through the broadcast receiver.
The technical solution of the present invention achieves compatibility with the prior art, since the first broadcast message is transmitted to the application in the same manner as the prior art.
In a second aspect, an embodiment of the present invention further provides an apparatus for processing a broadcast message, where the apparatus includes one or more modules that can implement the first aspect or any one of the implementations of the first aspect, and each module may perform one or more steps.
In a third aspect, an embodiment of the present invention further provides a terminal, where the terminal includes a processor and a memory, where the memory is used to store a software program, and the processor is used to read the software program stored in the memory and implement the first aspect or the method provided by any implementation manner of the first aspect.
In a fourth aspect, embodiments of the present invention further provide a computer storage medium, where the storage medium may be nonvolatile, that is, the content is not lost after power is turned off. The storage medium stores therein a software program which, when read and executed by one or more processors, may implement the method provided by the first aspect or any one of the implementations of the first aspect described above.
Drawings
Fig. 1 is a schematic flowchart illustrating a process of sending a broadcast message in an Android system in the prior art;
FIG. 2 is a diagram illustrating a proxy broadcast message queue according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a hardware architecture of a terminal according to an embodiment of the invention;
FIG. 4a is a flowchart illustrating a process for handling broadcast messages according to an embodiment of the present invention;
fig. 4b is a schematic diagram of a frame structure of the android system according to the embodiment of the present invention;
FIG. 4c is a flow chart illustrating the processing of a broadcast message according to an embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating an exemplary embodiment of the invention;
fig. 6a and fig. 6b are schematic structural diagrams of an apparatus for processing a broadcast message according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings.
It should be understood that the method for processing a broadcast message in the embodiment of the present invention is mainly applied to a terminal, which may also be referred to as a UE (user equipment), an MS (Mobile Station), a Mobile terminal (Mobile terminal), and the like, and optionally, the terminal may be a Mobile phone, a tablet computer, a PDA (Personal digital assistant), a POS (Point of sales), a vehicle-mounted computer, a set-top box, and the like.
The method for processing the broadcast message delays the time for sending the first broadcast message aiming at the N applications by introducing the first preset condition and the proxy broadcast message queue, and reduces the number of the applications for receiving the first broadcast message at the same time compared with the method for directly sending the first broadcast message to all the applications registered with the first broadcast message in the prior art, thereby reducing the possibility of easily causing the shortage of system resources when too many broadcast receivers are registered aiming at one broadcast message, and further improving the user experience.
Fig. 3 is a schematic diagram of a hardware structure of a terminal according to an embodiment of the present invention. As shown in fig. 3, the terminal 300 includes a display device 340, a processor 350, and a memory 380. The Memory 380 generally includes a Random Access Memory (RAM), a Read Only Memory (ROM), a CACHE Memory (CACHE), and an external Memory. The external memory can be a hard disk, an optical disk, a USB disk, a floppy disk or a tape drive. The memory 380 is used for storing computer programs and other data 383, the computer programs include an operating system 382, an application program 381, and the other data 383 may include data generated after the operating system 382 or the application program 381 is executed, the data includes system data (for example, configuration parameters of the operating system) and user data, for example, a photo taken by a user is typical user data, while in the embodiment of the present invention, the proxy broadcast queue is a part of storage space on the memory and is used for storing a second broadcast message, in the embodiment of the present invention, the first preset condition is stored in the memory 380, and in order to avoid that the operation speed of the terminal is affected by excessive data stored in the memory, the first preset condition is stored in an external memory. The processor 350 loads computer programs or other data from external memory to internal memory before performing processing or invoking the data. In the embodiment of the present invention, when the terminal 300 runs the program of the embodiment of the present invention, the first preset condition stored in the external memory is loaded onto the internal memory, and then the program of the embodiment of the present invention is executed on the internal memory.
The processor 350 is used to read the computer programs and then execute the methods defined by the computer programs, such as the processor 350 reading the operating system 382 to run the operating system and implement various functions of the operating system on the terminal 300 or the processor 350 reading one or more application programs 381 to run applications on the terminal 300. The Processor 350 may include one or more general-purpose processors, and may further include one or more DSPs (Digital Signal processors) for performing relevant operations to implement the technical solutions provided by the embodiments of the present invention.
The operating system 382 includes a computer program that can implement the method for processing a broadcast message according to the embodiment of the present invention, so that after the processor 350 reads the operating system 382 and runs the operating system, the operating system can have the function of processing a broadcast message according to the embodiment of the present invention. Thereby enabling the operating system to reduce the possibility of a broadcast storm occurring when transmitting a broadcast message to an upper layer application.
The terminal 300 may further include an input device 330 for receiving input numerical information, character information, or contact touch operation/non-contact gesture, and generating signal input related to user setting and function control of the terminal 300, etc. In addition, the input device 330 may include a touch panel 331. The touch panel 331, also referred to as a touch screen, can collect touch operations of a user (e.g., operations of the user on the touch panel 331 or on the touch panel 331 by using any suitable object or accessory such as a finger, a stylus, etc.) on or near the touch panel 331, and drive the corresponding connection device according to a preset program. Alternatively, the touch panel 331 may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 350, and can receive and execute commands sent by the processor 350. For example, if the user clicks the application a with a finger on the touch panel 331, and the application a is started from a non-started state to a foreground, after the application a is detected to be started, and if the second preset condition includes that the application is switched to the foreground for running, the second broadcast message in the proxy broadcast message queue is processed according to the preset first rate, and the second broadcast message including the broadcast receiver corresponding relation belonging to the application a is directly processed.
The touch panel 331 can be implemented by various types, such as resistive, capacitive, infrared, and surface acoustic wave. In addition to touch panel 331, input device 330 may include other input devices 332, where other input devices 332 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, and the like.
The terminal 300 may further include a display device 340, the display device 340 including a display panel 341 for displaying information input by a user or information provided to the user, various menu interfaces of the terminal 300, and the like, and in the embodiment of the present invention, is mainly used for displaying icons of applications installed in the terminal 300. The Display device 340 may include a Display panel 341, and optionally, the Display panel 341 may be configured in the form of an LCD (Liquid Crystal Display) or an OLED (Organic Light-emitting diode). In other embodiments, the touch panel 331 can cover the display panel 341 to form a touch display screen.
In addition to the above, the terminal 300 may further include a power supply 390 for supplying power to other modules and a camera 360 for taking a picture or video. The terminal 300 may also include one or more sensors 320, such as acceleration sensors, light sensors, and the like. The terminal 300 may further include a Radio Frequency (RF) circuit 310 for performing network communication with a Wireless network device, and a Wireless Fidelity (WiFi) module 370 for performing WiFi communication with other devices.
The method for processing broadcast messages according to the embodiment of the present invention can be implemented in the operating system 382 shown in fig. 3. Specifically, taking fig. 4a as an example, a method for processing a broadcast message according to an embodiment of the present invention is described in detail, where the embodiment of the present invention is implemented in a computer system 400 shown in fig. 4 b. The computer system 400 may operate in a terminal or other type of computer device. The computer system includes an application layer 410 and an operating system layer 450, and the method provided by the embodiment of the present invention is mainly implemented in a framework layer 420 of the operating system layer 450, and the operating system may be an Android (Android) operating system. The operating system layer 450 is further divided into a framework layer 420, a core library layer 430, and a driver layer 440. The operating system layer 450 in fig. 4b may be considered as a specific implementation of the operating system 382 in fig. 3, and the application layer 410 in fig. 4b may be considered as a specific implementation of the application programs 381 in fig. 3, including the gallery 411, the media player 412, the browser 413, and the like. The driver layer 440 includes a CPU driver 441, a GPU driver 442, a display controller driver 443, and the like. The core library layer 430 is a core part of the operating system, and includes an input/output service 431, a core service 432, a Graphics device interface 434, and a Graphics Engine (Graphics Engine)433 that implements CPU or GPU Graphics processing, and the like. The framework layer 420 may include an AMS (activity manager Service) 421, an RDA (real time data acquirer) 422, an RMS (Resource Management Server) 423, an R-DME (real time decision maker) 424, a CMS (configuration Management Server) 425, an ARS (aware recognition Server) 426, and the like. The application layer 410 may include a gallery 411, a media player (MediaPlayer)412, a Browser (Browser)413, and the like.
In addition, below the driver layer 440, the computer system 400 also includes a hardware layer. The hardware layer of the computer system 400 may include a Central Processing Unit (CPU) and a Graphics Processing Unit (GPU) (corresponding to a specific implementation of the processor 350 in fig. 3), may further include a storage (corresponding to the storage 380 in fig. 3), including a memory and an external storage, may further include an input device (corresponding to the input device 330 in fig. 3), a display device (corresponding to the display device 340 in fig. 3), such as a Liquid Crystal Display (LCD), a Holographic (Holographic), a projection (Projector), and the like, and may further include one or more sensors (corresponding to the sensors 320 in fig. 3). Of course, the hardware layer may further include the power supply, the camera, the RF circuit and the WiFi module shown in fig. 3, and may further include other hardware modules not shown in fig. 3, such as a memory controller and a display controller.
The method provided by any of the previous embodiments of the invention may be implemented in the frame layer shown in fig. 4 b.
As shown in fig. 4c, the method for processing a broadcast message according to the embodiment of the present invention includes:
in step 501, application a generates a first broadcast message. It should be noted that the first broadcast message may also be a broadcast message generated by the system, such as the status of the storage space in the system, and the usage status information of the battery. Wherein the type of the first broadcast message is a BroadcastRecord type.
At step 502, the application A r sends a first broadcast message to the AMS. Specifically, the application a may send a first broadcast message to the AMS through the binder.
In step 503, the AMS receives the first broadcast message, stores the first broadcast message in the broadcast message queue, and determines all applications for receiving the first broadcast message, and stores broadcast receivers belonging to the applications for receiving the first broadcast message in the broadcast receiver queue, respectively, wherein each broadcast receiver is assigned to a different application. It should be understood that the number of all applications for receiving the first broadcast message is at least one.
For example, all applications for receiving the first broadcast message are application 1, application 2, application 3, application 4 and application 5, then, for the first broadcast message, it is assumed that the broadcast receiver registered with the AMS by the application 1 is the broadcast receiver 1, the broadcast receiver 1 belongs to the application 1, and so on, assuming that the broadcast receiver registered with the AMS by the application 2 is the broadcast receiver 2, the broadcast receiver 2 belongs to the application 2, and it is assumed that the broadcast receiver registered by the application 3 in the AMS is the broadcast receiver 3, the broadcast receiver 3 belongs to the application 3, and it is assumed that the broadcast receiver registered by the application 4 in the AMS is the broadcast receiver 4, the broadcast receiver 4 belongs to the application 4, and it is assumed that the broadcast receiver registered by the application 5 in the AMS is the broadcast receiver 5, the broadcast receiver 5 belongs to the application 5 and it is to be understood that the first broadcast message is sent to the application by the broadcast receiver.
Specifically, since the parallel broadcast message queue and the ordered broadcast message queue are included in the related art, the first broadcast message in the parallel broadcast message queue is transmitted to the application through the broadcast receiver in the parallel broadcast receiver queue, and the first broadcast message in the ordered broadcast message queue is transmitted to the application through the ordered broadcast receiver, for example, the parallel broadcast message queue includes the first broadcast message 1, and the application for receiving the first broadcast message 1 includes the application 1 and the application 2, where the broadcast receiver registered by the application 1 is the broadcast receiver 1 and the broadcast receiver registered by the application 2 is the broadcast receiver 2, the AMS directly transmits the first broadcast message 1 to the application 1 through the broadcast receiver 1 while transmitting the first broadcast message 1 to the application 1 through the broadcast receiver 2, that is, the first broadcast message 1 in the parallel broadcast message queue is transmitted in parallel, and the first broadcast message in the ordered broadcast message queue is transmitted serially, for example, the ordered broadcast message queue includes the first broadcast message 2, and the application for receiving the first broadcast message 2 includes an application 3 and an application 4, where the broadcast receiver registered by the application 3 is the broadcast receiver 3, and the broadcast receiver registered by the application 4 is the broadcast receiver 4, and if the first broadcast message 2 is first transmitted to the application 3, the AMS transmits the first broadcast message 2 to the application 4 through the broadcast receiver 4 after transmitting the first broadcast message 2 to the application 3 through the broadcast receiver 3. In the embodiment of the invention, the broadcast message queue can be a parallel broadcast message queue or an ordered broadcast message queue.
At step 504, the AMS sends a first broadcast message to the RDA.
Wherein, the step 503 and the step 504 have no necessary sequence.
In step 505, the RDA obtains attribute feature information of the first broadcast message and sends the attribute feature information of the first broadcast message to the RMS.
The attribute feature information includes the following parameters: the application for receiving the first broadcast message optionally further comprises a rate of receiving the first broadcast message and/or a message type of the first broadcast message.
In step 506, the RMS obtains configuration file information from the CMS, where the configuration file information includes a first preset condition, a second preset condition, a preset first rate, a preset third rate, and a range of preset message types. Step 406 does not necessarily have to be in order from step 401 to step 405.
The CMS may also acquire behavior statistics of the user using the application from the ARS and then update the profile information every preset time period based on the configured algorithm according to the acquired behavior statistics.
In step 507, the RMS determines that the rate of receiving the first broadcast message is greater than a preset third rate, and determines that the message type of the first broadcast message is within a range of preset message types.
It should be noted that the message type included in the preset message type is a message type that is not important or critical to system operation and application operation, when it is determined that the rate of receiving the first broadcast message is greater than the preset third rate, and it is determined that the message type of the first broadcast message is no longer within the range of the preset message type, the RMS says that the message type of the first broadcast message is the first broadcast message of the important type, and in order to ensure normal operation of the system or the application, the RMS does not report to the R-DME indication information that the rate of receiving the first broadcast message is in an overload state, that is, does not proxy the first broadcast message any more, and sends the first broadcast message according to the existing flow, and optionally reports to the R-DME the broadcast message that the first broadcast message is the important type, and the R-DME indicates the AMS to send the first broadcast message according to the existing flow.
In addition, when the RMS determines that the rate of receiving the first broadcast message is not greater than the preset third rate, whether the message type of the first broadcast message is within the preset message type range or not, since the rate of receiving the first broadcast message is not greater than the preset third rate, the system operates in a normal or idle state without executing the proxy first broadcast message, and optionally, reports indication information that the rate of receiving the first broadcast message is not greater than the preset third rate to the R-DME, and the R-DME instructs the AMS to transmit the first broadcast message according to the existing flow.
In step 508, the RMS determines whether there is an application satisfying a first preset condition among at least one application for receiving the first broadcast message, if so, performs step 509, otherwise, performs step 513.
It should be noted that the first preset condition includes, but is not limited to, that the running state of the application is background running, a blacklisted application list, an infrequent application list, and the like. For example, when the RMS determines that the application a is an application running in the background, the application a is an application satisfying the first preset condition, or when the RMS determines that the application B is an application in the blacklist, the application B is also an application satisfying the first preset condition.
In step 509, the RMS determines N applications meeting the first preset condition, and reports to the R-DME indication information that the rate of receiving the first broadcast message is in the overload state and the N applications meeting the first preset condition, where N is a positive integer greater than 0, and the indication information is used to indicate that the rate of receiving the first broadcast message is greater than a preset third rate.
Specifically, the indication information includes a rate of receiving the first broadcast message and a preset third rate.
In step 510, after receiving the indication information and the N applications meeting the first preset condition, the R-DME sends the N applications meeting the first preset condition to the AMS.
Optionally, to improve the performance of system operation, the R-DME further sends instruction information and N applications meeting the first preset condition to the ARS, so that after the ARS receives the instruction information and the N applications, the ARS learns the behavior habits of the users using the applications, updates the configuration file information, and after the configuration file information is updated, the ARS pushes the updated configuration file information to the RMS through the CMS.
Because the running state inside the system changes continuously, in order to optimize the running state of the system and further improve the experience of the user, optionally, the preset first rate in the configuration file information is updated according to the following mode: determining a second rate, wherein the second rate is the preferred rate of the system for processing the second broadcast message currently; and if the second rate is different from the preset first rate, modifying the preset first rate into the second rate so as to process the second broadcast messages in the proxy broadcast message queue in sequence according to the second rate. The preferred rate is the rate obtained in a certain way to better support the system operation and guarantee the user experience.
The second rate, i.e. the preferred rate, may be determined by:
step 1, determining the number of broadcast receivers used for receiving broadcast messages in unit time within a preset time period; specifically, the ARS determines the number of broadcast receivers for receiving the broadcast message in unit time within a preset time period according to the indication information sent by the R-DME.
Step 2, determining the number of system frame losses in a preset time period;
step 3, determining the average duration required by starting the application within a preset time period;
and 4, determining a second rate based on a preset algorithm according to the number of the broadcast receivers used for receiving the broadcast messages in unit time, the number of system frame loss and the average time length required for starting the application. It should be noted that, the steps 1 to 3 do not have a necessary sequence, and may be executed simultaneously or step by step. Specifically, the unit time may be set according to actual conditions, for example, if the time is measured in seconds, the unit time is one second, and if the time is measured in frames, the unit time is one frame. The preset algorithm may be a correspondence between (a range of the number of broadcast receivers for receiving the broadcast message per unit time, a range of the number of system dropped frames, a range of the time duration for starting the application) and the second rate. For example, the number of broadcast receivers for receiving the broadcast message per unit time is 19, the number of system frame loss is 5, and the time duration for starting the application is 2 seconds, and assuming that the second rate is 0.9 (the number of broadcast receivers for receiving the broadcast message per unit time ranges from 0 to 20, the number of system frame loss ranges from 0 to 9, and the time duration for starting the application ranges from 0.1 second to 2.5 seconds), the second rate is 0.9. The preset algorithm may also be a correspondence relationship between (a range of the number of broadcast receivers used for receiving the broadcast message in unit time, a range of the number of frames lost by the system, and a range of the duration of starting the application) and the second rate calculation algorithm.
In step 511, the AMS receives N applications that satisfy the first preset condition, generates a second broadcast message for each application, and stores the second broadcast message in the proxy broadcast message queue, where the second broadcast message includes a correspondence between a broadcast receiver belonging to the application and the first broadcast message.
The type of the second broadcast message is BroadcastRecord type.
It should be noted that, when the N applications are all applications that receive the first broadcast message, the AMS deletes the first broadcast message in the broadcast message queue, and deletes N broadcast receivers in the broadcast receiver queue that belong to the N applications, respectively. For example, the first broadcast message is broadcast message a, and if N is 2, the two applications are all applications for receiving broadcast message a, and include application a and application B, where broadcast receiver a and broadcast receiver B are stored in the broadcast receiver queue, broadcast receiver a belongs to application a, broadcast receiver B belongs to application B, broadcast message a in the broadcast message queue is deleted, and broadcast receiver a and broadcast receiver B in the broadcast receiver queue are deleted, and when the number of all applications for receiving the first broadcast message is greater than N, only N broadcast receivers respectively belonging to N applications in the broadcast receiver queue are deleted.
Specifically, as shown in fig. 5, the proxy broadcast message queue includes a second broadcast message 1 and a second broadcast message 2, where the second broadcast message 1 includes a correspondence between the broadcast receiver 1 and the first broadcast message 1, and the second broadcast message 2 includes a correspondence between the broadcast receiver 2 and the first broadcast message 1, and when the second broadcast message is processed, the first broadcast message 1 in the second broadcast message 1 is stored in the broadcast message queue, the broadcast receiver 1 in the second broadcast message 1 is stored in the broadcast receiver queue, the first broadcast message 1 in the second broadcast message 2 is stored in the broadcast message queue, and the broadcast receiver 2 in the second broadcast message 2 is stored in the broadcast receiver queue.
In addition, it should be noted that, when the AMS determines that the number of the second broadcast messages stored in the proxy broadcast message queue is greater than the preset threshold, the proxy broadcast message queue is cleared. The preset threshold value is determined based on the memory of the terminal system, and the preset threshold values set by different terminals can be different due to different system memories in different terminals.
In step 512, the AMS stores the first broadcast message of the second broadcast message in the broadcast message queue according to the preset first rate, and stores the broadcast receiver of the second broadcast message in the broadcast receiver queue.
In step 513, the AMS obtains the first broadcast message from the broadcast message queue, obtains the broadcast receiver from the broadcast receiver queue, and sends the first broadcast message to the application through the obtained broadcast receiver.
For example, taking fig. 4a as an example, the application 2, the application 3, and the application 4 are applications that satisfy a first preset condition, and after storing the broadcast receivers belonging to the application 2, the application 3, and the application 4 in the second broadcast message in the broadcast receiver queue, respectively, and storing the first broadcast message in the second broadcast message in the broadcast message queue, respectively, the first broadcast message is sent to the application 2, the application 3, and the application 4 through the obtained broadcast receivers.
In addition, in order to reduce the number of times of sending the first broadcast message to the application in the system, and further reduce the possibility of system resource shortage caused by too many broadcast receivers registered for one first broadcast message in the prior art, on the basis of processing the broadcast message as shown in fig. 4c, after generating the second broadcast message, determining whether the broadcast message same as the generated second broadcast message exists in the proxy broadcast message queue, and if so, deleting the existing broadcast message, wherein the broadcast receiver in the broadcast message same as the generated second broadcast message is the same as the broadcast receiver in the generated second broadcast message, and the message type of the first broadcast message is the same as the message type of the first broadcast message in the generated second broadcast message. It should be noted that, in the embodiment of the present invention, the order of storing and generating the second broadcast message is not limited.
In this embodiment of the present invention, in order to improve the stability of the normal operation of the system, optionally, while step 512 is executed, it is determined whether a second broadcast message meeting a second preset condition exists in the proxy broadcast message queue, when it is determined that the second broadcast message meeting the second preset condition exists in the proxy broadcast message queue, if the second broadcast message meeting the second preset condition is not processed in the proxy broadcast message queue according to the preset first rate, the processing of the second broadcast message in the proxy broadcast message queue according to the preset first rate is stopped, and the second broadcast message meeting the second preset condition is directly processed, so that an application corresponding to the second broadcast message meeting the preset condition can receive the first broadcast message in advance, thereby ensuring the normal operation of the application.
If the broadcast message meeting the second preset condition is just processed according to the preset first rate, the execution is continued.
The second preset condition may be the same as the first preset condition, or may be different from the first preset condition, for example, the second preset condition is that the application to which the broadcast receiver belongs in the second broadcast message is switched from an un-started state or a state of running in the background to a state of running in the foreground. It should be understood that the second preset condition can be set according to the actual requirement.
Based on the same inventive concept, the embodiment of the present invention further provides a device having a function of processing a broadcast message in the embodiment of the present invention, and since the method corresponding to the device in the embodiment of the present invention is the method of processing a broadcast message in the embodiment of the present invention, reference may be made to the implementation of the method for implementing the device in the embodiment of the present invention, and repeated details are not described again.
Please refer to fig. 6a, which is a schematic structural diagram of an apparatus 600 according to an embodiment of the present invention.
The apparatus for processing a broadcast message includes: a determining module 610, configured to determine that N applications, which are positive integers greater than zero, exist in at least one application for receiving the first broadcast message and satisfy a first preset condition; a broadcast agent module 620, configured to generate a second broadcast message for each of the N applications, and store the second broadcast message in an agent broadcast message queue, where the second broadcast message includes a correspondence between a broadcast receiver belonging to the application and the first broadcast message; the broadcast deputy module 630 is configured to sequentially process the second broadcast messages in the proxy broadcast message queue according to a preset first rate, so that the N applications can receive the first broadcast message through the broadcast receiver belonging to each application, where the first rate is smaller than a rate at which the system currently sends the first broadcast message to the application.
Further, the broadcast agent module 620 determines that the same broadcast message as the generated second broadcast message already exists in the agent broadcast message queue after the second broadcast message is generated, and deletes the existing broadcast message, wherein the broadcast receiver in the same broadcast message as the generated second broadcast message is the same as the broadcast receiver in the generated second broadcast message, and the message type of the first broadcast message is the same as the message type of the first broadcast message in the generated second broadcast message.
Further, the broadcast agent module 620 is further configured to determine that a second broadcast message meeting a second preset condition exists in the agent broadcast message queue, and process the second broadcast message meeting the second preset condition in advance, so that an application corresponding to the second broadcast message meeting the preset condition can receive the first broadcast message in advance.
Further, the broadcast agent module 620 is further configured to determine that the number of the second broadcast messages stored in the agent broadcast message queue is greater than a preset threshold, and empty the agent broadcast message queue.
Further, as shown in fig. 6b, the apparatus further includes a configuration module 640, configured to determine a second rate, where the second rate is a preferred rate at which the system currently processes the second broadcast message; and when the second rate is determined to be different from the preset first rate, modifying the preset first rate into the second rate so as to process the second broadcast messages in the proxy broadcast message queue in sequence according to the second rate.
Optionally, the configuration module 640 determines the second rate according to the following manner:
determining the number of broadcast receivers used for receiving the first broadcast message in unit time within a preset time period; determining the number of system frame loss in a preset time period; determining the average time length required for starting the application within a preset time period; and determining a second rate based on a preset algorithm according to the number of broadcast receivers used for receiving the broadcast messages in unit time, the number of system frame loss and the average duration required for starting the application.
Further, the determining module 610 is further configured to determine that a rate of receiving the first broadcast message is greater than a preset third rate and a message type of the first broadcast message is within a range of a preset message type before it is determined that N applications in the at least one application for receiving the first broadcast message satisfy a preset condition.
Further, the broadcast deputy module 630 processes the second broadcast message in the following manner so that the N applications can receive the first broadcast message:
storing a first broadcast message in the second broadcast message into a broadcast message queue, and storing a broadcast receiver in the second broadcast message into a broadcast receiver queue; and acquiring the first broadcast message from the broadcast message queue, acquiring the broadcast receiver from the broadcast receiver queue, and sending the first broadcast message to an application to which the broadcast receiver belongs through the broadcast receiver.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. In addition, in the drawings of the embodiment of the apparatus provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, and may be specifically implemented as one or more communication buses or signal lines. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, it is clear to those skilled in the art that the drawing apparatus according to the embodiments of the present invention can be implemented by software plus necessary general-purpose hardware, and of course, can also be implemented by dedicated hardware including an application specific integrated circuit, a dedicated CPU, a dedicated memory, a dedicated component, and the like. Generally, functions performed by computer programs can be easily implemented by corresponding hardware, and specific hardware structures for implementing the same functions may be various, such as analog circuits, digital circuits, or dedicated circuits.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.
Claims (17)
1. A method of processing broadcast messages, comprising:
determining that N applications in at least one application for receiving a first broadcast message meet a first preset condition, wherein N is a positive integer greater than zero;
generating a second broadcast message for each of the N applications, and storing the second broadcast message in a proxy broadcast message queue, wherein the second broadcast message includes a correspondence of a broadcast receiver attributed to the application to the first broadcast message;
and sequentially processing the second broadcast messages in the agent broadcast message queue according to a preset first rate so that the N applications can receive the first broadcast messages through broadcast receivers belonging to the applications, wherein the first rate is less than the rate at which the system currently sends the first broadcast messages to the applications.
2. The method of claim 1, wherein after the generating the second broadcast message, further comprising:
determining that a broadcast message identical to the generated second broadcast message already exists in the proxy broadcast message queue, and deleting the existing broadcast message, wherein a broadcast receiver in the broadcast message identical to the generated second broadcast message is identical to a broadcast receiver in the generated second broadcast message, and a message type of a first broadcast message is identical to a message type of a first broadcast message in the generated second broadcast message.
3. The method of claim 1 or 2, further comprising:
determining that a second broadcast message meeting a second preset condition exists in the proxy broadcast message queue, and processing the second broadcast message meeting the second preset condition in advance, so that an application corresponding to the second broadcast message meeting the preset condition can receive the first broadcast message in advance.
4. The method of claim 1 or 2, further comprising:
and determining that the number of the second broadcast messages stored in the agent broadcast message queue is greater than a preset threshold value, and emptying the agent broadcast message queue.
5. The method of claim 1 or 2, further comprising:
determining a second rate, wherein the second rate is a preferred rate of the system for processing the second broadcast message currently;
and when the second rate is determined to be different from the preset first rate, modifying the preset first rate to be the second rate so as to process the second broadcast messages in the agent broadcast message queue in sequence according to the second rate.
6. The method of claim 5, wherein the determining the second rate comprises:
determining the number of broadcast receivers used for receiving the first broadcast message in unit time within a preset time period;
determining the number of system frame loss in the preset time period;
determining the average time length required for starting the application in the preset time period;
and determining the second rate based on a preset algorithm according to the number of the broadcast receivers used for receiving the broadcast messages in the unit time, the number of the lost frames of the system and the average time length required for starting the application.
7. The method of claim 1 or 2, before determining that N applications of the at least one application for receiving the first broadcast message satisfy a preset condition, further comprising:
and determining that the rate of receiving the first broadcast message is greater than a preset third rate and the message type of the first broadcast message is within the range of a preset message type.
8. The method of claim 1 or 2, wherein said processing the second broadcast message such that the N applications can receive the first broadcast message comprises:
storing the first broadcast message in the second broadcast message in a broadcast message queue, storing the broadcast receiver in the second broadcast message in a broadcast receiver queue;
and acquiring the first broadcast message from the broadcast message queue, acquiring the broadcast receiver from the broadcast receiver pair queue, and sending the first broadcast message to an application to which the broadcast receiver belongs through the broadcast receiver.
9. An apparatus for processing broadcast messages, comprising:
the device comprises a judging module, a first sending module and a second sending module, wherein the judging module is used for determining that N applications in at least one application for receiving a first broadcast message meet a first preset condition, and N is a positive integer larger than zero;
a broadcast agent module, configured to generate a second broadcast message for each application of the N applications, and store the second broadcast message in an agent broadcast message queue, where the second broadcast message includes a correspondence between a broadcast receiver belonging to the application and the first broadcast message;
and the broadcast deputy module is used for sequentially processing the second broadcast messages in the proxy broadcast message queue according to a preset first rate so that the N applications can receive the first broadcast messages through broadcast receivers belonging to the applications, wherein the first rate is less than the rate at which the system sends the first broadcast messages to the applications currently.
10. The apparatus of claim 9, wherein the broadcast agent module, after the generating the second broadcast message, is further to:
determining that a broadcast message identical to the generated second broadcast message already exists in the proxy broadcast message queue, and deleting the existing broadcast message, wherein a broadcast receiver in the broadcast message identical to the generated second broadcast message is identical to a broadcast receiver in the generated second broadcast message, and a message type of a first broadcast message is identical to a message type of a first broadcast message in the generated second broadcast message.
11. The apparatus of claim 9 or 10, wherein the broadcast agent module is further configured to:
determining that a second broadcast message meeting a second preset condition exists in the proxy broadcast message queue, and processing the second broadcast message meeting the second preset condition in advance, so that an application corresponding to the second broadcast message meeting the preset condition can receive the first broadcast message in advance.
12. The apparatus of claim 9 or 10, wherein the broadcast agent module is further configured to:
and determining that the number of the second broadcast messages stored in the agent broadcast message queue is greater than a preset threshold value, and emptying the agent broadcast message queue.
13. The apparatus of claim 9 or 10, further comprising a configuration module;
the configuration module is configured to determine a second rate, where the second rate is a preferred rate for a system to currently process a second broadcast message; and when the second rate is determined to be different from the preset first rate, modifying the preset first rate to be the second rate so as to process the second broadcast messages in the agent broadcast message queue in sequence according to the second rate.
14. The apparatus of claim 13, wherein the configuration module determines a second rate, in particular for:
determining the number of broadcast receivers used for receiving the first broadcast message in unit time within a preset time period; determining the number of system frame loss in the preset time period; determining the average time length required for starting the application in the preset time period; and determining the second rate based on a preset algorithm according to the number of broadcast receivers used for receiving broadcast messages in unit time, the number of lost frames of the system and the average time length required for starting the application.
15. The apparatus of claim 9 or 10, wherein the determining module is further configured to:
before determining that N applications in at least one application for receiving the first broadcast message meet a preset condition, determining that the rate of receiving the first broadcast message is greater than a preset third rate and the message type of the first broadcast message is within a range of preset message types.
16. The apparatus of claim 9 or 10, wherein the broadcast deputy module processes the second broadcast message such that the N applications can receive the first broadcast message, in particular for:
storing the first broadcast message in the second broadcast message in a broadcast message queue, storing the broadcast receiver in the second broadcast message in a broadcast receiver queue;
and acquiring the first broadcast message from the broadcast message queue, acquiring the broadcast receiver from the broadcast receiver queue, and sending the first broadcast message to an application to which the broadcast receiver belongs through the broadcast receiver.
17. A terminal, characterized in that it comprises a processor and a memory, said memory being intended to store a software program, said processor being intended to read the software program stored in said memory and to implement the method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610964179.1A CN108011860B (en) | 2016-10-28 | 2016-10-28 | Method, device and terminal for processing broadcast message |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610964179.1A CN108011860B (en) | 2016-10-28 | 2016-10-28 | Method, device and terminal for processing broadcast message |
Publications (2)
Publication Number | Publication Date |
---|---|
CN108011860A CN108011860A (en) | 2018-05-08 |
CN108011860B true CN108011860B (en) | 2020-05-08 |
Family
ID=62048225
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610964179.1A Active CN108011860B (en) | 2016-10-28 | 2016-10-28 | Method, device and terminal for processing broadcast message |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108011860B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110971920B (en) * | 2018-09-30 | 2021-11-26 | 武汉斗鱼网络科技有限公司 | Message degradation method and related device |
CN112052101A (en) * | 2020-07-17 | 2020-12-08 | 苏宁智能终端有限公司 | Broadcast processing method and device and computer system |
CN116701008B (en) * | 2022-09-23 | 2024-08-13 | 荣耀终端有限公司 | Broadcasting method and apparatus |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104092815A (en) * | 2014-05-22 | 2014-10-08 | 中兴通讯股份有限公司 | Method and device for inter-application information interaction based on Android system |
WO2015070655A1 (en) * | 2013-11-15 | 2015-05-21 | 北京奇虎科技有限公司 | Broadcast interception method and apparatus of intelligent device |
CN104869569A (en) * | 2015-03-31 | 2015-08-26 | 小米科技有限责任公司 | Network permission control method and apparatus of application program |
CN104994481A (en) * | 2015-07-10 | 2015-10-21 | 上海斐讯数据通信技术有限公司 | Method and system for transceiving broadcast messages between application programs in Android system |
-
2016
- 2016-10-28 CN CN201610964179.1A patent/CN108011860B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2015070655A1 (en) * | 2013-11-15 | 2015-05-21 | 北京奇虎科技有限公司 | Broadcast interception method and apparatus of intelligent device |
CN104092815A (en) * | 2014-05-22 | 2014-10-08 | 中兴通讯股份有限公司 | Method and device for inter-application information interaction based on Android system |
CN104869569A (en) * | 2015-03-31 | 2015-08-26 | 小米科技有限责任公司 | Network permission control method and apparatus of application program |
CN104994481A (en) * | 2015-07-10 | 2015-10-21 | 上海斐讯数据通信技术有限公司 | Method and system for transceiving broadcast messages between application programs in Android system |
Also Published As
Publication number | Publication date |
---|---|
CN108011860A (en) | 2018-05-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108512695B (en) | Method and device for monitoring application blockage | |
US10635449B2 (en) | Method and apparatus for running game client | |
US10474507B2 (en) | Terminal application process management method and apparatus | |
CN106502703B (en) | Function calling method and device | |
CN106775828B (en) | Application program installation method and device and computer equipment | |
CN109976611B (en) | Terminal device control method and terminal device | |
CN106937258B (en) | A kind of control method of broadcast, device and mobile terminal | |
US9588757B2 (en) | Data update method, user terminal, and data update system | |
US20190213241A1 (en) | Web page display method and apparatus, mobile terminal, and storage medium | |
CN108334345B (en) | Application processing method and device, readable storage medium and mobile terminal | |
CN110597437A (en) | Screen capturing method and terminal equipment | |
CN108011860B (en) | Method, device and terminal for processing broadcast message | |
CN112749074B (en) | Test case recommending method and device | |
US11150913B2 (en) | Method, device, and terminal for accelerating startup of application | |
CN108021416B (en) | Media resource loading method and terminal | |
CN106302101B (en) | Message reminding method, terminal and server | |
CN107908527B (en) | Application icon display method and device | |
CN107404569B (en) | System control method, terminal and computer readable storage medium | |
CN107341094A (en) | The time-consuming measuring method of startup item and device | |
CN117407133A (en) | Task processing method and device and computer readable storage medium | |
CN106454953B (en) | Flow control method, device and terminal | |
CN115225966B (en) | Application starting method, device, terminal equipment and storage medium | |
CN107025118B (en) | Method and device for ending application program | |
CN105872041B (en) | The processing method and processing device of operation object | |
CN115118636A (en) | Method and device for determining network jitter state, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |