CN107621939B - Application optimization method and device - Google Patents

Application optimization method and device Download PDF

Info

Publication number
CN107621939B
CN107621939B CN201710840282.XA CN201710840282A CN107621939B CN 107621939 B CN107621939 B CN 107621939B CN 201710840282 A CN201710840282 A CN 201710840282A CN 107621939 B CN107621939 B CN 107621939B
Authority
CN
China
Prior art keywords
hook
java
application
function
native
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
Application number
CN201710840282.XA
Other languages
Chinese (zh)
Other versions
CN107621939A (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 Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo 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 Qihoo Technology Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201710840282.XA priority Critical patent/CN107621939B/en
Publication of CN107621939A publication Critical patent/CN107621939A/en
Application granted granted Critical
Publication of CN107621939B publication Critical patent/CN107621939B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

The invention discloses an application optimization method and device, relates to the technical field of application development, and can realize enhancement of application functions under the condition that an operating system does not need Root. The method comprises the following steps: after determining that an operating system where the application is located adopts an ART virtual machine library mode, generating a new ART hook related file matched with a service frame; injecting the new ART hook related file and preset codes of the service framework plug-in into the application to replace the native ART hook related file in the service framework; and realizing the function update of the application based on the new ART hook related file data through the service framework plug-in. The invention is suitable for the optimization and enhancement of the application.

Description

Application optimization method and device
Technical Field
The invention relates to the technical field of application development, in particular to an application optimization method and device.
Background
With the rise of intelligent terminals such as tablet computers and smart phones in the market, the intelligent terminals become an indispensable part of life of people, and people can perform operations such as online chatting, online games and online shopping through client applications installed on the intelligent terminals.
At present, in order to enhance the functions of the application itself, the application enhancement can be implemented by a service framework for application enhancement, where the service framework replaces an application process processing file (app process) of an operating system by Root, where the file is a start file of all systems and third-party applications; an Android Runtime (ART) virtual machine library mode is usually adopted in a newer operating system, so when an application needs to be started, the application process is used for processing files, related files of a new ART virtual machine library are loaded, and then certain functions of the application can be changed, added or deleted and the like through a service framework plug-in based on the related files, so that the functions of the application are enhanced.
However, as the operating system becomes more sophisticated, the operating system has a lower probability of being Root, and thus the function of the enhanced application itself cannot be realized by the above manner.
Disclosure of Invention
In view of the above, the present invention provides an application optimization method and apparatus, and mainly aims to solve the problem that the existing technical method cannot enhance the functions of the application itself.
According to a first aspect of the present invention, there is provided an application optimization method, comprising:
after determining that an operating system where the application is located adopts an ART virtual machine library mode, generating a new ART hook related file matched with a service frame;
injecting the new ART hook related file and preset codes of the service framework plug-in into the application to replace the native ART hook related file in the service framework;
and realizing the function update of the application based on the new ART hook related file data through the service framework plug-in.
According to a second aspect of the present invention, there is provided an application optimization apparatus comprising:
the generation unit is used for generating a new ART hook related file matched with the service frame after determining that the operating system where the application is located adopts an ART virtual machine library mode;
the injection unit is used for injecting the new ART hook related file generated by the generation unit and the preset code of the service frame plug-in into the application so as to replace the native ART hook related file in the service frame;
and the updating unit is used for realizing the function updating of the application based on the new ART hook related file data through the service framework plug-in.
According to a third aspect of the present invention, there is provided a storage device having stored thereon a computer program which, when executed by a processor, implements the application optimization method of the first aspect.
According to a fourth aspect of the present invention, there is provided a terminal, comprising a storage device and a processor,
the storage device is used for storing a computer program;
the processor is configured to execute the computer program to implement the application optimization method of the first aspect.
By means of the technical scheme, compared with the mode that the file is processed through the application process of the Root replacement operating system at present, and the function of the application is enhanced through the service framework for application enhancement only can be achieved, the method and the device for application optimization provided by the invention have the advantages that after the fact that the operating system where the application is located adopts an ART virtual machine library mode is determined, the generated related files of the new ART hook and the preset codes of the service framework plug-in are injected into the application to replace the related files of the native ART hook in the service framework, the native ART hook mechanism of the service framework is changed, so that the operating system can change, add or delete certain functions of the application and the like according to the actual needs of a user and based on the related file data of the new ART hook through the service framework plug-in to enhance the functions of the application without the Root, the application function is diversified, and different requirements of different users can be met.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a schematic flow chart illustrating an application optimization method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another application optimization method provided by the embodiment of the invention;
FIG. 3 is a schematic diagram illustrating an example of a native Xpos ART hook mechanism provided by an embodiment of the present invention;
FIG. 4 is a schematic diagram illustrating an example mechanism of a newborn Xpos ART hook according to the embodiment of the present invention;
fig. 5 is a schematic structural diagram illustrating an application optimization apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic structural diagram of another application optimization apparatus provided in the embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
As described in the background art, at present, since the way of implementing the enhanced application self-function through the service framework for application enhancement needs to replace the application process of the operating system with the Root for processing the file, but the possibility that the operating system is Root is lower and lower, the problem of enhancing the application self-function cannot be implemented in this way.
In order to solve the above problem, an embodiment of the present invention provides an application optimization method, which can change a native ART hook mechanism of a service framework, and implement enhancement on an application function without Root required by an operating system, as shown in fig. 1, and the method includes:
101. and after determining that the operating system where the application is located adopts an ART virtual machine library mode, generating a new ART hook related file matched with the service framework.
Compared with the Dalvik virtual machine, the ART virtual machine library uses an advanced-of-Time complex (Adead-of-Time complex) to replace the just-in-Time compilation technology in Dalvik, when the application is installed for the first Time, the byte codes are compiled into machine codes in advance, so that the machine codes become real local applications, and then the application is started (for the first Time) and executed more quickly. The ART hook-related file may contain Java functions and corresponding Java function code data, which may be used to implement enhancements to application functions. The application in the embodiment of the present invention may be a system application, a third party application, an avatar application, and the like, and specifically may be a game application, a shopping application, a video application, a search application, and the like.
The execution subject of the embodiment of the present invention may be an application optimization device for implementing application functions updated without Root for an operating system. After determining that the operating system where the application is located adopts an ART virtual machine library mode, adapting can be performed on the native ART hook related file of the service framework, and the function in the native ART hook related file is modified, so that the service framework plug-in can rely on the code data of the native ART hook related file when the function of the application needs to be updated.
102. And injecting the preset codes of the new ART hook related file and the service framework plug-in into the application to replace the native ART hook related file in the service framework.
In the embodiment of the invention, in order to realize that the service framework plug-in can call the code data in the new ART hook related file, the code of the service framework plug-in needs to be adapted first, and then the adapted code and the new ART hook related file are injected into the application, so that a new ART hook mechanism is adopted when the service framework plug-in realizes the application enhancement function, a native ART hook mechanism is not adopted, and the application function is further updated under the condition that an operating system does not need Root.
103. And realizing the function update of the application through the service framework plug-in based on the related file data of the new ART hook.
For example, when the service framework plug-in needs to call a corresponding function interface function, the corresponding application enhancement function is realized based on code data in the new ART hook related file and according to the actual requirement of the user.
For the embodiment of the invention, the technical scheme can be applied to different operating systems according to actual conditions, and compared with the mode that the file is processed through the application process of the Root replacement operating system at present to realize the enhancement of the application function through the service framework for application enhancement, the application optimization method provided by the embodiment of the invention replaces the native ART hook related file in the shelf, changes the native ART hook mechanism of the service framework, so that the operating system can change, add or delete certain functions of the application and the like on the basis of the data of the new ART hook related file through the service framework plug-in under the condition of no Root according to the actual requirements of the user, thereby enhancing the functions of the application, diversifying the functions of the application and being capable of adapting to different requirements of different users.
Further, to better describe the process of the processing method, as a refinement and an extension of the embodiment, the service framework may specifically be an Xposed framework, the corresponding service framework plug-in may specifically be an Xposed plug-in, and the operating system may be an Android (Android) system, which is taken as an example but not limited thereto, and the embodiment of the present invention provides another application optimization method, as shown in fig. 2, the method includes:
201. and acquiring version information of the android system where the application is located.
The version information may include information such as a version number and a version name of the android system.
202. And detecting whether the android system adopts an ART virtual machine library mode or not according to the acquired version information.
For example, according to the version number of the android system, it is determined whether the android system adopts an ART virtual machine library mode or a Dalvik virtual machine mode, and if the android system adopts the Dalvik virtual machine mode, the existing Dalvik mode mechanism can be utilized to implement modification, addition, deletion, and the like of some functions of the application through an Xposed plug-in, which is not described in detail in this embodiment; if the android system adopts an ART virtual machine library mode, the Xposed framework needs to be adapted based on code library data corresponding to the ART virtual machine library to realize the function of enhancing the application, but the native Xposed ART hook mechanism needs Root authority, so the new Xposed ART hook mechanism provided by the embodiment needs to be adopted.
203. And after determining that the android system adopts an ART virtual machine library mode, generating a new ART hook related file matched with the Xpos frame.
The new ART hook related file can comprise a new Native hook library file and a new Java hook library file, the new Java hook library file can comprise Java functions, and the new Native hook library file can comprise Java function code data. The new Native hook library file and the new Java hook library file may be adapted based on the Native hook library file and the Native Java hook library file.
The Xpos framework is a super powerful system and application enhancement framework, and the specific system and application enhancement function of the Xpos framework is realized through an Xpos plug-in. An Xposed plug-in is an application developed on the Xposed framework, which itself is also an operating system third party application.
204. Injecting the preset codes of the new ART hook related files and the service framework plug-in into the application, hooking Java functions in Native Java hook library files in the Xpos framework through hook functions in the preset codes of the Xpos plug-in, and hooking Java function data in Native hook library files in the Xpos framework.
The hook function can be a hook function, the hook function is a part of an operating system message processing mechanism, and by setting a hook, an application program can filter all messages and events at a system level and access messages which cannot be accessed under normal conditions. The essence of a hook is a program that handles system messages, which are put on the system through system calls.
205. And modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to the new Java hook library file, and hooking corresponding Java function data in the new Native hook library file according to the Java function in the new Java hook library file.
In the embodiment of the invention, a Native hook library file of the Xpos frame is modified, and a Native hook code is deleted, so that hook data is transmitted to a new Java hook library file, and further the new Native hook is realized according to the true hook of the new Java hook.
206. When the Java function in the native Java hook library file corresponding to the Xpos plugin needs to be called, triggering hook operation.
Step 206 may specifically include: according to the Java functions in the new Java hook library file and the corresponding Java function data in the new Native hook library file, a configuration interface corresponding to the Xpos plugin is configured, the configuration interface can contain function item data with updatable applications, for example, an application selection key can be arranged in the configuration interface, and a user can select an application to be configured through the key. The configuration interface can also be provided with a plug-in loading key, a user can directly add the functional plug-in into the configuration interface through the plug-in loading key, and the user can load the functional plug-in into the corresponding application through the Xpos plug-in, so that the application can realize the function corresponding to the functional plug-in; the configuration interface can also be provided with a graph setting key, a color setting key, a function icon moving key, a function deleting key, a function adding key and the like, the graph, the color and the position of some function keys in the application can be changed through the keys, and a user can delete some functions which are not needed in the application by using the function deleting key or add some functions for the application according to the needs of the user, so that the application can be diversified, and the functions of the application can be changed along with the preference of the user;
before the application is started, preset codes of the Xpos framework are injected into the application, so that mapping can be formed among the Xpos framework, the Xpos plug-in and the application, and mutual access among the Xpos framework, the Xpos plug-in and the application is realized; then after determining that the user inputs the completion information in the configuration interface, acquiring the configuration information input in the configuration interface, and modifying an entry point of an interface function related to the configuration information, which needs to be called in the application, by calling a hook function in the preset code of the injected Xpos frame, so that the entry point points to the preset interface function in the preset code of the Xpos frame plugin;
when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
207. And calling the Java functions in the new Java hook library file and calling the Java function distribution in the Native Java hook library file according to the Java function data in the new Native hook library file.
Furthermore, the function corresponding to the Xpos framework plug-in is conveniently executed, and the function update of the application is realized.
For example, when the user uses the configuration interface of the Xposed plug-in, the specific implementation process of changing the sharing key icon in the application a into the red heart shape is as follows:
(1) selecting an application A in a configuration interface of the Xpos plugin, and loading each function key of the application;
(2) selecting a sharing key from the plurality of function keys, and selecting a red heart-shaped icon;
(3) after an application key is triggered, the Xpos plugin forms corresponding configuration information according to the red heart-shaped icon, and parameter information in the configuration information is the red heart-shaped icon;
(4) after the setting is finished, the user can open the application A, and then the preset codes of the Xpos frame and the Xpos plug-in are injected into the application A;
(5) when a user triggers a sharing key, the Xpos frame points an entry point of an interface function started by the sharing key to a preset interface function code contained in the Xpos plug-in preset code by using the preset hook interface function code;
(6) before the sharing key is started, the parameter information in the step (3) is used as an input parameter, and is added into a corresponding function through a preset interface function code;
(7) and executing the function, and changing the icon of the sharing key into a red heart shape.
For better explaining the above embodiment, a corresponding implementation architecture example is given, taking an Xposed framework as an example, and combining a Native Xposed ART hook mechanism and a new-born Xposed ART hook mechanism in this embodiment, as shown in fig. 3, the Native Xposed ART hook mechanism is a Native Xposed hook mechanism, and the implementation of the hook mechanism is that the modified app process, Native hook and Java hook are implemented together, when the app starts, a Native hook library file and a Java hook library file are loaded, so that the Xposed plug-in hook hosts Java functions of the Xposed framework Java layer and Java hook hosts Java function data of the Xposed framework Native layer, when some Java functions of the hook authority are called, the hook functions are triggered, Java function data of the Xposed framework Native layer and Java function data of the Java layer are obtained for the Xposed plug-in to call, however, the app is a start-up process file of the application, and the substitute process file in the system is a process file required by the Xposed framework;
in order to solve the above problem, the function of enhancing the application can be realized without Root, as shown in fig. 4, the new Xposed ART hook mechanism in the present embodiment includes:
1. injecting the modified preset codes of the Xpos Java hook library, the Native hook library and the Xpos plug-in into the third-party application in advance;
2, hooking the Java function in the native Java hook library file of the Xpos frame by the Xpos plug-in through the hook function;
3. hook Java function data in Xposed framework Native hook library files through hook functions, and modify the Native hook library files, so that the hook data in the Native hook library files are transmitted to the new Java hook library files, and the aim of utilizing the new Java hook library file data to hook the Java function data in the new Native hook library files is fulfilled;
4. when the Java function in the native Java hook library file corresponding to the Xpos plugin needs to be called, the hook is triggered, the Java function in the native Java hook library file is called according to Java function data in the native hook library file, the Java function in the native Java hook library file is called, the Java function distribution in the native Java hook library file is called, and further the function related to the Xpos plugin is executed, so that the Xpos plugin can change, add or delete certain functions of the application and the like without Root, the functions of the application are enhanced, and the application functions are diversified.
Compared with the mode that the function of the application itself can be enhanced only by replacing the application process processing file of the operating system with the Root at present, the application optimization method provided by the embodiment of the invention can realize the enhancement of the function of the application by the service framework for application enhancement, and can realize the modification, addition or deletion of certain functions of the application and the like by the service framework plug-in based on the new ART hook mechanism without the Root according to the actual needs of users, so as to enhance the functions of the application, diversify the functions of the application, and can adapt to different requirements of different users.
Further, as a specific implementation of the method shown in fig. 1 and fig. 2, an embodiment of the present invention provides an application optimization apparatus, as shown in fig. 5, where the apparatus includes: a generating unit 31, an injecting unit 32, and an updating unit 33.
The generating unit 31 may be configured to generate a new ART hook related file matched with the service framework after it is determined that the operating system where the application is located adopts an ART virtual machine library mode during android running; the generating unit 31 is a main functional module that generates a new ART hook related file based on a native ART hook related file in the present apparatus, and triggers the injecting unit 32 to operate after the related file is generated.
An injecting unit 32, configured to inject the new ART hook related file generated by the generating unit 31 and a preset code of the service framework plug-in into the application, so as to replace the native ART hook related file in the service framework; the injection unit 32 is a main functional module for injecting files related to a new ART hook mechanism in the device.
The updating unit 33 may be configured to update the function of the application based on the new ART hook-related file data through the service framework plug-in. The updating unit 33 is a main functional module for implementing application function enhancement in the present device.
In a specific application scenario, the new ART hook related file may include a new Native hook library file and a new Java hook library file, and correspondingly, the injection unit 32 may be specifically configured to hook a Java function in a Native Java hook library file in a service framework through a hook function in a preset code of a service framework plug-in, and hook Java function data in a Native Java hook library file in the service framework; and then modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to a new Java hook library file, so that corresponding Java function data in the new Native hook library file is hooked according to Java functions in the new Java hook library file.
In a specific application scenario, as shown in fig. 6, the updating unit 33 specifically includes: a triggering module 331 and a calling module 332.
The triggering module 331, configured to trigger a hook operation when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called;
the invoking module 332 may be configured to invoke a Java function in the new Java hook library file according to Java function data in the new Native hook library file, and invoke Java function distribution in the Native Java hook library file, so as to execute a corresponding function of the service framework plug-in, and implement function update on the application.
In a specific application scenario, the triggering module 331 may be specifically configured to configure a configuration interface corresponding to the service framework plug-in according to Java functions in the new Java hook library file and corresponding Java function data in the new Native hook library file, where the configuration interface includes function item data that is updateable by the application; injecting preset codes of a service framework into the application before the application is started; acquiring configuration information input in the configuration interface, and modifying an entry point of an interface function which is required to be called and related to the configuration information in the application by calling a hook function in the preset code of the injected service frame, so that the entry point points to the preset interface function in the preset code of the service frame plug-in; when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
In a specific application scenario, as shown in fig. 6, the apparatus further includes: an acquisition unit 34 and a detection unit 35.
An obtaining unit 34, configured to obtain version information of an operating system where an application is located;
the detecting unit 35 may be configured to detect whether the operating system adopts an ART virtual machine library mode according to the version information acquired by the acquiring unit 34.
In a specific application scenario, the service framework may be an Xposed framework, and the service framework plug-in may be an Xposed plug-in.
It should be noted that other corresponding descriptions of the functional units related to the application optimization apparatus provided in the embodiment of the present invention may refer to the corresponding descriptions in fig. 1 and fig. 2, and are not described herein again.
Based on the methods shown in fig. 1 and fig. 2, correspondingly, the embodiment of the present invention further provides a storage device, on which a computer program is stored, and when the computer program is executed by a processor, the steps corresponding to the methods shown in fig. 1 and fig. 2 are implemented.
Based on the above embodiments of the method shown in fig. 1 and fig. 2 and the apparatus shown in fig. 5 and fig. 6, an embodiment of the present invention further provides a terminal, as shown in fig. 7, including: a processor 41, a memory 42, and a computer program stored on the memory 42 and executable on the processor, wherein the memory device 42 and the processor 41 are both disposed on a bus 43, and the processor 41 executes the program to implement the steps corresponding to the methods shown in fig. 1 and 2.
By applying the technical scheme of the invention, some functions of the application can be changed, added or deleted and the like through the service framework plug-in based on a new ART hook mechanism under the condition of not needing Root according to the actual needs of the user, so that the functions of the application are enhanced, the functions of the application are diversified, and different requirements of different users can be met.
The embodiment of the invention discloses:
a1, an application optimization method, comprising:
after determining that an operation system where the application is located adopts an ART virtual machine library mode in android operation, generating a new ART hook related file matched with a service frame;
injecting the new ART hook related file and preset codes of the service framework plug-in into the application to replace the native ART hook related file in the service framework;
and realizing the function update of the application based on the new ART hook related file data through the service framework plug-in.
A2, according to the method of A1, the new ART hook related files include new Native hook library files and new Java hook library files, and the replacement of the Native ART hook related files in the service framework specifically includes:
hooking Java functions in Native Java hook library files in the service framework and Java function data in Native Java hook library files in the service framework through hook functions in preset codes of the service framework plug-in;
and modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to the new Java hook library file, so that corresponding Java function data in the new Native hook library file is hooked according to the Java function in the new Java hook library file.
A3, according to the method of a2, the updating of the function of the application is realized based on the new ART hook related file data through the service framework plug-in, which specifically includes:
when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called, triggering hook operation;
and calling Java functions in the new Java hook library file according to the Java function data in the new Native hook library file, and calling Java function distribution in the Native Java hook library file so as to execute the corresponding function of the service framework plug-in and realize function updating of the application.
A4, according to the method in A3, when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called, triggering a hook operation, specifically including:
configuring a configuration interface corresponding to the service framework plug-in according to Java functions in the new Java hook library file and corresponding Java function data in the new Native hook library file, wherein the configuration interface comprises function item data which can be updated by the application;
injecting preset codes of a service framework into the application before the application is started;
acquiring configuration information input in the configuration interface, and modifying an entry point of an interface function which is required to be called and related to the configuration information in the application by calling a hook function in the preset code of the injected service frame, so that the entry point points to the preset interface function in the preset code of the service frame plug-in;
when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
A5, according to the method in A1, before generating a new ART hook related file matched with a service framework after determining that an operating system where an application is located adopts an ART virtual machine library mode, the method further includes:
acquiring version information of an operating system where an application is located;
and detecting whether the operating system adopts an ART virtual machine library mode or not according to the version information.
A6, the method of any one of A1 to A5, wherein the service framework is an Xpos framework and the service framework plug-ins are Xpos plug-ins.
B7, an application optimization apparatus, comprising:
the generation unit is used for generating a new ART hook related file matched with the service frame after determining that an operation system where the application is located adopts an ART virtual machine library mode during android operation;
the injection unit is used for injecting the new ART hook related file generated by the generation unit and the preset code of the service frame plug-in into the application so as to replace the native ART hook related file in the service frame;
and the updating unit is used for realizing the function updating of the application based on the new ART hook related file data through the service framework plug-in.
B8, the apparatus according to B7, the newborn ART hook-related files comprising newborn Native hook library files and newborn Java hook library files,
the injection unit is specifically used for hooking Java functions in Native Java hook library files in the service framework through hook functions in preset codes of the service framework plug-in, and hooking Java function data in Native Java hook library files in the service framework;
and modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to the new Java hook library file, so that corresponding Java function data in the new Native hook library file is hooked according to the Java function in the new Java hook library file.
B9, according to the apparatus of B8, the update unit specifically includes:
the triggering module is used for triggering hook operation when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called;
and the calling module is used for calling the Java functions in the new Java hook library file according to the Java function data in the new Native hook library file and calling the Java function distribution in the Native Java hook library file so as to execute the corresponding function functions of the service framework plug-in and realize the function update of the application.
B10, the device according to B9,
the triggering module is specifically configured to configure a configuration interface corresponding to the service framework plug-in according to Java functions in the new Java hook library file and corresponding Java function data in the new Native hook library file, where the configuration interface includes function item data that is updateable by the application;
injecting preset codes of a service framework into the application before the application is started;
acquiring configuration information input in the configuration interface, and modifying an entry point of an interface function which is required to be called and related to the configuration information in the application by calling a hook function in the preset code of the injected service frame, so that the entry point points to the preset interface function in the preset code of the service frame plug-in;
when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
B11, the apparatus of B7, the apparatus further comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring version information of an operating system where an application is located;
and the detection unit is used for detecting whether the operating system adopts an ART virtual machine library mode or not according to the version information acquired by the acquisition unit.
B12, the device according to any one of B7 to B11, wherein the service framework is an Xpos framework and the service framework plug-ins are Xpos plug-ins.
C13, a storage device on which a computer program is stored which, when being executed by a processor, carries out the application optimization method of any one of a1 to a 6.
D14, a terminal comprising a storage device and a processor,
the storage device is used for storing a computer program;
the processor, configured to execute the computer program to implement the application optimization method of any one of a1 to a 6.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
It will be appreciated that the relevant features of the method and apparatus described above are referred to one another. In addition, "first", "second", and the like in the above embodiments are for distinguishing the embodiments, and do not represent merits of the embodiments.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The algorithms and displays presented herein are not inherently related to any particular computer, virtual machine, or other apparatus. Various general purpose systems may also be used with the teachings herein. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functions of some or all of the components of an application optimization method and apparatus in accordance with embodiments of the present invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. An application optimization method, comprising:
after determining that an operation system where the application is located adopts an ART virtual machine library mode in android operation, generating a new ART hook related file matched with a service frame;
injecting the new ART hook related file and preset codes of the service framework plug-in into the application to replace the native ART hook related file in the service framework;
updating the function of the application based on the new ART hook related file data through the service framework plug-in;
the method comprises the following steps of replacing Native ART hook related files in a service framework, wherein the Native ART hook related files comprise a Native hook library file and a Java hook library file, and the method specifically comprises the following steps:
hooking Java functions in Native Java hook library files in the service framework and Java function data in Native Java hook library files in the service framework through hook functions in preset codes of the service framework plug-in;
and modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to the new Java hook library file, so that corresponding Java function data in the new Native hook library file is hooked according to the Java function in the new Java hook library file.
2. The method according to claim 1, wherein the updating of the function of the application based on the new ART hook-related file data by the service framework plug-in specifically comprises:
when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called, triggering hook operation;
and calling Java functions in the new Java hook library file according to the Java function data in the new Native hook library file, and calling Java function distribution in the Native Java hook library file so as to execute the corresponding function of the service framework plug-in and realize function updating of the application.
3. The method according to claim 2, wherein when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called, triggering a hook operation specifically includes:
configuring a configuration interface corresponding to the service framework plug-in according to Java functions in the new Java hook library file and corresponding Java function data in the new Native hook library file, wherein the configuration interface comprises function item data which can be updated by the application;
injecting preset codes of a service framework into the application before the application is started;
acquiring configuration information input in the configuration interface, and modifying an entry point of an interface function which is required to be called and related to the configuration information in the application by calling a hook function in the preset code of the injected service frame, so that the entry point points to the preset interface function in the preset code of the service frame plug-in;
when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
4. The method according to claim 1, wherein before generating the new ART hook related file matched with the service framework after determining that the operating system where the application is located adopts the ART virtual machine library mode, the method further comprises:
acquiring version information of an operating system where an application is located;
and detecting whether the operating system adopts an ART virtual machine library mode or not according to the version information.
5. The method of any of claims 1 to 4, wherein the service framework is an Xpos framework and the service framework plug-in is an Xpos plug-in.
6. An application optimization apparatus, comprising:
the generation unit is used for generating a new ART hook related file matched with the service frame after determining that an operation system where the application is located adopts an ART virtual machine library mode during android operation;
the injection unit is used for injecting the new ART hook related file generated by the generation unit and the preset code of the service frame plug-in into the application so as to replace the native ART hook related file in the service frame;
the updating unit is used for realizing the function updating of the application based on the new ART hook related file data through the service framework plug-in;
wherein the new ART hook related files comprise a new Native hook library file and a new Java hook library file,
the injection unit is specifically used for hooking Java functions in Native Java hook library files in the service framework through hook functions in preset codes of the service framework plug-in, and hooking Java function data in Native Java hook library files in the service framework;
and modifying the Native hook library file to enable hook data in the Native hook library file to be transmitted to the new Java hook library file, so that corresponding Java function data in the new Native hook library file is hooked according to the Java function in the new Java hook library file.
7. The apparatus according to claim 6, wherein the updating unit specifically includes:
the triggering module is used for triggering hook operation when a Java function in a native Java hook library file corresponding to the service framework plug-in needs to be called;
and the calling module is used for calling the Java functions in the new Java hook library file according to the Java function data in the new Native hook library file and calling the Java function distribution in the Native Java hook library file so as to execute the corresponding function functions of the service framework plug-in and realize the function update of the application.
8. The apparatus of claim 7,
the triggering module is specifically configured to configure a configuration interface corresponding to the service framework plug-in according to the Java function in the new Java hook library file and corresponding Java function data in the new Native hook library file, where the configuration interface includes function item data that is updateable by the application;
injecting preset codes of a service framework into the application before the application is started;
acquiring configuration information input in the configuration interface, and modifying an entry point of an interface function which is required to be called and related to the configuration information in the application by calling a hook function in the preset code of the injected service frame, so that the entry point points to the preset interface function in the preset code of the service frame plug-in;
when the preset interface function is called, determining that the Java function in the native Java hook library file corresponding to the preset interface function needs to be called so as to trigger hook operation.
9. The apparatus of claim 6, further comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring version information of an operating system where an application is located;
and the detection unit is used for detecting whether the operating system adopts an ART virtual machine library mode or not according to the version information acquired by the acquisition unit.
10. The apparatus of any of claims 6 to 9, wherein the service framework is an Xposed framework and the service framework plug-in is an Xposed plug-in.
11. A storage device on which a computer program is stored, which program, when being executed by a processor, is adapted to carry out the application optimization method of any one of claims 1 to 4.
12. A terminal, characterized in that the terminal comprises a storage device and a processor,
the storage device is used for storing a computer program;
the processor for executing the computer program to implement the application optimization method of any one of claims 1 to 4.
CN201710840282.XA 2017-09-18 2017-09-18 Application optimization method and device Expired - Fee Related CN107621939B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710840282.XA CN107621939B (en) 2017-09-18 2017-09-18 Application optimization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710840282.XA CN107621939B (en) 2017-09-18 2017-09-18 Application optimization method and device

Publications (2)

Publication Number Publication Date
CN107621939A CN107621939A (en) 2018-01-23
CN107621939B true CN107621939B (en) 2021-01-29

Family

ID=61089946

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710840282.XA Expired - Fee Related CN107621939B (en) 2017-09-18 2017-09-18 Application optimization method and device

Country Status (1)

Country Link
CN (1) CN107621939B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111352673B (en) * 2020-01-02 2023-10-03 上海域幂信息科技有限公司 Novel Hook method, storage medium and electronic device
CN112835639B (en) * 2021-01-29 2024-02-27 百度在线网络技术(北京)有限公司 Hook realization method, device, equipment, medium and product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106126290A (en) * 2016-06-27 2016-11-16 微梦创科网络科技(中国)有限公司 Application program optimization method, Apparatus and system
CN106897611A (en) * 2017-03-03 2017-06-27 金光 Secure virtual mobile applications running environment system and method and application without root authority

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9335985B2 (en) * 2014-02-07 2016-05-10 Vmware, Inc. Desktop image management for virtual desktops

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106126290A (en) * 2016-06-27 2016-11-16 微梦创科网络科技(中国)有限公司 Application program optimization method, Apparatus and system
CN106897611A (en) * 2017-03-03 2017-06-27 金光 Secure virtual mobile applications running environment system and method and application without root authority

Also Published As

Publication number Publication date
CN107621939A (en) 2018-01-23

Similar Documents

Publication Publication Date Title
CN109032691B (en) Applet running method and device and storage medium
CN106598655B (en) Application page processing method and device
CN110020323B (en) Page switching method and system for hybrid application, computer equipment and storage medium
CN106055368B (en) application updating method and device
CN105573755A (en) Method and device for acquiring application Activity rendering time
CN104375861A (en) Installation-free operation method and device for application programs based on Android platform and terminal
CN111897520A (en) Front-end project framework construction method and device, computer equipment and storage medium
CN105955833B (en) Engine calling method and device
CN105072461A (en) Data processing method and device
CN106850650B (en) Method for accessing data by game client and client game system
CN112386916A (en) Resource loading method and device and electronic equipment
CN106843977B (en) A kind of processing method, device and the mobile terminal of application program self-starting
CN107621939B (en) Application optimization method and device
CN111367518A (en) Page layout method and device, computing equipment and computer storage medium
CN112882732A (en) Method and device for updating function codes in Software Development Kit (SDK)
CN109445878B (en) Method and device for injecting Java class in running
CN106648671B (en) Application upgrading method and terminal
CN109933355B (en) Application program upgrading method and device
CN107103099B (en) Browser homepage returning method and device
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN114816482A (en) Method and device for upgrading block storage service, computer equipment and storage medium
CN114547632B (en) Information protection method, device, equipment and storage medium
CN110704157B (en) Application starting method, related device and medium
CN112579275A (en) Task execution method, device, equipment and storage medium
CN109933357B (en) Application program upgrading method and device

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20210129