CN106502754A - Activity component loading methods and device - Google Patents

Activity component loading methods and device Download PDF

Info

Publication number
CN106502754A
CN106502754A CN201611062676.9A CN201611062676A CN106502754A CN 106502754 A CN106502754 A CN 106502754A CN 201611062676 A CN201611062676 A CN 201611062676A CN 106502754 A CN106502754 A CN 106502754A
Authority
CN
China
Prior art keywords
bundle
configuration file
files
activity
bundlecontext
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
Application number
CN201611062676.9A
Other languages
Chinese (zh)
Other versions
CN106502754B (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.)
TCL Corp
Original Assignee
TCL Corp
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 TCL Corp filed Critical TCL Corp
Priority to CN201611062676.9A priority Critical patent/CN106502754B/en
Publication of CN106502754A publication Critical patent/CN106502754A/en
Application granted granted Critical
Publication of CN106502754B publication Critical patent/CN106502754B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The present invention provides a kind of Activity component loading methods and device.Wherein, the Activity component loading methods include:Obtain the BundleContext of the open service gateway initiative framework of embedded android system in advance;Determine Activity components to be launched;Obtain the bundle identifiers with the Activity component liaisons to be launched;According to the bundle identifiers for currently obtaining, the BundleContext.start methods of the BundleContext are called to start corresponding bundle files, to load corresponding Activity components, wherein, the bundle files are transformed by jar file, and the jar file is formed by the compilation of source code of the Activity components.The technical scheme that the present invention is provided enables to the dynamic load of Activity components and is possibly realized.

Description

Activity component loading methods and device
Technical field
The present invention relates to android system field, and in particular to a kind of Activity component loading methods and device.
Background technology
Android system is the operating system of a kind of freedom based on Linux and open source code, is widely used at present In intelligent terminal's (such as smart mobile phone, panel computer and intelligent television etc.).
Activity components are one of four big components of android system, and the Activity components of program are needed at this Registered in the AndroidManifest.xml files of program, also, the title of the Activity components of program development is needed The class name fixed with the AndroidManifest.xml documents of the program is identical.
At present, can change journey by way of .dex files being loaded based on dalvik.system.DexClassLoader The code logic of sequence, reaches the purpose for not installing new program installation kit with regard to the scalable program.However, aforesaid way has one Fixed limitation, due to program development Activity components need and the program AndroidManifest.xml files in The class name that specifies is identical, and due to AndroidManifest.xml files be build-in attribute, it is impossible to change when program is run Become, therefore, by the way cannot when program is run dynamic linker Activity components.
Content of the invention
The present invention provides a kind of Activity component loading methods and device so that the dynamic load of Activity components into For possibility.
First aspect present invention provides a kind of Activity component loading methods, is applied to android system, should Activity component loading methods, including:
Obtain the BundleContext of the open service gateway initiative framework of embedded android system in advance;
Determine Activity components to be launched;
Obtain the bundle identifiers with the Activity component liaisons to be launched;
According to the bundle identifiers for currently obtaining, the BundleContext.start of the BundleContext is called Method starts corresponding bundle files, and to load corresponding Activity components, wherein, the bundle files are by jar File translations are formed, and the jar file is formed by the compilation of source code of the Activity components.
Second aspect present invention provides a kind of Activity components charger, is applied to android system, should Activity component chargers include:
First acquisition unit, for obtaining the open service gateway initiative framework for being embedded in android system in advance BundleContext;
Determining unit, for determining Activity components to be launched;
Second acquisition unit, for obtaining the bundle identifiers with the Activity component liaisons to be launched;
Start unit, for the bundle identifiers obtained according to presently described second acquisition unit, calls described The BundleContext.start methods of BundleContext start corresponding bundle files, so as to loading accordingly Activity components, wherein, the bundle files are transformed by jar file, and the jar file is by the Activity groups The compilation of source code of part is formed.
Therefore, the jar file of the compilation of source code by Activity components is changed in the present invention Bundle files, also, open service gateway initiative framework (OSGI, Open Service Gateway are embedded in android system Initiative), the operation of bundle files is achieved by the OSGI frameworks, and then achieves corresponding Activity components Loading.As the loading of Activity components in the present invention is realized by starting corresponding bundle files, therefore, The loading of Activity components need not be limited to AndroidManifest.xml files, so that Activity components is dynamic State loading is possibly realized.
Description of the drawings
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing Accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this Some embodiments of invention, for those of ordinary skill in the art, without having to pay creative labor, may be used also To obtain other accompanying drawings according to these accompanying drawings.
Activity component loading method one embodiment schematic flow sheets that Fig. 1 is provided for the present invention;
Fig. 2 is implemented for a kind of Activity components dynamic updating method that the present invention is provided on the basis of method shown in Fig. 1 Example schematic flow sheet;
Fig. 3 provides a kind of Activity components dynamic offloading method on the basis of method shown in Fig. 1 or Fig. 2 for the present invention Embodiment schematic flow sheet;
Activity component charger one embodiment structural representations that Fig. 4 is provided for the present invention.
Specific embodiment
For enabling the goal of the invention of the present invention, feature, advantage more obvious and understandable, below in conjunction with the present invention Accompanying drawing in embodiment, to the embodiment of the present invention in technical scheme be clearly and completely described, it is clear that described reality It is only a part of embodiment of the invention to apply example, and not all embodiments.Embodiment in based on the present invention, the common skill in this area The every other embodiment obtained under the premise of creative work is not made by art personnel, belongs to the model of present invention protection Enclose.
The embodiment of the present invention provides a kind of Activity component loading methods, refers to shown in Fig. 1, in the embodiment of the present invention Activity component loading methods may include steps of:
Step 101, the BundleContext for obtaining the open service gateway initiative framework of embedded android system in advance;
In the embodiment of the present invention, open service gateway initiative framework namely OSGI frameworks are to realize and provide OSGI functions Running environment.OSGI frameworks play central role when the application based on OSGI is created, because it is the performing environment of application.
OSGI alliances correct behavior of framework defined in OSGI framework specifications, can thus be based on a definition clear Clear application programming interface (API, Application Programming Interface) is programmed.This framework It is according to three conceptual level designs defined in OSGI specifications:
Module layer:Focus on packing and share code.Module layer defines the concept of OSGI modules, and it is referred to as one bundle.Bundle files are jar files comprising metadata (with regard to the data of data), by class file and related resource Composition.It is the multiple logic modules for constituting an application-specific.
Service layer:Focus on the interaction and communication of inter-module in module, particularly module.Service layer supports and facilitates One flexible application programming model.Relate generally to service-oriented issue, lookup and binding interactive mode, i.e. ISP Service is published to service register center, then service client searches operational clothes by search service registration center Business.
Life cycle layer:Module management and the access to bottom OSGI frameworks when focusing on providing execution.Life cycle layer Define in OSGI frameworks is how dynamic is installed and manage.Life cycle layer defines the behaviour of bundle life cycle Make (as installed, updating, start, stop and unload).The operation of these life cycle allows to a kind of well-defined side Formula dynamically provides, manages and improve application program.
Bundle is the modular model in OSGI.Include class files and corresponding in the jar bags of standard Java platform Resource file, bundle files can simply be not understood as the jar bags that increased metadata.Wrap in one bundle file Java classes and some other data resources are contained, these data can be html file, help document and icon etc..Each Bundle files all correspond to one uniquely and keep constant id number in life cycle, and the ID is by OSGI frameworks point Match somebody with somebody.
For ease of description, by module definition it is:One logically encapsulates the set for realizing class, and one sub based on class is realized The optional public API of collection, and a set to external code dependence.Can be bundle document understandings from client layer For One function module.Bundle files can be imported and exported from project, and can be with other bundle in project altogether Enjoy jar file.In the embodiment of the present invention by bundle document definitions can be:One modular physical location, with jar file Form includes code, resource and metadata, the encapsulation border of logical modular when the border of wherein jar file also serves as executing.
Context when BundleContext refers to that module is run in OSGI frameworks, the context provide module with The method that OSGI frameworks are interacted (as application provides the method for operating OSGI frameworks during execution).During starting module, OSGI Framework can create a corresponding BundleContext object, but the object can not be transmitted between the modules, this be in order to The correct distribution of the safety and resource of assurance module.
In the embodiment of the present invention, OSGI frameworks are embedded in android system in advance, in a step 101, obtain the OSGI The BundleContext of framework.
Optionally, also include before step 101:OSGI frameworks are obtained by the agency of the OSGI framework services having been turned on Example, wherein, above-mentioned OSGI framework services are:Framework establishments are in advance based on, in order to realize in above-mentioned Android The service of system operation OSGI framework.In the embodiment of the present invention, can pass through after above-mentioned OSGI framework services start Binder mechanism in android system, to the agency that application layer provides the OSGI framework services, by the OSGI framework services Agency, it is possible to have access to relevant interface in the OSGI framework services (such as obtain OSGI framework instance interfaces).Specifically, The example of OSGI frameworks can be obtained by getFrameworkInstance methods.Certainly, can also lead in the embodiment of the present invention The example that alternate manner obtains above-mentioned OSGI frameworks is crossed, for example, FrameWork Factory.new FrameWork sides can be passed through Method obtains the example of above-mentioned OSGI frameworks, and starts the example of the OSGI frameworks by Framework.start methods.Step 101 are embodied in:Based on the example of the above-mentioned OSGI frameworks for obtaining, the OSGI frameworks of embedded android system in advance are obtained BundleContext.Specifically, can be above-mentioned by calling Framework.getBundleContext () method to obtain The BundleContext of OSGI frameworks.
Optionally, during add above-mentioned OSGI framework services to the system service of above-mentioned android system, for example, can lead to The OSGI framework services are added to above-mentioned by the service managerZ-HU (i.e. ServiceManager) that crosses in android system In the system service of android system.So, during each system start-up, the OSGI framework services just can opening with system service Move and start.
Step 102, determine Activity components to be launched;
In the embodiment of the present invention, Activity components to be launched can be determined during program starts or runs.
Specifically, program can be connect according to predefined when needing to call some or multiple Activity components Mouth agreement is input into default parameter, the Activity components to be launched of the parameter determination to pass through input in a step 102.This In inventive embodiments, above-mentioned predefined interface protocol includes importation and output par, c.Above-mentioned importation definition The parameter of input, such as program-package name, Activity component Names.Output par, c defines invoked Activity components Implementing result state.For the ease of description, illustrate here, it is assumed that a certain application program Activity to be started Component is that possess the Activity components for welcoming interface, when the Activity components are called, assists according to predefined interface View be input into the application program program-package name and the Activity component Names, with will pass through the application program program-package name and The Activity component Names uniquely determine that current Activity components to be started (determine Activity groups to be launched Part).
Step 103, obtain and the bundle identifiers of above-mentioned Activity component liaisons to be launched;
In the embodiment of the present invention, in advance by program needed for Activity components be converted into bundle files and (concrete convert Mode is illustrated at step 104) and locally downloading, afterwards (for example can be above-mentioned in acquisition in the locally-installed bundle files After the BundleContext of OSGI frameworks, call BundleContext.install methods that the bundle files are installed).When After success installed by the bundle files, Bundle can be obtained by calling the getBundleId methods of Bundle interfaces ID.Afterwards, the Bundle ID for obtaining can be stored with above-mentioned Activity component liaisons by list or array or alternate manner (for example by the Bundle ID of acquisition and the mark (name of such as Activity components that can uniquely indicate the Activity components Claim) associated storage), so as to the Activity components to be launched that in step 103, can be determined according to step 102, get Bundle ID with the Activity component liaisons.
Wherein, above-mentioned Bundle ID are runtime the most frequently used identifiers, and it is for being distributed by OSGI frameworks automatically Long numeral, in whole life cycle (after renewal including bundle files, unloading) all without change, or even OSGI frameworks can be remained after restarting.Bundle ID be in bundle file installation processes by OSGI frameworks according to The precedence of bundle file set-up times, ascending is allocated.
Further, after success installed by the bundle files, the getSymbolicName of Bundle interfaces may call upon Method and getVersion get the designation of the bundle files and bundle version numbers respectively.Row can also then be passed through Table or array or alternate manner by the designation of Bundle ID, bundle files for obtaining and bundle version numbers and on The storage of Activity component liaisons is stated, or, it is also possible to the designation of bundle files is set as corresponding Activity groups The title of part, then get by only needing to the designation by bundle files and corresponding Activity component liaisons Bundle identifiers.
The bundle identifiers that step 104, basis are currently obtained, call above-mentioned BundleContext's BundleContext.start methods start corresponding bundle files, to load corresponding Activity components;
In the embodiment of the present invention, above-mentioned bundle files are transformed by jar file, and above-mentioned jar file is by above-mentioned The compilation of source code of Activity components is formed.As above-mentioned bundle files are turned by the source code of above-mentioned Activity components Change is formed, and therefore, starts the bundle files by calling BundleContext.start methods, you can realizing should The loading of Activity components.
Process to generating the bundle files of Activity components is illustrated below:
From the foregoing it will be appreciated that bundle files are the jar files that with the addition of certain metadata, and therefore, will be by Activity The jar file of the compilation of source code of component changes into bundle files, needs to increase corresponding unit's number for the jar file According to wherein, above-mentioned metadata includes:Readable information, bundle identification informations and code visibility information.
1st, readable information:For the dependent help information that user provides the bundle.For example may include:
Bundle-Name:An abbreviated name as bundle files;
Bundle-Description:The function of description bundle files;
Bundle-DocURL:Document about bundle files is provided;
Bundle-Category:Define one group of systematic name by CSV;
Bundle-Vendor:Information about bundle providers;
Bundle-ContactAddress:Information about bundle providers;
Bundle-Copyright:Information about bundle providers;
2nd, bundle file identification informations:The necessary information of identification bundle files;
Each the bundle file being installed in OSGI frameworks must have a unique mark, and this mark is by bundle The designation of file and bundle version numbers two parts composition.
Bundle-SymbolicName, the i.e. designation of bundle files, it are consistent with bag naming method in java, Can be directly using bag name as designation.In the embodiment of the present invention, the name of Activity components can be referred to as the bundle The designation of file
Bundle-Version, i.e. bundle version numbers, version number's form of bundle files of OSGI specifications agreement is: Major version number. secondary version number. micro- version number. qualifier.
Bundle-ManifestVersion:OSGI frameworks determine the OSGI using which version according to this metadata information Specification is processing bundle files
3rd, code visibility information:Define visible inside which code and externally visible necessary information of which code;
Export-Package:Derive internal code, one in order to other bundle file-sharings and disclosed, by teasing Number separate inside bundle bags;
Import-Package:Import external code, that internal bundle codes need, from other bundle files simultaneously One group of bag by CSV.
Specifically, using the BndTools plug-in units of eclipse, jar orders and bnd instruments, in the META- of jar file Increase above-mentioned metadata in INF/MANIFEST.MF entries and be converted into bundle files, wherein, above-mentioned bnd instruments are by OSGI Technology is responsible for related personnel's switch, there is provided the substantial amounts of order line exclusively for OSGI designs.
It should be noted that the Activity component loading methods in the embodiment of the present invention can be added by Activity components Carry and put execution, the Activity components charger can be with integrated intelligent terminal (such as smart mobile phone, panel computer and intelligence TV etc.) in, it is not construed as limiting herein.
Therefore, the Activity component loading methods in the present invention are by the compilation of source code by Activity components Into jar file change into bundle files, also, be embedded in OSGI in android system, achieve by the OSGI frameworks The operation of bundle files, and then achieve the loading of corresponding Activity components.Due to Activity components in the present invention Loading is realized by starting corresponding bundle files, and therefore, the loading of Activity components need not be limited to AndroidManifest.xml files, so that the dynamic load of Activity components is possibly realized.
On the basis of embodiment illustrated in fig. 1, the Activity component loading methods in the embodiment of the present invention also include Activity component dynamic updating methods, as shown in Fig. 2 above-mentioned Activity components dynamic updating method includes:
Step 201, obtain from server the first configuration file;
Wherein, above-mentioned first configuration file includes:Bundle designations, version number and bundle file downloads address (such as uniform resource locator (URL, Uniform Resoure Locator) address).
In the embodiment of the present invention, can be during program be run or is started, by active obtaining mode or passive Acquisition modes obtain the first configuration file from server.Above-mentioned active obtaining mode can for example be:Periodic queries are pre- If server on whether have the first newly-increased configuration file, if there is the first newly-increased configuration file, download this newly-increased First configuration file.Above-mentioned passive acquisition modes can by server when there is the first newly-increased configuration file active push this One configuration file.
If locally there is the configuration file for meeting first condition in step 202,:According in above-mentioned first configuration file Download corresponding bundle files in bundle file downloads address;
Wherein, above-mentioned first condition is:The bundle designations that configuration file includes and above-mentioned first configuration file bag The bundle designations for containing are consistent, and, the version number that configuration file includes is less than the version that above-mentioned first configuration file includes Number.
In the embodiment of the present invention, each bundle file can correspond to a configuration file, and the configuration file can be in bundle texts With the bundle file associations storage when part is installed first, or, it is also possible to when the bundle files start first, using pre- The protocol interface of the acquisition default configuration file for first defining, obtains and downloads the acquiescence with the bundle file associations from server Configuration file, afterwards by the default configuration file that downloads and the bundle file associations storage.
In step 202., above-mentioned first configuration file is parsed, local with the presence or absence of the bundle for including to detect The consistent configuration file of bundle designations that designation is included with the first configuration file that step 201 is downloaded, if exist (for ease of description, the bundle for subsequently including the first configuration file that the bundle designations for including and step 201 are downloaded The consistent configuration file of designation is described as configuration file A), further whether the version number of detection configuration file A is less than upper The version number that the first configuration file includes is stated, if what the version number that configuration file A includes included less than above-mentioned first configuration file Version number, then can determine that configuration file A is the configuration file for meeting above-mentioned first condition.Now, according to the above-mentioned first configuration text Download corresponding bundle files in bundle file downloads address in part.
Step 203, the bundle files local based on the secondary bundle files renewal that downloads is worked as;
In step 203, local bundle files are updated based on the bundle files that step 202 is downloaded.For example, it is possible to The bundle files that step 202 is downloaded call BundleContext.update methods to update local as input function Bundle files.Specifically, the process for updating bundle files can also be realized with reference to other prior arts, not limited herein Fixed.
It should be noted that after bundle files update, be correspondingly stored in local and with the bundle being updated Related information (such as bundle version numbers) can also be updated.
Step 204, by the version number that the configuration file for meeting above-mentioned first condition includes be updated to above-mentioned first configuration text Version number in part;
In step 204, the version number that the configuration file for meeting above-mentioned first condition for locally existing includes is updated to Version number in above-mentioned first configuration file.
The dynamic updating method of the bundle files shown in Fig. 2 can achieve the dynamic renewal of bundle files, and for by The jar file of the compilation of source code of Activity components changes into bundle files, the dynamic renewal of the bundle files The dynamic renewal of corresponding Activity component is actually also achieved.
On the basis of Fig. 1 or embodiment illustrated in fig. 2, the Activity component loading methods in the embodiment of the present invention are also wrapped The dynamic offloading method of component containing Activity, as shown in figure 3, above-mentioned Activity components dynamic offloading method includes:
Step 301, obtain from server the second configuration file;
Wherein, above-mentioned second configuration file includes:Bundle designations, version number and command information.
In the embodiment of the present invention, can be during program be run or is started, by active obtaining mode or passive Acquisition modes obtain the second configuration file from server.Above-mentioned active obtaining mode can for example be:Periodic queries are pre- If server on whether have the second newly-increased configuration file, if there is the first newly-increased configuration file, download this newly-increased Second configuration file.Above-mentioned passive acquisition modes can by server when there is the first newly-increased configuration file active push this Two configuration files.
If step 302 is locally present meets the order that the configuration file and above-mentioned second configuration file of second condition include The order that information is indicated is unloading bundle files, then:According to the bundle designations that above-mentioned second configuration file includes, obtain Take the bundle identifiers associated with above-mentioned bundle designations;
Wherein, above-mentioned second condition is:The bundle designations that configuration file includes and above-mentioned second configuration file bag The bundle designations for containing are consistent, and, the version number that the version number that configuration file includes is included with second configuration file Unanimously.
In the embodiment of the present invention, each bundle file can correspond to a configuration file, and the configuration file can be in bundle texts With the bundle file associations storage when part is installed first, or, it is also possible to when the bundle files start first, using pre- The protocol interface of the acquisition default configuration file for first defining, obtains and downloads the acquiescence with the bundle file associations from server Configuration file, afterwards by the default configuration file that downloads and the bundle file associations storage.
In step 302, above-mentioned second configuration file is parsed, local with the presence or absence of the bundle for including to detect The consistent configuration file of bundle designations that designation is included with the second configuration file that step 301 is downloaded, if exist (for ease of description, the bundle for subsequently including the second configuration file that the bundle designations for including and step 301 are downloaded The consistent configuration file of designation is described as configuration file B), further the version number of detection configuration file B whether with above-mentioned Version number that second configuration file includes is consistent, if what the version numbers that include of configuration file B and above-mentioned second configuration file included Version number is consistent, then can determine that configuration file B is the configuration file for meeting above-mentioned second condition.Further detect that above-mentioned second matches somebody with somebody Whether the order for putting the command information instruction that file includes is that unloading bundle files (for example detect above-mentioned second configuration file bag Whether the command information for containing is " uninstall "), if the order that the command information that above-mentioned second configuration file of detection includes is indicated For unloading bundle files, then the bundle designations for being included according to above-mentioned second configuration file are obtained and above-mentioned bundle The bundle identifiers (i.e. Bundle ID) of designation association.
The bundle identifiers that step 303, basis are currently obtained, unload locally stored corresponding bundle files;
In step 303, the Bundle ID for being obtained based on step 302, unload locally stored corresponding bundle texts Part.For example, it is possible to the Bundle ID for obtaining step 302 call BundleContext.uninstall as input function Method unloads corresponding bundle files.Specifically, the process of unloading bundle files can also be with reference to other prior art realities Existing, do not limit herein.
It should be noted that after the unloading of bundle files, be correspondingly stored in local and with unloaded bundle Related information can also be deleted.
The dynamic offloading method of the bundle files shown in Fig. 3 can achieve the dynamic offloading of bundle files, and for by The jar file of the compilation of source code of Activity components changes into bundle files, the dynamic offloading of the bundle files The dynamic offloading of corresponding Activity component is actually also achieved.
It should be noted that the first configuration file referred in embodiment illustrated in fig. 2 and embodiment illustrated in fig. 3 refer to the Two configuration files can be the configuration file of consolidation form, and wherein, the first configuration file is bundle designation fields, version Number field and bundle file downloads address field are not empty configuration file, and the second configuration file is bundle designations Field, version number field and command information field are not empty configuration file.
The embodiment of the present invention also provides a kind of Activity component chargers for being applied to android system, such as Fig. 4 institutes Show, the Activity components charger 400 includes:
First acquisition unit 401, for obtaining the open service gateway initiative framework for being embedded in android system in advance BundleContext;
Determining unit 402, for determining Activity components to be launched;
Second acquisition unit 403, for obtaining the bundle identifiers with the Activity component liaisons to be launched;
Start unit 404, for the bundle identifiers obtained according to current second acquisition unit 403, calls described The BundleContext.start methods of BundleContext start corresponding bundle files, so as to loading accordingly Activity components, wherein, the bundle files are transformed by jar file, and the jar file is by the Activity groups The compilation of source code of part is formed.
Optionally, the Activity component chargers in the embodiment of the present invention also include:
3rd acquiring unit, for obtaining the first configuration file from server, wherein, the first configuration file bag Include:Bundle designations, version number and bundle file downloads address;
Download unit, for when locally there is the configuration file for meeting first condition, according to first configuration file In bundle file downloads address download corresponding bundle files;
Updating block, updates local bundle texts for working as time bundle files of download based on the download unit Part, and the version number that the configuration file for meeting the first condition includes is updated to the version in first configuration file Number;
Wherein, the first condition is:The bundle designations that configuration file includes and the first configuration file bag The bundle designations for containing are consistent, and, the version number that configuration file includes is less than the version that first configuration file includes Number.
Optionally, the Activity component chargers in the embodiment of the present invention also include:
3rd acquiring unit, for obtaining the second configuration file from server, wherein, the second configuration file bag Include:Bundle designations, version number and command information;
, for ought locally there is the configuration file and shown second configuration file bag that meet second condition in the 4th acquiring unit When the order that the command information for containing is indicated is unloading bundle files, according to the bundle symbols that second configuration file includes Title, obtains the bundle identifiers associated with the bundle designations;
Unloading unit, for obtaining the current bundle identifiers for obtaining according to the described 4th, unloads locally stored phase The bundle files that answers;
Wherein, the second condition is:The bundle designations that configuration file includes and the second configuration file bag The bundle designations for containing are consistent, and, the version number that the version number that configuration file includes is included with second configuration file Unanimously.
Optionally, the Activity component chargers in the embodiment of the present invention also include:
5th acquiring unit, the agency for the OSGI framework services by having been turned on obtain open service gateway initiative agreement frame The example of frame, wherein, the OSGI framework services are:Framework establishments are in advance based on, in order to realize described Android system runs the service of open service gateway initiative framework;
First acquisition unit 401 specifically for:The open service gateway initiative association obtained based on the 5th acquiring unit The example of view framework, obtains the BundleContext of the open service gateway initiative framework of embedded android system in advance.
Further, the Activity component chargers in the embodiment of the present invention may also include:System service adding device, In the OSGI framework services are added to the system service of the android system.
It should be noted that the Activity components charger in the embodiment of the present invention can be with integrated intelligent terminal (example Such as smart mobile phone, panel computer and intelligent television etc.) in, it is not construed as limiting herein.
It should be understood that the function of each functional module of Activity component chargers in the embodiment of the present invention can be with root Implement according to the method in said method embodiment, which implements the correlation that process can refer in said method embodiment and retouches State, here is omitted.
Therefore, the Activity components charger in the present invention is by the compilation of source code by Activity components Into jar file change into bundle files, also, be embedded in OSGI in android system, achieve by the OSGI frameworks The operation of bundle files, and then achieve the loading of corresponding Activity components.Due to Activity components in the present invention Loading is realized by starting corresponding bundle files, and therefore, the loading of Activity components need not be limited to AndroidManifest.xml files, so that the dynamic load of Activity components is possibly realized.
In several embodiments provided herein, it should be understood that disclosed methods, devices and systems can lead to Cross other modes to realize.
It should be noted that for aforesaid each method embodiment, for easy description, therefore which is all expressed as a series of Combination of actions, but those skilled in the art should know, the present invention do not limited by described sequence of movement because According to the present invention, some steps can be carried out using other orders or simultaneously.Secondly, those skilled in the art should also know Know, embodiment described in this description belongs to preferred embodiment, and involved action and module might not all be these Bright necessary.
In the above-described embodiments, the description of each embodiment is all emphasized particularly on different fields, in certain embodiment, there is no the portion that describes in detail Point, may refer to the associated description of other embodiments.
It is more than the description to a kind of Activity component loading methods provided by the present invention and device, for this area Those skilled in the art, according to the embodiment of the present invention thought, have change in specific embodiments and applications Place, to sum up, this specification content should not be construed as limiting the invention.

Claims (10)

1. a kind of Activity component loading methods, are applied to android system, it is characterised in that the Activity components Loading method includes:
Obtain the BundleContext of the open service gateway initiative framework of embedded android system in advance;
Determine Activity components to be launched;
Obtain the bundle identifiers with the Activity component liaisons to be launched;
According to the bundle identifiers for currently obtaining, the BundleContext.start methods of the BundleContext are called Start corresponding bundle files, to load corresponding Activity components, wherein, the bundle files are by jar file It is transformed, the jar file is formed by the compilation of source code of the Activity components.
2. Activity component loading methods according to claim 1, it is characterised in that described according to obtaining Bundle identifiers, call the BundleContext.start methods of the BundleContext to start corresponding bundle texts Also include after part:
The first configuration file from server is obtained, wherein, first configuration file includes:Bundle designations, version This number and bundle file downloads address;
If locally there is the configuration file for meeting first condition,:
Corresponding bundle files are downloaded according to the bundle file downloads address in first configuration file;
Local bundle files are updated based on when time bundle files of download;
The version number that the configuration file for meeting the first condition includes is updated to the version number in first configuration file;
Wherein, the first condition is:The bundle designations that configuration file includes are included with first configuration file Bundle designations are consistent, and, the version number that configuration file includes is less than the version number that first configuration file includes.
3. Activity component loading methods according to claim 1, it is characterised in that described according to obtaining Bundle identifiers, call the BundleContext.start methods of the BundleContext to start corresponding bundle texts Also include after part:
The second configuration file from server is obtained, wherein, second configuration file includes:Bundle designations, version This number and command information;
If the life that the command information that configuration file and above-mentioned second configuration file that local presence meets second condition include is indicated Make for unloading bundle files, then:
According to the bundle designations that second configuration file includes, acquisition is associated with the bundle designations Bundle identifiers;
According to the bundle identifiers for currently obtaining, locally stored corresponding bundle files are unloaded;
Wherein, the second condition is:The bundle designations that configuration file includes are included with second configuration file Bundle designations are consistent, and, the version number that the version number that configuration file includes is included with second configuration file is consistent.
4. Activity component loading methods according to claims 1 to 3, it is characterised in that the acquisition is embedded in advance The BundleContext of the open service gateway initiative framework of android system, includes before:
The example that open service gateway initiative framework is obtained by the agency of the OSGI framework services having been turned on, wherein, described OSGI framework services are:Framework establishments are in advance based on, in order to realize open service being run in the android system The service of gateway protocol framework;
The BundleContext for obtaining the open service gateway initiative framework of embedded android system in advance is specially:
Based on the example of the open service gateway initiative framework for obtaining, the open clothes of embedded android system in advance are obtained The BundleContext of business gateway protocol framework.
5. Activity component loading methods according to claim 4, it is characterised in that the OSGI by having been turned on The agency of framework services obtains the example of open service gateway initiative framework, also includes before:The OSGI framework services are added Add in the system service of the android system.
6. a kind of Activity components charger, is applied to android system, it is characterised in that the Activity components Charger includes:
First acquisition unit, for obtaining the open service gateway initiative framework for being embedded in android system in advance BundleContext;
Determining unit, for determining Activity components to be launched;
Second acquisition unit, for obtaining the bundle identifiers with the Activity component liaisons to be launched;
Start unit, for the bundle identifiers obtained according to presently described second acquisition unit, calls described The BundleContext.start methods of BundleContext start corresponding bundle files, so as to loading accordingly Activity components, wherein, the bundle files are transformed by jar file, and the jar file is by the Activity groups The compilation of source code of part is formed.
7. Activity components charger according to claim 6, it is characterised in that the Activity components loading Device also includes:
3rd acquiring unit, for obtaining the first configuration file from server, wherein, first configuration file includes: Bundle designations, version number and bundle file downloads address;
Download unit, for when locally there is the configuration file for meeting first condition, according in first configuration file Download corresponding bundle files in bundle file downloads address;
Updating block, updates local bundle files for working as time bundle files of download based on the download unit, and The version number that the configuration file for meeting the first condition includes is updated to the version number in first configuration file;
Wherein, the first condition is:The bundle designations that configuration file includes are included with first configuration file Bundle designations are consistent, and, the version number that configuration file includes is less than the version number that first configuration file includes.
8. Activity components charger according to claim 6, it is characterised in that the Activity components loading Device also includes:
3rd acquiring unit, for obtaining the second configuration file from server, wherein, second configuration file includes: Bundle designations, version number and command information;
, for ought locally there is the configuration file that meets second condition and shown second configuration file includes in the 4th acquiring unit When the order that command information is indicated is unloading bundle files, according to the bundle symbolic names that second configuration file includes Claim, obtain the bundle identifiers associated with the bundle designations;
Unloading unit, for obtaining the current bundle identifiers for obtaining according to the described 4th, unloads locally stored corresponding Bundle files;
Wherein, the second condition is:The bundle designations that configuration file includes are included with second configuration file Bundle designations are consistent, and, the version number that the version number that configuration file includes is included with second configuration file is consistent.
9. Activity component chargers according to any one of claim 6 to 8, it is characterised in that described Activity component chargers also include:
5th acquiring unit, the agency for the OSGI framework services by having been turned on obtain open service gateway initiative framework Example, wherein, the OSGI framework services are:Framework establishments are in advance based on, in order to realize in the Android systems The service of system operation open service gateway initiative framework;
The first acquisition unit specifically for:Based on the open service gateway initiative agreement frame that the 5th acquiring unit is obtained The example of frame, obtains the BundleContext of the open service gateway initiative framework of embedded android system in advance.
10. Activity components charger according to claim 9, it is characterised in that the Activity components add Carrying to put also includes:
System service adding device, in the OSGI framework services are added to the system service of the android system.
CN201611062676.9A 2016-11-25 2016-11-25 Activity component loading method and device Active CN106502754B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611062676.9A CN106502754B (en) 2016-11-25 2016-11-25 Activity component loading method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611062676.9A CN106502754B (en) 2016-11-25 2016-11-25 Activity component loading method and device

Publications (2)

Publication Number Publication Date
CN106502754A true CN106502754A (en) 2017-03-15
CN106502754B CN106502754B (en) 2021-06-01

Family

ID=58328682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611062676.9A Active CN106502754B (en) 2016-11-25 2016-11-25 Activity component loading method and device

Country Status (1)

Country Link
CN (1) CN106502754B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system
CN105516154A (en) * 2015-12-15 2016-04-20 Tcl集团股份有限公司 Security policy configuration method and device applied to SEAndroid (Security-Enhanced Android) system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105511902A (en) * 2015-11-09 2016-04-20 Tcl集团股份有限公司 Android platform module dynamic loading method and system
CN105516154A (en) * 2015-12-15 2016-04-20 Tcl集团股份有限公司 Security policy configuration method and device applied to SEAndroid (Security-Enhanced Android) system

Also Published As

Publication number Publication date
CN106502754B (en) 2021-06-01

Similar Documents

Publication Publication Date Title
CN105159788B (en) Method and system for dynamically sharing resources between Android applications
CN105657191B (en) Application increment upgrading method and system based on Android system
CN102413022B (en) Application debugging method and system
CN106569880B (en) Method and system for dynamically sharing resources between Android applications
CN105516154B (en) Security policy configuration method and device applied to SEAndroid system
US20080313282A1 (en) User interface, operating system and architecture
CN105373406B (en) Application layout dynamic switching method and system based on Android platform
CN104714828A (en) Methods and devices for installing and operating application
CN1271893A (en) System and method for improving management and usability of Java environment
EP1836562A1 (en) Method for building component-software for execution in a standards-compliant programming environment
CN110187910B (en) Thermal updating method, device, equipment and computer readable storage medium
CN102422266A (en) System and method for building and updating a runtime environment
CN106371874A (en) Plug-in data loading method and equipment
JP2011516987A (en) Method and apparatus for managing mobile device software
CN109240733A (en) A kind of method and terminal updating advertisement SDK based on Android system
CN108363612A (en) The J2EE modules heat deployment and recalls information statistical method realized based on class loaders
CN112860236A (en) Single-spa-based micro front-end technology
KR20180101545A (en) A method for managing objects in a security element
Chang et al. Developing mobile applications on the Android platform
CN106502685B (en) Method and system for upgrading database
CN108228266B (en) Method and device for starting Fragment component between different plug-ins under Android plug-in framework
Liu et al. A formal framework for component deployment
CN106502754A (en) Activity component loading methods and device
CN116414774A (en) File migration method, device, equipment and storage medium
CN116680003A (en) Front-end plug-in system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 516006 TCL technology building, No.17, Huifeng Third Road, Zhongkai high tech Zone, Huizhou City, Guangdong Province

Applicant after: TCL Technology Group Co.,Ltd.

Address before: 516006 Guangdong province Huizhou Zhongkai hi tech Development Zone No. nineteen District

Applicant before: TCL RESEARCH AMERICA Inc.

GR01 Patent grant
GR01 Patent grant