CN105159712B - Interface starting method and device - Google Patents
Interface starting method and device Download PDFInfo
- Publication number
- CN105159712B CN105159712B CN201510552061.3A CN201510552061A CN105159712B CN 105159712 B CN105159712 B CN 105159712B CN 201510552061 A CN201510552061 A CN 201510552061A CN 105159712 B CN105159712 B CN 105159712B
- Authority
- CN
- China
- Prior art keywords
- activity
- variable
- class name
- represented
- class
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 93
- 230000000694 effects Effects 0.000 claims abstract description 265
- 230000007246 mechanism Effects 0.000 claims description 18
- 230000004044 response Effects 0.000 claims description 12
- 238000004458 analytical method Methods 0.000 claims description 6
- 238000012544 monitoring process Methods 0.000 claims description 4
- 230000001960 triggered effect Effects 0.000 claims description 4
- 238000012795 verification Methods 0.000 description 12
- 230000008569 process Effects 0.000 description 8
- 230000000977 initiatory effect Effects 0.000 description 7
- 238000011161 development Methods 0.000 description 6
- 238000005516 engineering process Methods 0.000 description 5
- 238000010586 diagram Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000004913 activation Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000007689 inspection Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Stored Programmes (AREA)
Abstract
The embodiment of the invention discloses a method and a device for starting an interface. The method comprises the following steps: when a first interface ActivitV is started, a starting request sent to a system is obtained, wherein the starting request comprises an Intent class written in the class name of the first ActivitV, and the class name of the first ActivitV is expressed by a variable; modifying the variable represented by the class name of the first Activity in the starting request into a variable represented by the class name of a second ActivitV; sending the modified launch request to a system to launch the first ActivitV. By applying the invention, the workload of compiling the interface code can be reduced.
Description
Technical Field
The invention relates to a computer communication technology, in particular to a method and a device for starting an interface (Activity).
Background
At present, an Android (Android) operating system is more and more accepted by users due to the characteristics of simple operation, convenience and quickness, and is generally applied to the work and life of the users. The interface (Activity) is one of the most basic and most common components in Android operating system based applications. An Activity is an application component that provides a screen through which a user can interact with an application to perform a task.
According to the design standard of Android development, each Activity needs to register the Activity information in an Android manifest xml file, when an application starts the Activity, a request for starting the Activity is sent to an Android operating system, after the Android operating system receives the request, the Android operating system carries out a series of operations for checking the legality of the Activity which is requested to be started, wherein the operations comprise judging whether the Activity is registered in the Android manifest xml file, and if the legality passes the verification, the Activity can be started. However, the method for starting Activity needs to register the Activity information in the android manifest.
To solve the above problem, the prior art proposes an improved method for initiating Activity, that is, initiating unregistered Activity through proxy Activity. Specifically, an Activity, called ActivityA, is registered in an Android manifest xml file, and an unregistered ActivityB bound to ActivityA is called in each link of the ActivityA called back by the Android operating system, and when the unregistered ActivityB requests an Android operating system service, the Android operating system can be requested by calling a method of the registered ActivityA, that is, the ActivityB has a function owned by the registered Activity to some extent through the binding with ActivityA.
Although the problem that the activityB must be registered in the android manifest xml file can be solved, the binding interface code between the activityA and the activityB needs to be written, the workload of writing the binding interface code is increased, and the learning cost of using the binding interface technology is increased.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for starting an interface, so as to reduce the workload of writing interface codes.
In order to achieve the above purpose, the embodiment of the invention adopts the following technical scheme:
in one aspect, an embodiment of the present invention provides a method for starting an interface, including:
when a first interface Activity is started, a starting request sent to a system is obtained, wherein the starting request comprises an Intent class written in the class name of the first Activity, and the class name of the first Activity is represented by a variable;
modifying the variable represented by the class name of the first Activity in the starting request into a variable represented by the class name of a second Activity;
sending the modified starting request to a system to start the first Activity.
In the method for starting the interface provided by the embodiment of the invention, the variable represented by the class name of the first Activity in the starting request is replaced by the variable represented by the class name of the second Activity, and the modified starting request is sent to the system to start the first Activity. Therefore, only one Activity needs to be registered in the android manifest xml file, other unregistered activities can be normally started through a twice replacement method, all Activity registration information does not need to be maintained, binding interface codes of the registered activities and the unregistered activities do not need to be written, workload and development cost for writing the binding interface codes and the interface codes are reduced, and Activity starting efficiency is high.
In another aspect, an embodiment of the present invention provides an interface starting apparatus, including: a start request interception module, a variable replacement check module and a variable replacement start module, wherein,
the system comprises a starting request intercepting module, a starting request intercepting module and a starting module, wherein the starting request intercepting module is used for acquiring a starting request sent to a system when a first interface Activity is started, the starting request comprises an Intent class written in a class name of the first Activity, and the class name of the first Activity is expressed by a variable;
a variable replacement check module, configured to modify the variable indicated by the class name of the first Activity in the start request to a variable indicated by the class name of a second Activity;
and the variable replacement starting module is used for sending the modified starting request to a system to start the first Activity.
In the interface starting device provided in the embodiment of the present invention, when a first interface Activity is started, a start request intercepting module obtains a start request sent to a system, where the start request includes an Intent class written in a class name of the first Activity, the class name of the first Activity is represented by a variable, a variable replacement and verification module modifies the variable represented by the class name of the first Activity in the start request to a variable represented by a class name of a second Activity, and a variable replacement and start module sends the modified start request to the system to start the first Activity. Therefore, only one Activity needs to be registered in the android manifest xml file, other unregistered activities can be normally started through a twice replacement method, all Activity registration information does not need to be maintained, binding interface codes of the registered activities and the unregistered activities do not need to be written, workload and development cost for writing the binding interface codes and the interface codes are reduced, and Activity starting efficiency is high.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flowchart of an embodiment of a method for starting an interface;
FIG. 2 is a schematic view of a specific flowchart of a method for starting an interface according to an embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an apparatus for starting an interface according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a device for starting an interface according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 1 is a schematic general flowchart of a method for starting an interface according to an embodiment of the present invention. Referring to fig. 1, the process includes:
step 11, when a first interface Activity is started, acquiring a starting request sent to a system, wherein the starting request comprises an Intent class written in a class name of the first Activity, and the class name of the first Activity is represented by a variable;
in this step, the first Activity is an unregistered Activity, and the second Activity is a registered Activity.
Step 12, modifying the variable represented by the class name of the first Activity in the starting request into a variable represented by the class name of a second Activity;
in this step, the modifying the variable represented by the class name of the first Activity to the variable represented by the class name of the second Activity in the start request includes:
analyzing the source code of the android operating system, and replacing the mInstruction variable of the mMainThread variable of the mBase variable in the Application class with the class name of the first Activity by adopting a reflection mechanism.
In an embodiment of the present invention, after modifying the variable represented by the class name of the second Activity, the method further includes:
the class name of the first Activity represented by the mInstruction variable is saved.
In the embodiment of the present invention, as an optional embodiment, the start request is implemented by an executstartactivity method in an mis instrumentation variable.
After the modifying the variable represented by the class name of the first Activity in the launch request to a variable represented by the class name of a second Activity, the method further comprises:
setting a parent class of the variable represented by the class name of the second Activity to be the same as the variable represented by the class name of the first Activity.
And step 13, sending the modified starting request to a system to start the first Activity.
In this step, the sending the modified initiation request to the system to initiate the first Activity includes:
sending the modified starting request to a system for validity check, intercepting a received starting request response passing the validity check, and replacing a variable represented by the class name of the second Activity in the starting request response with a variable represented by the class name of the first Activity, so that an application program generates an instance of the first Activity according to the replaced variable to start the first Activity.
Fig. 2 is a schematic flowchart of a method for starting an interface according to an embodiment of the present invention. Referring to FIG. 2, take the first Activity as an unregistered Activity and the second Activity as a registered Activity as an example. The method comprises the following steps:
step 101, intercepting a start request sent by an application program when an unregistered Activity is started, wherein the start request comprises an Intent class written in a class name of the unregistered Activity, and the class name of the unregistered Activity is represented by a variable;
in this step, when an application starts an Activity, the class name of the Activity to be started is written into an Intent class, then a start request containing the Intent class is sent to an Android operating system, and after the Android operating system receives the start request, a series of tests are performed on the start request, for example, if the class name of the Activity in the Intent class contained in the start request is not registered in an Android manifest.
As an optional embodiment, after the application program writes the class name of the Activity to be started into the Intent class, and generates the start request, and before the start request is not processed by the Android operating system, the start request is intercepted. For example, the interception may be performed during transmission of the boot request, or may be performed after the boot request reaches the Android operating system but before the boot request is processed by the Android operating system.
In the embodiment of the invention, the variable is an abstract concept which can store a calculation result or can represent a value in a computer language, and the variable can be accessed through a variable name.
In the embodiment of the invention, in the Intent class, the variable is an mInstruction variable. In the Android operating system, the Activity needs to be started by an Intent class. The Intent class is a description of the abstraction of the action to be performed, and when used to launch an Activity, contains information about the Activity to be launched.
In the embodiment of the invention, the unregistered Activity can be started by the application program triggered by the user clicking the icon of the application program, after the user clicks the icon of the application program, the application program project directory Activity is created under the packages/executive directories of the Android source code project, and the generally default application program project directory Activity is defined in src/shy/Luo/Activity/MainActivity.
In the embodiment of the invention, the sending of the start request of the start Activity is finally realized by the exectstartactivity method in the mInstruction variable, so that as an optional embodiment, the start request can be intercepted by monitoring the exectActivity method. The specific way and how to intercept the initiation request is a well-known technique, and the detailed description is omitted here.
Further, the method may further include:
the class name of the unregistered Activity represented by the mInstruction variable is saved.
Step 102, replacing the variable represented by the class name of the unregistered Activity in the starting request with a variable represented by the class name of a registered Activity by using a reflection mechanism, and setting the parent class of the variable represented by the class name of the registered Activity to be the same as the variable represented by the class name of the unregistered Activity so as to pass validity check;
in this step, for the mInstruction variable, since the mInstruction variable is an instance of an Instrumentation class, the set variable represented by the class name of a registered Activity is inherited to the Instrumentation class of the application program, that is, the parent class of the set variable represented by the class name of a registered Activity is the same as the set variable represented by the class name of an unregistered Activity, so that the verification process can be executed by the registered Activity based on the delegation mechanism of Activity verification.
As an alternative embodiment, variables represented by a registered class name of Activity may be referred to as subclasses, which may be referred to as custom instrumentation variables.
In the embodiment of the invention, through the process analysis of the Activity starting of the application program, if the unregistered Activity needs to be started, the Android operating system needs to successfully check the starting request. Thus, in the embodiment of the present invention, it is considered that a first Activity (hereinafter, referred to as "Activity a") is registered in an android manifest xml file, and when an unregistered second Activity (hereinafter, referred to as "Activity b", which may be one or more of them) is started, a class name written to an unregistered Activity in an Intent class (a class name of the second Activity) is replaced with a class name of a registered Activity a (a class name of the first Activity) in a start request, so that Activity a can pass verification since it is registered in an android manifest xml file.
In the embodiment of the present invention, as an optional embodiment, the registered Activity class name information may be obtained by querying the registry information, and a registered Activity class name may be selected from the obtained Activity class name information in a random manner or a non-random manner.
In this embodiment of the present invention, as an optional embodiment, replacing, by using a reflection mechanism, the variable represented by the class name of the unregistered Activity in the activation request with the variable represented by the class name of a registered Activity includes:
analyzing the source code of the android operating system, and replacing an mInstruction variable of an mMainThread variable of an mBase variable in an Application class by a subclass (CustomInstruction) by adopting a reflection mechanism.
In this step, preferably, a JAVA reflection mechanism is adopted, and of course, in practical applications, other reflection mechanisms capable of accomplishing this function may also be adopted. The JAVA reflection mechanism is a function of dynamically acquiring information and dynamically calling methods of objects, that is, in a running state, all attributes and methods of any class can be known; any method and property can be called for any object. The class is an organization unit of the JAVA program, and any JAVA statement is written in the class file.
In the embodiment of the invention, when an Application program starts Activity, an mInstruction variable (the class name of the unregistered Activity to be started) in an mMainThread variable in an mBase variable in an Application class is replaced by a CustomInstruction variable (the class name of the registered Activity) by using a java reflection mechanism, and a parent class of the CustomInstruction variable is set to be the same as the mInstruction variable, so that an Android operating system can normally start the unregistered Activity to be started in a subsequent flow.
In the prior art, sending a start request of start Activity is finally implemented by an exectstartactivity method in an mInstrumentation variable, so as to intercept the start request by monitoring the exectstartactivity method as an alternative embodiment.
Step 103, sending the intercepted updated start request to perform validity check, intercepting the received start request response passing the validity check, and replacing the variable represented by the class name of the registered Activity in the start request response with the variable represented by the class name of the unregistered Activity, so that the application program generates an instance of the unregistered Activity according to the replaced variable to start the unregistered Activity.
In this step, because the reflection mechanism of java is utilized, the mInstruction variable is replaced by the CustomInstruction variable, so that the exectActivity method in the CustomInstruction variable realizes the sending of the start request, and the CustomInstruction variable is the class name of the registered Activity, so the verification of the Android operating system can be passed.
After the Android operating system service completes the inspection and a series of operations of the starting request of the starting Activity, the Activity generating instance is handed back to the application program for processing, namely, handed over to a newActivity method of a custom Instrument variable (the class name of the registered Activity). In the embodiment of the invention, because unregistered Activity needs to be started, the application program needs to generate an unregistered Activity instance, and the application program generates a registered Activity instance according to a starting request response returned by the Android operating system, after the validity of the Android operating system is checked, in order to ensure the normal operation of the unregistered Activity in the application program, the custom Activity variable contained in the starting request response needs to be replaced by the mInstrument variable, so that the newActivity method of the mInstrument variable is used for processing subsequent starting, that is, in the newActivity method of the custom Instrument variable, the newActivity method of the mInstrument variable should be transferred to be processed finally. Specifically, by replacing the mlnstration variable (Activity b) with the custom instrumentation variable (Activity a) to perform the verification, after the Android operating system completes the verification and the series of operations of the start request of Activity (Activity a), the validity of the start Activity (Activity b) has passed, and the instance generating Activity (Activity a) returns to the application to be processed, i.e., realized by the newActivity method of the custom instrumentation variable, since the custom instrumentation variable (Activity a) has been replaced with the custom instrumentation variable (Activity b) after the verification succeeds, the new Activity method of the custom instrumentation variable is actually realized, i.e., in the newActivity method, the target Activity is replaced by the Activity type b, so that the application generates the activation variable according to the replaced Activity, and the entry of the Activity variable by the newActivity method fails.
In the embodiment of the invention, after the unregistered Activity is started, the subsequent execution processes are all known processes, for example, after the application program requests the Android operating system to start the Activity successfully, the application program indicates that the life cycle of the Activity starts. Each lifecycle of Activity corresponds to an Activity state, and the Activity states include: a create state (onCreate method), a start state (onStart method), a restart state (onRestart method), a display (run) state (onResume method), a pause state (onPause method), a stop state (onStop method), and a destroy state (onrestore method). Wherein,
when the application program calls an Activity for the first time, the onCreate method is executed;
the onStart method is invoked when Activity is in the visible state;
the onResume method is called when Activity gets user focus;
recalling an Activity when it is not destroyed invokes the onRestart method;
when Activity is occluded, the onPause method is called;
the onsop method is invoked when Activity is in an invisible state;
the onDestory method is called when Activity is destroyed.
After the lifecycle of Activity begins, the Android operating system calls the onXXX method of Activity through a unique ActivitThread instance on the (Android) application, which may add the specified logic.
As an alternative embodiment, the method may further include:
and step 104, after the unregistered Activity is started successfully, triggering an Android operating system to call an ActivityThread instance of the application program, and enabling the ActivityThread instance to call an onXXX method of the Activity through a handleActivityOnXXX method in the unregistered Activity instance.
In this step, the handleActivityOnXXX method includes a handleActivityOnCreate method and a handleactivityonresult method.
As can be seen from the above description, in the method for starting an interface according to the embodiment of the present invention, the source code of the Android operating system is modified by using the java reflection mechanism, the messagementvariable in the unregistered Activity is replaced with the CustomInstrumentation variable of the registered Activity, and the CustomInstrumentation variable is the class name of the registered Activity, so that the application program can generate the unregistered Activity instance according to the newActivity method of the replaced messagementvariable through the verification of the Android operating system and successfully start the Activity b through the unregistered Activity instance after the validity of the Android operating system is verified. Therefore, only one Activity needs to be registered in the android manifest xml file, and other unregistered activities can be started normally through the method of the embodiment of the invention. That is to say, the method of the embodiment of the present invention enables Activity to be applied to a scene in which Activity is dynamically increased without registering in an android manifest. For example, if the method is applied to a scene of manufacturing the application plug-in, a developer using the application plug-in does not need to maintain all Activity registration information in the application plug-in, and the workload and development cost of the implementation technology are reduced; meanwhile, the learning cost is low by using the embodiment of the invention, the technology is easier to modify and maintain by simplifying the technology implementation logic, and the development of unregistered Activity is completely the same as the development of normal Activity.
Fig. 3 is a schematic structural diagram of a device for starting an interface according to an embodiment of the present invention. Referring to fig. 3, the apparatus includes: an initiation request interception module 201, a variable replacement check module 202, and a variable replacement initiation module 203, wherein,
a start request intercepting module 201, configured to obtain a start request sent to a system when a first interface Activity is started, where the start request includes an Intent class written in a class name of the first Activity, and the class name of the first Activity is represented by a variable;
in the embodiment of the present invention, the first Activity is an unregistered Activity, and the second Activity is a registered Activity. Intercepting a starting request sent by an application program when an unregistered Activity is started, wherein the starting request comprises an Intent class written in the class name of the unregistered Activity, and the class name of the unregistered Activity is represented by a variable.
In the embodiment of the invention, the sending of the start request of the start Activity is realized by an exectstartactivity method in an mInstruction variable, and the start request is intercepted after an application program writes the class name of the Activity to be started into an Intent class to generate the start request and before the start request is not processed by an Android operating system. As an alternative embodiment, the initiation request is intercepted by listening to the execStartActivity method.
A variable replacement checking module 202, configured to modify the variable indicated by the class name of the first Activity in the start request to a variable indicated by the class name of a second Activity;
in the embodiment of the present invention, a reflection mechanism may be used to replace the variable represented by the class name of the unregistered Activity in the start request with the variable represented by the class name of a registered Activity, and set the parent class of the variable represented by the class name of a registered Activity to be the same as the variable represented by the class name of the unregistered Activity, so as to pass the validity check.
In the embodiment of the invention, the variable represented by the registered Activity class name is set to be inherited to the Instrumentation class of the application program, so that the registered Activity can execute the verification process based on the delegation mechanism of Activity verification.
In the embodiment of the present invention, as an optional embodiment, the registered Activity class name information may be obtained by querying the registry information, and a registered Activity class name may be selected from the obtained Activity class name information in a random manner or a non-random manner.
And the variable replacement starting module 203 is used for sending the modified starting request to the system to start the first Activity.
In the embodiment of the invention, the intercepted updated start request is sent to carry out validity check, the received start request response passing the validity check is intercepted, and the variable represented by the class name of the registered Activity in the start request response is replaced by the variable represented by the class name of the unregistered Activity, so that the application program generates the instance of the unregistered Activity according to the replaced variable to start the unregistered Activity.
Fig. 4 is a schematic structural diagram of a device for starting an interface according to an embodiment of the present invention. Referring to fig. 4, the apparatus may further include, in addition to the start request intercepting module 201, the variable replacement checking module 202, and the variable replacement starting module 203 shown in fig. 3:
a variable saving module 204, configured to save the class name of the unregistered Activity represented by the mis instrumentation variable.
As an alternative embodiment, the apparatus may further include:
the invoking module 205 is configured to trigger the Android operating system to invoke the ActivityThread instance of the application program after the unregistered Activity is successfully started, and enable the ActivityThread instance to invoke the onXXX method of the Activity through a handleActivityOnXXX method in the unregistered Activity instance.
In the embodiment of the present invention, the handleActivityOnXXX method includes a handleActivityOnCreate method and a handleactivityonresult method.
In this embodiment of the present invention, as an optional embodiment, the variable replacement checking module 202 includes: an analyzing unit 31, a setting unit 32, and a replacing unit 33, wherein,
the analysis unit 31 is used for analyzing the source code of the android operating system;
a setting unit 32, configured to set a parent class of the variable represented by the class name of a registered Activity to be the same as the variable represented by the class name of an unregistered Activity, so as to pass validity check;
a replacing unit 33, configured to replace, by using a reflection mechanism, an mis variable of an mMainThread variable of an mmainginfo variable of an mBase variable in the Application class in the source code of the android operating system, which is obtained through analysis, with a subclass variable.
In the embodiment of the present invention, the JAVA reflection mechanism is preferably adopted, and of course, in practical applications, other reflection mechanisms capable of accomplishing the function may also be adopted.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), or the like.
The above description is only for the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. A method for launching an interface, the method comprising:
when an application program starts a first interface Activity, acquiring a starting request sent by the application program to an android operating system by monitoring a preset method of the first Activity, wherein the starting request is triggered by clicking an icon of the application program by a user, the starting request is realized by an exectActivities method in an mInstruction variable in an Intent class, the starting request comprises an Intent class written in a class name of the first Activity, and the class name of the first Activity is represented by a variable;
modifying the variable represented by the class name of the first Activity in the starting request into a variable represented by the class name of a second Activity; setting a parent class of a variable represented by the class name of the second Activity to be the same as the variable represented by the class name of the first Activity; wherein the second Activity is obtained by querying registry information;
and sending the modified starting request to an android operating system through a preset method of the second ActivitV so as to start the first Activity.
2. The method of claim 1, wherein the first Activity is an unregistered Activity and the second Activity is a registered Activity.
3. The method of claim 2, wherein sending the modified launch request to an android operating system to launch the first Activity comprises:
sending the modified starting request to an android operating system for validity check, intercepting a received starting request response passing the validity check, and replacing a variable represented by the class name of the second Activity in the starting request response with a variable represented by the class name of the first Activity, so that an application program generates an instance of the first Activity according to the replaced variable to start the first Activity.
4. The method of claim 1, wherein modifying the variable in the launch request represented by the class name of the first Activity to a variable represented by the class name of a second Activity comprises:
analyzing the source code of the android operating system, and replacing the mInstruction variable of the mMainThread variable of the mBase variable in the Application class with the class name of the first Activity by adopting a reflection mechanism.
5. The method of claim 4, further comprising:
the class name of the unregistered Activity represented by the mInstruction variable is saved.
6. An apparatus for actuating an interface, the apparatus comprising: a start request interception module, a variable replacement check module and a variable replacement start module, wherein,
the starting request intercepting module is used for acquiring a starting request sent by an application program to an android operating system by monitoring a preset method of first Activity when the application program starts the first interface Activity, wherein the starting request is triggered by a user clicking an icon of the application program, the starting request is triggered by a user clicking the icon of the application program, the starting request comprises an Intent class written in a class name of the first Activity, and the class name of the first Activity is represented by a variable;
a variable replacement check module, configured to modify the variable indicated by the class name of the first Activity in the start request to a variable indicated by the class name of a second Activity; setting a parent class of a variable represented by the class name of the second Activity to be the same as the variable represented by the class name of the first Activity; wherein the second Activity is obtained by querying registry information;
and the variable replacement starting module is used for sending the modified starting request to a system through a preset method of the second Activity so as to start the first Activity.
7. The apparatus of claim 6, wherein the first Activity is an unregistered Activity and the second Activity is a registered Activity.
8. The apparatus of claim 6 or 7, wherein the variable replacement check module comprises: an analysis unit, a setting unit, and a replacement unit, wherein,
the analysis unit is used for analyzing the source code of the android operating system;
the setting unit is used for setting that a parent class of the variable represented by the class name of the second Activity is the same as the variable represented by the class name of the first Activity so as to pass the validity check;
and the replacing unit is used for replacing the mInstruction variable of the mMainThread variable of the mBase variable in the Application class in the source code of the android operating system obtained by analysis by adopting a reflection mechanism.
9. The apparatus of claim 6, further comprising:
and the variable saving module is used for saving the class name of the unregistered Activity represented by the mInstruction variable.
10. The apparatus of claim 6, wherein the sending the modified launch request to a system to launch the first Activity comprises:
sending the modified starting request to a system for validity check, intercepting a received starting request response passing the validity check, and replacing a variable represented by the class name of the second Activity in the starting request response with a variable represented by the class name of the first Activity, so that an application program generates an instance of the first Activity according to the replaced variable to start the first Activity.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510552061.3A CN105159712B (en) | 2015-09-01 | 2015-09-01 | Interface starting method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510552061.3A CN105159712B (en) | 2015-09-01 | 2015-09-01 | Interface starting method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN105159712A CN105159712A (en) | 2015-12-16 |
| CN105159712B true CN105159712B (en) | 2019-06-07 |
Family
ID=54800576
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510552061.3A Expired - Fee Related CN105159712B (en) | 2015-09-01 | 2015-09-01 | Interface starting method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN105159712B (en) |
Families Citing this family (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN106250165A (en) * | 2016-06-12 | 2016-12-21 | 杭州无量网络科技有限公司 | Application component management method and system |
| CN106919377B (en) * | 2016-07-05 | 2020-06-26 | 阿里巴巴集团控股有限公司 | Method and device for determining whether display interface of application program is white screen |
| CN108334392B (en) * | 2018-01-09 | 2019-09-20 | 武汉斗鱼网络科技有限公司 | Method, storage medium, device and system for starting page in Android system |
| CN111488144B (en) * | 2020-04-17 | 2024-03-19 | 腾讯音乐娱乐科技(深圳)有限公司 | Data processing method and device |
| CN113722011B (en) * | 2021-09-01 | 2024-05-17 | 广州市百果园网络科技有限公司 | Application interface starting method, device, equipment and storage medium |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| 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 |
| US8997075B2 (en) * | 2013-07-23 | 2015-03-31 | Red Hat, Inc. | System and method for dynamic class management |
-
2015
- 2015-09-01 CN CN201510552061.3A patent/CN105159712B/en not_active Expired - Fee Related
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8997075B2 (en) * | 2013-07-23 | 2015-03-31 | Red Hat, Inc. | System and method for dynamic class management |
| 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 |
Also Published As
| Publication number | Publication date |
|---|---|
| CN105159712A (en) | 2015-12-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11960912B2 (en) | Methods for user interface generation and application modification | |
| CN105159712B (en) | Interface starting method and device | |
| CN105183457B (en) | Method and device for monitoring interface life cycle callback | |
| TWI649694B (en) | Android dynamic framework and method thereof | |
| US20150332043A1 (en) | Application analysis system for electronic devices | |
| CN109032825B (en) | Fault injection method, device and equipment | |
| US8539506B2 (en) | Dynamic injection of code into running process | |
| CN111930472B (en) | Code debugging method and device, electronic equipment and storage medium | |
| CN106055368B (en) | application updating method and device | |
| US9612942B2 (en) | Verification of a computer program in respect to an unexpected response to an access request | |
| EP3171275B1 (en) | Transparent process interception | |
| US11436131B2 (en) | Systems and methods for software testing using a disposable code | |
| WO2021098354A1 (en) | Method and apparatus for android penetration achieving silent installation on basis of accessibility service | |
| WO2014035737A1 (en) | Obtaining metadata set by imperative statement | |
| CN105138337B (en) | A kind of plug-in unit adaptation method and plug-in unit adaptive device | |
| Groß et al. | Pianalyzer: A precise approach for pendingintent vulnerability analysis | |
| CN113760339A (en) | Vulnerability repair method and device | |
| Riganelli et al. | Policy enforcement with proactive libraries | |
| Lettner et al. | Mobile platform architecture review: android, iphone, qt | |
| CN114416578A (en) | Test method and apparatus | |
| Johnson et al. | Dazed droids: A longitudinal study of android inter-app vulnerabilities | |
| CN117215811A (en) | System call hooking method, device and medium based on binary overwrite | |
| CN109933355B (en) | Application program upgrading method and device | |
| CN116755719A (en) | Data processing method, device and data processing system of application component | |
| JP5865180B2 (en) | Portable communication terminal, data communication detection device, data communication detection method, and program |
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 | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20190607 |
|
| CF01 | Termination of patent right due to non-payment of annual fee |