CN105183457B - Method and device for monitoring interface life cycle callback - Google Patents

Method and device for monitoring interface life cycle callback Download PDF

Info

Publication number
CN105183457B
CN105183457B CN201510498109.7A CN201510498109A CN105183457B CN 105183457 B CN105183457 B CN 105183457B CN 201510498109 A CN201510498109 A CN 201510498109A CN 105183457 B CN105183457 B CN 105183457B
Authority
CN
China
Prior art keywords
subclass
interface
application plug
variable
plug
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201510498109.7A
Other languages
Chinese (zh)
Other versions
CN105183457A (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 Kingsoft Internet Security Software Co Ltd
Original Assignee
Beijing Kingsoft Internet Security Software 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 Kingsoft Internet Security Software Co Ltd filed Critical Beijing Kingsoft Internet Security Software Co Ltd
Priority to CN201510498109.7A priority Critical patent/CN105183457B/en
Publication of CN105183457A publication Critical patent/CN105183457A/en
Application granted granted Critical
Publication of CN105183457B publication Critical patent/CN105183457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the invention discloses a method and a device for monitoring interface life cycle callback. The method comprises the following steps: after an application program plug-in requests to start an interface successfully, creating a subclass, wherein the subclass inherits an interface thread instance of the application program plug-in; rewriting the interface thread instance of the application program plug-in, and adding logic for monitoring the life cycle callback of the application program plug-in into the rewriting method; creating an instance of the subclass according to a rewriting method, and replacing a preset variable in the application program plug-in by using the instance of the subclass; and calling an interface thread instance of the application program plug-in, and enabling the interface thread instance to call the method of the interface through the method in the subclass instance. By applying the method and the device, the workload of an access developer can be reduced, and the success rate of the application program plug-in access can be improved.

Description

A kind of method and device for monitoring life cycle of interface readjustment
Technical field
The present invention relates to computer communication technology more particularly to a kind of methods and dress for monitoring life cycle of interface readjustment It sets, which can be Activity.
Background technology
Currently, Android operation system, which can be Android operation system, with its it is easy to operate and Conveniently characteristic is increasingly received by user, has been widely used in the work and life of user.Activity is One of common four big component in Android operation system, an Activity is an application component, provides a screen Curtain, user can be by the screen of offer, for being interacted with application program to complete a certain task.Activity is gathered around there are four types of base This state, each state can possess the life cycle of oneself, and life cycle that can be by onXXX methods in Activity is sent out Application plug logic is adjusted back when changing.
Application plug is operate in the plug-in unit in the application program in Android operation system, for for using journey Sequence accesses additional function, due to application plug may be carried out in the specific life cycle scene of Activity it is specific Action or logic, thus, application plug make manufacturer often require that the part life cycle in Activity, such as The logic for monitoring life cycle of interface readjustment is added in onXXX methods in Activity.For example, application plug needs Initialization logic is executed when interface creating, it is then desired to which the generation of application plug initialization is added in onCreate methods Code logic.
But it cannot know that access developer needs to write or be arranged since application plug makes manufacturer Activity quantity, and, the title for the Activity that access developer writes, thus.It cannot be in advance in onCreate methods The code logic of the middle Activity initialization that respective numbers are added, can only make corresponding interface, then by accessing document Inform that access developer in the specified life cycle of Activity, needs the specified interface for calling application plug to provide. When accessing developer's access application plug, the access document according to offer is needed, custom logic is voluntarily write, is worked Amount is big, and the cost for accessing plug-in unit is higher.
Invention content
In view of this, the embodiment of the present invention provides a kind of method and device of monitoring life cycle of interface readjustment, solve to connect Enter developer's heavy workload and the low success rate of technical problem of application plug access.
In order to achieve the above objectives, the embodiment of the present invention adopts the following technical scheme that:
On the one hand, the embodiment of the present invention provides a kind of method of monitoring life cycle of interface readjustment, including:
After application plug request startup interface success, a subclass is created, the subclass inherits the application program The interface thread instance of plug-in unit;
The method for rewriteeing the interface thread instance of the application plug, and application program is added in the method for rewriting Plug-in unit monitors the logic of life cycle callback;
The example that the subclass is created according to the method rewritten is replaced the application program using the example of the subclass and is inserted Pre-set variable in part;
The interface thread instance of the application plug is called, and the interface thread instance is made to pass through the subclass The method at the method call interface in example.
The method provided in an embodiment of the present invention for monitoring life cycle of interface readjustment passes through wound after startup interface success A succession is built in the subclass of the interface thread instance of application plug, in subclass, rewrites the parting line of application plug The method of journey example, and application plug is added in the method for rewriting and needs to monitor the logic of life cycle callback, it generates The example of subclass replaces pre-set variable in application program using the example of subclass.In this way, by by application plug The logic for monitoring life cycle callback is needed to be added in method so that access developer foundation need not access document again, Application plug is added in method to need to monitor the logic of life cycle callback, effectively reduces the work of access developer Amount, and improve the success rate of application plug access.
On the other hand, the embodiment of the present invention provides a kind of device of monitoring life cycle of interface readjustment, including:Subclass creates Module, rewriting module, replacement module and calling module, wherein
Subclass creation module creates a subclass, the subclass is inherited after application plug request startup interface success The interface thread instance of the application plug;
Rewriting module, the method for the interface thread instance for rewriteeing the application plug, and in the method for rewriting The middle application plug that is added needs to monitor the logic of life cycle callback;
Replacement module, the example for creating the subclass according to the method rewritten are replaced using the example of the subclass Pre-set variable in the application plug;
Calling module, the interface thread instance for calling the application plug, and make the interface thread instance Pass through the method at the method call interface in the example of the subclass.
It is provided in an embodiment of the present invention monitor life cycle of interface readjustment device, subclass creation module startup interface at After work(, creates one and inherit in the subclass of the interface thread instance of application plug, rewriting module rewrites in subclass and applies journey The method of the interface thread instance of sequence plug-in unit, and application plug is added in the method for rewriting and needs to monitor life cycle time The logic of tune generates the example of subclass, and replacement module replaces the variable of the interface thread instance of application program using subclass example, The method that calling module calls the method call interface of the interface thread instance of application plug.In this way, by the way that journey will be applied Sequence plug-in unit needs the logic for monitoring life cycle callback to be added in method so that access developer need not be again according to access text Application plug is added in method and needs to monitor the logic of life cycle callback, effectively reduces access developer's for shelves Workload, and improve the success rate of application plug access.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is the method overall procedure schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment;
Fig. 2 is the method flow schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment;
Fig. 3 is the apparatus structure schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment.
Specific implementation mode
The embodiment of the present invention is described in detail below in conjunction with the accompanying drawings.
It will be appreciated that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base Embodiment in the present invention, those of ordinary skill in the art obtained without creative efforts it is all its Its embodiment, shall fall within the protection scope of the present invention.
Fig. 1 is the method overall procedure schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment.It, should referring to Fig. 1 Flow includes:
Step 01, after application plug request startup interface success, a subclass is created, is answered described in the subclass succession With the interface thread instance of view plug-ins;
In this step, which can be ActivityThread.
Step 02, the method for rewriteeing the interface thread instance of the application plug, and be added in the method for rewriting Application plug monitors the logic of life cycle callback;
Step 03, the method according to rewriting creates the example of the subclass, is answered described in the example replacement using the subclass With pre-set variable in view plug-ins;
Step 04, the interface thread instance of the application plug is called, and the interface thread instance is made to pass through institute The method for stating the method call interface in the example of subclass.
In the embodiment of the present invention, the subclass inherits the means class in the interface thread instance of the application plug, The means class can be Instrumentation.
In the embodiment of the present invention, the method for the interface thread instance of the application plug includes:
Handle interfacial process in the means class of the interface thread instance of the application plug, the handle interface can be with It is handleActivity.
In the embodiment of the present invention, the variable is the in the means class of the interface thread instance of the application plug Proficiency segment variable, the method further includes:
The first-hand segment variable of the interface thread instance of the application plug is preserved, which can be mInstrumentation。
In the embodiment of the present invention, the example using the subclass is replaced pre-set in the application plug Variable includes:
Analysis system source code, using reflex mechanism, by the first-hand segment variable of the interface thread instance of application plug The subclass example is replaced with, the first-hand segment variable is located in the first main thread variable, which can be MMainThread, the first main thread variable are located in the first package informatin variable, which can be MPackageInfo, the first package informatin variable are located in first foundation variable, and the first foundation variable is located at the hand In section class, which can be mBase.
Fig. 2 is the method flow schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment.Referring to Fig. 2, this method Including:
Step 101, setting application plug request Android operation system startup interface success after, create one inherit in The subclass of the means class of the interface thread instance of the application plug;
In this step, when starting the Activity of application plug, every Activity needs The information that the Activity is registered in AndroidManifest.xml files is led to when application plug starts Activity The request for being sent to android operating systems and starting the Activity is crossed, it is right after android operating systems receive the request Request start Activity carry out it is a series of examine its legitimacy operation, including judge the Activity whether It is registered in AndroidManifest.xml files, if legitimacy verifies pass through, Activity can be started.Wherein, AndroidManifest.xml files are authority applications important in Android operation system and define configuration file, programmer It needs to pre-define to Android operation system by the AndroidManifest.xml files in exploitation and application is answered Required permission is run with view plug-ins.
In the embodiment of the present invention, application plug is after request android os startings Activity successes, table Show that the life cycle of Activity has started.Wherein, each life cycle corresponds to an Activity states, Activity state packets It includes:Creation state (onCreate methods), starting state (onStart methods) restart state (onRestart methods), are aobvious Show (operation) state (onResume methods), halted state (onPause methods), halted state (onStop methods) and destroys State (onDestory methods).
When application plug calls an Activity to carry out onCreate methods for the first time;
OnStart methods will be called when Activity is in visible state;
OnResume methods will be called when Activity can obtain user focus;
The Activity is re-called when Activity does not have destroyed will call onRestart methods;
OnPause methods will be called when Activity is blocked;
OnStop methods will be called when Activity is in invisible mode;
OnDestory methods can be called when Activity is destroyed.
After the life cycle of Activity starts, Android operation system passes through in (android) application plug Unique ActivityThread examples call the onXXX methods of Activity specified logic is added.Wherein,
ActivityThread examples pass through the handleActivityOnXXX methods in mInstrumentation variables (including handleActivityOnCreate methods and handleActivityOnResume methods) calls Activity's OnXXX methods, in the prior art, access developer can in the onXXX methods of Activity custom logic, to monitor The life cycle of Activity monitors the logic of each life cycle callback of Activity, to add when onXXX is called Enter the logic that application plug manufacturer specifies.That is, calling the onXXX of Activity in Android operation system Before method, Android operation system can be called first in the mInstrumentation variables of ActivityThread examples HandleActivityOnXXX methods.Thus, in the embodiment of the present invention, in order to reduce the workload of access developer so that Application plug need not be added in onXXX methods and need to monitor the logic of life cycle callback by access developer, consider The logic for monitoring life cycle callback is needed to be added in handleActivityOnXXX methods application plug.In this way, By monitoring the life cycle of Activity in handleActivityOnXXX methods, that is, monitor each life of Activity The logic that application plug manufacturer specifies can be added before onXXX methods are called, can make for the readjustment in life stage Obtain the addition that application plug access developer is detectable logic so that plug-in unit, which accesses developer, to be concerned about in onXXX The interface for calling which application plug specified is needed in method, it is only necessary to the code of oneself is usually write, to greatly Degree reduces the cost (workload for writing code logic) that application plug access developer accesses application plug, carries Rise the success rate of application plug access.
In the embodiment of the present invention, variable be machine word call the turn can store result of calculation or can expression value abstract concept, become Amount can be accessed by variable name.
Since handleActivityOnCreate methods (one of handleActivityOnXXX methods) are The method of mInstrumentation variables in ActivityThread examples, thus, in the embodiment of the present invention, first have to replace MInstrumentation variables.
In the embodiment of the present invention, since mInstrumentation variables are the examples of Instrumentation classes, because And one is created first and is inherited in the son of the Instrumentation classes of the ActivityThread examples of the application plug Class.
As an alternative embodiment, which can be named as CustoInstrumentation.
Further, this method can also include:
Preserve the mInstrumentation variables of the ActivityThread examples of the application plug with Activity is replaced after exiting.
Step 102, the interface handle method in the means class of the interface thread instance of the application plug is rewritten, and Application plug is added in the interface handle method of rewriting to need to monitor the logic of life cycle callback;
In this step, interface handle method can be handleActivityOnXXX methods.Rewriting be when subclass after A parent is held, and when the title of the method in the method and parent in the subclass, number of parameters, type are all completely the same, just claim Method in the subclass has rewritten the method in parent.It is to call son when the method that calling subclass is inherited and rewritten from parent The realization of class calls parent to realize when the method called subclass to be inherited from parent and do not rewritten.
In the embodiment of the present invention, application plug manufacturer monitors life cycle time by needing application plug The logic of tune is added in handleActivityOnXXX methods so that and access developer foundation need not access document again, Application plug is added in onXXX methods to need to monitor the logic of life cycle callback, in this way, realizing in onXXX methods Application plug is added before called to need to monitor the logic of life cycle callback so that (application plug) access is opened Originator need not be concerned about the interface for needing to call which application plug specified in onXXX methods, avoid access developer Forget that scheduled logic is added in a certain specified life cycle in onXXX methods, alternatively, in a certain scheduled life cycle There is mistake in the middle scheduled logic of addition, to cause access developer to access the situation of application plug failure, also effectively Reduce the workload of access developer.
In the embodiment of the present invention, application plug needs the logic for monitoring life cycle callback can be according to actual needs Self-defined setting is carried out, for example, for DST PLAYER plug-in unit, needs to monitor life cycle callback in application plug In logic, when can be defined on user and being switched to another application view plug-ins, pause video simultaneously stops network connection, and works as user When switching back into DST PLAYER plug-in unit, network is reconnected, and the point suspended before user continues to play.
Step 103, the example that the subclass is created according to the interface handle method rewritten, obtains subclass example, utilizes institute State the first-hand segment variable that subclass example replaces the interface thread instance of the application plug;
In this step, by the subclass of reflex mechanism load structure, and the subclass of the structure is instantiated and generates subclass Example.I.e. by rewriteeing the handleActivityOnXXX methods in Instrumentation classes, and create CustomInstrumentation examples (subclass example) are replaced using CustomInstrumentation examples The mInstrumentation variables of ActivityThread examples, due to having rewritten in Instrumentation classes The handleActivityOnXXX methods of mInstrumentation variables, thus, in CustomInstrumentation realities In all methods of example, corresponding handleActivityOnXXX methods in mInstrumentation variables can be called, from And it can ensure the normal operation of application program.
In the embodiment of the present invention, as an alternative embodiment, the application plug is replaced using the subclass example The mInstrumentation variables of ActivityThread examples include:
Android operating system source codes are analyzed, it is using reflex mechanism, the ActivityThread of application plug is real The mInstrumentation variable replacements of mMainThread variables of the mPackageInfo variables of the mBase variables of example are Subclass (CustomInstrumentation) example.
In this step, preferably, using JAVA reflex mechanisms, certainly, in practical application, can also use can complete this Other reflex mechanisms of function.JAVA reflex mechanisms are the functions of dynamic access information and the method for dynamic call object, i.e., In operating status, for any one class, such all properties and method can be known;For any one object, Its any one method and attribute can be called.Wherein, class is the organization unit of JAVA programs, any JAVA sentences, It will write in class file.
Step 104, it triggers the Android operation system and calls the interface thread instance of the application plug, and make institute State method of the interface thread instance by the interface handle method call interface in the subclass example.
In this step, handleActivityOnXXX methods include handleActivityOnCreate methods and HandleActivityOnResume methods.
In the embodiment of the present invention, pass through in the subclass example in ActivityThread examples The operating process executed after the onXXX methods of handleActivityOnXXX method calls Activity is known technology, This omits detailed description.
In the embodiment of the present invention, by the way that application plug is added in the handleActivityOnXXX methods of rewriting The logic of monitoring life cycle callback is needed, monitoring the method flow of life cycle of interface readjustment becomes:
ActivityThread- > CustomInstrumentation example-> hanldeActivityOnXXX methods- (i.e. application plug needs to monitor the logic of life cycle callback > application plugs logic, saturating to access developer It is bright)-> onXXX methods.And the existing method flow for monitoring life cycle of interface readjustment is:
ActivityThread- > mInstrumentation variable-> handleActivityOnXXX methods-> OnXXX method-> application plugs logic (i.e. application plug needs to monitor the logic of life cycle callback).
As an alternative embodiment, this method can further include:
After Activity is exited, using reflex mechanism, the application plug of preservation is utilized Subclass example described in the mInstrumentation variable replacements of ActivityThread examples.
In the embodiment of the present invention, the ActivityThread examples of the application program are replaced using the subclass example After mInstrumentation variables, ActivityThread examples call in mInstrumentation variables therein When handleActivityOnXXX methods, since mInstrumentation variables have been replaced by CustomInstrumentation examples are equivalent to android operating systems and are calling handleActivityOnXXX methods When it is intercepted, after intercepting android operating systems and calling handleActivityOnXXX methods, android operating systems Triggering calls the step of handleActivityOnXXX methods to go to execute original flow to mInstrumentation variables Between step, application plug logic is added, i.e., before the onXXX methods of Activity, application plug makes factory Quotient (manufacturer) is successfully completed oneself specified logic, and application plug access developer fails aware application and inserts The addition of part logic.Simultaneously as the CustomInstrumentation examples generated have rewritten mInstrumentation changes HandleActivityOnXXX methods in amount, in the method for CustomInstrumentation examples, all by HandleActivityOnXXX methods in mInstrumentation variables go to handle, that is, execute original flow, Ke Yibao Demonstrate,prove the normal operation of application plug.Thus when application plug needs that code is added in onXXX methods, using anti- Mechanism modification android operating system source codes are penetrated, by the way that application plug is added in handleActivityOnXXX methods Logic (application plug needs to monitor the logic of life cycle callback), creates more efficient more convenient scheme and goes to solve The scheme for monitoring life cycle, can be added logical code in the case where accessing developer's unaware, without by accessing text Shelves go to tell access developer, to reduce the learning cost of access developer, promote the success rate of application plug access.
Fig. 3 is the apparatus structure schematic diagram that the embodiment of the present invention monitors life cycle of interface readjustment.Referring to Fig. 3, the device Including:Subclass creation module 201, rewriting module 202, replacement module 203 and calling module 204, wherein
Subclass creation module 201 creates a subclass, the subclass after application plug request startup interface success Inherit the interface thread instance of the application plug;
In the embodiment of the present invention, as an alternative embodiment, subclass creation module 201 is asked in application plug After the Activity successes of android os startings, creates one and inherit in the application plug The subclass of the Instrumentation classes of ActivityThread examples.
Rewriting module 202, the method for the interface thread instance for rewriteeing the application plug, and in the side of rewriting Application plug is added in method to need to monitor the logic of life cycle callback;
In the embodiment of the present invention, as an alternative embodiment, rewriting module 202 rewrites the application plug HandleActivityOnXXX methods in the Instrumentation classes of ActivityThread examples, and in rewriting Application plug is added in handleActivityOnXXX methods to need to monitor the logic of life cycle callback;
In the embodiment of the present invention, handleActivityOnXXX methods include handleActivityOnCreate methods And handleActivityOnResume methods.
Replacement module 203, the example for creating the subclass according to the method rewritten, is replaced using the example of the subclass Change pre-set variable in the application plug;
In the embodiment of the present invention, as an alternative embodiment, replacement module 203 is according to rewriting HandleActivityOnXXX methods create the example of the subclass, obtain subclass example, and institute is replaced using the subclass example State the mInstrumentation variables of the ActivityThread examples of application plug;
Calling module 204, the interface thread instance for calling the application plug, and keep the interface thread real The method that example passes through the method call interface in the example of the subclass.
In the embodiment of the present invention, as an alternative embodiment, calling module 204 triggers the android operating systems tune With the ActivityThread examples of the application plug, and the ActivityThread examples is made to pass through the subclass The onXXX methods of handleActivityOnXXX method calls Activity in example.
In the embodiment of the present invention, onXXX methods include:OnCreate methods, onStart methods, onRestart methods, OnResume methods, onPause methods, onStop methods and onDestory methods.
In the embodiment of the present invention, as an alternative embodiment, replacement module 203 includes:Subclass example generation unit, analysis Unit and replacement unit (not shown), wherein
Subclass example generation unit, the example for creating the subclass according to the method rewritten;
In the embodiment of the present invention, as an alternative embodiment, subclass example generation unit is according to rewriting HandleActivityOnXXX methods create the example of the subclass, obtain subclass example.
Analytic unit is used for analysis system source code, the source code for the view plug-ins that are applied;
In the embodiment of the present invention, as an alternative embodiment, analytic unit is used to analyze android operating system source codes, Be applied the source codes of view plug-ins;
Replacement unit, for using reflex mechanism, by first of the interface thread instance in the source code of application plug Means variable replacement is the subclass example, and the first-hand segment variable is located in the first main thread variable, first main line Cheng Bianliang is located in the first package informatin variable, and the first package informatin variable is located in first foundation variable, the first foundation Variable is located in the means class.
In the embodiment of the present invention, as an alternative embodiment, replacement unit uses reflex mechanism, by application plug The mMainThread variables of the mPackageInfo variables of the mBase variables of ActivityThread examples in source code MInstrumentation variable replacements are the subclass example.
In the embodiment of the present invention, the reflex mechanism includes but not limited to JAVA reflex mechanisms.
As another alternative embodiment, which can further include:Variable storage module 205 and variable restore Module 206, wherein
Variable storage module 205, the ActivityThread examples for preserving the application plug MInstrumentation variables;
Variable recovery module 206, for after Activity is exited, using reflex mechanism, utilizing the application of preservation Subclass example described in the mInstrumentation variable replacements of the ActivityThread examples of view plug-ins.
One of ordinary skill in the art will appreciate that realizing all or part of flow in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the program can be stored in a computer read/write memory medium In, the program is when being executed, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access Memory, RAM) etc..
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any Those familiar with the art in the technical scope disclosed by the present invention, all answer by the change or replacement that can be readily occurred in It is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (16)

1. a kind of method for monitoring life cycle of interface readjustment, which is characterized in that this method includes:
After application plug request startup interface success, a subclass is created, the subclass inherits the application plug Interface thread instance;
The method for rewriteeing the interface thread instance of the application plug, and application plug is added in the method for rewriting Monitor the logic of life cycle callback;
The example that the subclass is created according to the method rewritten is replaced using the example of the subclass in the application plug Pre-set variable;
The interface thread instance of the application plug is called, and makes example of the interface thread instance by the subclass In method call interface method.
2. according to the method described in claim 1, it is characterized in that, the subclass inherits the parting line of the application plug Means class in journey example.
3. according to the method described in claim 1, it is characterized in that, the method for the interface thread instance of the application plug Including:
Handle interfacial process in the means class of the interface thread instance of the application plug.
4. according to the method described in claim 1, it is characterized in that, the variable is the interface thread of the application plug First-hand segment variable in the means class of example, the method further includes:
Preserve the first-hand segment variable of the interface thread instance of the application plug.
5. according to the method described in claim 4, it is characterized in that, the example replacement using the subclass is described to apply journey Pre-set variable includes in sequence plug-in unit:
Analysis system source code is replaced the first-hand segment variable of the interface thread instance of application plug using reflex mechanism For the subclass example, the first-hand segment variable is located in the first main thread variable, and the first main thread variable is located at the In one package informatin variable, the first package informatin variable is located in first foundation variable, and the first foundation variable is located at described In means class.
6. according to the method described in claim 5, it is characterized in that, the reflex mechanism includes java reflex mechanisms.
7. according to the method described in claim 4, it is characterized in that, the method further includes:
After interface is exited, using reflex mechanism, the first of the interface thread instance of the application plug of preservation is utilized The example of subclass described in means variable replacement.
8. according to the method described in claim 3, it is characterized in that, the handle interfacial process includes handle interface creating method And handle interface rebooting method.
9. a kind of device for monitoring life cycle of interface readjustment, which is characterized in that the device includes:Subclass creation module is rewritten Module, replacement module and calling module, wherein
Subclass creation module creates a subclass after application plug request startup interface success, described in the subclass is inherited The interface thread instance of application plug;
Rewriting module, the method for the interface thread instance for rewriteeing the application plug, and add in the method for rewriting Enter application plug to need to monitor the logic of life cycle callback;
Replacement module, the method for foundation rewriting create the example of the subclass, described in the example replacement using the subclass Pre-set variable in application plug;
Calling module, the interface thread instance for calling the application plug, and the interface thread instance is made to pass through The method at the method call interface in the example of the subclass.
10. device according to claim 9, which is characterized in that the subclass inherits the interface of the application plug Means class in thread instance.
11. device according to claim 10, which is characterized in that the replacement module includes:Subclass example generation unit, Analytic unit and replacement unit, wherein
Subclass example generation unit, the example for creating the subclass according to the method rewritten;
Analytic unit is used for analysis system source code, the source code for the view plug-ins that are applied;
Replacement unit, for using reflex mechanism, by the first means of the interface thread instance in the source code of application plug Variable replacement is the subclass example, and the first-hand segment variable is located in the first main thread variable, and first main thread becomes Amount is located in the first package informatin variable, and the first package informatin variable is located in first foundation variable, the first foundation variable In the means class.
12. device according to claim 9, which is characterized in that the side of the interface thread instance of the application plug Method includes:
Handle interfacial process in the means class of the interface thread instance of the application plug.
13. device according to claim 9, which is characterized in that described device further comprises:
Variable storage module, the first-hand segment variable of the interface thread instance for preserving the application plug.
14. according to the devices described in claim 11, which is characterized in that the reflex mechanism includes jaVa reflex mechanisms.
15. device according to claim 13, which is characterized in that described device further comprises:
Variable recovery module, for after interface is exited, using reflex mechanism, utilizing the boundary of the application plug of preservation The first-hand segment variable of face thread instance replaces the subclass example.
16. device according to claim 12, which is characterized in that the handle interfacial process includes handle interface creating side Method and handle interface rebooting method.
CN201510498109.7A 2015-08-13 2015-08-13 Method and device for monitoring interface life cycle callback Active CN105183457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510498109.7A CN105183457B (en) 2015-08-13 2015-08-13 Method and device for monitoring interface life cycle callback

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510498109.7A CN105183457B (en) 2015-08-13 2015-08-13 Method and device for monitoring interface life cycle callback

Publications (2)

Publication Number Publication Date
CN105183457A CN105183457A (en) 2015-12-23
CN105183457B true CN105183457B (en) 2018-11-06

Family

ID=54905556

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510498109.7A Active CN105183457B (en) 2015-08-13 2015-08-13 Method and device for monitoring interface life cycle callback

Country Status (1)

Country Link
CN (1) CN105183457B (en)

Families Citing this family (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106909408B (en) * 2015-12-23 2020-09-11 北京奇虎科技有限公司 Method and device for calling APK plug-in of application program
CN106250165A (en) * 2016-06-12 2016-12-21 杭州无量网络科技有限公司 Application component management method and system
CN106371977A (en) * 2016-09-02 2017-02-01 中科信息安全共性技术国家工程研究中心有限公司 Method for detecting whether current application positioned on foreground or not
CN106817373A (en) * 2017-01-23 2017-06-09 重庆邮电大学 A kind of evidence collecting method towards privately owned cloud platform
CN106844181B (en) * 2017-02-07 2021-02-23 网易(杭州)网络有限公司 Method, system and mobile terminal for recording user behavior
CN107967169A (en) * 2017-11-22 2018-04-27 北京搜狐新媒体信息技术有限公司 Page jump monitor method and device
CN108182131B (en) * 2017-12-13 2021-11-26 东软集团股份有限公司 Method and device for monitoring application running state, storage medium and electronic equipment
CN108563523B (en) * 2018-04-25 2021-06-04 咪咕文化科技有限公司 Information callback method, equipment and storage medium
CN111290818B (en) * 2020-01-23 2023-07-25 网易传媒科技(北京)有限公司 Operation method for creating application program and operation method for application program
CN113760396A (en) * 2020-07-01 2021-12-07 北京沃东天骏信息技术有限公司 Application running method and device, electronic equipment and storage medium
CN116775172B (en) * 2023-08-25 2023-11-03 成都太阳高科技有限责任公司 Method and system for achieving Android data acquisition through reflection
CN117056173B (en) * 2023-10-12 2024-01-30 麒麟软件有限公司 Method for monitoring android application life cycle on Web operating system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530156A (en) * 2013-10-17 2014-01-22 北京奇虎科技有限公司 Method and device for dynamically loading and calling program
CN103744669A (en) * 2013-12-26 2014-04-23 世纪龙信息网络有限责任公司 Method and system for creation and calling of Android system Activity plug-ins
CN104375861A (en) * 2014-11-04 2015-02-25 北京奇虎科技有限公司 Installation-free operation method and device for application programs based on Android platform and terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103530156A (en) * 2013-10-17 2014-01-22 北京奇虎科技有限公司 Method and device for dynamically loading and calling program
CN103744669A (en) * 2013-12-26 2014-04-23 世纪龙信息网络有限责任公司 Method and system for creation and calling of Android system Activity plug-ins
CN104375861A (en) * 2014-11-04 2015-02-25 北京奇虎科技有限公司 Installation-free operation method and device for application programs based on Android platform and terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"使用反射技术在Android平台上实现本进程内Activity切换时的拦截";passion;《blog.csdn.net/passion/article/details/27118493》;20140526;1-7 *

Also Published As

Publication number Publication date
CN105183457A (en) 2015-12-23

Similar Documents

Publication Publication Date Title
CN105183457B (en) Method and device for monitoring interface life cycle callback
Müller et al. {TRESOR} Runs Encryption Securely Outside {RAM}
US9003239B2 (en) Monitoring and resolving deadlocks, contention, runaway CPU and other virtual machine production issues
US20060010422A1 (en) Common user interface development toolkit for a system administration program
JP2007316637A (en) Screensaver for individual application program
WO2011025668A1 (en) Method and system for monitoring usage of computing resources
Saltaformaggio et al. Screen after Previous Screens:{Spatial-Temporal} Recreation of Android App Displays from Memory Images
CN112612988A (en) Page processing method and device, computer equipment and storage medium
CN105404547A (en) Fusion method and device of operating system
CN110619227A (en) Audit log management method, device, equipment and readable storage medium
CN105159712B (en) Interface starting method and device
CN104487935A (en) Recording external processes
CN101645004A (en) Method for window display
CN116346728A (en) Low code platform current limiting method and device
CN114996955A (en) Target range environment construction method and device for cloud-originated chaotic engineering experiment
CN109783156B (en) Application starting control method and device
CN111026452B (en) Method and system for remote 32-bit process injection of 64-bit process
CN114238934A (en) Equipment information acquisition method, device, equipment and medium
CN113613044A (en) Video playing method and device, storage medium and electronic equipment
CN112650959A (en) Page loading duration statistical method, device, equipment and storage medium
CN104112097A (en) Information processing method and electronic equipment
CN111600742B (en) Method and system for dynamically switching main monitor of distributed storage system
US20190197235A1 (en) Server and setting method thereof
US20170249473A1 (en) Method for managing permission policy of application in an electronic terminal
Boyd et al. Injecting Distributed Capabilities into Legacy Applications Through Cloning and Virtualization.

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant