CN104731622B - The loading method of a kind of application program, device and mobile terminal - Google Patents

The loading method of a kind of application program, device and mobile terminal Download PDF

Info

Publication number
CN104731622B
CN104731622B CN201510142323.9A CN201510142323A CN104731622B CN 104731622 B CN104731622 B CN 104731622B CN 201510142323 A CN201510142323 A CN 201510142323A CN 104731622 B CN104731622 B CN 104731622B
Authority
CN
China
Prior art keywords
application program
classloader
self
packageinfo
field
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
CN201510142323.9A
Other languages
Chinese (zh)
Other versions
CN104731622A (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
Qizhi Software Beijing 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, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201510142323.9A priority Critical patent/CN104731622B/en
Publication of CN104731622A publication Critical patent/CN104731622A/en
Application granted granted Critical
Publication of CN104731622B publication Critical patent/CN104731622B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

Embodiments provide loading method, device and the mobile terminal of a kind of application program, belong to computer realm.The method includes: when the process initiation of application program, obtain the mClassLoader field in the PackageInfo object that operating system is application program foundation, change address therein, make it point to self-defining ClassLoader object address, thus complete the replacement to primary ClassLoader for the self-defining ClassLoader object.The method that the embodiment of the present invention is provided, by the method function under ClassLoader is written over, so that any assembly under application program all can be loaded normally, the loading making application program is more flexible, the loading of the resource to plug-in unit, class etc. can be completed, and user is without considering that the replacement of ClassLoader can use, method of calling is more natural.

Description

The loading method of a kind of application program, device and mobile terminal
Technical field
The present invention relates to computer realm, be specifically related to loading method, device and the movement of a kind of application program Terminal.
Background technology
At present, Android (Android) operating system is widely used in field of mobile terminals, greatly The mobile phone of amount, panel computer use Android operation system.In Android operation system, apply journey Sequence is compiled by Java, and provides independent Java Virtual Machine to each application program and support that it runs, Provide substantial amounts of object for virtual machine simultaneously.
Wherein, ClassLoader object is one object of most important of which, its mainly the request to class carry For service, in order to complete the loading of the files such as dex file and resource when application program launching or operation. But owing to Android operation system have employed higher security mechanism, ClassLoader object is to application The restriction of program is also apparent from.
For example: the class that ClassLoader object provides only supports the dex file to application program or resource literary composition The loading of part, but can not support the loading of the dex file for the plug-in unit under application program or resource file, Cause developer restricted very big for the exploitation of plug-in unit.
In order to the application program under the exploitation Android of easy and flexible, developer wants to rewrite ClassLoader object under Android, namely self-defined ClassLoader object, to realize exploitation The desired function of person.But present case is, when application program launching, Android can give tacit consent to use The ClassLoader object of self, and cannot go to load application by self-defining ClassLoader object Program.
Content of the invention
In view of the above problems, it is proposed that the present invention is to provide one to overcome the problems referred to above or at least in part Solve loading method, correspondingly device and the mobile terminal of a kind of application program of the problems referred to above.
According to one aspect of the present invention, provide the loading method of a kind of application program, comprising:
When the process initiation of application program, obtaining operating system is that described application program is set up PackageInfo object;
Obtain the mClassLoader field in described PackageInfo object, described mClassLoader Field points to the address of ClassLoader object for storing;
Change the address in described mClassLoader field so that it is point to self-defining ClassLoader Object address;
Load described application program by described self-defining ClassLoader object.
Alternatively, when the process initiation of application program, also include:
Rewrite the designation method function that calls when the process initiation of described application program, make described in the finger that calls Determine method function triggering acquisition operating system process is the PackageInfo object that described application program is set up Operation.
Alternatively, described acquisition operating system is the PackageInfo object that described application program is set up, bag Include:
Obtain the Application object of described application program;
Obtain the mBase object in described Application object;
Read the mPackageInfo field in described mBase object, by described mPackageInfo Field obtains the PackageInfo object that described operating system is that described application program is set up;
Wherein, be stored with in described mPackageInfo field the address of described PackageInfo object.
Alternatively, before the mClassLoader field in obtaining described PackageInfo object, institute Method of stating also includes:
Generate self-defining ClassLoader object.
Alternatively, the self-defining ClassLoader object of described generation, comprising:
Rewrite the method function under described ClassLoader object, and make described self-defining ClassLoader Object is inherited from the ClassLoader object of described operating system.
According to another aspect of the present invention, provide the charger of a kind of application program, comprising:
Object acquisition module, is suitable to when the process initiation of application program, and obtaining operating system is described application The PackageInfo object that program is set up;
Address acquisition module, is suitable to obtain the mClassLoader field in described PackageInfo object, Described mClassLoader field points to the address of ClassLoader object for storing;
Replacement module, is suitably modified to the address in described mClassLoader field so that it is point to self-defined ClassLoader object address;
Load-on module, uses and loads described application program by described self-defining ClassLoader object.
Alternatively, described device also includes:
Calling module, is suitable to when the process initiation of application program, rewrites when the process of described application program opens The designation method function calling when dynamic, it is described for making described designation method function trigger acquisition operating system process The operation of the PackageInfo object that application program is set up.
Alternatively, described object acquisition module, comprising:
First object acquisition unit, is suitable to obtain the Application object of described application program;
Second object acquisition unit, is suitable to obtain the mBase object in described Application object;
3rd object acquisition unit, is suitable to read the mPackageInfo field in described mBase object, Obtaining described operating system by described mPackageInfo field is that described application program is set up PackageInfo object;
Wherein, be stored with in described mPackageInfo field the address of described PackageInfo object.
Alternatively, described device also includes:
Object generation module, is suitable to the mClassLoader word in obtaining described PackageInfo object Before Duan, generate self-defining ClassLoader object.
Alternatively, described object generation module is particularly adapted to generate as follows self-defining ClassLoader object:
Rewrite the method function under described ClassLoader object, and make described self-defining ClassLoader Object is inherited from the ClassLoader object of described operating system.
According to another aspect of the present invention, providing a kind of mobile terminal, described mobile terminal includes:
Memory;
One or more processors;
Wherein, the one or more processor is configured to perform following method:
When the process initiation of application program, obtaining operating system is that described application program is set up PackageInfo object;
Obtain the mClassLoader field in described PackageInfo object, described mClassLoader Field points to the address of ClassLoader object for storing;
Change the address in described mClassLoader field so that it is point to self-defining ClassLoader Object address;
Load described application program by described self-defining ClassLoader object.
Embodiments provide loading method, device and the mobile terminal of a kind of application program, work as application During the process initiation of program, obtain the PackageInfo object that operating system is that application program is set up, obtain MClassLoader field in PackageInfo object, the address in modification mClassLoader field, Make it point to self-defining ClassLoader object address, thus complete self-defining ClassLoader The replacement to primary ClassLoader for the object so that self-defining ClassLoader object can be passed through Loading application programs.The method that the embodiment of the present invention is provided, use that can be complete is self-defining ClassLoader replaces original ClassLoader, by carrying out the method function under ClassLoader Rewrite, so that any assembly under application program all can be loaded normally so that adding of application program Carry more flexible, use scene extensive, the loading of the resource to plug-in unit, class etc. can be completed, due to for The entirety of ClassLoader is replaced, and user, without considering that the replacement of ClassLoader can use, adjusts More natural by mode.
Described above is only the general introduction of technical solution of the present invention, in order to better understand the technology of the present invention Means, and can being practiced according to the content of specification, and in order to allow above and other objects of the present invention, Feature and advantage can become apparent, below the detailed description of the invention especially exemplified by the present invention.
According to below in conjunction with the detailed description to the specific embodiment of the invention for the accompanying drawing, those skilled in the art will More understand above-mentioned and other purposes, the advantages and features of the present invention.
Brief description
By reading the detailed description of hereafter preferred embodiment, various other advantage and benefit for ability Territory those of ordinary skill will be clear from understanding.Accompanying drawing is only used for illustrating the purpose of preferred embodiment, and simultaneously It is not considered as limitation of the present invention.And it in whole accompanying drawing, is denoted by the same reference numerals identical Parts.In the accompanying drawings:
Fig. 1 is the loading method flow chart of a kind of application program that one embodiment of the invention provides;
Fig. 2 is the concrete loading method flow chart of a kind of application program that one embodiment of the invention provides;
Fig. 3 is the charger structured flowchart of a kind of application program that one embodiment of the invention provides.
Detailed description of the invention
It is more fully described the exemplary embodiment of the disclosure below with reference to accompanying drawings.Although accompanying drawing shows The exemplary embodiment of the disclosure, it being understood, however, that may be realized in various forms the disclosure and should not Limited by embodiments set forth here.On the contrary, these embodiments are provided to be able to thoroughly understand this Open, and complete for the scope of the present disclosure can be conveyed to those skilled in the art.
Embodiment one
Embodiments provide the loading method of a kind of application program.It can be by under Android Application program to be loaded improve realization, the terminal being implemented in being provided with Android operation system sets Standby upper, such as mobile phone, the customer mobile terminal equipment such as flat board, HPC.
Fig. 1 is the loading method flow chart of a kind of application program that the present embodiment provides.Wherein, the method is real In the installation kit of present application program, and after application program is mounted, perform when startup every time. Apply the application program of the method that the present embodiment one is provided, can when it starts with self ClassLoader object replaces the primary ClassLoader of operating system, and then passes through self The loading of the more flexible resource to application program of ClassLoader, class etc., especially can realize to tool There is the loading of the application program of plug-in unit, solve the problem that current operating system does not support the loading of plug-in unit.
For example, it can be implemented in fail-safe software, for supporting adding of various plug-in units under this fail-safe software Carry.
Specifically, the method that the present embodiment is provided specifically includes step S102 to step S108.
S102: when the process initiation of application program, obtaining operating system is that application program is set up PackageInfo object.
S104: obtain the mClassLoader field in PackageInfo object.
Wherein, mClassLoader field is for storing the address pointing to ClassLoader object.
S106: the address in modification mClassLoader field so that it is point to self-defining ClassLoader Object address.
S108: by self-defining ClassLoader object loading application programs.
Wherein, in the present embodiment, self-defining ClassLoader object by developer to its concrete logic Code carries out self-defined, and ClassLoader can be carried out by developer according to its particular demands to application program Rewrite, and replace ClassLoader primary in operating system by method provided by the present invention.
The difference of the conventional self-defined ClassLoader object ClassLoader object primary with system can To be: self-defining ClassLoader can realize the particular load mode of the class to application program or resource, For example, when loading the activity assembly of plug-in unit, the context of re-direction applications program is plug-in unit Context, to realize loading (will be described in detail in embodiment two) to the complete of plug-in unit.
Embodiments provide the loading method of a kind of application program, when the process initiation of application program, Obtain the PackageInfo object that operating system is that application program is set up, obtain in PackageInfo object MClassLoader field, modification mClassLoader field in address so that it is point to self-defined ClassLoader object address, thus complete self-defining ClassLoader object to primary The replacement of ClassLoader so that self-defining ClassLoader object loading application programs can be passed through. The method that the embodiment of the present invention is provided, the self-defining ClassLoader of use that can be complete replaces original ClassLoader, by the method function under ClassLoader is written over, so that application Any assembly under program all can be loaded normally so that the loading of application program is more flexible, makes use Scape is extensive, can complete the loading of the resource to plug-in unit, class etc., owing to the entirety for ClassLoader is replaced Changing, user is without considering that the replacement of ClassLoader can use, and method of calling is more natural.
Embodiment two
The present embodiment is a kind of concrete application scenarios of above-described embodiment one, by the present embodiment, and can be more Clear, specifically illustrate method provided by the present invention.
As in figure 2 it is shown, the concrete loading method flow chart of a kind of application program providing for the embodiment of the present invention, The method includes step S201 to S207 altogether.
In step s 201, obtaining operating system is to be loaded Application pair set up for program As.
Wherein, Application object and Activity, Service are equally one of Android framework System assembly, when Android program starts, system can create an Application object, is used for storing Some information of system.
When android system can be run for each program automatically create an Application class object and Only create one, so Application can be described as a class of single example (singleton) pattern.
The life cycle of Application object is the longest in whole program, and its life cycle is equal to this The life cycle of individual program.Because it is single example of the overall situation, so at different Activity, Service The object of middle acquisition is all same object.So can be carried out by Application, such as: The operations such as data transmission, data sharing and data buffer storage.
It should be noted that so that the application program under android system can walk according to the present embodiment Rapid method flow shown in S201-S207 runs, in addition it is also necessary to the specified function method in operating system Change.
Owing to when an application program launching, that call at first is Application.attachBaseContext Method, therefore, the method function preferably can be modified by we as designation method function so that When the method function is called, trigger the method shown in the present embodiment step S201-S207.By this side Formula, just can kidnap to the start-up course of application program when application program starts to start most, in case The loading of the primary ClassLoader object of locking system.
Preferably, the method for HOOK can be used to Application.attachBaseContext function, It is made to trigger the operation of step S201.
After obtaining Application object, step S202, obtain in Application object MBase object.
Wherein, mBase object is corresponding with context, is typically creating Application, Service, Activity When assignment, by this object, we can find some attribute informations unique of each application program.
After obtaining mBase object, step S203, reads under this mBase object MPackageInfo field.
Wherein, mBase object represents different types under the android system of different editions, for example, exist Android is for 2.1 times ApplicationContext, and Android 2.2 is then ContextImpl, Android 2.3 and above be then AppContextImpl.But their common feature, they exist One field being named as " mPackageInfo ".
In the present embodiment, can use such as the mPackageInfo field obtaining under mBase object Lower code:
Wherein, the PackageInfo object of the application program to be loaded that is stored with in mPackageInfo field Address.
After acquiring the address of PackageInfo object of application program to be loaded, get final product step S204, is the PackageInfo object that application program to be loaded is set up by this address acquiring operation system.
Wherein, after getting the PackageInfo object of application program to be loaded in this step S204, protect Deposit stand-by.
In step S205, generate self-defining ClassLoader object.
Wherein, self-defining ClassLoader object must make to be inherited from the ClassLoader of operating system Object or its subclass.
In order to illustrate self-defining ClassLoader object, the present embodiment is illustrated below:
It under Android operation system, after the apk of application program is installed in operating system, is difficult to It is extended.It to application program carries out small upgrading, is required for again packing code, user New apk need to be reused install, so that the application program in android system is less Flexibly.
Recently occurring in that Plugin Mechanism, the function of application being divided module, each module corresponds to a plug-in unit Concentrate in an apk.There is this Plugin Mechanism, when expanding application program or upgrading, only Need to change corresponding plug-in unit.
But, it is generally the case that a plug-in unit is made up of the part such as class, resource, and the resource of plug-in unit can include Its content such as interface images, background music, and prior art means can only realize the loading of the class to plug-in unit, But can not realize the loading of the resource to plug-in unit, plug-in unit can be caused to show mistake after loading, cannot show completely Etc. problem.
It the reason that cause drawbacks described above is that, when application program launching, system can be this application assigned one Individual context (is equivalent to handle), and this context is for various groups of unique instruction to this application program Part and resource.And operating system does not carry out the distribution of context to the plug-in unit under application program, normally Under flow process, the primary ClassLoader object of system, only can be according to application program when carrying out resource loading Context load, and the resource of plug-in unit can not be had access to.In order to realize the loading to plug-in unit, can In the way of being adopted as the self-built context of plug-in unit, but, still need to ensure that ClassLoader can get The context of plug-in unit is just permissible.Accordingly, it would be desirable to developer's self-defined ClassLoader object, and to it In be written over for the method function loading resource.
In order to ensure that self-defining ClassLoader does not lose its original function, the method for rewriting finally must Original ClassLoader object must be pointed to.
For example, in some cases, so that the resource of plug-in unit can be by normal load, opening at plug-in unit During Dong, need the method that the ClassLoader object reference plug-in unit making its main program is specified, rather than Go to call primary method according to the normal process of Android.In this case, it is necessary to self-defined ClassLoader object, and the method function for obtaining resource therein is written over.
As a example by without any custom feature, shown below a kind of self-defined ClassLoader object Code:
Wherein, LocalClassLoader is self-defining ClassLoader object, is inherited from system ClassLoader, and by above-mentioned code rewriting wherein method function findClassMethod.
In order to illustrate to be written over the method function under ClassLoader object, the embodiment of the present invention provides Code sample is as follows:
Wherein, generally involve the place of acquisition resource, all can call getResources method function, In getResources method function after overriding, when the function is called, plug-in unit can i.e. be returned Resources object, thus complete the loading of the resource to plug-in unit.
By upper it is known that self-defined ClassLoader object, can realize the resource of plug-in unit is loaded.
Again for example:
Wherein, getAssets is also the resource for obtaining plug-in unit, when loading the part resource of plug-in unit, and meeting Use getAssets method function.When the function is called, the Assets object of plug-in unit can i.e. be returned, Thus complete the loading of the resource to plug-in unit.
Again for example:
Wherein, as long as relating to the place that Context calls, all can preferentially use Context.getClassLoader method, when application program launching, can call the method, due to us Override the method, therefore, be returned for self-defining DexClassLoader, by self-defining DexClassLoader completes the loading of the class to plug-in unit.
Except the loading of the resource for plug-in unit, following work(can also be realized by self-defined ClassLoader Can:
In current operating system, do not support to be loaded in same process by multiple Activity, therefore Result in the application program based on Plugin Mechanism exploitation and can not open multiple plug-in unit simultaneously.In the present embodiment, Developer can change ClassLoader so that it is obtains the situation that the Activity of plug-in unit is called by you, and Change the state of Activity according to this situation so that the Activity of plug-in unit can be loaded into same process In.
After generating self-defining ClassLoader object, step S206, use self-defining ClassLoader object replaces application program original ClassLoader object.
Wherein, owing to the address of the ClassLoader object of application program is saved in PackageInfo object Under mClassLoader field under, therefore, in the present embodiment, replace application program original MClassLoader field under PackageInfo object extremely, is replaced by ClassLoader object method Address for self-defining ClassLoader object.
After being completed by step S206 for the replacement of the ClassLoader object of application program, i.e. Can step S207, by self-defining ClassLoader object loading application programs.
It should be noted that under the present embodiment, with application under primary for the system in application program loading procedure The maximum difference that program loads is, substituted for application program original ClassLoader object.Due to me To the replacement of ClassLoader object and the method having rewritten under ClassLoader object so that when one During individual application program launching, our self-defining ClassLoader object can be called, and operating system is not Can detect that the ClassLoader that its ClassLoader has been customized replaces, thus complete for should With the complete control of the loading procedure of program.
When carrying out the compiling of application program, it is only necessary to write self-defined under self-defining ClassLoader Loading method, can go to load an application program according to the functional requirement of developer.
For example, when operating system loads the plug-in unit under an application program, due to not existing of operating system Effective plug-in unit load mechanism, the resource of the loading plug-in unit that it can not be friendly, at this moment operating system can be passed through Call self-defining ClassLoader and complete the loading of the resource for plug-in unit, and primary not in use by system Method, thus developer is brought a lot of convenient.
Embodiments provide the loading method of a kind of application program, when the process initiation of application program, Obtain the PackageInfo object that operating system is that application program is set up, obtain in PackageInfo object MClassLoader field, modification mClassLoader field in address so that it is point to self-defined ClassLoader object address, thus complete self-defining ClassLoader object to primary The replacement of ClassLoader so that self-defining ClassLoader object loading application programs can be passed through. The method that the embodiment of the present invention is provided, the self-defining ClassLoader of use that can be complete replaces original ClassLoader, by the method function under ClassLoader is written over, so that application Any assembly under program all can be loaded normally so that the loading of application program is more flexible, makes use Scape is extensive, can complete the loading of the resource to plug-in unit, class etc., owing to the entirety for ClassLoader is replaced Changing, user is without considering that the replacement of ClassLoader can use, and method of calling is more natural.
Embodiment three
Fig. 3 is the structured flowchart of the charger of a kind of application program that one embodiment of the invention provides, should Device 300 includes:
Object acquisition module 310, is suitable to when the process initiation of application program, obtains operating system for answering The PackageInfo object set up by program;
Address acquisition module 320, is suitable to obtain the mClassLoader field in this PackageInfo object, This mClassLoader field points to the address of ClassLoader object for storing;
Replacement module 330, is suitably modified to the address in mClassLoader field so that it is point to self-defined ClassLoader object address;
Load-on module 340, uses and loads above-mentioned application program by self-defining ClassLoader object.
Alternatively, said apparatus 300 also includes:
Calling module 350, is suitable to when the process initiation of application program, rewrites when the process of application program opens The designation method function calling when dynamic, making designation method function trigger acquisition operating system process is application program The operation of the PackageInfo object set up.
Alternatively, object acquisition module 310, comprising:
First object acquisition unit 311, is suitable to obtain the Application object of application program;
Second object acquisition unit 312, is suitable to obtain the mBase object in this Application object;
3rd object acquisition unit 313, is suitable to read the mPackageInfo field in this mBase object, Obtain PackageInfo pair that operating system is that this application program is set up by this mPackageInfo field As;
Wherein, this mPackageInfo field is stored with listing PackageInfo object address.
Alternatively, said apparatus 300 also includes:
Object generation module 360, is suitable to the mClassLoader field in obtaining PackageInfo object Before, self-defining ClassLoader object is generated.
Alternatively, object generation module 360 is particularly adapted to generate as follows self-defining ClassLoader object:
Rewrite the method function under ClassLoader object, and make this self-defining ClassLoader object It is inherited from the ClassLoader object of operating system.
Embodiments provide the loading method of a kind of application program, when the process initiation of application program, Obtain the PackageInfo object that operating system is that application program is set up, obtain in PackageInfo object MClassLoader field, modification mClassLoader field in address so that it is point to self-defined ClassLoader object address, thus complete self-defining ClassLoader object to primary The replacement of ClassLoader so that self-defining ClassLoader object loading application programs can be passed through. The method that the embodiment of the present invention is provided, the self-defining ClassLoader of use that can be complete replaces original ClassLoader, by the method function under ClassLoader is written over, so that application Any assembly under program all can be loaded normally so that the loading of application program is more flexible, makes use Scape is extensive, can complete the loading of the resource to plug-in unit, class etc., owing to the entirety for ClassLoader is replaced Changing, user is without considering that the replacement of ClassLoader can use, and method of calling is more natural.
Meanwhile, the embodiment of the present invention additionally provides a kind of mobile terminal, and this mobile terminal includes:
Memory;
One or more processors;
Wherein, this one or more processors are configured to perform following method:
When the process initiation of application program, obtaining operating system is that above-mentioned application program is set up PackageInfo object;
Obtain the mClassLoader field in above-mentioned PackageInfo object, above-mentioned mClassLoader Field points to the address of ClassLoader object for storing;
Change the address in above-mentioned mClassLoader field so that it is point to self-defining ClassLoader Object address;
Load above-mentioned application program by above-mentioned self-defining ClassLoader object.
Wherein, above-mentioned mobile terminal can be the equipment such as mobile phone, panel computer.
In specification mentioned herein, illustrate a large amount of detail.It is to be appreciated, however, that this Bright embodiment can be put into practice in the case of not having these details.In some instances, not in detail Known method, structure and technology are shown, in order to do not obscure the understanding of this description.
Similarly, it will be appreciated that in order to simplify the disclosure helping understand one of each inventive aspect or Multiple, above in the description of the exemplary embodiment of the present invention, each feature of the present invention is sometimes by one Rise and be grouped in single embodiment, figure or descriptions thereof.But, should be by the method for the disclosure It is construed to reflect an intention that i.e. the present invention for required protection requires than institute in each claim clearly The more feature of feature recorded.More precisely, as the following claims reflect, send out Bright aspect is all features less than single embodiment disclosed above.Therefore, it then follows detailed description of the invention Claims be thus expressly incorporated in this detailed description of the invention, the wherein conduct of each claim itself The independent embodiment of the present invention.
Those skilled in the art are appreciated that and can carry out adaptive to the module in the equipment in embodiment Change to answering property and they are arranged in one or more equipment different from this embodiment.Can be reality Execute the module in example or unit or assembly is combined into a module or unit or assembly, and in addition can be it Be divided into multiple submodule or subelement or sub-component.Except in such feature and/or process or unit Outside at least some excludes each other, any combination can be used (to include that adjoint right is wanted to this specification Ask, make a summary and accompanying drawing) disclosed in all features and so disclosed any method or equipment all Process or unit are combined.Unless expressly stated otherwise, this specification (include adjoint claim, Summary and accompanying drawing) disclosed in each feature can be by the alternative features providing identical, equivalent or similar purpose Replace.
Although additionally, it will be appreciated by those of skill in the art that some embodiments described herein include other Some feature included in embodiment rather than further feature, but the combination meaning of the feature of different embodiment Taste and is within the scope of the present invention and is formed different embodiments.For example, in detail in the claims, One of arbitrarily can mode using in any combination of embodiment required for protection.
The all parts embodiment of the present invention can realize with hardware, or with at one or more processor The software module of upper operation realizes, or realizes with combinations thereof.It will be understood by those of skill in the art that Microprocessor or digital signal processor (DSP) can be used in practice to realize according to the present invention real The some or all functions of the some or all parts in the charger of the application program executing example.This Bright part or all the equipment being also implemented as performing method as described herein or dress Put program (for example, computer program and computer program).Such program realizing the present invention can With storage on a computer-readable medium, or can have the form of one or more signal.Such Signal can be downloaded from internet website and obtain, or provides on carrier signal, or with any other Form provides.
The present invention will be described rather than limits the invention to it should be noted above-described embodiment, and And those skilled in the art can design replacement enforcement without departing from the scope of the appended claims Example.In the claims, any reference symbol that should not will be located between bracket is configured to claim Limit.Word "comprising" does not excludes the presence of and does not arranges element in the claims or step.Be positioned at element it Front word "a" or "an" does not excludes the presence of multiple such element.The present invention can be by means of bag Include the hardware of some different elements and realize by means of properly programmed computer.Some listing In the unit claim of device, several in these devices can be to be come specifically by same hardware branch Embody.Word first, second and third use do not indicate that any order.Can be by these word solutions It is interpreted as title.
So far, although those skilled in the art will appreciate that and detailed herein illustrate and describing the present invention's Multiple exemplary embodiments, but, without departing from the spirit and scope of the present invention, still can be according to this Disclosure of invention directly determines or derives other variations or modifications of many meeting the principle of the invention.Cause This, the scope of the present invention is it is understood that and regard as covering other variations or modifications all these.

Claims (9)

1. the loading method of an application program, comprising:
When the process initiation of application program, obtaining operating system is that described application program is set up PackageInfo object;
Obtain the mClassLoader field in described PackageInfo object, described mClassLoader Field points to the address of ClassLoader object for storing;
Change the address in described mClassLoader field so that it is point to self-defining ClassLoader Object address;
Load described application program by described self-defining ClassLoader object;
Wherein, when the process initiation of application program, also include:
Rewrite the designation method function calling when the process initiation of described application program, make described designation method Function triggers and obtains the operation that operating system process is the PackageInfo object that described application program is set up.
2. method according to claim 1, wherein, described acquisition operating system is described application program The PackageInfo object set up, comprising:
Obtain the Application object of described application program;
Obtain the mBase object in described Application object;
Read the mPackageInfo field in described mBase object, by described mPackageInfo Field obtains the PackageInfo object that described operating system is that described application program is set up;
Wherein, be stored with in described mPackageInfo field the address of described PackageInfo object.
3. method according to claim 1, wherein, in obtaining described PackageInfo object Before mClassLoader field, described method also includes:
Generate self-defining ClassLoader object.
4. method according to claim 3, wherein, self-defining ClassLoader pair of described generation As, comprising:
Rewrite the method function under described ClassLoader object, and make described self-defining ClassLoader Object is inherited from the ClassLoader object of described operating system.
5. the charger of an application program, comprising:
Object acquisition module, is suitable to when the process initiation of application program, and obtaining operating system is described application The PackageInfo object that program is set up;
Address acquisition module, is suitable to obtain the mClassLoader field in described PackageInfo object, Described mClassLoader field points to the address of ClassLoader object for storing;
Replacement module, is suitably modified to the address in described mClassLoader field so that it is point to self-defined ClassLoader object address;
Load-on module, is suitable to load described application program by described self-defining ClassLoader object;
Calling module, is suitable to when the process initiation of application program, rewrites when the process of described application program opens The designation method function calling when dynamic, it is described for making described designation method function trigger acquisition operating system process The operation of the PackageInfo object that application program is set up.
6. device according to claim 5, wherein, described object acquisition module, comprising:
First object acquisition unit, is suitable to obtain the Application object of described application program;
Second object acquisition unit, is suitable to obtain the mBase object in described Application object;
3rd object acquisition unit, is suitable to read the mPackageInfo field in described mBase object, Obtaining described operating system by described mPackageInfo field is that described application program is set up PackageInfo object;
Wherein, be stored with in described mPackageInfo field the address of described PackageInfo object.
7. device according to claim 5, wherein, described device also includes:
Object generation module, is suitable to the mClassLoader word in obtaining described PackageInfo object Before Duan, generate self-defining ClassLoader object.
8. device according to claim 7, wherein, described object generation module is particularly adapted to according to such as The self-defining ClassLoader object of under type generation:
Rewrite the method function under described ClassLoader object, and make described self-defining ClassLoader Object is inherited from the ClassLoader object of described operating system.
9. a mobile terminal, it is characterised in that described mobile terminal includes:
Memory;
One or more processors;
Wherein, the one or more processor is configured to perform following method:
When the process initiation of application program, obtaining operating system is that described application program is set up PackageInfo object;
Obtain the mClassLoader field in described PackageInfo object, described mClassLoader Field points to the address of ClassLoader object for storing;
Change the address in described mClassLoader field so that it is point to self-defining ClassLoader Object address;
Load described application program by described self-defining ClassLoader object;
Wherein, when the process initiation of application program, also include:
Rewrite the designation method function calling when the process initiation of described application program, make described designation method Function triggers and obtains the operation that operating system process is the PackageInfo object that described application program is set up.
CN201510142323.9A 2015-03-27 2015-03-27 The loading method of a kind of application program, device and mobile terminal Expired - Fee Related CN104731622B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510142323.9A CN104731622B (en) 2015-03-27 2015-03-27 The loading method of a kind of application program, device and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510142323.9A CN104731622B (en) 2015-03-27 2015-03-27 The loading method of a kind of application program, device and mobile terminal

Publications (2)

Publication Number Publication Date
CN104731622A CN104731622A (en) 2015-06-24
CN104731622B true CN104731622B (en) 2016-10-05

Family

ID=53455540

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510142323.9A Expired - Fee Related CN104731622B (en) 2015-03-27 2015-03-27 The loading method of a kind of application program, device and mobile terminal

Country Status (1)

Country Link
CN (1) CN104731622B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105975290A (en) * 2015-10-13 2016-09-28 乐视致新电子科技(天津)有限公司 Method and device for analyzing APK document
CN106095521A (en) * 2016-08-02 2016-11-09 北京奇虎科技有限公司 Plug-in loading method and device
CN109426546B (en) * 2017-09-01 2022-10-25 腾讯科技(深圳)有限公司 Application starting method and device, computer storage medium and equipment
CN108008985A (en) * 2017-11-20 2018-05-08 北京奇虎科技有限公司 Application program loading method and device
CN110543305B (en) * 2018-05-29 2023-05-30 杭州海康威视系统技术有限公司 Method and device for replacing easy UI component
CN110308945B (en) * 2019-05-22 2022-07-05 百度在线网络技术(北京)有限公司 Dynamic loading method and device of plug-in
CN111625290B (en) * 2020-05-06 2023-03-24 小船出海教育科技(北京)有限公司 Layout file preloading method and device under Android platform and electronic equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268444A (en) * 2012-12-28 2013-08-28 武汉安天信息技术有限责任公司 Android malicious code detection system and method based on plugin loading

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8738589B2 (en) * 2009-09-30 2014-05-27 Red Hat, Inc. Classloading technique for an application server that provides dependency enforcement

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103268444A (en) * 2012-12-28 2013-08-28 武汉安天信息技术有限责任公司 Android malicious code detection system and method based on plugin loading

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"面向安卓系统的应用安全模块的研究与实现";刘一阳;《北京邮电大学硕士学位论文》;20141220;第4.1.1节 *

Also Published As

Publication number Publication date
CN104731622A (en) 2015-06-24

Similar Documents

Publication Publication Date Title
CN104731622B (en) The loading method of a kind of application program, device and mobile terminal
CN107291480B (en) Function calling method and device
CN108121594B (en) Process management method and device
CN103970563B (en) The method of dynamic load Android class
CN102981915B (en) A kind of inter-application communication method and device
US9851987B2 (en) Nested emulation and dynamic linking environment
CN104750528B (en) A kind of assembly management method and apparatus in Android program
CN106293696B (en) Method for displaying downloading and installing state of application program and corresponding device thereof
CN111475227B (en) Business plug-in loading implementation method and device and terminal equipment
CN103034546B (en) The method and device of inter-application communication in iOS system
CN105094878A (en) System library file integration method and apparatus
CN104699503A (en) Method and device for replacing function execution logic in Android system
US8397217B2 (en) Integrating templates into tests
CN104572431A (en) Test method and test device
US9696990B2 (en) Method and apparatus for implementing inter-component function calls
US8769498B2 (en) Warning of register and storage area assignment errors
CN103560934A (en) Power line modem production testing method and device
US10552135B1 (en) Reducing a size of an application package
CN106648788B (en) Application program installation method and device
KR20100110710A (en) Method for simplifying interfaces having dynamic libraries
CN104572199B (en) The method and apparatus that a kind of No starting item starts
CN110633210B (en) File execution method and device, storage medium and electronic equipment
CN103455342B (en) The method and device that a kind of theme calls
CN112445683A (en) Multi-switch detection bypass method, storage medium, device and system
CN114020278A (en) Data processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220721

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20161005

CF01 Termination of patent right due to non-payment of annual fee