Invention content
In view of the above problems, it is proposed that the present invention overcoming the above problem in order to provide one kind or solves at least partly
That states problem carries out the method for process recovery processing and corresponding device in the application.
One side according to the present invention provides a kind of method carrying out process recovery processing in the application, including:
The process of preset monitored recycles event;
When listening to the preset process recycling event, the attribute letter of each component run in current process is obtained
Breath;
By the attribute of the attribute information of each component run in the current process component corresponding with process recycling rule
Information is compared, it is determined whether is recycled to the current process.
Optionally, the method further includes:The component that cannot be recovered is registered in specified class;
By the attribute of the attribute information of each component run in the current process component corresponding with process recycling rule
Information is compared, it is determined whether the current process is recycled, including:
Judge whether each component run in the current process is registered in the specified class;
If there are at least one component register to the specified class in each component run in the current process, really
Determine to the current process without recovery processing.
Optionally, the method further includes:
If there is no in component register to the specified class in each component run in the current process, it is determined that institute
Current process is stated to be recycled.
Optionally, judge whether each component run in the current process is registered in the specified class, including:
The judgment method for calling the specified class searches each component run in the current process by the judgment method
Whether it is registered in the specified class;
Receive the lookup result that the judgment method returns;
Determined whether to recycle the current process according to the lookup result.
Optionally, the preset process recycling event includes at least one following:
Component stopping event;
Component destruction event;
It is reached by the timing duration that timer is set and specifies duration event.
Optionally, if the preset process recycling event includes component stopping event and/or component destruction event, institute
Before the process recycling event for stating preset monitored, the method further includes:
The life cycle callback method of component registration, with the life cycle events of the receiving unit in readjustment.
Optionally, the life cycle events of the component include at least one following:
Component creates event, component starts event, component recovery event, component suspending event, component stopping event, component
Destruction event.
Optionally, by the attribute information of each component run in the current process component corresponding with process recycling rule
Attribute information be compared, it is determined whether the current process is recycled, including:
Judge in each component run in the current process with the presence or absence of the component being resumed;
If so, determining to the current process without recovery processing;
If not, it is determined that the current process is recycled.
Optionally, the method further includes:
Count area is arranged to each process in application program, for the group to being resumed and/or being suspended in the process
Part is counted;
When receiving component recovery event, count value is increased to the count area for the component place process being resumed;
When receiving component suspending event, count value is reduced to the count area for the component place process being suspended.
Optionally, judge with the presence or absence of the component being resumed in each component run in the current process, including:
Read the count area of the current process;
Judge whether the count value of the count area is more than specified threshold;
If so, determining the component for existing in each component run in the current process and being resumed;
If not, it is determined that there is no the components being resumed in each component run in the current process.
Optionally, by the attribute information of each component run in the current process component corresponding with process recycling rule
Attribute information be compared, it is determined whether the current process is recycled, including:
Judge whether the current process is null process or background process;
If so, determination is recycled the current process.
Another aspect according to the present invention additionally provides a kind of device carrying out process recovery processing in the application,
Including:
Module is monitored, preset process recycling event is adapted for listening for;
Acquisition module, suitable for when listening to the preset process recycling event, obtaining each of the interior operation of current process
The attribute information of component;
The attribute information of determining module, each component suitable for will be run in the current process is corresponding with process recycling rule
The attribute information of component be compared, it is determined whether the current process is recycled.
Optionally, described device further includes:
First registration module, suitable for registering the component that cannot be recovered in specified class;
The determining module is further adapted for:Judge whether each component run in the current process is registered to the specified class
In;If in each component run in the current process, there are at least one component register to the specified class, it is determined that right
The current process is without recovery processing.
Optionally, the determining module is further adapted for:
If there is no in component register to the specified class in each component run in the current process, it is determined that institute
Current process is stated to be recycled.
Optionally, the determining module is further adapted for:
The judgment method for calling the specified class searches each component run in the current process by the judgment method
Whether it is registered in the specified class;
Receive the lookup result that the judgment method returns;
Determined whether to recycle the current process according to the lookup result.
Optionally, the preset process recycling event includes at least one following:
Component stopping event;
Component destruction event;
It is reached by the timing duration that timer is set and specifies duration event.
Optionally, described device further includes:
Second registration module, if including component stopping event and/or component pin suitable for the preset process recycling event
Event is ruined, before the process recycling event for monitoring module preset monitored, the life cycle callback method of component registration, to return
The life cycle events of timing receiving unit.
Optionally, the life cycle events of the component include at least one following:
Component creates event, component starts event, component recovery event, component suspending event, component stopping event, component
Destruction event.
Optionally, the determining module is further adapted for:
Judge in each component run in the current process with the presence or absence of the component being resumed;
If so, determining to the current process without recovery processing;
If not, it is determined that the current process is recycled.
Optionally, described device further includes:
Count area processing module is suitable for that count area is arranged to each process in application program, for in the process
The component for being resumed and/or being suspended is counted;When receiving component recovery event, to the component place process being resumed
Count area increase count value;When receiving component suspending event, to the count area for the component place process being suspended
Reduce count value.
Optionally, the determining module is further adapted for:
Read the count area of the current process;
Judge whether the count value of the count area is more than specified threshold;
If so, determining the component for existing in each component run in the current process and being resumed;
If not, it is determined that there is no the components being resumed in each component run in the current process.
Optionally, the determining module is further adapted for:
Judge whether the current process is null process or background process;
If so, determination is recycled the current process.
The embodiment of the present invention realizes the scheme being recycled to the process of application program, is provided with first preset
Process recycles event, and carries out active sniffing to preset process recycling event, when listening to preset process recycling event,
Obtain current process in run each component attribute information, and then by the attribute information of each component run in current process with
The attribute information of the corresponding component of process recycling rule is compared, it is determined whether is recycled to current process.As a result,
The embodiment of the present invention can realize that the purpose being recycled in time to process, solution can not achieve process in the prior art
Recycling in time, cause before recycling process still can long-term committed memory resource the problem of.Also, the embodiment of the present invention be by
The attribute information of the attribute information of each component run in current process component corresponding with process recycling rule is compared, really
It is fixed whether current process to be recycled, rather than only according to the liveness collection process of process, so that operation
The process of system application will not be recovered, and can ensure the normal operation of terminal device.
Above description is only the general introduction of technical solution of the present invention, in order to better understand the technical means of the present invention,
And can be implemented in accordance with the contents of the specification, and in order to allow above and other objects of the present invention, feature and advantage can
It is clearer and more comprehensible, below the special specific implementation mode for lifting the present invention.
According to the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will be brighter
The above and other objects, advantages and features of the present invention.
Specific implementation mode
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in attached drawing
Exemplary embodiment, it being understood, however, that may be realized in various forms the disclosure without should be by embodiments set forth here
It is limited.On the contrary, these embodiments are provided to facilitate a more thoroughly understanding of the present invention, and can be by the scope of the present disclosure
Completely it is communicated to those skilled in the art.
In order to solve the above technical problems, carrying out process recovery processing in the application an embodiment of the present invention provides a kind of
Method.Fig. 1 shows the stream of the method according to an embodiment of the invention for carrying out process recovery processing in the application
Cheng Tu.As shown in Figure 1, this method at least includes the following steps S102 to step S106:
The process of step S102, preset monitored recycle event;
Step S104 obtains the category of each component run in current process when listening to preset process recycling event
Property information;
Step S106, by the attribute information of each component run in current process component corresponding with process recycling rule
Attribute information is compared, it is determined whether is recycled to current process.
The embodiment of the present invention realizes the scheme being recycled to the process of application program, is provided with first preset
Process recycles event, and carries out active sniffing to preset process recycling event, when listening to preset process recycling event,
Obtain current process in run each component attribute information, and then by the attribute information of each component run in current process with
The attribute information of the corresponding component of process recycling rule is compared, it is determined whether is recycled to current process.As a result,
The embodiment of the present invention can realize that the purpose being recycled in time to process, solution can not achieve process in the prior art
Recycling in time, cause before recycling process still can long-term committed memory resource the problem of.Also, the embodiment of the present invention be by
The attribute information of the attribute information of each component run in current process component corresponding with process recycling rule is compared, really
It is fixed whether current process to be recycled, rather than only according to the liveness collection process of process, so that operation
The process of system application will not be recovered, and can ensure the normal operation of terminal device.
In above step S102, preset process recycling event can be reached by the timing duration that timer is set
Specified duration event, specified duration here can be configured according to actual demand, such as 10 seconds, 1 grade, the present invention to this not
It is limited.
It in an embodiment of the present invention, can be with component registration before the process recycling event of step S102 preset monitoreds
Life cycle callback method, with readjustment when receiving unit life cycle events.Here, the life cycle events of component can
To be that component creates event, component starts event, component recovery event, component suspending event, component stopping event, component are destroyed
Event etc..
Before introducing the life cycle callback method of component registration, introduce Android (Android) first four are big basic
Component, be respectively Activity (activity), Service (service), ContentProvider (content provider),
BroadcastReceiver (radio receiver) is separately below introduced this four components.
First, Activity is the concept of a user interface, and Activity usually indicates a screen in application program
Curtain.It generally comprise one or more View (View is user interface element, be constitute user interface basic building block,
View can be a button, label, the text field or various other user interface elements), but can not also include View.
The meaning of this word of Activity and it itself is much like:User is helped to complete a certain operation, this operation may be to look at number
According to, create data or editor data.It is owned by multiple Activity in most of Android application programs.
Service in Android is similar to the service in Windows (window) or other platforms, they are all possible
The background process of long-play.Android defines two kinds of Service:Local Service and long-range Service.
Local Service is the component that can only be accessed by the application program for carrying the Service.And long-range Service is in equipment
The Service of the other applications remote access of upper operation.Email application is used for the component of poll new mail, just
It is a Service example.If the other applications that this Service cannot be run in equipment use, it
It is exactly local Service.If there is multiple application programs use the Service, then it is exactly long-range Service.
Android defines a kind of standard mechanism for application program and carrys out shared data (such as contacts list), without public affairs
Open bottom storage, structure and realization.Application program can be allowed to use and come from it with public data by ContentProvider
The data of his application program.
Android application programs can be filtered external event using BroadcastReceiver, only to interested
External event received and responded (e.g., when phone incoming call or when data network is available).
BroadcastReceiver does not have user interface, however, they can start an Activity or Serice to respond them
The information received, or notify user with NotificationManager (notice management class).Notice can use many kinds side
Formula attracts the attention of user, such as flashes back light, vibrations, plays sound, in general can put one on status bar
Lasting icon, user can open it and obtain message.
Four big basic modules are required for registration that could use, each Activity, Service, ContentProvider
It needs to be configured in AndroidManifest files.It is not stated in AndroidManifest files
Activity, Service and ContentProvider will not be system finding, to also just unavailable, and
The registration point static registration (being configured in AndroidManifest files) of BroadcastReceiver and pass through code
Dynamic creation is simultaneously registered to system in a manner of calling Context.registerReceiver ().It should be noted that
The BroadcastReceiver configured in AndroidManifest files can be constantly in active with the startup of system
State, even if program not running, as long as receiving interested broadcast will trigger.
Operation Android application programs and its process of component can undergo various life cycle events (Android application journeys
The life cycle of sequence is to be managed by Android frames, rather than directly controlled by application program), Android is provided back
It adjusts, by realizing that they can handle state change.
By taking the various life cycle callbacks of an Activity as an example, the life cycle callback method of Activity is as follows:
onCreate()、onStart()、onRestart()、onResume()、onPause()、onStop()、onDestroy
().It is illustrated in figure 2 the state transition diagram of Activity.
System can start and stop Activity according to other events of generation.When just having created Activity,
Android calls onCreate () method, then can always call onStart (), but calls not total before onStart ()
It is to call onCreate (), because can stop in application program and (call calling onStart () after onStop ()).Work as tune
When with onStart (), Activity is invisible to user, but later will be visible.After calling onStart (),
OnResume () is called when Activity is in foreground and can be accessed for user, at this moment, user will interact with Activity.
When user determines to go to another Activity, system will call onPause () method of current Activity,
Then onResume () or onStop () may be called.For example, if current Activity is recalled to foreground by user, will call
onResume().If Activity becomes invisible to user, onStop () will be called.Before if Activity has been recalled to
Platform will call onRestart () then after calling onStop ().If Activity is located in Activity stacks, but
It is invisible to user, and system decision terminates the Activity, then onDestroy () will be called.
In practical applications, that most often call is onCreate (), onResume () and onPause ().When having registered
The life cycle callback method of Activity components is registered ActivityLifecycleCallbacks interfaces, is then being adjusted back
When can receive the life cycle events of Activity, to obtain Activity current state (as created, starting, restore,
The states such as pause, stopping).Similarly, for Service, ContentProvider, BroadcastReceiver, work as registration
Their life cycle callback method then can receive respective life cycle events in readjustment, respective to obtain
Current state (such as creates, starts, restoring, pause, stopping state).
In an embodiment of the present invention, it based on the life cycle callback method for having registered each component, is referred in step S102
Preset process recycle event, can also be component stopping event or component destruction event etc..By taking Activity components as an example,
When Activity is by whole coverings (e.g., user is by Home key etc.), execution onStop () callback method then receives
Activity component stopping events.When Activity i.e. will be destroyed, onDestroy () method is executed, then is received
Activity component destruction events.
The attribute information for each component that above step S104 is referred to can be the current state information of each component.The present invention
Embodiment has registered the life cycle callback method of each component, and the life cycle events of receiving unit are capable of in readjustment, can
The current state for obtaining component in real time, to, when listening to preset process recycling event, be obtained in step S104
The current state information of each component run in current process.
An embodiment of the present invention provides a kind of scheme of optionally implementation steps S106, Fig. 3 is shown according to the present invention one
The flow chart of the method for determining whether to be recycled current process of a embodiment.As shown in figure 3, this method is at least wrapped
Following steps S302 is included to step S306.
Step S302 judges with the presence or absence of the component being resumed in each component run in current process, if so, continuing
Execute step S304;Otherwise, step S306 is continued to execute.
In this step, the component being resumed is the component for being in front stage operation, can also judge current process indirectly
With the presence or absence of the component for being in front stage operation in each component of interior operation.
Step S304 is determined to current process without recovery processing.
In this step, the component being resumed is in the state of front stage operation, then not to the process where the component into
Row recycling.
Step S306, determination are recycled current process.
It in this step, can be to when advance if there is no the components being resumed in each component run in current process
Cheng Jinhang is recycled, and the method subsequently referred to can also be used further to judge.
In an embodiment of the present invention, count area each process in application program can be arranged (as worked as application program
In process initiation when, the count area of the process is set), for the group to being resumed component in the process and/or being suspended
Part is counted.For example, when receiving component recovery event (calling onResume () callback method), to what is be resumed
The count area of process increases count value where component;(onPause () readjustment side is called when receiving component suspending event
Method) when, count value is reduced to the count area for the component place process being suspended.
By taking Activity components as an example, when receiving Activity component recovery events, the counting to process where it
Field mResumedActivityCount increases count value, such as 1 or 2;When receiving Activity component suspending events,
Count value, such as 1 or 2 are reduced to the count area mResumedActivityCount of process where it, the present invention does not do this
Limitation.
Based on to the count area of each process setting in application program, an embodiment of the present invention provides a kind of implementations above
The alternative of above step S302 can read the count area of current process in this scenario, and then judge count area
Count value whether be more than specified threshold, there is the component that is resumed in each component run in current process if so, determining;
If not, it is determined that there is no the components being resumed in each component run in current process.
The embodiment of the present invention additionally provides the scheme of another optionally implementation steps S106, and Fig. 4 is shown according to this hair
The flow chart of the method for determining whether to be recycled current process of another bright embodiment.As shown in figure 4, this method
S402 is at least included the following steps to step S406.
Step S402 judges whether current process is null process or background process, if so, continuing to execute step S404;
Otherwise, step S406 is continued to execute.
In this step, the identifier of current process can be first obtained, searches the identifier of current process in systems
RunningAppProcessInfo (information for the process that the interface encapsulation is currently running), calls its importance field.
If the field value is IMPORTANCE_EMPTY, then it represents that current process is null process;If the field value is
IMPORTANCE_BACKGROUND, then it represents that current process is background process.
Step S404, determination are recycled current process.
Step S406 is determined to current process without recovery processing.
In this step, if current process be null process or background process, can to current process without recycling at
Reason, can also be using method shown in Fig. 3 or the method subsequently referred to further judge above.
In an embodiment of the present invention, the component that cannot be recovered can be registered in specified class.In an application program
It is interior, usually possess one or more Activity, Service, ContentProvider, BroadcastReceiver, is answering
During being run with program, for the component that cannot be recovered, it can be registered in specified class.For example, self defined class
IKillable, it is impossible to which in the component register being recovered to the self defined class, there are one method isKillable () for it, are sentencing
When whether disconnected component needs to be recovered, this method isKillable () can be called, by this method isKillable () lookup group
Whether part is registered in the self defined class, if this method returns to false, then it represents that in component register to the self defined class, the group
Part cannot be recovered.If this method return true, then it represents that component is not registered in the self defined class, can recycle the component or
Person continues through other methods and judges whether to recycle the component.
Based on specified class above, the embodiment of the present invention additionally provides the scheme of another optionally implementation steps S106,
Fig. 5 shows the flow of the method for determining whether to be recycled current process according to another embodiment of the invention
Figure.As shown in figure 5, this method at least includes the following steps S502 to step S506.
Step S502, judges whether each component run in current process is registered in specified class, if fortune in current process
There are at least one component register to specified class in capable each component, then step S504 is continued to execute;If fortune in current process
There is no in component register to specified class in capable each component, then step S506 is continued to execute.
In this step, the judgment method that specified class can be called, it is each by being run in judgment method lookup current process
Whether component is registered in specified class, and then receives the lookup result that judgment method returns, and is determined whether back according to lookup result
Receive current process.
Step S504 is determined to current process without recovery processing.
Step S506, determination are recycled current process.
It in this step, can be right if being not present in component register to specified class in each component run in current process
Current process process is recycled, and can also be used conservative scheme, i.e., is not recycled, may be used Fig. 3's above or Fig. 4
Method further judges.
In practical applications, may be used Fig. 3, Fig. 4 or Fig. 5 method shown in any one determine whether to current process into
Row recovery processing can also determine whether to be recycled current process, example in conjunction with Fig. 3, Fig. 4 and method shown in fig. 5
Such as, there is no the components being resumed in each component run in current process, and in each component run in current process not
When there are in component register to specified class, determination is recycled current process.
Current process be multiple processes when, can respectively be judged for each process, with determine whether to its into
Row recovery processing, details are not described herein again.
The method for carrying out process recovery processing in the application of the present invention is discussed in detail with a specific embodiment below
Realization process.
In this embodiment, the customized class being related to is as follows:
1)IKillable
One interface.There are one method, isKillable () for it
isKillable
Search whether the components such as Activity or Service are registered in IKillable, if this method returns to false,
It indicates in component register to IKillable, which cannot be recovered.If this method returns to true, then it represents that component is unregistered
Into IKillable, the component can be recycled or continue through other methods judge whether to recycle the component.
2)KillableMonitor
For managing the class of all IKillable interfaces, including typical List<IKillable>.
registerKillable(IKillable)
It is added in IKillable interface objects to List (mKillableSet).
unregisterKillable(IKillable)
It deletes in IKillable interface objects to List (mKillableSet).
isAllKillable()
It judges whether there is IKillable.isKillable and returns to false.As long as there is any one, this cannot be recycled by meaning that
Process.
3)KillerHandler
It is inherited from Handler, for handling event:MESSAGE_TRY_KILL_PROCESS
MESSAGE_TRY_KILL_PROCESS
This method is used for calling tryKillProcess.It, can be with setting time interval since Handler can accomplish poll
(such as 1 minute) is walked once, until the event is terminated.
4)ProcessKiller
Core classes, for dispatching the life and death of entire process.Including method:
init()
Register life cycle callback methods of components such as Activity or Service etc..
addKillableService(ComponentName)
The Service classes of IKillable interfaces are had been realized in addition current application to mKillableService (oneself
Definition) list.If provided with all Service for being not carried out IKillable interfaces are preserved, as long as being sent out when exiting
The Service of the existing IKillable being not carried out is run in current process, then current process would not be exited.
For the Service classes for having been realized in IKillable interfaces added here, it can be found in current process
Also at runtime, it can judge whether it can exit by force by isKillable ().It, should when it returns to true
Service will not prevent exiting for process again being run in current process.
tryKillProcess
Core methed is called in KillerHandler, called primary according to setting time interval, this method
Judge that flow sees above Fig. 3, Fig. 4 and Fig. 5, details are not described herein again.
Fig. 6 shows the method in accordance with another embodiment of the present invention for carrying out process recovery processing in the application
Flow chart.As shown in fig. 6, this method at least includes the following steps S602 to step S614.
The process of step S602, preset monitored recycle event.
In this step, preset process recycling event can be by timer (by KillerHandler come real
Now) the timing duration of setting, which reaches, specifies duration event, can also be component stopping event or component destruction event etc..
In the present embodiment, to each process setting count area in application program (as when the process initiation in application program
When, the count area of the process is set), for being counted to the component for being resumed component in the process and/or being suspended.Example
Such as, when receiving component recovery event (call onResume () callback method), to process where the component that is resumed
Count area increases count value;When receiving component suspending event (calling onPause () callback method), to being suspended
Component where process count area reduce count value.
Step S604 obtains the category of each component run in current process when listening to preset process recycling event
Property information.
Step S606 judges with the presence or absence of the component being resumed in each component run in current process, if so, continuing
Execute step S608;Otherwise, step S610 is continued to execute.
Step S608 is determined to current process without recovery processing.
In this step, the component being resumed is in the state of front stage operation, then not to the process where the component into
Row recycling.
Step S610, judges whether each component run in current process is registered in specified class, if fortune in current process
There are at least one component register to specified class in capable each component, then step S608 is continued to execute;If fortune in current process
There is no in component register to specified class in capable each component, then step S612 is continued to execute.
Step S612 judges whether current process is null process or background process, if so, continuing to execute step S614;
Otherwise, step S608 is continued to execute.
Step S614, determination are recycled current process.
The embodiment of the present invention is that the attribute information for each component that will be run in current process is corresponding with process recycling rule
The attribute information of component is compared, it is determined whether current process is recycled, rather than only according to the work of process
Jerk collection process can ensure the normal fortune of terminal device so that the process of operating system application will not be recovered
Row.
Based on the method for carrying out process recovery processing in the application that each embodiment above provides, it is based on same hair
Bright design, the embodiment of the present invention additionally provide a kind of device carrying out process recovery processing in the application.
Fig. 7 shows the knot of the device according to an embodiment of the invention for carrying out process recovery processing in the application
Structure schematic diagram.As shown in fig. 7, the device 700 at least may include monitoring module 710, acquisition module 720 and determining module
730。
Now introduce each composition or device of the device 700 for carrying out process recovery processing in the application of the embodiment of the present invention
Connection relation between the function and each section of part:
Module 710 is monitored, preset process recycling event is adapted for listening for;
Acquisition module 720 is coupled with module 710 is monitored, suitable for when listening to preset process recycling event, obtaining
The attribute information of each component run in current process;
Determining module 730 is coupled with acquisition module 720, suitable for believing the attribute of each component run in current process
The attribute information for ceasing component corresponding with process recycling rule is compared, it is determined whether is recycled to current process.
In an embodiment of the present invention, as shown in figure 8, the device of Fig. 7 displayings can also include:
First registration module 740, is coupled with determining module 730, suitable for registering the group that cannot be recovered in specified class
Part;
Determining module 730 is further adapted for:Judge whether each component run in current process is registered in specified class;If current
There are at least one component register to specified class in each component run in process, it is determined that current process without recycling
Processing.
In an embodiment of the present invention, determining module 730 is further adapted for:
If there is no in component register to specified class in each component run in current process, it is determined that current process into
Row recovery processing.
In an embodiment of the present invention, determining module 730 is further adapted for:
The judgment method for specifying class is called, searches whether each component run in current process is registered to finger by judgment method
Determine in class;
Receive the lookup result that judgment method returns;
Determined whether to recycle current process according to lookup result.
In an embodiment of the present invention, preset process recycling event includes at least one following:
Component stopping event;
Component destruction event;
It is reached by the timing duration that timer is set and specifies duration event.
In an embodiment of the present invention, as shown in figure 8, the device of Fig. 7 displayings can also include:
Second registration module 750 is coupled with module 710 is monitored, if including component suitable for preset process recycling event
Stopping event and/or component destruction event, before the process recycling event for monitoring 710 preset monitored of module, component registration
Life cycle callback method, with the life cycle events of the receiving unit in readjustment.
In an embodiment of the present invention, the life cycle events of component include at least one following:
Component creates event, component starts event, component recovery event, component suspending event, component stopping event, component
Destruction event.
In an embodiment of the present invention, determining module 730 is further adapted for:
Judge in each component run in current process with the presence or absence of the component being resumed;
If so, determining to current process without recovery processing;
If not, it is determined that current process is recycled.
In an embodiment of the present invention, as shown in figure 8, the device of Fig. 7 displayings can also include:
Count area processing module 760 is coupled with determining module 730, is suitable for that each process in application program is arranged
Count area, for being counted to the component for being resumed and/or being suspended in the process;When receiving component recovery event
When, count value is increased to the count area for the component place process being resumed;When receiving component suspending event, to being suspended
Component where process count area reduce count value.
In an embodiment of the present invention, determining module 730 is further adapted for:
Read the count area of current process;
Judge whether the count value of count area is more than specified threshold;
If so, determining the component for existing in each component run in current process and being resumed;
If not, it is determined that there is no the components being resumed in each component run in current process.
In an embodiment of the present invention, determining module 730 is further adapted for:
Judge whether current process is null process or background process;
If so, determination is recycled current process.
According to the combination of any one above-mentioned preferred embodiment or multiple preferred embodiments, the embodiment of the present invention can reach
Following advantageous effect:
The embodiment of the present invention realizes the scheme being recycled to the process of application program, is provided with first preset
Process recycles event, and carries out active sniffing to preset process recycling event, when listening to preset process recycling event,
Obtain current process in run each component attribute information, and then by the attribute information of each component run in current process with
The attribute information of the corresponding component of process recycling rule is compared, it is determined whether is recycled to current process.As a result,
The embodiment of the present invention can realize that the purpose being recycled in time to process, solution can not achieve process in the prior art
Recycling in time, cause before recycling process still can long-term committed memory resource the problem of.Also, the embodiment of the present invention be by
The attribute information of the attribute information of each component run in current process component corresponding with process recycling rule is compared, really
It is fixed whether current process to be recycled, rather than only according to the liveness collection process of process, so that operation
The process of system application will not be recovered, and can ensure the normal operation of terminal device.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that the implementation of the present invention
Example can be put into practice without these specific details.In some instances, well known method, structure is not been shown in detail
And technology, so as not to obscure the understanding of this description.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of each inventive aspect,
Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes
In example, figure or descriptions thereof.However, the method for the disclosure should be construed to reflect following intention:It is i.e. required to protect
Shield the present invention claims the more features of feature than being expressly recited in each claim.More precisely, as following
Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore,
Thus the claims for following specific implementation mode are expressly incorporated in the specific implementation mode, wherein each claim itself
All as a separate embodiment of the present invention.
Those skilled in the art, which are appreciated that, to carry out adaptively the module in the equipment in embodiment
Change and they are arranged in the one or more equipment different from the embodiment.It can be the module or list in embodiment
Member or component be combined into a module or unit or component, and can be divided into addition multiple submodule or subelement or
Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it may be used any
Combination is disclosed to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so to appoint
Where all processes or unit of method or equipment are combined.Unless expressly stated otherwise, this specification (including adjoint power
Profit requires, abstract and attached drawing) disclosed in each feature can be by providing the alternative features of identical, equivalent or similar purpose come generation
It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments
In included certain features rather than other feature, but the combination of the feature of different embodiments means in of the invention
Within the scope of and form different embodiments.For example, in detail in the claims, embodiment claimed it is one of arbitrary
It mode can use in any combination.
The all parts embodiment of the present invention can be with hardware realization, or to run on one or more processors
Software module realize, or realized with combination thereof.It will be understood by those of skill in the art that can use in practice
Microprocessor or digital signal processor (DSP) realize that the process according to the ... of the embodiment of the present invention that carries out in the application is returned
Receive some or all functions of some or all components in the device of processing.The present invention is also implemented as executing
Some or all equipment or program of device of method as described herein are (for example, computer program and computer journey
Sequence product).It is such realize the present invention program can may be stored on the computer-readable medium, can either have there are one or
The form of multiple signals.Such signal can be downloaded from internet website and be obtained, either provide on carrier signal or
It provides in any other forms.
It should be noted that the present invention will be described rather than limits the invention for above-described embodiment, and ability
Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims,
Any reference mark between bracket should not be configured to limitations on claims.Word "comprising" does not exclude the presence of not
Element or step listed in the claims.Word "a" or "an" before element does not exclude the presence of multiple such
Element.The present invention can be by means of including the hardware of several different elements and being come by means of properly programmed computer real
It is existing.In the unit claims listing several devices, several in these devices can be by the same hardware branch
To embody.The use of word first, second, and third does not indicate that any sequence.These words can be explained and be run after fame
Claim.
So far, although those skilled in the art will appreciate that present invention has been shown and described in detail herein multiple shows
Example property embodiment still without departing from the spirit and scope of the present invention, still can according to the present disclosure directly
Determine or derive many other variations or modifications consistent with the principles of the invention.Therefore, the scope of the present invention is understood that and recognizes
It is set to and covers other all these variations or modifications.