CN109144677A - The method and apparatus of keep-alive process for Android system - Google Patents

The method and apparatus of keep-alive process for Android system Download PDF

Info

Publication number
CN109144677A
CN109144677A CN201710457869.2A CN201710457869A CN109144677A CN 109144677 A CN109144677 A CN 109144677A CN 201710457869 A CN201710457869 A CN 201710457869A CN 109144677 A CN109144677 A CN 109144677A
Authority
CN
China
Prior art keywords
file
application
starting
moved
android system
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.)
Granted
Application number
CN201710457869.2A
Other languages
Chinese (zh)
Other versions
CN109144677B (en
Inventor
史剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201710457869.2A priority Critical patent/CN109144677B/en
Publication of CN109144677A publication Critical patent/CN109144677A/en
Application granted granted Critical
Publication of CN109144677B publication Critical patent/CN109144677B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/485Task life-cycle, e.g. stopping, restarting, resuming execution

Abstract

This application discloses the method and apparatus of the keep-alive process for Android system.One specific embodiment of this method includes: to start in response to application, for two processes started by Android system of the application declarative, respectively the first process, the second process, wherein the first process, the second process separately include the component for starting above-mentioned application;Subfile is respectively created for the first process, the second process, so that the first process, the second process obtain file lock by subfile respectively, and the state by monitoring other side's process file lock judges whether other side's process is moved to end;Determine that other side's process is moved to end according to the file lock status of the other side's process listened in response to any process in the first process, the second process, the component for the above-mentioned application of starting for including by other side's process restarts above-mentioned application.The validity of Android system keep-alive process can be improved in the embodiment.

Description

The method and apparatus of keep-alive process for Android system
Technical field
This application involves field of computer technology, and in particular to field of terminal technology, more particularly, to Android system The method and apparatus of keep-alive process.
Background technique
In Android system, process keep-alive techniques are usually mutually kept at (such as nativie layers) of ccf layer using father and son's process The method of shield.Specifically, father and son's process is guarded mutually, no matter who is died for two processes, and other side should execute keep-alive behaviour to him Make.For example, in the system of 5.0 or less version of Android, when system finishing process, ccf layer (such as nativie will not be killed Layer) associated process, can native layer use fork process method, father and son's process establish two pipelines block mutually Pipeline is read, if can read, just represents monitored process dies, executes keep-alive operation to protect process.However pacifying In the system of tall and erect 5.0 or more versions, system finishing process when, can terminate together same group of all processes, this is the same as group Meaning may include " same group of history ", such as in mono- subprocess of native layers of fork, this subprocess whether by init into Journey is adopted, or is jumped in new process group across group across session by setuid function, all can be recorded as going through by Android system Once same group of history, so can all be moved to end.Then ccf layer father and son process keep-alive techniques just fail in 5.0 system above of Android , can not keep-alive process.
Therefore, it is necessary to a kind of general keep-alive proceeding methods for Android system, improve the validity of keep-alive process.
Summary of the invention
The purpose of the application is the method and apparatus for proposing a kind of improved keep-alive process for Android system, to solve The technical issues of certainly background section above is mentioned.
In a first aspect, this application provides a kind of method of keep-alive process for Android system, this method comprises: response Start in application, for two processes started by Android system of the application declarative, respectively the first process, the second process, wherein First process, the second process separately include the component for starting above-mentioned application;It is respectively created for the first process, the second process Subfile, so that the first process, the second process obtain file lock by subfile respectively, and by monitoring other side's process file lock State judge whether other side's process is moved to end;In response to any process in the first process, the second process according to pair listened to The file lock status of Fang Jincheng determines that other side's process is moved to end, and the component for the above-mentioned application of starting for including by other side's process is restarted Above-mentioned application.
In some embodiments, subfile is respectively created for the first process, the second process so that the first process, second into Journey obtains file lock by subfile respectively, and the state by monitoring other side's process file lock judges whether other side's process is tied Beam includes: to each of the first process, the second process: creation the first file, the second file, wherein the first file is used for File lock is obtained, the second file is used to read the second file of other side's process;When reading the second file of other side's process, ring Ying Yu completes the first file locking, the second file of other side's process is deleted, so that other side's process can monitor the file of the process Lock status.
In some embodiments, in response to according to any process in the first process, the second process according to the other side listened to The file lock status of process determines that other side's process is moved to end, the above method further include: end listens to what other side's process was moved to end Process is moved to end to restart the process so that other side's process listens to the process.
In some embodiments, restarting above-mentioned application includes: to send the use that starting other side's process is included to Android system In the intention for the component for starting above-mentioned application.
In some embodiments, the intention for the component for starting above-mentioned application that starting other side's process is included exists respectively Generated when the first process or the second process initialization, and obtain binding object of the process management services in the process, with it is right Fang Jincheng is bundled.
In some embodiments, the above method further include: restarting is above-mentioned in application, the seamless starting of setting application is marked Will.
Second aspect, present invention also provides a kind of devices of keep-alive process for Android system, which includes: sound Bright module is configured to start in response to application, for the processes that the application declarative two is started by Android system, respectively first Process, the second process, wherein the first process, the second process separately include the component for starting the application;Monitor mould Block is configured to that subfile is respectively created for the first process, the second process, so that the first process, the second process pass through son respectively File acquisition file lock, and the state by monitoring other side's process file lock judges whether other side's process is moved to end;Keep-alive module, It is configured to be determined in response to any process in the first process, the second process according to the file lock status of the other side's process listened to Other side's process is moved to end, and the component for the above-mentioned application of starting for including by other side's process restarts above-mentioned application.
In some embodiments, module is monitored further to be configured to: to each of the first process, the second process: Create the first file, the second file, wherein the first file is for obtaining file lock, and the second file is for reading other side's process Second file;When reading the second file of other side's process, in response to completing to the first file locking, other side's process is deleted Second file, so that other side's process can monitor the file lock status of the process.
In some embodiments, in response to according to any process in the first process, the second process according to the other side listened to The file lock status of process determines that other side's process is moved to end, and keep-alive module is also configured to: end listens to other side's process and is tied The process of beam is moved to end to restart the process so that other side's process listens to the process.
In some embodiments, keep-alive module is also configured to: sending starting other side's process to Android system is included For starting the intention of the component of above-mentioned application, to restart above-mentioned application.
In some embodiments, the intention for the component for starting above-mentioned application that starting other side's process is included exists respectively Generated when the first process or the second process initialization, and obtain binding object of the process management services in the process, with it is right Fang Jincheng is bundled.
In some embodiments, above-mentioned apparatus further includes setup module, is configured to: restarting is above-mentioned in application, setting It sets using seamless active flag.
The third aspect, present invention also provides a kind of calculating equipment, comprising: one or more processors;Storage device is used In the one or more programs of storage;When the one or more program is executed by said one or multiple processors, so that this Or multiple processors realize above-mentioned method.
The method and apparatus of keep-alive process provided by the present application for Android system start in response to application, answer for this With two processes started by Android system of statement, respectively the first process, the second process, wherein the first process, the second process The component for starting above-mentioned application is separately included, then, subfile is respectively created for the first process, the second process, so that First process, the second process obtain file lock, and the state judgement by monitoring other side's process file lock by subfile respectively Whether other side's process is moved to end, then, in response to any process in the first process, the second process according to the other side's process listened to File lock status determine that other side's process is moved to end, the component for the above-mentioned application of starting for including by other side's process restarts above-mentioned answer With.Since the file that the process by Android system starting by statement mutually monitors other side send state to determine whether to protect It is living, avoid two processes from being all moved to end, so as to improve the validity of Android system keep-alive process.
Detailed description of the invention
By reading a detailed description of non-restrictive embodiments in the light of the attached drawings below, the application's is other Feature, objects and advantages will become more apparent upon:
Fig. 1 is the flow chart according to one embodiment of the method for the keep-alive process for Android system of the application;
Fig. 2 is illustrated according to the application scenarios of the embodiment of the method for the keep-alive process for Android system of the application Figure;
Fig. 3 is the flow chart of two mutual keep-alives of process in application scenarios shown in Fig. 2;
Fig. 4 is the structural schematic diagram according to one embodiment of the keep-alive process device for Android system of the application;
Fig. 5 is adapted for the structural schematic diagram for realizing the computer system of the embodiment of the present application.
Specific embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to Convenient for description, part relevant to related invention is illustrated only in attached drawing.
It should be noted that in the absence of conflict, the features in the embodiments and the embodiments of the present application can phase Mutually combination.The application is described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
Referring to FIG. 1, showing one embodiment of the method for the keep-alive process for Android system according to the application Process 100.The process 100 can be adapted for the electronic equipment with certain computing capability, such as can include but is not limited to Below any one: smart phone, tablet computer, E-book reader, MP3 player (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio level 3), MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard audio level 4) it is player, on knee portable Computer and desktop computer etc..This is used for the method for the keep-alive process of Android system, comprising the following steps:
Step 101, start in response to application, for the processes that the application declarative two is started by Android system, respectively the One process, the second process.
In the present embodiment, operation has electronic equipment (such as the intelligent hand of the method for keep-alive process for Android system Machine) it first can be from the application for needing keep-alive be obtained, when detecting application starting, for the application declarative two by Android system The process of system starting, the two processes are respectively the first process, the second process.Here, first, second is only the area named Not, the not substantial difference of two processes.First process is as the second process function, in the keep-alive process side of the present embodiment It cooperates both in method, status can be interchanged.Wherein, the first process, the second process have been separately included for starting above-mentioned answer Component, to pass through the first process, the mutual keep-alive of the second process, to achieve the purpose that above-mentioned application carries out keep-alive.
Wherein, it for example can include but is not limited to following at least one: activity for starting the component of above-mentioned application Component, service component, broadcast receiver component etc..
Step 102, be the first process, subfile is respectively created in the second process, so that the first process, the second process are led to respectively It crosses subfile and obtains file lock, and the state by monitoring other side's process file lock judges whether other side's process is moved to end.
In the present embodiment, operation has electronic equipment (such as the intelligent hand of the method for keep-alive process for Android system Machine) then subfile can be respectively created for the first process, the second process, so that the first process, the second process pass through son respectively File acquisition file lock, and the state by monitoring other side's process file lock judges whether other side's process is moved to end.
In practice, above-mentioned electronic equipment can distribute file lock to the process started.First process, the second process are simultaneously Subfile is created, and to sub- file locking.Some process can indicate after the completion that sub- file locking, other side's process monitors its text Part lock status.Other side's process can judge whether the process is moved to end according to the file lock status of the process.For example, obtaining file The process of lock carries out subfile locking after obtaining file lock, and another process can not read locked file or file lock.Only When process is moved to end, the file lock of release can be read by another process.For another example obtaining the process of file lock can be set The value of file lock status indicator position, different markers represents the different conditions of file lock, such as locks or release state.By This, another process can judge whether other side's process terminates by judging the state that locks or release of file lock.Specifically, file Other side's process is not finished when lock is in the lock state, and other side's process is moved to end when file lock is in release conditions.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can be in the first process, the second process Each, create the first file, the second file, wherein the first file is for obtaining file lock, and the second file is for reading pair The second file of Fang Jincheng;When reading the second file of another process, in response to being completed to the first file locking, delete another Second file of one process, so that the file lock of the readable process of another process.As an example, above-mentioned electronic equipment statement is added Two processes be respectively the first process A, the second process B.Above-mentioned electronic equipment is process A the first file of creation A1, the first text Part A1 is created and is started to create A2 after the completion of locking.Meanwhile above-mentioned electronic equipment is process B the first file of creation B1, the first text Part B1 starts to create B2 after the completion of obtaining file lock.Since process A and B start simultaneously, the first file A1 and the first file B1 which first obtain file lock be it is uncertain, A and B mutually monitor the second file, and A is listened in the presence of B2, illustrate that B1 has been obtained File lock is taken, similarly, B is listened in the presence of A2, illustrates that A1 has obtained file lock.When A1 obtains file lock, above-mentioned electronics is set Standby permission process A deletes file B2.B1 listens to B2 and is deleted, then obtains A1 and lock the information completed, begin listening for A1 file The state of lock.Similarly, when B1 obtains file lock, above-mentioned electronic equipment allows process B to delete file A2.A1 listens to A2 and is deleted It removes, then obtains B1 and lock the information completed, begin listening for the state of B1 file lock.Further, process A and B is respectively according to right The state of square process file lock determines whether other side's process is moved to end.
Step 103, in response to any process in the first process, the second process according to the file lock of the other side's process listened to State determines that other side's process is moved to end, and the component for the above-mentioned application of starting for including by other side's process restarts above-mentioned application.
In the present embodiment, operation has electronic equipment (such as the intelligent hand of the method for keep-alive process for Android system Machine) the file lock status of other side's process that may further be listened to according to the first process, the second process determines that other side's process is It is no to be moved to end, however, it is determined that other side's process of any process is moved to end, and passes through the component for the above-mentioned application of starting that other side's process includes The application started in reboot step 101.
It is appreciated that since the first process, the second process are started by Android system, for by opening in step 101 The dynamic process using keep-alive illustrates in step 101 when any one process in the first process, the second process is moved to end The application started is moved to end, and is needed to application progress keep-alive, at this point, above-mentioned electronic equipment can be by the process that is moved to end In include to restart above-mentioned application for starting the component of above-mentioned application.
Wherein, when restarting above-mentioned, the process that is not ended in the first process, the second process can be according to being moved to end The component for starting application included in process starts above-mentioned application.For example, in above-mentioned example, it is assumed that contain and open in A process Move the activity component of above-mentioned application, B process contains the service component for starting above-mentioned application, when B process read A into The file lock of the subfile A1 of journey, when determining that A process is moved to end, B process can send the intention of operation activity component Intent is to the Android system for running on above-mentioned electronic equipment, and Android system is by starting the activity component weight in B process Open above-mentioned application.In practice, if Android system detects B, process is moved to end, first starting B process, in B process of reruning later Activity component, to restart above-mentioned application.In some implementations, above-mentioned electronic equipment can be in the first process, When the process initialization of two processes, respectively they generate the component for being used to start the application that starting other side's process is included Intention, and obtain binding binder object of the process management services (ActivityManagerService) in the process, To be bundled with other side's process.In this way, once a process determines that another process is moved to end, intention can be directly transmitted and come Start another process, saves the time.
In some optional implementations of the present embodiment, in response to what is listened to according to the process of monitoring file lock status File lock status determines that other side's process is moved to end, after restarting above-mentioned application by listening to the process that other side's process is moved to end, Above-mentioned electronic equipment can be with: terminating to listen to the process that other side's process is moved to end.Since other side's process is restarted, other side's process It listens to the process to be moved to end, and the process can be restarted, to guarantee that two processes are all run.
In some optional implementations of the present embodiment, above-mentioned electronic equipment restart it is above-mentioned in application, can be with Seamless active flag is applied in setting, in order to avoid this time starting record is detected by the Android system run on above-mentioned electronic equipment, from And terminate above-mentioned application again.In practice, seamless browsing mark for example be can include but is not limited in following flag bit at least One is preset value: Intent.FLAG_ACTIVITY_EXCLUDS_FROM_RECENTS and Intent.FLAG_ACTIVITY_ NO_HISTORY etc., the Android system run on above-mentioned electronic equipment when flag bit is set to preset value can't detect State the starting record of application.
As an application scenarios, the method for the keep-alive process provided by the present application for Android system can be applied to intelligence It can mobile phone 200.Android system can have been run on smart phone 200.As shown in Fig. 2, the Android system run on smart phone 200 " ×× friend-making " is equipped in system answers client 201, it is assumed that user wishes that this is remained operational using 201, is disappeared with timely reception This can be applied white list using 201 addition smart phones 200 by breath, user.Then as shown in figure 3, in 201 starting of application When, above-mentioned electronic equipment can apply creation process 1 and process 2 for this.Process 1 and process 2 are may include respectively for starting Using 201 component.Process 1 and process 2 have same interchangeable status, are illustrated based on process 1 herein.Intelligent hand Machine 200 is that process 1 creates file 11, and locks to file 11, is represented when file 11 gets file lock to the locking of file 11 When completion, file 12 is created for process 1.At this point, 1 poll of process checks that file 22 whether there is, and if it exists, delete file 22 It removes.Similarly, process 2 executes similar operations.Meanwhile after file 12 is created, by 1 monitoring file 12 of process whether there is also, If it does not exist, then it represents process 2 and completion is locked to file 21, file 12 is deleted by process 2.At this point, process 1 starts from file 21 File lock is read, and the file lock for judging whether to read file 21 determines that process 2 is moved to end when reading.Smart phone 200 The component that starting included in process 2 applies 201 can be sent by the Android system that process 1 is run on smart phone The intent of (such as activity component), Android system run assembly type discovery process 2 and are moved to end, then first run process 2, into And the component that starting included in process 2 applies 201 is run, realize the keep-alive using 201.In practice, process 1 has been sent It can also terminate own process after intent.Then process 2 restart after discovery process 1 terminate, in the same way keep-alive into Journey 1.
Therefore, the method for the keep-alive process for Android system of the present embodiment, due to by stating by Android system The file that the process of starting mutually monitors other side send state to determine whether to carry out keep-alive, and two processes is avoided all to be moved to end, thus The validity of Android system keep-alive process can be improved.
With further reference to Fig. 4, as the realization of the method to the above-mentioned keep-alive process for Android system, the application is provided A kind of one embodiment of the keep-alive process device for Android system, the Installation practice and method shown in FIG. 1 are implemented Example is corresponding.
As shown in figure 4, the keep-alive process device 400 for Android system of the present embodiment includes: declaration module 401, prison Listen module 402 and keep-alive module 403.Wherein, declaration module 401 may be configured to start in response to application, apply sound for this Bright two processes started by Android system, respectively the first process, the second process, wherein the first process, the second process difference It include the component for starting the application;Monitoring module 402 may be configured to create respectively for the first process, the second process Subfile is built, so that the first process, the second process obtain file lock by subfile respectively, and by monitoring other side's process file The state of lock judges whether other side's process is moved to end;Keep-alive module 403 may be configured in response to the first process, the second process In any process according to the file lock status of the other side's process listened to determine that other side's process is moved to end, include by other side's process The component of the above-mentioned application of starting restart above-mentioned application.
In some optional implementations of the present embodiment, monitor module 402 may further be configured to: to first into Each of journey, second process: creation the first file, the second file, wherein the first file is for obtaining file lock, and second File is used to read the second file of other side's process;When reading the second file of other side's process, in response to the first file It locks and completes, the second file of other side's process is deleted, so that other side's process can monitor the file lock status of the process.
In some optional implementations of the present embodiment, in response to according to any process in the first process, the second process Determine that other side's process is moved to end according to the file lock status of the other side's process listened to, keep-alive module 403 can also be configured to: End listens to the process that other side's process is moved to end, and is moved to end to restart the process so that other side's process listens to the process.
In some optional implementations of the present embodiment, keep-alive module 403 can also be configured to: be sent out to Android system The intention for the component for starting above-mentioned application for sending starting other side's process to be included, to restart above-mentioned application.In some realizations In, the intention for the component for starting above-mentioned application that starting other side's process is included is respectively at the beginning of the first process or the second process It is generated when beginningization, and obtains binding object of the process management services in the process, to be bundled with other side's process.In this way may be used To save the time spent to process keep-alive.
In some optional implementations of the present embodiment, device 400 can also include setup module (not shown), configuration For: restarting is above-mentioned in application, seamless active flag is applied in setting.
It is worth noting that all modules recorded in device 400 for the keep-alive process of Android system are retouched with reference to Fig. 1 Each step in the method stated is corresponding.Device 400 is equally applicable to above with respect to the operation and feature of method description as a result, And module wherein included or unit, details are not described herein.
It will be understood by those skilled in the art that the device 400 of the above-mentioned keep-alive process for Android system further includes Other known features, such as processor, memory etc., in order to unnecessarily obscure embodiment of the disclosure, these well known knots Structure is not shown in Fig. 4.
Below with reference to Fig. 5, it illustrates the structural representations for the computer system 500 for being suitable for being used to realize the embodiment of the present application Figure.Computer system shown in Fig. 5 is only an example, should not function to the embodiment of the present application and use scope bring and appoint What is limited.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU501, ROM502 and RAM503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to bus 504。
I/O interface 505 is connected to lower component: the importation 506 including keyboard or touch screen etc.;Including such as cathode The output par, c 507 of ray tube (CRT), liquid crystal display (LCD) etc.;Storage section 508 including hard disk etc.;And including all The communications portion 509 of such as network interface card of LAN card, modem.Communications portion 509 via such as internet network Execute communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as disk, CD, Magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to from the computer journey read thereon Sequence is mounted into storage section 508 as needed.
Particularly, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description Software program.For example, embodiment of the disclosure includes a kind of computer program product comprising be carried on computer-readable medium On computer program, which includes the program code for method shown in execution flow chart.In such reality It applies in example, which can be downloaded and installed from network by communications portion 509, and/or from detachable media 511 are mounted.When the computer program is executed by central processing unit (CPU) 501, limited in execution the present processes Above-mentioned function.It should be noted that non-volatile computer-readable medium involved in the application can be non-volatile calculating Machine readable signal medium or non-volatile computer readable storage medium storing program for executing either the two any combination.It is non-volatile What computer readable storage medium for example may be-but not limited to-electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor is System, device or device, or any above combination.The more specific example of non-volatile computer readable storage medium storing program for executing can be with Including but not limited to: there is electrical connection, the portable computer diskette, hard disk, random access storage device of one or more conducting wires (RAM), read-only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc Read-only memory (CD-ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this application, Non-volatile computer readable storage medium storing program for executing can be any tangible medium for including or store program, which can be commanded Execution system, device or device use or in connection.And in this application, computer-readable signal media can To include in a base band or as the data-signal that carrier wave a part is propagated, wherein carrying computer-readable program generation Code.The data-signal of this propagation can take various forms, including but not limited to electromagnetic signal, optical signal or above-mentioned any Suitable combination.Computer-readable signal media can also be any computer-readable other than computer readable storage medium Medium, the computer-readable medium can be sent, propagated or transmitted for being used by instruction execution system, device or device Or program in connection.The program code for including on computer-readable medium can pass with any suitable medium It is defeated, including but not limited to: wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of the various embodiments of the application, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of the module, program segment or code include one or more use The executable instruction of the logic function as defined in realizing.It should also be noted that in some implementations as replacements, being marked in box The function of note can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are actually It can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it to infuse Meaning, the combination of each box in block diagram and or flow chart and the box in block diagram and or flow chart can be with holding The dedicated hardware based system of functions or operations as defined in row is realized, or can use specialized hardware and computer instruction Combination realize.
Being described in module involved in the embodiment of the present application can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet It includes declaration module, monitor module and keep-alive module.Wherein, the title of these modules is not constituted under certain conditions to the unit The restriction of itself, for example, declaration module is also described as " being configured to start in response to application, for the application declarative two The module of a process by Android system starting ".
As on the other hand, present invention also provides a kind of computer-readable medium, which be can be Included in device described in above-described embodiment;It is also possible to individualism, and without in the supplying device.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the device, so that should Device: starting in response to application, for two processes started by Android system of the application declarative, respectively the first process, second Process, wherein the first process, the second process separately include the component for starting above-mentioned application;For the first process, second into Subfile is respectively created in journey, so that the first process, the second process obtain file lock by subfile respectively, and by monitoring other side The state of process file lock judges whether other side's process is moved to end;In response to any process in the first process, the second process according to The file lock status of the other side's process listened to determines that other side's process is moved to end, the above-mentioned application of starting for including by other side's process Component restart above-mentioned application.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.Those skilled in the art Member is it should be appreciated that invention scope involved in the application, however it is not limited to technology made of the specific combination of above-mentioned technical characteristic Scheme, while should also cover in the case where not departing from foregoing invention design, it is carried out by above-mentioned technical characteristic or its equivalent feature Any combination and the other technical solutions formed.Such as features described above has similar function with (but being not limited to) disclosed herein Can technical characteristic replaced mutually and the technical solution that is formed.

Claims (14)

1. a kind of method of the keep-alive process for Android system, which is characterized in that the described method includes:
Start in response to application, is two processes started by Android system of the application declarative, respectively the first process, second Process, wherein the first process, the second process separately include the component for starting the application;
Subfile is respectively created for the first process, the second process, so that the first process, the second process are obtained by subfile respectively File lock, and the state by monitoring other side's process file lock judges whether other side's process is moved to end;
Other side is determined according to the file lock status of the other side's process listened in response to any process in the first process, the second process Process is moved to end, and the component for the starting application for including by other side's process restarts the application.
2. the method according to claim 1, wherein described is that Ziwen is respectively created in the first process, the second process Part, so that the first process, the second process obtain file lock, and the shape by monitoring other side's process file lock by subfile respectively State judges whether other side's process is moved to end
To each of the first process, the second process:
Create the first file, the second file, wherein the first file for obtaining file lock, the second file for read other side into Second file of journey;
When reading the second file of other side's process, in response to completing to the first file locking, the second of other side's process is deleted File, so that other side's process can monitor the file lock status of the process.
3. the method according to claim 1, wherein in response to according in the first process, the second process it is any into Journey determines that other side's process is moved to end according to the file lock status of the other side's process listened to, the method also includes:
End listen to the process that other side's process is moved to end, for other side's process listen to the process be moved to end to restart this into Journey.
4. restarting the application the method according to claim 1, wherein described and including:
The intention for the component for starting the application that starting other side's process is included is sent to Android system.
5. according to the method described in claim 4, it is characterized in that, starting other side's process included for starting the application The intention of component generated respectively in the first process or the second process initialization, and obtain process management services in the process Binding object, to be bundled with other side's process.
6. the method according to claim 1, wherein the method also includes:
Restarting is described in application, seamless active flag is applied in setting.
7. a kind of device of the keep-alive process for Android system, which is characterized in that described device includes:
Declaration module is configured to start in response to application, is two processes started by Android system of the application declarative, point It Wei the first process, the second process, wherein the first process, the second process separately include the component for starting the application;
Module is monitored, is configured to that subfile is respectively created for the first process, the second process, so that the first process, the second process File lock is obtained by subfile respectively, and the state by monitoring other side's process file lock judges whether other side's process is tied Beam;
Keep-alive module is configured in response to any process in the first process, the second process according to the other side's process listened to File lock status determines that other side's process is moved to end, and the component for the starting application for including by other side's process restarts described answer With.
8. device according to claim 7, which is characterized in that the monitoring module is further configured to:
To each of the first process, the second process:
Create the first file, the second file, wherein the first file for obtaining file lock, the second file for read other side into Second file of journey;
When reading the second file of other side's process, in response to completing to the first file locking, the second of other side's process is deleted File, so that other side's process can monitor the file lock status of the process.
9. device according to claim 7, which is characterized in that in response to according in the first process, the second process it is any into Journey determines that other side's process is moved to end according to the file lock status of the other side's process listened to, and the keep-alive module is also configured to:
End listen to the process that other side's process is moved to end, for other side's process listen to the process be moved to end to restart this into Journey.
10. device according to claim 7, which is characterized in that the keep-alive module is also configured to:
The intention for the component for starting the application that starting other side's process is included is sent to Android system, it is described to restart Using.
11. device according to claim 10, which is characterized in that starting other side's process was included is used to start described answer The intention of component is generated in the first process or the second process initialization respectively, and obtains process management services in the process In binding object, to be bundled with other side's process.
12. being configured to the method according to the description of claim 7 is characterized in that described device further includes setup module:
Restarting is described in application, seamless active flag is applied in setting.
13. a kind of calculating equipment, comprising:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as method as claimed in any one of claims 1 to 6.
14. a kind of non-volatile computer readable storage medium storing program for executing, is stored thereon with computer program, which is characterized in that the program Such as method as claimed in any one of claims 1 to 6 is realized when being executed by processor.
CN201710457869.2A 2017-06-16 2017-06-16 Keep-alive process method and device for android system Active CN109144677B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710457869.2A CN109144677B (en) 2017-06-16 2017-06-16 Keep-alive process method and device for android system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710457869.2A CN109144677B (en) 2017-06-16 2017-06-16 Keep-alive process method and device for android system

Publications (2)

Publication Number Publication Date
CN109144677A true CN109144677A (en) 2019-01-04
CN109144677B CN109144677B (en) 2022-08-26

Family

ID=64830630

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710457869.2A Active CN109144677B (en) 2017-06-16 2017-06-16 Keep-alive process method and device for android system

Country Status (1)

Country Link
CN (1) CN109144677B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111399924A (en) * 2020-03-18 2020-07-10 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
CN112445530A (en) * 2019-08-29 2021-03-05 成都鼎桥通信技术有限公司 Method and device for keeping third-party application program alive
CN112860408A (en) * 2021-03-03 2021-05-28 苏州沁游网络科技有限公司 Process keep-alive method, device and system in cloud reality machine and storage medium
CN113760492A (en) * 2020-11-04 2021-12-07 北京沃东天骏信息技术有限公司 Program process keep-alive method, system, device, equipment and storage medium
CN117407068A (en) * 2023-12-08 2024-01-16 厦门她趣信息技术有限公司 Method for activating Android process by multiple strategies

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484223A (en) * 2014-12-16 2015-04-01 北京奇虎科技有限公司 Android system application closing method and android system application closing device
CN106162510A (en) * 2015-04-08 2016-11-23 株式会社日立制作所 Security procedure managing device and security procedure management method
CN106355060A (en) * 2016-10-31 2017-01-25 Tcl集团股份有限公司 Application-lock implementation method and system based on android system
CN106371911A (en) * 2016-09-06 2017-02-01 北京海誉动想科技股份有限公司 Method for rebooting guarded process by daemon processes
CN106648863A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Live keeping method and system of Android application installation package and application target process
CN106708617A (en) * 2016-12-23 2017-05-24 武汉斗鱼网络科技有限公司 Service-based application process keep-alive system and keep-alive method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104484223A (en) * 2014-12-16 2015-04-01 北京奇虎科技有限公司 Android system application closing method and android system application closing device
CN106162510A (en) * 2015-04-08 2016-11-23 株式会社日立制作所 Security procedure managing device and security procedure management method
CN106371911A (en) * 2016-09-06 2017-02-01 北京海誉动想科技股份有限公司 Method for rebooting guarded process by daemon processes
CN106355060A (en) * 2016-10-31 2017-01-25 Tcl集团股份有限公司 Application-lock implementation method and system based on android system
CN106648863A (en) * 2016-12-08 2017-05-10 武汉斗鱼网络科技有限公司 Live keeping method and system of Android application installation package and application target process
CN106708617A (en) * 2016-12-23 2017-05-24 武汉斗鱼网络科技有限公司 Service-based application process keep-alive system and keep-alive method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
猫九爷阳果果: "Android进程常驻(4)和(5)", 《CSDN HTTPS://BLOG.CSDN.NET/MARSWIN89/ARTICLE/DETAILS/50916631》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112445530A (en) * 2019-08-29 2021-03-05 成都鼎桥通信技术有限公司 Method and device for keeping third-party application program alive
CN111399924A (en) * 2020-03-18 2020-07-10 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
CN111399924B (en) * 2020-03-18 2023-06-16 山东车微联信息技术股份有限公司 Method, terminal and storage medium for keeping application process alive under android platform
CN113760492A (en) * 2020-11-04 2021-12-07 北京沃东天骏信息技术有限公司 Program process keep-alive method, system, device, equipment and storage medium
CN112860408A (en) * 2021-03-03 2021-05-28 苏州沁游网络科技有限公司 Process keep-alive method, device and system in cloud reality machine and storage medium
CN117407068A (en) * 2023-12-08 2024-01-16 厦门她趣信息技术有限公司 Method for activating Android process by multiple strategies
CN117407068B (en) * 2023-12-08 2024-03-29 厦门她趣信息技术有限公司 Method for activating Android process by multiple strategies

Also Published As

Publication number Publication date
CN109144677B (en) 2022-08-26

Similar Documents

Publication Publication Date Title
CN109144677A (en) The method and apparatus of keep-alive process for Android system
US9117191B2 (en) Automatic device inventory management for different types of devices
WO2020216204A1 (en) Information acquisition method and apparatus
CN103765936B (en) The method and apparatus managed for privacy policy
CN110222775A (en) Image processing method, device, electronic equipment and computer readable storage medium
CN110390493B (en) Task management method and device, storage medium and electronic equipment
CN111340482A (en) Conflict detection method, device, node equipment and storage medium
CN109408481B (en) Log collection rule updating method and device, electronic equipment and readable medium
CN113505520A (en) Method, device and system for supporting heterogeneous federated learning
JP2022541929A (en) Method and apparatus for issuing smart contracts
CN109890024B (en) Method and equipment for determining rescue group information
CN109634702B (en) Information prompting method and device, electronic equipment and readable medium
CN109218041A (en) Request processing method and device for server system
CN116225886A (en) Test case generation method, device, equipment, storage medium and program product
CN111460432B (en) On-line document authority control method, device, equipment and computer readable medium
CN111598544B (en) Method and device for processing information
CN111625326B (en) Task pipeline execution method and device and electronic equipment
CN109145591A (en) The plug-in loading method of application program
WO2020224295A1 (en) Information management method, device, and system
CN110855655B (en) Information verification method, device, equipment and storage medium
CN117155994B (en) Service registration management method, device, equipment and readable storage medium
CN112104733B (en) Method, device, electronic equipment and medium for acquiring preset service information
CN111382057B (en) Test case generation method, test method and device, server and storage medium
CN117473047B (en) Business text generation method and device, electronic equipment and readable storage medium
CN109190352A (en) A kind of authorization text Accuracy Verification method and apparatus

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