Based on the functional inquiry module realizing method of Android system, system and mobile phone
Technical field
The present invention relates to field of mobile terminals, in particular a kind of based on the functional inquiry module realizing method of Android system, system and mobile phone。
Background technology
Along with the development of mobile communication technology and improving constantly of people's living standard, the use of various mobile terminal such as mobile phones is more and more universal, and mobile phone has become as indispensable communication tool in people's daily life。
Android(Android widely used in current mobile phone) system is the mobile terminal operating system of a kind of intelligence that Google releases, in the development process of android system, the needs under different situations, different systemic-functions being turned on and off can be faced, and the switch of difference in functionality is needed specific definition file to be described by system in prior art, and described definition file distribution is at the diverse location of disparate modules。It is required for when being therefore turned on and off a systemic-function first searching the particular location that the switch definition file to described function is deposited every time, again through to described definition file polling or control being turned on and off of corresponding function, when needing the switch of multiple difference in functionalitys in frequent operation system, this mode of operation not only wastes time and energy, but also may result in omitting being turned on and off some function。
Therefore, prior art has yet to be improved and developed。
Summary of the invention
The technical problem to be solved in the present invention is in that, drawbacks described above for prior art, there is provided a kind of based on the functional inquiry module realizing method of Android system, system and mobile phone, it is intended to enable developer or user's unified management Android function, operation is directly perceived easy, also optimizes the management to systemic-function switch simultaneously。
This invention address that the technical scheme that technical problem adopts is as follows:
A kind of functional inquiry module realizing method based on Android system, wherein, including step:
A, each functional module controlled in respectively system generate a configuration file, described configuration file can be uniformly controlled the definition of all functional switches being scattered in corresponding function block code, integrate all described configuration files and generate a functional inquiry module, by described functional inquiry module provide to outside one can the external inquiry interface of all functional switches in inquiry system;
B, when needing the switch of query function, the query statement that described external inquiry interface user that system is provided by described functional inquiry module is incoming, control whether inquiry corresponding function is opened according to described query statement;
Further comprise the steps of: a preset all described configuration file that can travel through under assigned catalogue in systems before described step A, and control the module generator by the configuration of the switch of function being described in described configuration file the Java code being converted into correspondence。
The described functional inquiry module realizing method based on Android system, wherein, the incoming query statement of user described in described step B specifically includes: need the functional module name at the function place of inquiry and the name of described function。
The described functional inquiry module realizing method based on Android system, wherein, described step A specifically includes step:
A1, each functional module controlled in respectively system generate a configuration file, and described configuration file can be uniformly controlled the switch of all functions that corresponding function module comprises;
A2, by preset module generator will in all described configuration files to functional switch configuration describe be converted into correspondence Java code;
A3, the java code that described conversion is obtained and be used for query function switch java code be combined editor, generate a functional inquiry module, and can be used in inquiring about the external inquiry interface whether all systemic-functions open to outside offer one by described functional inquiry module。
The described functional inquiry module realizing method based on Android system, wherein, described step A2 specifically includes step:
A21, traveled through all configuration files below assigned catalogue by described module generator, and control described configuration file is resolved one by one;
A22, the data controlling parsing to be obtained are converted into the Java code of correspondence according to certain rule。
The described functional inquiry module realizing method based on Android system, wherein, the configuration file described in described step A1 is the file of XML format。
A kind of functional inquiry module based on Android system realizes system, wherein, and including:
First management module, generate a configuration file for controlling each functional module in respectively system, described configuration file can be uniformly controlled the definition of all functional switches being scattered in corresponding function block code, integrate all described configuration files and generate a functional inquiry module, by described functional inquiry module provide to outside one can the external inquiry interface of all functional switches in inquiry system;
Second management module, for when needing the switch of query function, receive the query statement that described external inquiry interface that user provided by described functional inquiry module is incoming, inquire about whether corresponding function is opened according to the control of described query statement;
Module generator, for traveling through the configuration file below assigned catalogue, and controls described configuration file is resolved one by one;And for being converted into corresponding Java code by resolving the data obtained according to certain rule。
Described system, wherein, described first management module specifically includes:
First module, for controlling to generate respectively the configuration file of for each functional module, the switch of all functions that described configuration file comprises for unified configuration corresponding function module;
Second unit, for control preset module generator will in described configuration file to functional switch configuration describe be converted into correspondence Java code;
Unit the 3rd, module generator described in assemble editing convert the java code obtained and the java code for functional switch inquiry, control to generate a functional inquiry module, and described functional inquiry module provides one to outside and can be used in inquiring about the external inquiry interface whether all android functions open。
Described system, wherein, described query statement specifically includes: need the functional module name at the function place of inquiry and the name of described function。
Described system, wherein, described configuration file is the file of XML format。
A kind of mobile phone, comprises the described functional inquiry module based on Android system and realizes system。
A kind of functional inquiry module realizing method based on Android system provided by the present invention, system and hands machine, it achieves the unified management to all functions and inquiry by generating a functional inquiry module, greatly provide conveniently for developer or user, the on-off control and the management operation that make function become more directly perceived easy, the defect switching some function is easily missed when avoiding Decentralization, by this centralized processing to systemic-function switch of the present invention and simple and direct mode of operation, contrast the phenomenon existed in the management of current android system functional switch, greatly facilitate system developer and use user。
Accompanying drawing explanation
Fig. 1 is the flow chart of the embodiment of a kind of functional inquiry module realizing method based on Android system of the present invention。
Fig. 2 is that the present invention is a kind of based on systematic function enquiry module schematic diagram in the functional inquiry module realizing method embodiment of Android system。
Fig. 3 is that the present invention is a kind of based on the code sample of DTD grammatical rules in the functional inquiry module realizing method embodiment of Android system。
Fig. 4 is that the present invention is a kind of based on the code sample passing through external inquiry interface polls functional switch in the functional inquiry module realizing method embodiment of Android system。
Fig. 5 is the inner frame schematic diagram of a kind of functional inquiry module realizing method embodiment based on Android system of the present invention。
Fig. 6 is the structured flowchart of the embodiment of a kind of android functional inquiry system of the present invention。
Fig. 7 is the structured flowchart of the first management module in a kind of android functional inquiry system of the present invention。
Detailed description of the invention
For making the purpose of the present invention, technical scheme and advantage clearly, clearly, developing simultaneously referring to accompanying drawing, the present invention is described in more detail for embodiment。Should be appreciated that specific embodiment described herein is only in order to explain the present invention, is not intended to limit the present invention。
Refer to the flow chart that Fig. 1, Fig. 1 are the embodiments of a kind of functional inquiry module realizing method based on Android system of the present invention。In the present embodiment, said method comprising the steps of:
S1, in advance the switch of all android functions is unified configuration, and generate a functional inquiry module, provide a universal external query interface that can be used in inquiring about the switch of all android functions to outside by described functional inquiry module。It is about in the functional inquiry module that the switch definition to function being originally scattered in everywhere focuses on described generation, with the switch of all of function in unified management android system。
The query statement of function is specified in the incoming inquiry of described external inquiry interface user that S2, system are provided by described functional inquiry module, controls whether inquiry corresponding function is opened according to described query statement。In the present embodiment, the incoming query statement of described user specifically includes two information: need the name of the functional module at the function place of inquiry and the name of described function。
Further, in the present embodiment specific implementation process, as in figure 2 it is shown, described step S1 specifically includes step:
001, generate the configuration file of in advance respectively for each functional module in Android system, described configuration file is defined for the switch of unified all functions that the corresponding function module is comprised;It is also preferred that the left the configuration file described in the present embodiment adopts the file of XML format, with the switch definition giving expression to each function comprised in each functional module become apparent from and their respective hierarchical relationship, it is simple to developer reads and understands。
It should be noted that, for each functional module generates a described configuration file of correspondence, so that the functional module in system is all to having a configuration file to describe the switch of its all functions comprised, the module level of whole system so can be made to become apparent from。
002, then pass through preset module generator in systems and the definition of the switch of function will be described the Java code being converted into correspondence by described configuration file;Therefore, in the present embodiment, need before described step S1 exploitation one module generator and preset in systems, described module generator can travel through all configuration files under assigned catalogue and control to generate described functional inquiry module。Detailed process is: travel through all configuration files below assigned catalogue by described module generator, described configuration file is resolved one by one;It is converted into corresponding Java code according to certain rule again by resolving the data obtained。
003, last assemble editing converts the java code obtained and the java code for functional switch inquiry by module generator, thus generate described functional inquiry module, and described functional inquiry module provides a general external inquiry interface, for the query statement receiving user to inquire about to specify functional switch and then control whether inquiry corresponding function is opened。
It is also preferred that the left in the present embodiment, in described configuration file, by functional module corresponding to each configuration file of class " class " marker recognition, " class " marker bit includes again 2 attributes: attribute " name " and attribute " package "。Wherein attribute " name " is for identifying the name of corresponding function module, and attribute " package " is for carrying out Classification Management corresponding function module by structure。Further, the class " class " of described marker recognition functional module allows nested multiple submodules, submodule " subclass " marker recognition, only comprises an attribute " name " in described " subclass " labelling, for describing the name of corresponding submodule。Functional module and its submodule comprised can configure the concrete definition to functional switch, with the concrete function in " feature " marker recognition functional module in the present embodiment, described " feature " labelling comprises 2 attributes: attribute " name " and attribute " value ", wherein attribute " name " is for describing the name of described concrete function, attribute " value " is for describing opening or closing of corresponding function, and therefore described attribute " value " allows the value arranged can only be true or false。For the grammatical rules that the configuration file described in clearer expression the present embodiment generates, refer to Fig. 3 code sample based on DTD (DocumentTypeDefinition, the grammatical rules of marker character) provided。
Based on configuration file described above, module generator described in the present embodiment resolves described configuration file and is specifically included by the transformation rule resolving the Java code that the data obtained are converted into correspondence according to certain rule:
The content transformation obtained from attribute " package " is generated as the bag name of java;
The content transformation obtained in " name " attribute from labelling " class " is generated as the class modified with " publicfinal ";
The content transformation obtained in " name " attribute from labelling " subclass " is generated as the class modified with " publicfinalstatic ";
The content transformation obtained from labelling " feature " is generated as similar " publicstaticboolean [name]=[value];" java statement。
Further, there is described in generating the query function module of external inquiry interface, also need the corresponding Java code for query function switch, with the Java code of query function switch described in the form editor of an external interface, concrete definition can be similar to publicstaticbooleanisSupport (StringmoduleName, StringfeatureName)。The realization of described external inquiry interface can adopt the code sample shown in Fig. 4。
Finally, by above-mentioned by configuration file conversion generate java statement and described in be used for query function switch external inquiry interface Java code according to java grammer be combined editor, obtain a java bag, described java bag namely described in there is the query function module of external inquiry interface。
Further, after generating described functional inquiry module, when whether being opened by described functional inquiry module polls concrete function, call the external inquiry interface in described functional inquiry module, the module name at concrete function place that need inquiry incoming by described interface user and the name of concrete function, whether the function controlling inquiry corresponding opens。Its inner frame code schematic diagram is as shown in Figure 5。
Therefore, through the above-mentioned functional inquiry module realizing method based on Android system, achieve the unified management to all functions of android and inquiry, greatly provide conveniently for developer or user, the control and the management operation that make functional switch become more directly perceived easy, the defect of the switch of some function is easily missed when avoiding Decentralization, this to centralized the processing and simple and direct query manipulation mode of android function by the present invention, greatly facilitate system developer and use user。
The embodiment of the present invention additionally provides a kind of functional inquiry module based on Android system and realizes system, and as shown in Figure 6, described system specifically includes following ingredient:
First management module 610, for the switch of all android functions being unified configuration, and control to generate a functional inquiry module, it is placed on described functional inquiry module by unified for the switch definition of the function being originally scattered in everywhere, and can be used in inquiring about the external inquiry interface whether all android functions open to outside offer one by described functional inquiry module;Described in above-described embodiment。
Second management module 620, for when needing the switch of query function, receive user by the incoming query statement of described external inquiry interface, and control whether inquiry corresponding function is opened according to described query statement。Described in above-described embodiment。
Further, described system also includes module generator 630, for traveling through the described configuration file below assigned catalogue, and described configuration file is resolved one by one;And for being converted into corresponding Java code by resolving the data obtained according to certain rule。Described in above-described embodiment。
It is also preferred that the left as it is shown in fig. 7, described first management module 610 specifically includes:
First module 611, for controlling to generate respectively the configuration file of for functional module each in Android system, the switch of all functions that described configuration file comprises for unified configuration corresponding function module;Described in above-described embodiment。
Second unit 612, for control described module generator 630 will in described configuration file to the switch of function configuration describe be converted into correspondence Java code;Described in above-described embodiment
3rd unit 613, for described module generator 630 being converted the java code that obtains and being used for the code of functional switch inquiry and be combined editor, systematic function enquiry module, described functional inquiry module provides one to outside and can be used in inquiring about the external inquiry interface whether all android functions open;Described in above-described embodiment
Present invention also offers a kind of mobile phone, described mobile phone comprises the functional inquiry module based on Android system described in above-described embodiment and realizes system。
In sum, a kind of functional inquiry module realizing method based on Android system provided by the present invention, system and hands machine, it achieves the unified management to all functions of android and inquiry by generating a functional inquiry module, greatly provide conveniently for developer or user, the control and the management operation that make functional switch become more directly perceived easy, the defect of some functional switch is easily missed when avoiding Decentralization, this to centralized the processing and simple and direct mode of operation of systemic-function switch by the present invention, contrast the phenomenon existed in the management of current android system functional switch, greatly facilitate system developer and use user。
It should be appreciated that the application of the present invention is not limited to above-mentioned citing, for those of ordinary skills, it is possible to improved according to the above description or convert, all these improve and convert the protection domain that all should belong to claims of the present invention。