CN109933381A - A kind of loading method and device of kernel - Google Patents
A kind of loading method and device of kernel Download PDFInfo
- Publication number
- CN109933381A CN109933381A CN201910168640.6A CN201910168640A CN109933381A CN 109933381 A CN109933381 A CN 109933381A CN 201910168640 A CN201910168640 A CN 201910168640A CN 109933381 A CN109933381 A CN 109933381A
- Authority
- CN
- China
- Prior art keywords
- load
- kernel
- load document
- virtual machine
- classloader
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a kind of loading method of kernel and devices, the described method includes: when application program launching, the load instruction of the corresponding kernel of Software Development Kit of the application program is obtained, the load instruction is for judging whether the kernel is its load for the first time after installing;When the kernel is load for the first time after its installation, virtual machine is executed into the machine code instruction storage path in code and is set as empty, so that the virtual machine, which executes code, does not make process of compilation to the load document of the kernel;Wherein, the application program obtains the browsing service that the kernel provides by the Software Development Kit, and the load document is loaded by the virtual machine for creating virtual environment on Android system.Present invention reduces the times of the load document load to kernel, ensure that compatibility of the virtual machine to Android system version and/or related terminal device of load kernel, kernel is enabled to provide efficiently high-quality browsing service for application program.
Description
Technical field
The present invention relates to Internet communication technology field more particularly to the loading methods and device of a kind of kernel.
Background technique
With the development of Internet communication technology, the application program on terminal device emerges one after another, and is used by application program
The usage experience at family is also become better and better.For example, user can pass through the browser browsed web content on mobile terminal;Pass through shifting
Player plays video and music in dynamic terminal;Chat interaction etc. is carried out by the social application on mobile terminal.
For application program while function is more perfect, Covering domain is more comprehensive, the scale of application program is also increasingly huger
Greatly, module is also more and more.Application program is increased using the scene of Dynamic loading technique, is mentioned using kernel for application help
It is serviced for browsing, however in the load for the first time after kernel is installed often in the presence of time-consuming, being also easy to produce ANR, (application program is without sound
Answer, Application Not Responding) the problems such as, affect user experience.
Summary of the invention
In order to solve the problems such as application response is slow when the prior art applies the load for the first time after kernel installation, this hair
It is bright to provide the loading method and device of a kind of kernel:
On the one hand, the present invention provides a kind of loading methods of kernel, which comprises
When application program launching, the load for obtaining the corresponding kernel of Software Development Kit of the application program refers to
It enables, the load instruction is for judging whether the kernel is its load for the first time after installing;
When the kernel for its installation after load for the first time when, by virtual machine execute code in machine code instruction store road
Diameter is set as empty, so that the virtual machine, which executes code, does not make process of compilation to the load document of the kernel;
Wherein, the application program obtains the browsing service that the kernel provides, institute by the Software Development Kit
Load document is stated to load by the virtual machine for creating virtual environment on Android system.
On the other hand a kind of loading device of kernel is provided, described device includes:
Judgment module is loaded for the first time: for obtaining the Software Development Tools of the application program when application program launching
The load instruction of corresponding kernel is wrapped, the load instruction is for judging whether the kernel is its load for the first time after installing;
Store path setup module: for when the kernel for its installation after load for the first time when, virtual machine is executed into generation
Machine code instruction storage path in code is set as empty, so that the virtual machine executes code not to the load text of the kernel
Part makees process of compilation;
Wherein, the application program obtains the browsing service that the kernel provides, institute by the Software Development Kit
Load document is stated to load by the virtual machine for creating virtual environment on Android system.
On the other hand a kind of terminal device is provided, the terminal device includes a kind of load side's dress of above-mentioned kernel
It sets.
On the other hand a kind of computer readable storage medium is provided, at least one finger is stored in the storage medium
Enable, at least a Duan Chengxu, code set or instruction set, at least one instruction, an at least Duan Chengxu, the code set or
Instruction set is loaded by processor and is executed to realize the loading method such as a kind of above-mentioned kernel.
The loading method and device of a kind of kernel provided by the invention, have the following technical effect that
The present invention is when application program launching, the case where for kernel for load for the first time after its installation, by virtual machine
The machine code instruction storage path executed in code is set as empty, and virtual machine no longer needs the load document to the kernel to compile
It translates processing and is loaded directly into corresponding load document, shorten the virtual machine for creating virtual environment on Android system in this way
To the time of the load document load of kernel, it ensure that the virtual machine of load kernel sets Android system version and/or associated terminal
Standby compatibility enables kernel to provide efficiently high-quality browsing service for application program.
Detailed description of the invention
It in order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology and advantage, below will be to implementation
Example or attached drawing needed to be used in the description of the prior art are briefly described, it should be apparent that, the accompanying drawings in the following description is only
It is only some embodiments of the present invention, for those of ordinary skill in the art, without creative efforts,
It can also be obtained according to these attached drawings other attached drawings.
Fig. 1 is a kind of schematic diagram of application environment provided in an embodiment of the present invention;
Fig. 2 is a kind of flow diagram of the loading method of kernel provided in an embodiment of the present invention;
Fig. 3 is that the machine code instruction storage path provided in an embodiment of the present invention executed virtual machine in code is set as empty
A kind of flow diagram;
Fig. 4 be the class processing task provided in an embodiment of the present invention by the load document Classloader be transferred to it is described plus
Published article part base class loader is executed, and sets the path optimizing in the execution code of the load document base class loader to
A kind of empty flow diagram;
Fig. 5 is also a kind of flow diagram of the loading method of kernel provided in an embodiment of the present invention;
Fig. 6 is a kind of composition block diagram of the loading device of kernel provided in an embodiment of the present invention;
Fig. 7 is also a kind of composition block diagram of the loading device of kernel provided in an embodiment of the present invention;
Fig. 8 is the flow diagram provided in an embodiment of the present invention using ART virtual machine load Dex file;
Fig. 9 is the working principle diagram of load document Classloader provided in an embodiment of the present invention;
Figure 10 is the schematic diagram of loading device one kind of kernel provided in an embodiment of the present invention;
Figure 11 is a kind of structural schematic diagram of terminal provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art without making creative work it is obtained it is all its
His embodiment, shall fall within the protection scope of the present invention.
It should be noted that term " includes " and " tool in description and claims of this specification and above-mentioned attached drawing
Have " and their any deformation, it is intended that cover it is non-exclusive include, for example, containing a series of steps or units
Process, method, system, product or server those of are not necessarily limited to be clearly listed step or unit, but may include not having
Other step or units being clearly listed or intrinsic for these process, methods, product or equipment.
Referring to Fig. 1, Fig. 1 is a kind of schematic diagram of application environment provided in an embodiment of the present invention, as shown in Figure 1, this is answered
With in environment, some application programs in terminal device are equipped with kernel corresponding Software Development Kit (SDK, Software
Development Kit), application program has access to kernel by the Software Development Kit, and then is able to use kernel
The browsing service of offer.Application response is answered when the operation of user will use browsing service (such as browsed web content)
Kernel can be loaded by Software Development Kit with program.It should be noted that Fig. 1 is only a kind of example.
Specifically, browsing service include but is not limited to browsing enhancing, content frame, advertisement system, H5 game distribution and greatly
The service such as data.Browsing enhancing service may include: that perfect efficient public security system is provided for application-browsing scene;It is right beyond the clouds
Webpage and resource flow are compressed, and load whole process in terminal optimized webpage;Kernel is shared with certain application hosts;Enhance file
Opening ability, video tenability etc..In practical applications, for example Tencent browses the TBS kernel under service scenarios, TBS kernel
The content load and rendering of webpage can be provided, clearly know web page contents and its structure: can be fast for article clear in structure
Fast-growing has assigned the link of corresponding content that page presentation can be realized at one " sub-panel ";Not enough clearly for structure
Each section of article of content summary can be taken out by intelligence learning algorithm, then be arranged in one simply by natural structure by article
Tree.
In embodiments of the present invention, terminal device can support Android (Android) system, and terminal device includes but unlimited
In smart phone, intelligent wearable device and PDA (tablet computer).Application program includes but is not limited to social category using (such as micro-
Letter application), have the application (such as Video Applications, audio play application, game application and ocr software) of amusement function and have
The application of standby service function (such as digital map navigation application purchases by group application).
The loading method of kernel of the present invention introduced below, Fig. 2 are a kind of load sides of kernel provided in an embodiment of the present invention
The flow diagram of method, present description provides the method operating procedures as described in embodiment or flow chart, but based on conventional or
Person may include more or less operating procedure without creative labor.The step of enumerating in embodiment sequence is only crowd
One of multi-step execution sequence mode does not represent and unique executes sequence.System or server product in practice is held
When row, can be executed according to embodiment or method shown in the drawings sequence or it is parallel execute (such as parallel processor or
The environment of multiple threads).It is specific as shown in Fig. 2, the method may include:
S201: when application program launching, adding for the corresponding kernel of Software Development Kit of the application program is obtained
Instruction is carried, the load instruction is for judging whether the kernel is its load for the first time after installing;
In embodiments of the present invention, the application program obtains what the kernel provided by the Software Development Kit
Browsing service, (ART is virtual by the virtual machine for creating virtual environment on Android system for the load document of the kernel
Machine) load.Kernel has a large amount of logics in load document, and (such as Dex file, java code is at runtime in a kind of android system
Corresponding load and execution file) in.As shown in figure 8, the load to the load document is successively passed through in java layers and c++
Layer, correspondingly, the load document can be presented with the progress of loading procedure with different file formats.For example, described add
Published article part compiled can be rendered as .class file (a kind of byte code files) at java layers.ART virtual machine can be used in c
++ the load document presented with bytecode format is compiled as to the load document presented with machine code format.Likewise, even if Fig. 8
Occurs DexFile at two in the block, but in different hierarchical structures, data structure and function are also completely uncorrelated.
Wherein, byte is the data volume unit in computer.Bytecode (Byte-code) file is a kind of comprising executing program, You Yixu
Op (operation code, operation code) code/data is arranged to the binary file of composition.Bytecode is a kind of intermediate code, it
It is more abstract than machine code.It is often counted as the binary file comprising an execution program, more like an object model.Machine
Device code (machine code) file, may also be referred to as machine language instruction and native code (Native Code), it is computer
The data that CPU (Central Processing Unit, central processing unit) can be interpreted directly.
Specifically, for kernel be its installation after the situation loaded for the first time, refer to kernel installation after for the first time certain into
It is loaded in journey.It generally after new kernel installs, can not be used immediately, need to need to be provided next time browsing service
The process kernel that just can really use this new when restarting rear.In practical applications, user installs application program A for the first time
When, kernel (such as TBS kernel) is not present at this time, therefore uses system kernel.With the installation to application program A, TBS kernel peace
It has been attached to " tmp catalogue ", and kernel is set and enables mark.After the process where TBS kernel is restarted, in application program A and in TBS
The position of the corresponding SDK meeting TBS kernel installation of core is changed to " core_share catalogue " by " tmp catalogue ", and then the SDK is rebooted
TBS kernel is loaded from " core_share catalogue ", and browsing service could be provided after loading successfully.After the installation of TBS kernel,
When TBS is loaded in certain process for the first time, with the enabling of TBS kernel, catalogue where TBS kernel is reset.Due to kernel
Place catalogue is reset, and causes, when loading Dex file, can not also can not find the corresponding machine of Dex in load Kernel-Process
Device code instruction, machine code instruction can be a kind of Oat file (ELF file privately owned for Android system;ELF file, can be performed with
Formatted file can be linked).Due to can not find corresponding Oat file, ART virtual machine can be attempted first to generate a Oat file, in turn
Complete really load.The process that ART virtual machine generates Oat file is referred to as dex2oat.However this work takes a long time,
It is even up to 10s or more on some terminal devices, causes large effect that ANR even occurs user experience.For ANR,
In android system, if application program respond for some time it is not sensitive enough, system can pass through UI interface display one dialogue
Frame, this dialog box are referred to as application program without response (ANR, Application Not Responding) dialog box.At this point, with
Family can choose " waiting " and application program allowed to continue to run, and also can choose " positive closing " application program.ANR dialog box
There is the smooth operation that seriously restrict application program.
S202: when the kernel for its installation after load for the first time when, by virtual machine execute code in machine code instruction
Storage path is set as empty, so that the virtual machine, which executes code, does not make process of compilation to the load document of the kernel;
In embodiments of the present invention, as shown in figure 8, the machine code instruction of ART virtual machine executed in code is stored road
Diameter oat_location is set as empty (nullptr).Load Dex is carried out by DexFile.loadDex () mode at java layers
File, loadDex have created a DexFile object.In the constructed fuction of DexFile, openDexFile is called to load
Dex file.OpenDexFile has invoked openDexFileNative again, has corresponded to art/runtime/native/dalivk_
DexFile_openDexFileNative static method in system_DexFile.cc.It is opened using ART virtual machine call
It checks that function checks the load document in class connector: being had invoked in DexFile_openDexFileNative
The OpenDexFilesFromOat (opening checks function) of ClassLinker (class connector) loads Dex file.
ClassLinker is a critical class of ART virtual machine internal, is responsible for the load of class, the code solution inside class
Analysis processing etc..The member variable of ClassLinker: oat_files_ can be traversed, check current Dex file whether by
It is parsed into Oat file.So when oat_location is that empty (nullptr) also indicates that there is the corresponding Oat of Dex file at present
File, however corresponding Oat file be unwilling to be not present as the kernel loaded for the first time after installation, it is equivalent to and passes through null pointer
Once pretended, it would not be in the compiling for making generation Oat file to Dex file in this way in the execution logic of ART virtual machine
, but be loaded directly into and use the Dex file.
Specifically, as shown in figure 3, the machine code instruction storage path by virtual machine execution code is set as sky
Step, comprising:
S301: creation load document Classloader, the load document Classloader is inherited to be loaded in load document base class
Device, the load document base class loader are used to the load document resolving to class;
In some embodiments, load document Classloader (DexClassLoader) is to load document base class loader
It (BaseDexClassLoader) is one layer of simple packaging, the core logic such as load Dex file exist
It is realized in BaseDexClassLoader.It is as follows that DexClassLoader executes code snippet:
DexClassLoader by dexPath therein, new File (optimizedDirectory),
LibraryPath, parent are transferred to BaseDexClassLoader.DexPath (complete trails where file to be resolved),
Dex file specified in the path is found specified target class by ClassLoader.(the optimization road optimzedDirectory
Diameter) it refers to generating text after virtual machine optimizes the Dex file in apk (AndroidPackage, Android installation kit)
The path of part storage, the Oat file path generated such as ART virtual machine.This path must be that the inside of current application program is deposited
Path is stored up, Google thinks there is the danger maliciously injected if be placed under publicly-owned path.LibraryPath is specified
Native layer identification code stores path.
As shown in Figure 8,9, kernel has a large amount of logics in Dex file, and needs dynamically load.So needing to create
Classloader ClassLoader is built, the operation of load Dex file is then carried out inside ClassLoader.As shown in figure 9, figure
The triangle of middle arrow indicate following Classloader inherit (inherit the attribute that can make subclass that there is parent and method or
Redefine, add attribute and method etc..It is from another Similar integral that a class, which can be declared, by extends keyword
Come) from Classloader above;The diamond shape of arrow indicates the syntagmatic for the class that arrow both ends are related in figure, and whether diamond shape is real
The heart indicates whether two classes possess membership, as the class in BaseDexClassLoader possesses DexPathList (load text
Part route directory) class example.When class in DexClassLoader dynamically load Dex file, DexClassLoader is
Simply BaseDexClassLoader has been done and has been encapsulated, concrete implementation is still in parent BaseDexClassLoader
In.DexPathList class is created, Element (element) object array is searched class and then deposited in.
DexClassLoader eventually calls DexFile class by the Dex file cache of load in DexPathList class.
S302: by the class of load document Classloader processing task be transferred to the load document base class loader into
Row executes, and the path optimizing of the load document base class loader executed in code is arranged empty.
In some embodiments, it is not strictly required in the execution code of BaseDexClassLoader
OptimizedDirectory (path optimizing) one is set to non-empty.(the triangle and diamond shape of arrow in Figure 10 as shown in Fig. 4,10
The same Fig. 9 of meaning), S401: construction load document derives from Classloader (SpeedyDexClassLoader), the load document group
Raw Classloader is inherited in the load document base class loader.SpeedyDexClassLoader is inherited from
BaseDexClassLoader has the ability of BaseDexClassLoader automatically.S402: by way of agency,
The decoupling load document derives from Classloader and the load document Classloader.Pass through construction one
DexClassLoader acts on behalf of (ClassLoaderProvider), will need to change using the place of DexClassLoader originally
To use BaseDexClassLoader, the workload of modification code is reduced, cost is reduced.In practical applications, can pass through
Constructing following code may be implemented purpose (oat_location==nullptr):
As shown in figure 5, the loading method of kernel further include:
S203: function is compiled by the virtual machine call for creating virtual environment on Android system and is loaded directly into
The load document;
As shown in figure 8, oat_location is set as empty (nullptr) at this time, ART virtual machine call DexFile::
Open be loaded directly into Dex file load, using class.
S204: newly-built kernel loads thread, by described for creating the virtual machine tune of virtual environment on Android system
The machine code instruction of the corresponding load document is generated with respective function;
In embodiments of the present invention, to avoid interfering, step S204 in step S203 to the load of Dex file after the completion of
It carries out.In practical applications, on compared with lowest version Android operation system (such as Android5.x or more), newly-built kernel adds
Carrying thread, there may be the compatibility issues on individual ROM (mirror image of Android system).In this case, backstage can be started
Service (Android Service component) executes the conversion process of Dex file to Oat file (machine code instruction) wherein.
Specifically, thread can be started additionally to load Dex file (generating Oat file), it is ensured that load next time Dex file
When can AOT (Ahead OfTime, precompile) mode under normal use ART virtual machine efficiently execute.It ensure that kernel
Dex file loads the gentle reasonable employment of situation Yu AOT mode for the first time, realizes the efficient offer of browsing service.
As shown in figure 8, carrying out load Dex file by DexFile.loadDex () mode at java layers, loadDex is new
A DexFile object is built.In the constructed fuction of DexFile, openDexFile is called to load Dex file.
OpenDexFile has invoked openDexFileNative again, has corresponded to art/runtime/native/dalivk_system_
DexFile_openDexFileNative static method in DexFile.cc.
The newly-built kernel loads thread, by described for creating the virtual machine call of virtual environment on Android system
Compile the step of function generates the machine code instruction of the corresponding load document, comprising:
Firstly, checking function in class using the virtual machine call opening for creating virtual environment on Android system
The load document is checked in connector;
In practical applications, ClassLinker (class connector) is had invoked in DexFile_openDexFileNative
OpenDexFilesFromOat (opening checks function) load Dex file.ClassLinker is ART virtual machine internal
One critical class is responsible for the load of class, code analysis processing inside class etc..ClassLinker can be traversed
Member variable: oat_files_ checks whether current Dex file has been resolvable to Oat file.
The process that OpenDexFilesFromOat is checked are as follows: check whether the Oat file that can have;If without available Oat
File then detects whether the Oat file generated on disk;If there is the Oat generated on disk
File then checks whether the Oat file is expired and whether contains all Dex file;It, can if above-mentioned be unsatisfactory for
Regenerate Oat file.
Then, when the load document is not resolved, using described for creating virtual environment on Android system
Virtual machine call described in compiling function creation the load document is compiled as to the process of the machine code instruction.
In practical applications, OpenDexFilesFromOat constructs an OatFileAssistant object,
It is that DEX generates corresponding Oat file that the MakeUpToDate of OatFileAssistant, which can call GenerateOatFile,.
Dex2oat process by call execv execute android system in /system/bin/dex2oat) realize.
The technical solution provided by above this specification embodiment is as it can be seen that work as application program launching in this specification embodiment
When, for kernel for its installation after load for the first time the case where, by virtual machine execute code in machine code instruction store path
It is set as empty, virtual machine no longer needs the load document to the kernel to make process of compilation and is loaded directly into corresponding load text
Part shortens the time of Dex file load of the ART virtual machine to kernel, at certain application programs (such as QQ browser) in this way
On time-consuming can be optimized within 1 second, reduce period of reservation of number.It ensure that the virtual machine of load kernel to Android system version
The compatibility of this and/or related terminal device, and it is versatile, cost of access is low and performance is stablized, enable kernel for application
Program provides efficiently high-quality browsing service.
The embodiment of the invention also provides a kind of loading devices of kernel, as shown in fig. 6, described device includes:
Judgment module 61 is loaded for the first time: for obtaining the software development work of the application program when application program launching
Has the load instruction of the corresponding kernel of packet, the load instruction is for judging whether the kernel is adding after it is installed for the first time
It carries;
Store path setup module 62: for when the kernel for its installation after load for the first time when, virtual machine is executed
Machine code instruction storage path in code is set as empty, so that the virtual machine executes the code not load to the kernel
File makees process of compilation.Specifically, storage path setup module 62 includes: creating unit: for creating load document class
Loader, the load document Classloader are inherited in load document base class loader, and the load document base class loader is used
In the load document is resolved to class;Adjustment unit: for shifting the class processing task of the load document Classloader
It is executed to the load document base class loader, by the optimization road of the load document base class loader executed in code
Diameter is set as empty.Wherein, the adjustment unit includes: construction subelement: Classloader is derived from for constructing load document, it is described
Load document, which derives from Classloader, to be inherited in the load document base class loader;Decoupling subelement: for passing through agency's
Mode, the decoupling load document derive from Classloader and the load document Classloader.
Wherein, the application program obtains the browsing service that the kernel provides, institute by the Software Development Kit
Load document is stated to load by the virtual machine for creating virtual environment on Android system.
As shown in fig. 7, described device further include:
First loading module 63: for being based on the load document, by described virtual for being created on Android system
The virtual machine call respective function of environment is loaded directly into the load document;
Second loading module 64: for creating kernel loads thread, by described virtual for being created on Android system
The virtual machine call compiling function of environment generates the machine code instruction of the corresponding load document.Specifically, second load
Module 64 includes: inspection unit: for using the virtual machine call for creating virtual environment on Android system to open
Check that function checks the load document in class connector;Resolution unit: being used for when the load document is not resolved,
It is using compiling function creation described in the virtual machine call for creating virtual environment on Android system that the load is literary
Part is compiled as the process of the machine code instruction.
It should be noted that the apparatus and method embodiment in described device embodiment is based on same inventive concept.
The embodiment of the invention provides a kind of terminal device, the terminal device includes the load such as a kind of above-mentioned kernel
Square device.
Please refer to Figure 11 which shows a kind of structural schematic diagram of terminal device provided in an embodiment of the present invention, the terminal
Equipment is used for the data back up method for implementing to provide in above-described embodiment.Specifically:
Terminal device 1100 may include RF (RadioFrequency, radio frequency) circuit 1110, include one or one
The memory 1120 of the above computer readable storage medium, input unit 1130, display unit 1140, video sensor 1150,
Voicefrequency circuit 1160, includes one or more than one place at WiFi (wirelessfidelity, Wireless Fidelity) module 1170
Manage the components such as processor 1180 and the power supply 110 of core.It will be understood by those skilled in the art that terminal shown in Figure 11
Device structure does not constitute the restriction to terminal device, may include components more more or fewer than diagram, or combine certain
Component or different component layouts.Wherein:
RF circuit 1110 can be used for receiving and sending messages or communication process in, signal sends and receivees, particularly, by base station
After downlink information receives, one or the processing of more than one processor 1180 are transferred to;In addition, the data for being related to uplink are sent to
Base station.In general, RF circuit 1110 include but is not limited to antenna, at least one amplifier, tuner, one or more oscillator,
Subscriber identity module (SIM) card, transceiver, coupler, LNA (LowNoiseAmplifier, low-noise amplifier), duplex
Device etc..In addition, RF circuit 1110 can also be communicated with network and other equipment by wireless communication.The wireless communication can make
With any communication standard or agreement, including but not limited to GSM (move by GlobalSystemofMobilecommunication, the whole world
Dynamic communication system), GPRS (GeneralPacketRadioService, general packet radio service), CDMA
(CodeDivisionMultipleAccess, CDMA), WCDMA (WidebandCodeDivisionMultipleAcce
Ss, wideband code division multiple access), LTE (LongTermEvolution, long term evolution), Email, SMS
(ShortMessagingService, short message service) etc..
Memory 1120 can be used for storing software program and module, and processor 1180 is stored in memory by operation
1120 software program and module, thereby executing various function application and data processing.Memory 1120 can mainly include
Storing program area and storage data area, wherein storing program area can application journey needed for storage program area, at least one function
Sequence (such as sound-playing function, image player function etc.) etc.;Storage data area can store the use according to terminal device 1100
Data (such as video data, phone directory etc.) created etc..In addition, memory 1120 may include high random access storage
Device, can also include nonvolatile memory, and a for example, at least disk memory, flush memory device or other volatibility are solid
State memory device.Correspondingly, memory 1120 can also include Memory Controller, to provide processor 1180 and input unit
The access of 1130 pairs of memories 1120.
Input unit 1130 can be used for receiving the number or character information of input, and generate and user setting and function
Control related keyboard, mouse, operating stick, optics or trackball signal input.Specifically, input unit 1130 may include figure
As input equipment 1131 and other input equipments 1132.Image input device 1131 can be camera, be also possible to photoelectricity
Scanning device.In addition to image input device 1131, input unit 1130 can also include other input equipments 1132.Specifically,
Other input equipments 1132 can include but is not limited to physical keyboard, function key (such as volume control button, switch key etc.),
One of trace ball, mouse, operating stick etc. are a variety of.
Display unit 1140 can be used for showing information input by user or the information and terminal device that are supplied to user
1300 various graphical user interface, these graphical user interface can be by figure, text, icon, video and any combination thereof
To constitute.Display unit 1140 may include display panel 1141, optionally, can use LCD
(LiquidCrystalDisplay, liquid crystal display), OLED (OrganicLight-EmittingDiode, organic light emission two
Pole pipe) etc. forms configure display panel 1141.
Terminal device 1100 may include at least one video sensor 1150, and video sensor is used to obtain the video of user
Information.Terminal device 1100 can also include other sensor (not shown), such as optical sensor, motion sensor and other
Sensor.Specifically, optical sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can basis
The light and shade of ambient light adjusts the brightness of display panel 1141, and proximity sensor can be moved in one's ear in terminal device 1100
When, close display panel 1141 and/or backlight.As a kind of motion sensor, gravity accelerometer can detect each
The size of (generally three axis) acceleration, can detect that size and the direction of gravity, can be used to identify mobile phone on direction when static
The application (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating) of posture, (such as the step counting of Vibration identification correlation function
Device, percussion) etc.;Gyroscope, barometer, hygrometer, thermometer, the infrared sensor that can also configure as terminal device 1100
Etc. other sensors, details are not described herein.
Video circuit 1160, loudspeaker 1161, microphone 1162 can provide the video between user and terminal device 1100
Interface.Electric signal after the audio data received conversion can be transferred to loudspeaker 1161, by loudspeaker by voicefrequency circuit 1160
1161 are converted to voice signal output;On the other hand, the voice signal of collection is converted to electric signal by microphone 1162, by audio
Circuit 1160 is converted to audio data after receiving, then by after the processing of audio data output processor 1180, through RF circuit 1111 with
It is sent to such as another terminal device, or audio data is exported to memory 1120 to be further processed.Voicefrequency circuit
1160 are also possible that earphone jack, to provide the communication of peripheral hardware earphone Yu terminal device 1100.
WiFi belongs to short range wireless transmission technology, and terminal device 1100 can help user to receive by WiFi module 1170
It sends e-mails, browse webpage and access streaming video etc., it provides wireless broadband internet access for user.Although figure
11 show WiFi module 1170, but it is understood that, and it is not belonging to must be configured into for terminal device 1100, completely may be used
To omit within the scope of not changing the essence of the invention as needed.
Processor 1180 is the control centre of terminal device 1100, utilizes each of various interfaces and connection whole mobile phone
A part by running or execute the software program and/or module that are stored in memory 1120, and calls and is stored in storage
Data in device 1120 execute the various functions and processing data of terminal device 1100, to carry out integral monitoring to mobile phone.It can
Choosing, processor 1180 may include one or more processing cores;Preferably, processor 1180 can integrate application processor and tune
Demodulation processor processed, wherein the main processing operation system of application processor, user interface and application program etc., modulatedemodulate is mediated
Reason device mainly handles wireless communication.It is understood that above-mentioned modem processor can not also be integrated into processor 1180
In.
Terminal device 1100 further includes the power supply 110 (such as battery) powered to all parts, it is preferred that power supply can lead to
Cross power-supply management system and processor 1180 be logically contiguous, thus by power-supply management system realize management charging, electric discharge and
The functions such as power managed.Power supply 110 can also include one or more direct current or AC power source, recharging system, electricity
The random components such as source fault detection circuit, power adapter or inverter, power supply status indicator.
Although being not shown, terminal device 1100 can also be including bluetooth module etc., and details are not described herein.
Specifically in the present embodiment, terminal device 1100 further includes having memory and one or more than one journey
Sequence, perhaps more than one program is stored in memory and is configured to by one or more than one processor for one of them
It executes.Said one or more than one program include the finger for executing the data back up method of above method embodiment offer
It enables.
The embodiments of the present invention also provide a kind of computer storage medium, the storage medium may be disposed at terminal device
Among to save relevant at least one instruction of loading method for realizing kernel a kind of in embodiment of the method, an at least Duan Cheng
Sequence, code set or instruction set, at least one instruction, an at least Duan Chengxu, the code set or the instruction set are added by the processor
Carry and execute the loading method to realize the kernel of above method embodiment offer.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to: USB flash disk, read-only memory (ROM,
Read-OnlyMemory), random access memory (RAM, RandomAccessMemory), mobile hard disk, magnetic or disk
Etc. the various media that can store program code.
It should be understood that embodiments of the present invention sequencing is for illustration only, do not represent the advantages or disadvantages of the embodiments.
And above-mentioned this specification specific embodiment is described.Other embodiments are within the scope of the appended claims.One
In a little situations, the movement recorded in detail in the claims or step can be executed according to the sequence being different from embodiment and
Still desired result may be implemented.In addition, process depicted in the drawing not necessarily requires the particular order shown or company
Continuous sequence is just able to achieve desired result.In some embodiments, multitasking and parallel processing it is also possible or
It may be advantageous.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device and
For terminal device embodiment, since it is substantially similar to the method embodiment, so be described relatively simple, related place referring to
The part of embodiment of the method illustrates.
Those of ordinary skill in the art will appreciate that realizing that all or part of the steps of above-described embodiment can pass through hardware
It completes, relevant hardware can also be instructed to complete by program, the program can store in a kind of computer-readable
In storage medium, storage medium mentioned above can be read-only memory, disk or CD etc..
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and
Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.
Claims (10)
1. a kind of loading method of kernel, which is characterized in that the described method includes:
When application program launching, the load instruction of the corresponding kernel of Software Development Kit of the application program, institute are obtained
Load instruction is stated for judging whether the kernel is its load for the first time after installing;
When the kernel for its installation after load for the first time when, by virtual machine execute code in machine code instruction storage path set
It is set to sky, so that the virtual machine, which executes code, does not make process of compilation to the load document of the kernel;
Wherein, the application program obtains the browsing service that the kernel provides by the Software Development Kit, described to add
Part of publishing papers is loaded by the virtual machine for creating virtual environment on Android system.
2. the method according to claim 1, wherein the load for the first time after the kernel is installed for it
When, virtual machine is executed into the machine code instruction storage path in code and is set as empty step, comprising:
Load document Classloader is created, the load document Classloader is inherited in load document base class loader, described to add
Published article part base class loader is used to the load document resolving to class;
The class processing task of the load document Classloader is transferred to the load document base class loader to execute, it will
Path optimizing in the execution code of the load document base class loader is set as empty.
3. according to the method described in claim 2, it is characterized in that, described appoint the class processing of the load document Classloader
Business is transferred to the load document base class loader and is executed, will be in the execution code of the load document base class loader
Path optimizing is set as empty step, comprising:
It constructs load document and derives from Classloader, the load document derives from Classloader succession and adds in the load document base class
Carry device;
By way of agency, the decoupling load document derives from Classloader and the load document Classloader.
4. the method according to claim 1, wherein the load for the first time after the kernel is installed for it
When, virtual machine is executed into the machine code instruction storage path in code and is set as after the step of sky, comprising:
The load is loaded directly by the virtual machine call respective function for creating virtual environment on Android system
File;
Newly-built kernel loads thread compiles function by the virtual machine call for creating virtual environment on Android system
Generate the machine code instruction of the corresponding load document.
5. according to the method described in claim 4, it is characterized in that, described virtual for being created on Android system by described
The step of virtual machine call compiling function of environment generates the machine code instruction of the corresponding load document, comprising:
Check function in class connector using the virtual machine call opening for creating virtual environment on Android system
Check the load document;
When the load document is not resolved, using described for creating the virtual machine tune of virtual environment on Android system
The load document is compiled as to the process of the machine code instruction with the compiling function creation.
6. a kind of loading device of kernel, which is characterized in that described device includes:
Judgment module is loaded for the first time: for obtaining the Software Development Kit pair of the application program when application program launching
The load for the kernel answered instructs, and the load instruction is for judging whether the kernel is its load for the first time after installing;
Store path setup module: for when the kernel for its installation after load for the first time when, will virtual machine execute code in
Machine code instruction storage path be set as empty the load document of the kernel is not made so that the virtual machine executes code
Process of compilation;
Wherein, the application program obtains the browsing service that the kernel provides by the Software Development Kit, described to add
Part of publishing papers is loaded by the virtual machine for creating virtual environment on Android system.
7. device according to claim 6, which is characterized in that storage path setup module includes:
Creating unit: for creating load document Classloader, the load document Classloader is inherited in load document base class
Loader, the load document base class loader are used to the load document resolving to class;
Adjustment unit: it is loaded for the class processing task of the load document Classloader to be transferred to the load document base class
Device is executed, and sets empty for the path optimizing in the execution code of the load document base class loader.
8. device according to claim 7, which is characterized in that the adjustment unit includes:
Construction subelement: Classloader is derived from for constructing load document, the load document, which derives from Classloader, to be inherited in institute
State load document base class loader;
Decoupling subelement: for by way of agency, the decoupling load document to derive from Classloader and the load
File Classloader.
9. device according to claim 6, which is characterized in that described device further include:
First loading module: for passing through the virtual machine call respective function for the creation virtual environment on Android system
It is loaded directly into the load document;
Second loading module: for creating kernel loads thread, by described for creating virtual environment on Android system
Virtual machine call compiles the machine code instruction that function generates the corresponding load document.
10. device according to claim 9, which is characterized in that second loading module includes:
Inspection unit: for using the virtual machine call opening for creating virtual environment on Android system to check function
The load document is checked in class connector;
Resolution unit: for being used to create virtually on Android system using described when the load document is not resolved
The load document is compiled as the process of the machine code instruction by compiling function creation described in the virtual machine call of environment.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910168640.6A CN109933381B (en) | 2019-03-06 | 2019-03-06 | Kernel loading method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910168640.6A CN109933381B (en) | 2019-03-06 | 2019-03-06 | Kernel loading method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109933381A true CN109933381A (en) | 2019-06-25 |
CN109933381B CN109933381B (en) | 2021-07-16 |
Family
ID=66986301
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910168640.6A Active CN109933381B (en) | 2019-03-06 | 2019-03-06 | Kernel loading method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109933381B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110543338A (en) * | 2019-09-09 | 2019-12-06 | 北京安云世纪科技有限公司 | dynamic loading method and device for files |
CN111240766A (en) * | 2020-01-22 | 2020-06-05 | 北京字节跳动网络技术有限公司 | Application starting method and device, electronic equipment and computer readable storage medium |
CN111338636A (en) * | 2020-02-21 | 2020-06-26 | 北京松果电子有限公司 | Kernel preprocessing method, kernel preprocessing device and electronic equipment |
CN112540929A (en) * | 2020-12-25 | 2021-03-23 | 北京百度网讯科技有限公司 | Detection method, device, equipment and storage medium |
CN113934461A (en) * | 2021-09-26 | 2022-01-14 | 厦门亿联网络技术股份有限公司 | DEX-based android system formatting method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6698015B1 (en) * | 2000-06-13 | 2004-02-24 | Cisco Technology, Inc. | Apparatus and method for improving performance of critical code execution |
US20040073904A1 (en) * | 2002-10-15 | 2004-04-15 | Nokia Corporation | Method and apparatus for accelerating program execution in platform-independent virtual machines |
CN105303072A (en) * | 2015-10-26 | 2016-02-03 | 李晖 | ART mode based software hardening method and apparatus |
CN108415737A (en) * | 2018-02-07 | 2018-08-17 | 北京奇虎科技有限公司 | A kind of method and electric terminal loading plug-in unit in virtual machine |
-
2019
- 2019-03-06 CN CN201910168640.6A patent/CN109933381B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6698015B1 (en) * | 2000-06-13 | 2004-02-24 | Cisco Technology, Inc. | Apparatus and method for improving performance of critical code execution |
US20040073904A1 (en) * | 2002-10-15 | 2004-04-15 | Nokia Corporation | Method and apparatus for accelerating program execution in platform-independent virtual machines |
CN105303072A (en) * | 2015-10-26 | 2016-02-03 | 李晖 | ART mode based software hardening method and apparatus |
CN108415737A (en) * | 2018-02-07 | 2018-08-17 | 北京奇虎科技有限公司 | A kind of method and electric terminal loading plug-in unit in virtual machine |
Non-Patent Citations (1)
Title |
---|
WEIXIN_34417183: "Android ART dex2oat 加载加速浅析", 《HTTPS://BLOG.CSDN.NET/WEIXIN_34417183/ARTICLE/DETAILS/91393501》 * |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110543338A (en) * | 2019-09-09 | 2019-12-06 | 北京安云世纪科技有限公司 | dynamic loading method and device for files |
CN111240766A (en) * | 2020-01-22 | 2020-06-05 | 北京字节跳动网络技术有限公司 | Application starting method and device, electronic equipment and computer readable storage medium |
CN111240766B (en) * | 2020-01-22 | 2023-12-29 | 抖音视界有限公司 | Application starting method and device, electronic equipment and computer readable storage medium |
CN111338636A (en) * | 2020-02-21 | 2020-06-26 | 北京松果电子有限公司 | Kernel preprocessing method, kernel preprocessing device and electronic equipment |
CN111338636B (en) * | 2020-02-21 | 2023-09-26 | 北京小米松果电子有限公司 | Kernel preprocessing method, kernel preprocessing device and electronic equipment |
CN112540929A (en) * | 2020-12-25 | 2021-03-23 | 北京百度网讯科技有限公司 | Detection method, device, equipment and storage medium |
CN112540929B (en) * | 2020-12-25 | 2024-03-12 | 北京百度网讯科技有限公司 | Detection method, detection device, detection equipment and storage medium |
CN113934461A (en) * | 2021-09-26 | 2022-01-14 | 厦门亿联网络技术股份有限公司 | DEX-based android system formatting method and device |
CN113934461B (en) * | 2021-09-26 | 2023-10-13 | 厦门亿联网络技术股份有限公司 | DEX-based android system formatting method and device |
Also Published As
Publication number | Publication date |
---|---|
CN109933381B (en) | 2021-07-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR102436987B1 (en) | Method and terminal device for extracting web page content | |
KR102245025B1 (en) | Memory return method and device | |
CN109358936B (en) | Information processing method, device, storage medium, electronic device and system | |
CN109933381A (en) | A kind of loading method and device of kernel | |
CN106970790B (en) | Application program creating method, related equipment and system | |
US11853820B2 (en) | Cross-process communication method, apparatus, and device | |
US10186244B2 (en) | Sound effect processing method and device, plug-in unit manager and sound effect plug-in unit | |
CN109408136B (en) | Information processing method, information processing apparatus, storage medium, and electronic device | |
CN106502703B (en) | Function calling method and device | |
CN103914205B (en) | A kind of file thumbnail methods of exhibiting of intelligent terminal and device | |
CN108287918B (en) | Music playing method and device based on application page, storage medium and electronic equipment | |
US20170249934A1 (en) | Electronic device and method for operating the same | |
US20170011010A1 (en) | Method for displaying web content and electronic device supporting the same | |
CN109800030B (en) | Application program running method and device and terminal | |
CN114185491B (en) | Partition file downloading method and device, storage medium and computer equipment | |
CN105740263A (en) | Page display method and apparatus | |
CN110945475A (en) | System and method for providing patchable ROM firmware | |
CN103607431B (en) | Mobile terminal resource processing method, device and equipment | |
CN112486459A (en) | Activity page generation method and device, computer equipment and readable storage medium | |
CN104050001A (en) | Resource processing method, device and equipment based on Android system | |
CN110489158B (en) | Method, device, medium and electronic equipment for optimizing code hosting platform | |
CN103309677B (en) | Built-in resource management, device and terminal | |
CN114547604A (en) | Application detection method and device, storage medium and electronic equipment | |
CN108182090A (en) | Flash plug-in loading methods and device based on blink kernels | |
CN108664389B (en) | Test method, test device and terminal |
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 |