A kind of method and apparatus calling relating module
Technical field
The application belongs to intelligent television field, more particularly, to a kind of method and apparatus calling relating module.
Background technology
TV is modal household electrical appliance in modern society, with scientific and technical development, has full open model platform,
The intelligent television being equipped with operating system also arises at the historic moment.User is appreciating the same of general television content based on this intelligent television
When, can voluntarily install and uninstall types of applications software, the sustainable function to intelligent television is expanded and upgrades, and can give
User brings abundant individualized experience.
Intelligent television uses ARIXTRA (android) system at present.In the framework development process of Android system,
It is specially in the development process of ccf layer, the side operator adding in the jar bag of java has higher limit 65536, and under android
Framework.jar bag adds substantial amounts of method in compilation process, and when leading to compile framework.jar bag, side operator exceedes
Higher limit, reports an error so that this jar bag cannot generate.
In prior art, the method solving to add in jar bag is the part mould selecting in jar bag beyond the method for higher limit
Block sets up new jar bag removal, and the foundation of selection for the module of this removal is and the uncorrelated module of other modules in jar bag, so
And less with the uncorrelated module of other modules, even if the module of selection is set up after new jar bag removal, energy in this former jar bag
Enough side operator continuing to add are seldom so that the having little significance of this removal.
Also have other to have the module of relatively multi-method in framework.jar bag, remove this module, can make in former jar bag
Increase substantial amounts of side operator.However, associating due to having typically to have with other modules compared with the module of multi-method, this is claimed to have relatively
The module of multi-method is relating module, once this relating module is removed, the compiling in framework.jar bag can be made to generate
When call this relating module occur mistake it is impossible to generate framework.jar bag it is impossible to realize correct compilation process, lead to
Final Android system cannot correctly compile.
Content of the invention
In view of this, the purpose of the application is to provide a kind of method and apparatus calling relating module, using base class
Corresponding relation between default first parameter of object and the second parameter, by the first method belonging to the first parameter, with regard to energy
Obtain second method, and second method is sent to framework.jar bag as goal approach, described to ensure
The method called in the compilation process of framework.jar bag and parameter and the call result phase not moved out before this relating module
With.
A kind of method calling relating module, described relating module is the tool of removal from framework.jar bag in advance
There is the relating module of default bag name, the method includes:
According to the default bag name of described relating module, obtain the bag of described relating module, and the bag from described relating module
Middle lookup first method;
When finding described first method, described first method is searched the first parameter, described first parameter is to adopt
With the default parameter of base class object;
According to the corresponding relation of the first parameter and the second parameter, obtain the second method comprising described second parameter;
Described second method is sent to framework.jar bag as goal approach, so that described
The compiling of framework.jar bag is correctly carried out.
Above-mentioned method is it is preferred that remove relating module in advance in framework.jar bag, comprising:
When judging to obtain that in framework.jar bag, side operator reaches default higher limit, by the shifting of described relating module
Go out;
Add the first method including the first parameter in described relating module;
Preset bag name using the described relating module that java reflex mechanism is removal, and the default bag by described relating module
Name feeds back to framework.jar bag.
Above-mentioned method is it is preferred that go back after the default bag name of described relating module is fed back to framework.jar bag
Including:
So that described in the android.mk that the default bag name of described relating module is sent to java.jar bag
Android.mk increases the default bag name of described relating module.
Above-mentioned method is it is preferred that also include:
When not finding first method in the bag from described relating module or when not searching from described first method
During to the first parameter, generate warning message and report to the police.
A kind of device calling relating module, described relating module is the tool of removal from framework.jar bag in advance
There is the relating module of default bag name, this device includes:
First searching unit, for the default bag name according to described relating module, obtains the bag of described relating module, and from
First method is searched in the bag of described relating module;
Second searching unit, for when finding described first method, described first method being searched the first parameter,
Described first parameter is using the default parameter of base class object;
Acquiring unit, for the corresponding relation according to the first parameter and the second parameter, obtains and comprises described second parameter
Second method;
First transmitting element, for described second method is sent to framework.jar bag as goal approach, so that
The compiling obtaining described framework.jar bag is correctly carried out.
Above-mentioned device is it is preferred that also include:
Removal unit, for when judging to obtain that in framework.jar bag, side operator reaches default higher limit, by institute
State relating module removal;Add the first method including the first parameter in described relating module;Using java reflex mechanism
Described relating module for removal presets bag name, and the default bag name of described relating module is fed back to framework.jar bag.
Above-mentioned device is it is preferred that also include:
Second transmitting element, for sending the default bag name of described relating module to java.jar bag
So that described android.mk increases the default bag name of described relating module in android.mk.
Above-mentioned device is it is preferred that also include:
Alarm unit, for when not finding first method in the bag from described relating module or when from described first
When not finding the first parameter in method, generate warning message and report to the police.
This application provides a kind of method calling relating module, described relating module is in advance from framework.jar
The relating module with default bag name of removal in bag, the method includes: according to the default bag name of described relating module, obtains institute
State the bag of relating module, and search first method from the bag of described relating module;When finding described first method, in institute
State and in first method, search the first parameter, described first parameter is using the default parameter of base class object;According to the first parameter
With the corresponding relation of the second parameter, obtain the second method comprising described second parameter;Using described second method as target side
Method sends to framework.jar bag, so that the compiling of described framework.jar bag is correctly carried out.In the application
When two methods as do not move out, the goal approach that calls in compilation process, using default first parameter of base class object and the
Corresponding relation between two parameters, by the first method belonging to the first parameter, just can obtain goal approach second method,
And by second method and its second parameter of comprising is sent to framework.jar bag, to ensure described framework.jar bag
Compilation process in the method called and parameter with do not move out this relating module before call result identical so that described
The compiling of framework.jar bag is correctly carried out, and is not affected by removing this relating module.
Brief description
In order to be illustrated more clearly that the embodiment of the present application or technical scheme of the prior art, below will be to embodiment or existing
Have technology description in required use accompanying drawing be briefly described it should be apparent that, drawings in the following description are the application
Some embodiments, for those of ordinary skill in the art, on the premise of not paying creative work, can also basis
These accompanying drawings obtain other accompanying drawings.
Fig. 1 is a kind of flow chart of embodiment of the method 1 calling relating module that the application provides;
Fig. 2 is a kind of flow chart of embodiment of the method 2 calling relating module that the application provides;
Fig. 3 is a kind of another flow chart of embodiment of the method 2 calling relating module that the application provides;
Fig. 4 is a kind of flow chart of embodiment of the method 3 calling relating module that the application provides;
Fig. 5 is a kind of structural representation of device embodiment 1 calling relating module that the application provides;
Fig. 6 is a kind of structural representation of device embodiment 2 calling relating module that the application provides;
Fig. 7 is a kind of another structural representation of device embodiment 2 calling relating module that the application provides;
Fig. 8 is a kind of structural representation of device embodiment 3 calling relating module that the application provides.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present application are clearer, below in conjunction with the embodiment of the present application
In accompanying drawing, the technical scheme in the embodiment of the present application is clearly and completely described it is clear that described embodiment is
Some embodiments of the present application, rather than whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art
The every other embodiment being obtained under the premise of not making creative work, broadly falls into the scope of the application protection.
In the embodiment of the present application, relating module can be any mould being associated with other modules of framework.jar bag
Block, is typically the module compared with multi-method, such as, the various module such as webkit module, bluetooth module, phone module.
Embodiment 1
Referring to Fig. 1, the flow chart showing a kind of embodiment of the method 1 calling relating module that the application provides, comprising:
Step s101: according to the default bag name of described relating module, obtain the bag of described relating module, and from described association
First method is searched in the bag of module;
In the present embodiment, relating module is the pass gang mould with default bag name of removal from framework.jar bag in advance
Block, is to have related module with other modules in framework.jar bag.
When needing to call certain method in this relating module, need to be preset according to the relating module for this removal first
Bag name, obtain the bag of this relating module, this bag is a new jar bag.
After obtaining the bag of this relating module, search first method from this bag.
Step s102: when finding described first method, described first method searches the first parameter, described first
Parameter is using the default parameter of base class object;
When finding first method in the bag of relating module, this first method continues to search for the first parameter, this
One parameter is a kind of parameter of specific type, is that the parameter of this base class object is simultaneous using base class object default parameter
Hold the parameter of type, and the default parameter of this base class object and the second parameter have corresponding relation.
Step s103: when finding the first parameter, according to the corresponding relation of the first parameter and the second parameter, acquisition comprises
The second method of described second parameter;
According to the corresponding relation of the first parameter and the second parameter, this second parameter can be obtained, and the second parameter is included in the
In two methods, so, this second method can be obtained according to this second parameter.
This second method belonging to the second parameter is the goal approach calling, due to removing this relating module so that being somebody's turn to do
Second method can not directly be called, by first method and its first parameter as intermediate transit it is ensured that follow-up calls
During second method, can realize this second method is correctly called by this first parameter and first method, make
Call result before obtaining the method called in the compilation process of framework.jar bag and not moving out this relating module is identical.
Step s104: described second method is sent to framework.jar bag as goal approach, so that described
The compiling of framework.jar bag is correctly carried out.
This second method is sent to framework.jar bag as goal approach so that this framework.jar bag exists
In follow-up compilation process, the goal approach getting and this relating module do not move out the mesh calling during framework.jar bag
Mark method is identical content, and the result called is identical, is not affected it is ensured that making described by removing this relating module
The compiling of framework.jar bag is correctly carried out.
To sum up, the embodiment of the present application 1 provides a kind of method calling relating module, and the second method in the present embodiment is
During for not moving out, the goal approach that calls in compilation process, using default first parameter of base class object and the second parameter it
Between corresponding relation, by the first method belonging to the first parameter, just can obtain goal approach second method, and by second
Method is sent to framework.jar bag as goal approach, to ensure to adjust in the compilation process of described framework.jar bag
Method and parameter with do not move out this relating module before call result identical so that described framework.jar bag
Compiling is correctly carried out, and is not affected by removing this relating module.
Embodiment 2
Referring to Fig. 2, the flow chart showing a kind of embodiment of the method 2 calling relating module that the application provides, Fig. 1 institute
In the flow chart showing, also include before step s101:
Step s105: when judging to obtain that in framework.jar bag, side operator reaches default higher limit, by described pass
Gang mould block removes;
This higher limit can be the higher limit 65536 of jar bag or default one be less than this 65536 integer
Value, so that in execution removal course of action, remain able to continue adding method in framework.jar bag.
When being added to that in framework.jar bag, side operator reaches default higher limit, for ensureing that compiling should
Can correctly carry out during framework.jar bag, then need to remove this relating module, there is in this relating module more side
Method number, removes this relating module, and can add more methods for framework.jar bag provides space.
Step s106: add the first method including the first parameter in described relating module;
Add a new method first method in this relating module, in this first method, include the first ginseng
Number, this first parameter default parameter of base class object, the parameter of this base class object is the parameter of compatible type, and this first
Parameter and the second parameter have corresponding relation, and this second method belonging to the second parameter is the goal approach calling, due to inciting somebody to action
This relating module removes so that this second method can not directly be called, and is used as centre by first method and its first parameter
Switching it is ensured that follow-up call second method during, can by this first parameter and first method realize to this
Two methods correctly called so that the method called in the compilation process of framework.jar bag with do not move out this pass gang mould
Call result before block is identical.
Step s107: preset bag name using the described relating module that java reflex mechanism is removal, and by described pass gang mould
The default bag name of block feeds back to framework.jar bag.
Preset a bag name using this relating module that java reflex mechanism is removal, and this default bag name is sent
To framework.jar bag, so that when calling the method in this relating module by framework.jar bag, by this
Default bag name just can find the relating module of this removal.
Referring to Fig. 3, show a kind of another flow chart of embodiment of the method 2 calling relating module that the application provides,
In flow chart shown in Fig. 2, also include after step s107:
Step s108: the default bag name of described relating module is sent in the android.mk to java.jar bag, makes
Obtaining described android.mk increases the default bag name of described relating module.
The compilation process of java.jar compiles for system layer, and the compiling in order to ensure system layer is not removed this pass gang mould
The impact of block, needs to send the default bag name of this removal module to the android.mk of java.jar bag, so that system layer
When calling the goal approach in this relating module, can identical with the call result before not moving out this relating module so that institute
The compiling stating java.jar bag is correctly carried out.
To sum up, provide a kind of method calling relating module in the embodiment of the present application 2, also include in advance from
Remove the process of relating module in framework.jar bag, in this process, set up the first parameter and the second party of first method
Corresponding relation between second parameter of method, and the default bag name of the relating module of removal is sent to framework.jar bag
And in the android.mk in java.jar bag it is ensured that in the compilation process making the method called with do not move out this pass gang mould
Call result before block is identical.
Embodiment 3
Referring to Fig. 4, the flow chart showing a kind of embodiment of the method 3 calling relating module that the application provides, Fig. 1 institute
In the flow chart showing, also include:
Step s108: judging whether to find first method from the bag of described relating module, if found, executing step
Rapid s102, otherwise execution step s110;
When not finding first method in the bag of relating module, then explanation is broken down, and generates warning message and reports to the police,
Programming by prompting personnel break down, and the bag Program of relating module is carried out checking, adjusts.
Step s109: judge whether to find the first parameter from described first method, if found, execution step
S103, otherwise execution step s110;
Step s110: generate warning message and report to the police.
When not finding the first parameter in first method, then explanation is broken down, and generates warning message and reports to the police, points out
Programming personnel is broken down, and the program of first method is carried out checking, adjusts.
The mode that warning message is reported to the police can be multiple, such as: generate pop-up and carry out pointing out, generate caution sound prompting etc. respectively
The mode of kind, concrete mode can be configured according to practical situation, repeat no more in the present embodiment.
To sum up, provide a kind of method calling relating module in the embodiment of the present application 3, also include: when from described association
Do not find in the bag of module during first method or when not finding the first parameter from described first method, generate and report to the police
Information alert.When breaking down it is ensured that programming personnel can obtain information, and then the program that this fault is occurred is examined
Look into, adjust.
Corresponding with a kind of embodiment of the method calling relating module that above-mentioned the application provides, in present specification
Additionally provide a kind of device embodiment calling relating module.
Embodiment 1
Referring to Fig. 5, show a kind of structural representation of device embodiment 1 calling relating module that the application provides,
Including: the first searching unit 101, the second searching unit 102, acquiring unit 103 and the first transmitting element 104;
Wherein, described first searching unit 101, for the default bag name according to described relating module, obtains described association
The bag of module, and search first method from the bag of described relating module;
In the present embodiment, relating module is the pass gang mould with default bag name of removal from framework.jar bag in advance
Block, is to have related module with other modules in framework.jar bag.
When needing to call certain method in this relating module, the first searching unit 101 is according to the association for this removal
Module default bag name, obtains the bag of this relating module, and this bag is a new jar bag, and the first searching unit 101 obtains this pass
After the bag of gang mould block, search first method from this bag.
Wherein, described second searching unit 102, for when finding described first method, in described first method
Search the first parameter, described first parameter is using the default parameter of base class object;
When the first searching unit 101 finds first method in the bag of relating module, the second searching unit 102 this
Continue to search for the first parameter in one method, this first parameter is a kind of parameter of specific type, be to be preset using base class object
Parameter, the parameter of this base class object is the parameter of compatible type, and the default parameter of this base class object and the second parameter
There is corresponding relation.
Wherein, described acquiring unit 103, for the corresponding relation according to described first parameter and the second parameter, obtains bag
Second method containing described second parameter;
Acquiring unit 103, according to the corresponding relation of the first parameter and the second parameter, can obtain this second parameter, and the second ginseng
Number comprises in the second approach, so, this second method can be obtained according to this second parameter.
This second method belonging to the second parameter is the goal approach calling, due to removing this relating module so that being somebody's turn to do
Second method can not directly be called, by first method and its first parameter as intermediate transit it is ensured that follow-up calls
During second method, can realize this second method is correctly called by this first parameter and first method, make
Call result before obtaining the method called in the compilation process of framework.jar bag and not moving out this relating module is identical.
Wherein, described transmitting element 104, for using described second method as goal approach send to
Framework.jar bag, so that the compiling of described framework.jar bag is correctly carried out.
This second method is sent to framework.jar bag as goal approach so that being somebody's turn to do by the first transmitting element 104
In follow-up compilation process, the goal approach getting and this relating module do not move out framework.jar bag
The goal approach calling during framework.jar bag is identical content, and the result called is identical, is not removed this relating module
Impact it is ensured that making the compiling of described framework.jar bag correctly carry out.
To sum up, the embodiment of the present application 1 provides a kind of device calling relating module, and the second method in the present embodiment is
During for not moving out, the goal approach that calls in compilation process, using default first parameter of base class object and the second parameter it
Between corresponding relation, by the first method belonging to the first parameter, just can obtain goal approach second method, and by second
Method is sent to framework.jar bag as goal approach, to ensure to adjust in the compilation process of described framework.jar bag
Method and parameter with do not move out this relating module before call result identical so that described framework.jar bag
Compiling is correctly carried out, and is not affected by removing this relating module.
Embodiment 2
Referring to Fig. 6, show a kind of structural representation of device embodiment 2 calling relating module that the application provides,
Also include in structure shown in Fig. 5: removal unit 105;
Removal unit 105, for when judging to obtain that in framework.jar bag, side operator reaches default higher limit,
Described relating module is removed;Add the first method including the first parameter in described relating module;Using java reflection
Mechanism is that the described relating module of removal presets bag name, and the default bag name of described relating module is fed back to
Framework.jar bag.
This higher limit can be the higher limit 65536 of jar bag or default one be less than this 65536 integer
Value, so that in execution removal course of action, remain able to continue adding method in framework.jar bag.
When being added to that in framework.jar bag, side operator reaches default higher limit, for ensureing that compiling should
Can correctly carry out during framework.jar bag, then need to remove this relating module, there is in this relating module more side
Method number, removal unit 105 removes this relating module, and can add more methods for framework.jar bag provides space.
Removal unit 105 adds a new method first method in this relating module, wraps in this first method
Containing the first parameter, this first parameter default parameter of base class object, the parameter of this base class object is compatible type
Parameter, this first parameter and the second parameter have corresponding relation, and this second method belonging to the second parameter is the target called
Method, due to removing this relating module so that this second method can not directly be called, by first method and its first ginseng
Number as intermediate transit it is ensured that follow-up call second method during, this first parameter and first method can be passed through
Realize this second method correctly called so that the method called in the compilation process of framework.jar bag with do not move
Call result before going out this relating module is identical.
Removal unit 105 presets a bag name using this relating module that java reflex mechanism is removal, and this is pre-
If bag name be sent to framework.jar bag, so that calling the side in this relating module by framework.jar bag
The relating module of this removal during method, just can be found by this default bag name.
Referring to Fig. 7, show a kind of another structural representation of device embodiment 2 calling relating module that the application provides
Figure, also includes in structure shown in Fig. 6: the second transmitting element 106;
Second transmitting element 106, for sending the default bag name of described relating module to java.jar bag
So that described android.mk increases the default bag name of described relating module in android.mk.
The compilation process of java.jar compiles for system layer, and the compiling in order to ensure system layer is not removed this pass gang mould
The impact of block, the second transmitting element 106 sends the default bag name of this removal module to the android.mk of java.jar bag,
So that when system layer calls the goal approach in this relating module, can be with the call result phase not moved out before this relating module
With so that the compiling of described java.jar bag is correctly carried out.
To sum up, provide a kind of device calling relating module in the embodiment of the present application 2, also include removing unit and second
Transmitting element, removal unit sets up the corresponding relation between the first parameter of first method and the second parameter of second method, and
The default bag name of the relating module of removal is sent to framework.jar bag;This default bag name is sent by the second transmitting element
In android.mk in java.jar bag it is ensured that in the compilation process making the method called with do not move out this relating module
Call result before is identical.
Embodiment 3
Referring to Fig. 8, show a kind of structural representation of device embodiment 3 calling relating module that the application provides,
Also include in structure shown in Fig. 5: alarm unit 107;
Alarm unit 107, for when not finding first method in the bag from described relating module or when from described
When not finding the first parameter in first method, generate warning message and report to the police.
When not finding first method in the bag of relating module, then explanation is broken down, and generates warning message and reports to the police,
Programming by prompting personnel break down, and the bag Program of relating module is carried out checking, adjusts.
When not finding the first parameter in first method, then explanation is broken down, and generates warning message and reports to the police, points out
Programming personnel is broken down, and the program of first method is carried out checking, adjusts.
The mode that warning message is reported to the police can be multiple, such as: generate pop-up and carry out pointing out, generate caution sound prompting etc. respectively
The mode of kind, concrete mode can be configured according to practical situation, repeat no more in the present embodiment.
To sum up, provide a kind of device calling relating module in the embodiment of the present application 3, also include: when from described association
Do not find in the bag of module during first method or when not finding the first parameter from described first method, alarm unit
Generate warning message to report to the police.When breaking down it is ensured that programming personnel can obtain information, and then the program that this fault is occurred
Carry out checking, adjust.
Above to a kind of method and apparatus calling relating module provided by the present invention, it is described in detail, herein
In apply specific case the principle of the present invention and embodiment be set forth, the explanation of above example is only intended to help
Assistant's solution method of the present invention and its core concept;Simultaneously for one of ordinary skill in the art, according to the think of of the present invention
Think, all will change in specific embodiments and applications.In sum, this specification content should not be construed as right
The restriction of the present invention.