Process control method and device for application program
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for controlling a process of an application.
Background
With the continuous innovation of science and technology, the smart television not only works in one working mode to output, but also can simultaneously support the operation of other modes, and realize the switching of the smart television in different modes. For example, the smart Television supports both analog Television mode output and Digital Television Terrestrial broadcasting (DTMB) mode output.
However, when the smart television operates in the analog television mode, the signal source process in the analog television mode is in a running state; when the smart television works in the DTMB mode, the DTMB process corresponding to the DTMB is also in a running state. Generally, in an operating system of an Android system, after a user clicks a shortcut key such as a home key to quit an application, the application is not quit in a true sense, and a corresponding application process is not closed in the true sense, but the process corresponding to the application is put into a system background to continue running.
Therefore, when a user clicks a shortcut key to quit the signal source process and simultaneously starts the DTMB process, the signal source process and the DTMB process run in the system at the same time, only the signal source process runs in the system background, and the DTMB process runs in the system foreground, so that the signal source process and the DTMB process compete for the system resources of the smart television mutually. This undoubtedly reduces the stability of the smart tv system, affecting the system performance.
Disclosure of Invention
Aiming at the problems, the invention provides a process control method and a process control device for an application program, which are used for solving the problem of the prior art that the stability of an intelligent television system is reduced due to the fact that a signal source process and a DTMB process compete for system resources mutually. The technical scheme is as follows:
based on one aspect of the present invention, the present invention provides a process control method for an application program, which is applied to an intelligent television, and includes:
acquiring a control instruction for starting a digital television terrestrial broadcasting DTMB application input by a user;
detecting whether a signal source process in a running state exists in the smart television at present;
if yes, stopping the signal source process in the running state;
and starting the DTMB process corresponding to the DTMB application.
Preferably, the method further comprises the following steps:
and if the intelligent television does not have a signal source process in a running state currently, directly starting a DTMB process corresponding to the DTMB application.
Preferably, the detecting whether the signal source process in the running state currently exists in the smart television comprises:
sending a broadcast message; the broadcast message at least comprises a character string with a preset identifier; the character string with the preset identification is used for stopping the signal source process after the signal source process receives the character string;
receiving a feedback message; the feedback message is used for indicating whether the current intelligent television has a signal source process in a running state.
Preferably, the detecting whether the signal source process in the running state currently exists in the smart television comprises:
searching a process stack of the smart television in a running state at present; the process stack is at least used for storing a signal source process and/or a DTMB process in a running state;
and judging whether a signal source process exists in the process stack.
Preferably, the stopping the signal source process in the running state includes:
extracting the identity of the signal source process from the process stack;
and stopping the signal source process in the running state by processing the identity.
Preferably, the identity comprises a process control identifier PID.
Based on another aspect of the present invention, the present invention provides a process control device for an application program, which is applied to an intelligent television, and includes:
the acquisition module is used for acquiring a control instruction for starting the digital television terrestrial broadcasting DTMB application input by a user;
the detection module is used for detecting whether a signal source process in a running state exists in the intelligent television at present;
the stopping module is used for stopping the signal source process in the running state when the detection module detects that the signal source process in the running state currently exists in the intelligent television;
and the starting module is used for starting the DTMB process corresponding to the DTMB application.
Preferably, the detection module includes:
a broadcast message sending module for sending broadcast messages; the broadcast message at least comprises a character string with a preset identifier; the character string with the preset identification is used for stopping the signal source process after the signal source process receives the character string;
a message receiving module for receiving feedback messages; the feedback message is used for indicating whether the current intelligent television has a signal source process in a running state.
Preferably, the detection module includes:
the searching module is used for searching the process stack of the intelligent television in the running state; the process stack is at least used for storing a signal source process and/or a DTMB process in a running state;
and the judging module is used for judging whether a signal source process exists in the process stack.
Preferably, the stopping module includes:
the identity extraction module is used for extracting the identity of the signal source process from the process stack;
and the stopping submodule is used for stopping the signal source process in the running state through processing the identity.
By applying the technical scheme, after the control instruction for starting the DTMB application, which is input by a user, is obtained, whether the signal source process in the running state exists in the intelligent television or not is detected at first. When the signal source process in the running state of the intelligent television is detected to exist currently, after the signal source process in the running state is stopped, the DTMB process corresponding to the DTMB application is started. Therefore, when the DTMB process is started, the signal source process is closed, and the signal source process and the DTMB process are prevented from running in the system at the same time, so that the problem that the signal source process and the DTMB process mutually compete for the resources of the intelligent television system is avoided, and the stability of the intelligent television system is ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a process control method for an application according to the present invention;
FIG. 2 is another flowchart of a method for controlling a process of an application according to the present invention;
FIG. 3 is a flowchart illustrating a method for controlling a process of an application according to another embodiment of the present invention;
FIG. 4 is a flowchart of a method for stopping a signal source process according to the present invention;
FIG. 5 is a schematic structural diagram of a process control apparatus for an application according to the present invention;
FIG. 6 is a schematic diagram of a detection module in the process control apparatus for an application according to the present invention;
FIG. 7 is a schematic diagram illustrating another structure of a detection module in the process control apparatus for an application according to the present invention;
fig. 8 is a schematic structural diagram of a stop module in the process control device of an application according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the prior art, due to different requirements of a user, the user can switch the working mode of the smart television and start different processes of the smart television in different working modes. If the intelligent television firstly works in the analog television mode, the signal source process is in a running state. At some point, the user wants to start a DTMB process in DTMB mode. At this time, the user may click a shortcut key such as a home key to quit the signal source application, that is, quit the signal source process corresponding to the signal source application, and then start the DTMB process. However, the Android system of the existing smart television designs the application, when the user clicks the shortcut key of the home key to exit, the application is not the exit of the application program in the real sense, but the system is put into the system background to continue running. At this time, for the smart television system, after the user starts the DTMB process again, the signal source process and the DTMB process in the smart television are in a running state at the same time. Therefore, the signal source process and the DTMB process compete for the resources of the smart television system, which undoubtedly reduces the stability of the smart television system and affects the system performance. The invention provides a process control method and a process control device of an application program aiming at the defects in the prior art, so as to solve the problem that a signal source process and a DTMB process mutually compete for resources of a smart television system in the prior art. Resulting in the problem of reduced stability of the smart television system.
It should be noted that, when the smart television operates in the analog television mode, starting the application program in the analog television correspondingly starts the signal source process. When the intelligent television is in the DTMB mode, starting the DTMB application program, namely correspondingly starting the DTMB process.
Example one
Referring to fig. 1, a flowchart of a method for controlling a process of an application according to the present invention is shown, including:
step 101, acquiring a control instruction for starting the DTMB application, which is input by a user.
In this embodiment, when the user clicks and starts the application program of the DTMB, the control instruction for starting the DTMB application, which is input by the user, is obtained.
In practical application, the smart television includes a plurality of application modules, such as a video module, a chat module, an audio module, and a web module. Different application modules belong to different application programs. When a user selects a certain application to start, the process corresponding to the application is correspondingly started.
Step 102, detecting whether a signal source process in a running state exists in the smart television currently. If so, step 103 is performed, and if not, step 105 is performed.
In this embodiment, when a user triggers to start a DTMB application, it is first detected whether a signal source process in a running state currently exists in the smart television.
In the prior art, after a user clicks a shortcut key such as a home key to quit a signal source process, the signal source process is not directly stopped but put into a system background to continue running based on the design concept of an Android system for application. In the invention, in order to avoid that the signal source process and the DTMB process are simultaneously in the running state, when a control instruction for starting the DTMB application input by a user is obtained, whether the signal source process in the running state exists in the smart television or not is detected, and if the signal source process in the running state exists, the step 103 is executed to stop the signal source process in the running state.
And step 103, stopping the signal source process in the running state.
And step 104, starting the DTMB process corresponding to the DTMB application.
In this embodiment, after detecting that there is a signal source process in a running state and stopping the signal source process in the running state, the DTMB process corresponding to the DTMB application is started.
And 105, directly starting the DTMB process corresponding to the DTMB application.
In this embodiment, when it is detected that the smart television does not currently have a signal source process in a running state, a DTMB process corresponding to the DTMB application is directly started.
By applying the technical scheme of the invention, after the control instruction for starting the DTMB application, which is input by a user, is obtained, whether the smart television currently has a signal source process in a running state is detected. When the signal source process in the running state of the intelligent television is detected to exist currently, after the signal source process in the running state is stopped, the DTMB process corresponding to the DTMB application is started. Therefore, when the DTMB process is started, the signal source process is closed, and the signal source process and the DTMB process are prevented from running in the system at the same time, so that the problem that the signal source process and the DTMB process mutually compete for the resources of the intelligent television system is avoided, and the stability of the intelligent television system is ensured.
Example two
On the basis of the foregoing embodiment, please refer to fig. 2, which shows another flowchart of a process control method for an application program according to the present invention, including:
step 201, obtaining a control instruction for starting the DTMB application, which is input by a user.
Step 202, a broadcast message is sent. The broadcast message at least comprises a character string with a preset identifier; and the character string with the preset identification is used for stopping the signal source process after the signal source process receives the character string.
In this embodiment, after the system obtains a control instruction for starting the DTMB application, which is input by the user, the system automatically sends a broadcast message to the application layer of the smart television. The broadcast message at least comprises a character string with a preset identification. If the current smart television has the signal source process in the running state, the signal source process in the running state receives the broadcast message and reads the character string in the broadcast message. Preferably, the signal source process receives the broadcast message through the broadcast receiver.
After reading the character string with the preset identification, the signal source process stops the operation of the process according to the indication of the character string, so as to achieve the purpose of stopping the signal source process.
If the current intelligent television does not have a signal source process in a running state, the broadcast message is only broadcast as a common message in an application layer.
Step 203, receiving a feedback message. The feedback message is used for indicating whether the current intelligent television has a signal source process in a running state. If so, step 204 is performed, and if not, step 206 is performed.
In this embodiment, if the current smart television has a signal source process in a running state, the signal source process also feeds back a feedback message to the DTMB process while receiving the broadcast message to stop its own process. The feedback message at least comprises the information content of the signal source process currently existing in the running state. At this time, the DTMB process receives the feedback message, reads the information content in the feedback message, and learns that the current smart television has the signal source process in the running state. Preferably, the feedback message may further include information related to the signal source process, so as to facilitate the DTMB process to understand the depth of the signal source process.
And step 204, stopping the signal source process in the running state.
In this embodiment, when the DTMB process receives the feedback message sent by the signal source process, and learns that the current smart tv has the signal source process in the running state, the signal source process has also read the character string with the preset identifier included in the broadcast message sent by the system, and stops the signal source process in the running state according to the character string with the preset identifier.
Step 205, starting a DTMB process corresponding to the DTMB application.
And step 206, directly starting the DTMB process corresponding to the DTMB application.
In this embodiment, in order to ensure that the signal source process in the running state is stopped when the DTMB process corresponding to the DTMB application is started, the present invention may set a preset time after receiving the feedback information sent by the signal source process, and control to start the DTMB process corresponding to the DTMB application; and after the signal source process stops running, the system can also send a confirmation stop message to the DTMB process, and the DTMB process starts the DTMB process corresponding to the DTMB application after acquiring the confirmation stop message.
EXAMPLE III
On the basis of the foregoing embodiment, please refer to fig. 3, which shows another flowchart of a process control method for an application program according to the present invention, including:
step 301, acquiring a control instruction for starting the DTMB application, which is input by a user.
Step 302, searching a process stack currently in a running state of the smart television. The process stack is at least used for storing the signal source process and/or the DTMB process in a running state.
In the invention, the intelligent television system comprises at least one process stack, and the process stack is at least used for storing a signal source process and/or a DTMB process in a running state. And when the DTMB process is started, the DTMB process is put into the process stack. In addition, when other applications in the system are started, the system can also put processes corresponding to the other applications into the process stack.
Of course, according to different types of applications, a plurality of process stacks may be further provided, and the process stacks are respectively used for storing processes corresponding to different applications. When one or more processes are placed in a process stack, the process stack is in a running state.
In this embodiment, after obtaining a control instruction for starting the DTMB application, which is input by a user, the system first searches for a process stack in a running state.
Step 303, determine whether there is a signal source process in the process stack. If so, step 304 is performed, and if not, step 306 is performed.
In this embodiment, after the system finds all process stacks in the running state, it is respectively determined whether a signal source process exists in each process stack. And if at least one process stack has the signal source process, indicating that the current intelligent television has the signal source process in the running state. And if the signal source processes do not exist in all the process stacks in the running state, indicating that the signal source processes in the running state do not exist in the current intelligent television.
Step 304, stopping the signal source process in the running state.
In this embodiment, when it is detected that a signal source process exists in the process stack, the signal source process is stopped.
Specifically, referring to fig. 4, it shows a flowchart of a method for stopping a signal source process according to the present invention, including:
step 401, extracting the identity of the signal source process from the process stack.
The identity may be a PID (Process Identifier). In the actual application process, after the application program is started, the system automatically allocates a unique PID to the process corresponding to the application program, and the PID is used for distinguishing different processes. When the process finishes stopping, the system will reclaim the PID of the process. After other processes are started, the system allocates the PID to the process corresponding to other programs in the running state. Therefore, the invention can find the signal source process in the running state only by extracting the identification PID of the signal source process. And the control of the signal source process is realized by processing the identification PID of the signal source process.
And step 402, stopping the signal source process in the running state through the processing of the identity.
In this embodiment, after extracting the identification PID of the signal source process, the system executes an operation such as kill-PID, reclaims the PID of the signal source process, and stops the signal source process in the running state.
Step 305, starting the DTMB process corresponding to the DTMB application.
And step 306, directly starting the DTMB process corresponding to the DTMB application.
Example four
Based on the description of the process control method for the application program provided by the present invention, the present invention further provides a process control device for an application program, which is applied to a smart tv, please refer to fig. 5, which shows a schematic structural diagram of the process control device for an application program provided by the present invention, and the schematic structural diagram includes: an acquisition module 100, a detection module 200, a stop module 300, and a start module 400. Wherein,
the obtaining module 100 is configured to obtain a control instruction for starting the DTMB application, which is input by a user.
The detecting module 200 is configured to detect whether a signal source process in a running state exists in the smart television currently.
The stopping module 300 is configured to stop the signal source process in the running state when the detecting module 200 detects that the signal source process in the running state currently exists in the smart television.
The starting module 400 is configured to start a DTMB process corresponding to the DTMB application.
By applying the technical scheme of the invention, after the acquisition module 100 acquires the control instruction for starting the DTMB application, which is input by a user, the detection module 200 firstly detects whether the smart television currently has a signal source process in a running state. When the detection module 200 detects that the signal source process in the running state currently exists in the smart television, after the stop module 300 stops the signal source process in the running state, the start module 400 starts the DTMB process corresponding to the DTMB application. Therefore, when the DTMB process is started, the signal source process is closed, and the signal source process and the DTMB process are prevented from running in the system at the same time, so that the problem that the signal source process and the DTMB process mutually compete for the resources of the intelligent television system is avoided, and the stability of the intelligent television system is ensured.
EXAMPLE five
On the basis of the above embodiments, the present invention further provides a schematic structural diagram of a detection module in a process control device of an application program, please refer to fig. 6, which includes: a transmit broadcast message module 210 and a receive message module 220. Wherein,
a send broadcast message module 210 for sending broadcast messages. The broadcast message at least comprises a character string with a preset identifier; the character string with the preset identification is used for stopping the signal source process after the signal source process receives the character string.
A receive message module 220, configured to receive the feedback message. The feedback message is used for indicating whether the current intelligent television has a signal source process in a running state.
EXAMPLE six
On the basis of the above embodiment, the present invention further provides another structural schematic diagram of a detection module in a process control device of an application program, please refer to fig. 7, which includes: a lookup module 230 and a decision module 240.
And the searching module 230 is used for searching the process stack currently in the running state of the smart television. The process stack is at least used for storing the signal source process and/or the DTMB process in a running state.
And the judging module 240 is configured to judge whether a signal source process exists in the process stack.
EXAMPLE seven
On the basis of the above embodiment, the present invention further provides a schematic structural diagram of a stop module in a process control device of an application program, please refer to fig. 8, which includes: an identity extraction module 310 and a stop sub-module 320. Wherein,
and an identity extraction module 310, configured to extract an identity of the signal source process from the process stack.
Preferably, the identity may be a PID (Process Identifier).
And a stop submodule 320, configured to stop the signal source process in the running state through processing the identity.
It should be noted that, in the present specification, the embodiments are all described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other. For the device-like embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above detailed description is provided for the process control method and apparatus of an application program, and the specific examples are applied herein to illustrate the principle and implementation of the present invention, and the above descriptions of the embodiments are only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.