[go: up one dir, main page]

CN112256249A - Method and equipment for expanding Android system function and computer storage medium - Google Patents

Method and equipment for expanding Android system function and computer storage medium Download PDF

Info

Publication number
CN112256249A
CN112256249A CN202011106553.7A CN202011106553A CN112256249A CN 112256249 A CN112256249 A CN 112256249A CN 202011106553 A CN202011106553 A CN 202011106553A CN 112256249 A CN112256249 A CN 112256249A
Authority
CN
China
Prior art keywords
interface
function
android system
target
class
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
CN202011106553.7A
Other languages
Chinese (zh)
Other versions
CN112256249B (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.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202011106553.7A priority Critical patent/CN112256249B/en
Publication of CN112256249A publication Critical patent/CN112256249A/en
Application granted granted Critical
Publication of CN112256249B publication Critical patent/CN112256249B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Landscapes

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

Abstract

The invention discloses a method, equipment and computer storage medium for expanding Android system functions, wherein the method comprises the following steps: defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module; defining an extended target client class; the extended target client class implements the extended target system functional interface; defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface. The method solves the problem that the Android system expansion function modifies the native framework code, achieves the purpose of expanding the Android system function, and simultaneously avoids modifying the Android native framework code. Meanwhile, the invention reduces the workload of code transplantation expansion function and improves the efficiency.

Description

Method and equipment for expanding Android system function and computer storage medium
Technical Field
The invention relates to the field of system development, in particular to a method for expanding Android system functions.
Background
Android is an open source intelligent terminal operating system proposed by google, and aid l (Android Interface Definition language) is an Android Interface Definition language, is a description language for defining Communication interfaces between a server and a client, and can be used to generate codes for IPC (Inter-Process Communication). The Android system functions basically adopt a Manager/ADIL/Service mode. For example, AMS, WMS, PMS, Surface, etc., the Manager client provides SDK interface, the Service server realizes interface function, and the communication part is generated by AIDL.
In the development process of an Android system terminal manufacturer, the original system function of an Android frame is often expanded due to the function requirements of the Android system terminal manufacturer, and the typical method is to directly modify frame source codes: and modifying the original ADIL file to increase an interface, modifying the Manager client to increase the interface and realize the increase of the interface, and modifying the service to increase the interface to realize the increase. However, the extension mode of directly modifying the native file can change the source code of the Android frame to a complete level, and is time-consuming, labor-consuming and high in risk for subsequent platform version upgrading.
Disclosure of Invention
In view of this, the present application provides a method for extending an Android system function, which solves a problem that an Android system extended function modifies a native framework code.
The embodiment of the application provides a method for expanding Android system functions, which is characterized by comprising the following steps:
defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module;
defining an extended target client class; the extended target client class implements the extended target system functional interface;
defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface.
In one embodiment, the method further comprises:
constructing the expanded target server class by using a reflection mechanism of an Android system;
and replacing the original server class in the Android system with the expanded target server class to modify the service starting code of the Android system.
In one embodiment, the method further comprises:
and calling the expanded target system function interface to realize the expansion of the Android system function.
In one embodiment, the defining the extended target system function interface includes:
and defining a static variable, and determining that the static variable is based on a temporary certificate in a communication mechanism according to a code generated by an Android interface definition language.
In one embodiment, the defining the extended target system function interface includes:
extended target interface functions and lists are defined.
In one embodiment, the defining the extended target system function interface includes:
defining a communication interface ID of the target interface function; and each target interface function corresponds to a communication interface ID and does not conflict with the communication interface ID generated by the Android interface definition language.
In an embodiment, the static variable is obtained by:
searching a JAVA file generated by compiling the Android interface definition language file;
and/or the presence of a gas in the gas,
defined according to preset rules.
In one embodiment, the defining the extended target client class includes:
and acquiring the communication mechanism of the expanded target system function interface, and storing the communication mechanism into the member variable defined by the expanded target client class.
In one embodiment, the method further comprises:
and sending the communication interface ID, the static variable and the input parameter of the target interface function to the expanded target server class according to the protocol format of the communication mechanism.
In one embodiment, the extended target server class includes:
the onTransact function is reloaded.
In an embodiment, the extended target server class further includes:
and realizing the function of the expanded target system functional interface.
In one embodiment, the reload onTransact function comprises:
when the received communication interface ID sent by the self-expanded target client class is equal to the communication interface ID of the corresponding target interface function in the expanded target system function interface, checking the temporary certificate of the static variable, and calling the corresponding target interface function;
otherwise, calling the parent ontact function for processing.
To achieve the above object, there is also provided a computer readable storage medium having a method program for extending Android system functions stored thereon, where the method program for extending Android system functions, when executed by a processor, implements any of the steps of the method described above.
In order to achieve the above object, an apparatus is further provided, which includes a memory, a processor, and a method program for extending an Android system function, where the method program is stored in the memory and is executable on the processor, and when the processor executes the method program for extending the Android system function, any of the steps of the method is implemented.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module; a new target system function interface is added for carrying out function expansion on the native system, is the basis of an expanded target client class and an expanded target server class, and is also an object interface to be realized. Defining an extended target client class; the extended target client class implements the extended target system functional interface; the extended target client class implements an extended target system function interface for implementing new functions to implement function extension. Defining an extended target server class; the expanded target server class inherits from a server class of an Android system and realizes an expanded target system function interface; inheritance may enable an extended target server class to have the properties and methods of the native server class or redefine, append, etc. the properties and methods. The inheritance technology makes the reuse of the former codes very easy, and can greatly shorten the development period and reduce the development cost. The problem that the Android system expansion function modifies the native framework code is solved. The aim of expanding the functions of the Android system is fulfilled, and meanwhile, the Android native framework code is prevented from being modified. The invention reduces the workload of code transplantation expansion function and improves the efficiency.
Drawings
Fig. 1 is a schematic diagram of a hardware architecture of the method for extending Android system functions according to the present application;
fig. 2 is a schematic flowchart of a first embodiment of a method for extending Android system functions according to the present application;
fig. 3 is a flowchart illustrating a second embodiment of the method for extending Android system functions according to the present application;
fig. 4 is a schematic view of a technical solution of the application taking expansion of functions of an Android AMS system as an example.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows: defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module; defining an extended target client class; the extended target client class implements the extended target system functional interface; defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface. The method solves the problem that the Android system expansion function modifies the native framework code, achieves the purpose of expanding the Android system function, and simultaneously avoids modifying the Android native framework code. Meanwhile, the invention reduces the workload of code transplantation expansion function and improves the efficiency.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
The present application relates to a device 010 comprising as shown in fig. 1: at least one processor 012, memory 011.
The processor 012 may be an integrated circuit chip having signal processing capability. In implementation, the steps of the method may be performed by hardware integrated logic circuits or instructions in the form of software in the processor 012. The processor 012 may be a general-purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps and logic blocks disclosed in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in the memory 011, and the processor 012 reads the information in the memory 011 and completes the steps of the method in combination with the hardware.
It is to be understood that the memory 011 in embodiments of the present invention can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile Memory may be a Read Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically Erasable PROM (EEPROM), or a flash Memory. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static random access memory (Static RAM, SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic random access memory (Synchronous DRAM, SDRAM), Double Data Rate Synchronous Dynamic random access memory (ddr Data Rate SDRAM, ddr SDRAM), Enhanced Synchronous SDRAM (ESDRAM), synchlronous SDRAM (SLDRAM), and Direct Rambus RAM (DRRAM). The memory 011 of the systems and methods described in connection with the embodiments of the invention is intended to comprise, without being limited to, these and any other suitable types of memory.
Referring to fig. 2, fig. 2 is a first embodiment of a method for extending an Android system function according to the present application, where the method for extending the Android system function includes the following steps:
step S110: defining an extended target system function interface; and the expanded target system function interface is used for carrying out function expansion on the Android system module.
Android is a free and open source operating system based on the Linux kernel (which does not contain GNU components). The mobile phone is mainly used for mobile devices such as smart phones and tablet computers, and is led and developed by Google corporation and the open cell phone alliance in the United states. The Android system architecture is divided into four layers, namely an Application layer (Applications), an Application Framework layer (Application Framework), a system Runtime layer (Libraries and Android Runtime) and a Linux Kernel layer (Linux Kernel) from a high layer to a low layer.
An interface (interface) is a key word for interface operation in an object-oriented programming language, and functions are to combine required members to encapsulate a set of certain functions. An interface is a template in which the members that an object must implement are defined, which is implemented by classes or structures. An interface cannot contain any code for a member, only the member itself is defined. The specific code for the interface member is provided by the class implementing the interface.
The extended target system function interface is to define a special class (template) in which the member variables and functions that the object must implement are defined, and is implemented by an extended target client class and an extended target server class.
The native system module is a module in the source code of the Android system, and in this embodiment, a system function interface is newly added to perform function extension on the Android system. The function extension is that a developer develops a new function for the Android system function.
Step S120: defining an extended target client class; the extended target client class implements the extended target system function interface.
The extended target client class is the extension class that is to define a client. The extended target client class may include a plurality of preset member attributes and preset member methods, which are not limited to a certain attribute and method, and are adjusted and changed according to functions to be extended by a developer.
The extended target client class realizes the extended target system function interface through specific codes. The method includes the definitions of variables, the specific implementation of functions, the implementation of calling procedures and the like.
Class (Class) is the basis for Object-Oriented Programming (OOP) implementation information encapsulation. A class is a user-defined type of reference data, also called a class type. Each class contains a description of the data and a set of functions that operate on the data or pass messages. Instances of classes are referred to as objects.
The essence of a class is a reference data type, similar to the basic data types of byte, short, int (char), long, float, double, etc., except that it is a complex data type. Because it is data type in nature, not data, it does not exist in memory, cannot be directly manipulated, and only when instantiated as an object, it becomes operable.
A class is an abstraction of a class of things in real life that have common characteristics. If the type of data provided in a program has a direct correspondence to concepts in the application, the program will be more easily understood and more easily modified. A well-chosen set of user-defined classes makes the program more compact. In addition, it also makes various forms of code analysis easier to perform. In particular, it also makes it possible for the compiler to check for illegal use of the object.
The inside of the class encapsulates attributes and methods for manipulating its members. A class is a definition of an object, having behaviors (behaviors) that describe what an object can do and the methods (methods) that it can do, which are the procedures and processes that can operate on the object. It contains information about the way an object behaves, including its name, properties, methods, and events.
The composition of the class includes member attributes and member methods (data members and member functions). The data members correspond to the attributes of the class, and the data members of the class are also of a data type and do not need to be allocated with memory. The member function is used for operating various attributes of the class, and is a specific operation of the class, for example, a student can be used for class, and a fruit cannot be used for class. The operation in which a class interacts with the outside world is called an interface.
Step S130: defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface.
An extended target server class is an extended class that is to define a server. The extended target server class may include a plurality of preset member attributes and preset member methods, and the preset member attributes and the preset member methods are not limited to a certain attribute and method, and are adjusted and changed according to functions to be extended by a developer.
Inheritance is a concept in object-oriented software technology, and is three basic characteristics of object-oriented with polymorphism and encapsulation. Inheritance may cause a child to have the properties and methods of a parent class or redefine, append properties and methods, etc. The technology makes it easy to reuse the former codes, and can greatly shorten the development period and reduce the development cost.
The creation of the subclass can add new data and new functions, can inherit all functions of the parent class, but cannot selectively inherit partial functions of the parent class. Inheritance is a class-to-class relationship, not an object-to-object relationship.
For example: firstly, defining a class to call a car, wherein the car has the following attributes: the car body size, color, tires, steering wheel, brand, speed and displacement, two types of cars and trucks are derived from the car type, a small trunk is added for the cars, and a large container is added for the trucks.
Inheritance can enable sub-categories to have various properties and methods of parent categories without the need to write the same code again. When the sub-category inherits the parent category, some attributes can be redefined, and some methods are rewritten, namely, the original attributes and methods of the parent category are covered, so that the parent category and the child category have different functions.
The native classes in the Android native system include Activity, Service, ContentProvider, broadcastrecheiver, and the like.
The beneficial effects existing in the above embodiments: defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module; a new target system function interface is added for carrying out function expansion on the native system, is the basis of an expanded target client class and an expanded target server class, and is also an object interface to be realized. Defining an extended target client class; the extended target client class implements the extended target system functional interface; the extended target client class implements an extended target system function interface for implementing new functions to implement function extension. Defining an extended target server class; the expanded target server class inherits from a server class of an Android system and realizes an expanded target system function interface; inheritance may enable an extended target server class to have the properties and methods of the native server class or redefine, append, etc. the properties and methods. The inheritance technology makes the reuse of the former codes very easy, and can greatly shorten the development period and reduce the development cost. The problem that the Android system expansion function modifies the native framework code is solved. The aim of expanding the functions of the Android system is fulfilled, and meanwhile, the Android native framework code is prevented from being modified. The workload of transplanting the extended function is reduced, and the efficiency is improved; the product is inherited efficiently, and the software stability is high; the system upgrading has strong feasibility and short upgrading period.
Referring to fig. 3, fig. 3 is a second embodiment of the method for extending an Android system function according to the present application, where the method for extending an Android system function includes the following steps: :
step S210: defining an extended target system function interface; and the expanded target system function interface is used for carrying out function expansion on the Android system module.
Step S220: defining an extended target client class; the extended target client class implements the extended target system function interface.
Step S230: defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface.
Step S240: and constructing the extended target server class by using a reflection mechanism of an Android system.
The JAVA reflection mechanism refers to that in the running state of a program, an object of any class can be constructed, a class to which any object belongs can be known, member variables and methods of any class can be known, and attributes and methods of any object can be called. This function of dynamically acquiring program information and dynamically calling objects is called a reflection mechanism of the JAVA language. Reflections are considered as a key to dynamic languages.
Step S250: and replacing the original server class in the Android system with the expanded target server class to modify the service starting code of the Android system.
And constructing an expanded target server class by a JAVA reflection mechanism to replace the original server class, and replacing the original server class with the expanded target server class in the system service starting code to start the system service.
The function expansion can be realized by calling the expanded target system function interface, so that in the service starting code of the Android system, the expanded target system function interface is used as a default starting interface, and the expanded target system function replaces the original system function interface of the Android to realize the function expansion of the Android system.
Step S260: and calling the expanded target system function interface to realize the expansion of the Android system function.
When the system service is started, the expanded target system function interface can be called, and the original system module cannot be influenced. Unnecessary risks caused by modifying native system modules are avoided.
Compared with the first embodiment, the second embodiment includes steps S240, S250, and S260. Other steps are the same as those in the first embodiment, and are not described again.
The method has the advantages that the extended target server class is constructed through the JAVA reflection mechanism to replace the original server class, the system starting code is modified, the extended target system function interface is called, and new function extension is achieved. Further reducing the workload of transplanting the extended functions and improving the efficiency.
In one embodiment, the target system function interface for defining the extension includes:
and defining a static variable, and determining that the static variable is based on a temporary certificate in a communication mechanism according to a code generated by an Android interface definition language.
Static variables (Static variables) in the field of computer programming refer to variables for which the system allocates storage space statically (i.e., does not change the allocation during runtime) just before program execution. Corresponding to this are auto-variables (i.e. local variables) which exist only temporarily at runtime and some objects which acquire memory in a dynamically allocated manner, wherein the memory of the auto-variables is allocated and freed on the call stack.
AIDL (Android Interface Definition Language) is a description Language for defining a Communication Interface between a server and a client, and can be used to generate a code for IPC (Inter-Process Communication). In a sense, the AIDL is actually a template, because in the using process, the AIDL actually acts not as an AIDL file but as an example code of an Interface generated according to the AIDL, and the AIDL is actually a template which is generated to avoid repeatedly writing the code.
The AIDL language is designed for inter-process communication. In the Android system, each process runs in an independent memory, and each activity of the process is completed in the independent memory, and the process is separated from other processes. However, there are some cases where there is a need for interaction between applications, such as comparison of transmitted data or task requests, and the aid id is created to meet such a need. Through AIDL, data of another process can be acquired in one process and exposed methods can be called, so that the requirement of inter-process communication is met.
Generally, an application which exposes methods to other applications for calling is called a server, an application which calls methods of other applications is called a client, and the client performs interaction by binding Service of the server.
The communication mechanism can be a Binder communication mechanism, the Binder mechanism utilizes the kernel space as a shared area, and a Binder driver establishes mapping between the memory address of each process and the storage address in the kernel space. So that the data can be copied only once. Meanwhile, UID/PID identity is added for the sender, so that the real-name Binder and the anonymous Binder are supported, and the safety is improved.
The temporary credential may be a Token mechanism, which is an identification of inter-process communication.
In one embodiment, the target system function interface for defining the extension includes:
extended target interface functions and lists are defined.
And defining the extended target interface function, including naming of the interface function, type of the interface function and the like. A list of interface function formations is also defined. The definition of the extended target interface functions and the list are not limited to some extended target interface functions, and the definition is adjusted and changed according to functions to be extended by developers.
In one embodiment, the target system function interface for defining the extension includes:
defining a communication interface ID of the target interface function; and each target interface function corresponds to a communication interface ID and does not conflict with the communication interface ID generated by the Android interface definition language.
The value of the communication interface ID needs not to conflict with the communication interface ID generated by the Android interface definition language, and the proposal can be started from Android.
The embodiment has the beneficial effects that the data security in the system function expansion is ensured through the Binder communication mechanism and the Token authentication mechanism.
In one embodiment, the static variable is obtained by:
searching a JAVA file generated by compiling the Android interface definition language file;
and/or the presence of a gas in the gas,
defined according to preset rules.
The defined static variables can be obtained by searching in a JAVA file generated by compiling an AIDL file.
The preset rule may be AIDI package name + interface name.
For example: isdorage management, aidl, android.
In one embodiment, the defining the extended target client class includes:
and acquiring the communication mechanism of the expanded target system function interface, and storing the communication mechanism into the member variable defined by the expanded target client.
The member variable may be used without assigning an initial value, and when called, the member variable may have a default initial value of the system. For example, the initial value of int type is 0, and the initial value of string type is null.
The beneficial effects present in the above embodiments: the implementation of the extended target client class is a step for ensuring the implementation of the extended target system interface, and is a basis for implementing the extension of the Android system function.
In one embodiment, the method further comprises the following steps: and sending the communication interface ID, the static variable and the input parameter of the target interface function to the expanded target server class according to the protocol format of the communication mechanism.
And carrying out specific code realization on the target interface function, and realizing the function of each interface function.
The communication mechanism may be a binder communication mechanism, which is a client-server communication structure. The client side directly calls the server side by obtaining a proxy interface of the server side, wherein methods defined in the proxy interface correspond to methods defined in the server side one by one; when the client calls the method in the proxy interface, the method of the proxy interface packages the parameters transferred by the client into a Parcel object, in this embodiment, the parameters to be packaged may be the extended target interface function communication interface number, the static variable, the input parameter, and the like, and these parameters are packaged into a Parcel object.
The beneficial effects present in the above embodiments: the parameter is sent to the extended target server class, so as to further judge whether the condition for calling the extended target interface function is met, and the parameter is a necessary step for system function extension, and parameter data for judging processing is provided.
In one embodiment, the extended target server class includes:
the onTransact function is reloaded.
Overloading is the same name of the method, but different parameters. The return types may be the same or different. Heavy load rule: the reloaded method must change the parameter list (the number or type of parameters is different); reloaded methods may change the type of return; the overridden method may change the access modifier; reloaded methods may declare new or broader check exceptions; methods can be reloaded in the same class or in a subclass. There is no way to use the return value type as a criteria for discrimination of the reload function. Each reloaded method (or constructor) must have a unique list of parameter types.
The main content of reloading the ontact function is to convert the parameters of the ontact function into the parameters of the extended target interface function, and the source of the parameters of the ontact function is passed in when the client calls the transact function, so if the transact function has a fixed format input, the ontact function will also have a fixed format output.
In one embodiment, the extended target server class further includes:
and realizing the function of the expanded target system functional interface.
And carrying out specific code implementation on functions of the expanded target system function interface.
The method has the advantages that the implementation of the extended target server class is a step for ensuring the implementation of the extended target system interface, and is a basis for further implementing the extension of the Android system function.
In one embodiment, the reload onTransact function comprises:
when the received communication interface ID sent by the self-expanded target client class is equal to the communication interface ID of the corresponding target interface function in the expanded target system function interface, checking the temporary certificate of the static variable, and calling the corresponding target interface function;
otherwise, calling the parent ontact function for processing.
The check is a way of correcting data errors during data transmission, and the check of the temporary certificate of the static variable is an authentication process, which means to verify whether the client has the right to access the server. Currently, the mainstream authentication method is to verify whether the digital signature is correct or not by using authentication authorization, and in this embodiment, the temporary credential of the static variable is checked to be correct or not. Here, the authentication method is not limited to the above-described authentication method, and other verification modes may be used.
The embodiment has the beneficial effects that the onTransact function needs to be reloaded to realize one Binder service, so that the reloading of the onTransact function is a necessary step for realizing a communication mechanism and a necessary step for realizing the function extension of an Android system.
In this embodiment, a schematic diagram of a technical solution of the present application takes expanding functions of an Android AMS system as an example, where a left half is an Android system native class, and a right half is a related class of the application for expanding functions of the Android system, and specifically, as shown in fig. 4, an expanded target system function interface may be iactivitymanager, where a String type static variable describe is defined, and a target interface function mediaplaytersetvideofullscreen () is also defined; the extended target client class may be activitymanagere, implementing activitymanagere () function, where the target interface function mediaplaytersetvideofullscreen () is implemented according to a specific code; another extended target server class may be activitymanageserviceex, in which a native server class activitymanageservice is inherited, the ontransfer () function is reloaded, and the target interface function mediaPlayerSetVideoFullScreen () is implemented according to a specific code.
It can be seen that the method does not modify the native framework code of the Android system. And the purpose of expanding the function of the Android system can be achieved. The method reduces the workload of transplanting the extended functions and improves the efficiency.
The invention also provides a computer readable storage medium, on which a method program for expanding Android system functions is stored, which is characterized in that the method program for expanding Android system functions realizes any of the steps of the method described above when executed by a processor.
The invention also provides equipment which comprises a memory, a processor and the method program for expanding the Android system function, wherein the method program is stored in the memory and can be run on the processor, and any one of the steps of the method is realized when the processor executes the method program for expanding the Android system function.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (14)

1. A method for expanding Android system functions is characterized by comprising the following steps:
defining an extended target system function interface; the expanded target system function interface is used for carrying out function expansion on the Android system module;
defining an extended target client class; the extended target client class implements the extended target system functional interface;
defining an extended target server class; and the expanded target server class inherits the server class of the Android system and realizes the expanded target system function interface.
2. The method for extending Android system functionality of claim 1, further comprising:
constructing the expanded target server class by using a reflection mechanism of an Android system;
and replacing the original server class in the Android system with the expanded target server class to modify the service starting code of the Android system.
3. The method for extending Android system functionality of claim 2, further comprising:
and calling the expanded target system function interface to realize the expansion of the Android system function.
4. The method for extending Android system functionality of claim 1, wherein the defining an extended target system functionality interface comprises:
and defining a static variable, and determining that the static variable is based on a temporary certificate in a communication mechanism according to a code generated by an Android interface definition language.
5. The method for extending Android system functionality of claim 4, wherein the defining of the extended target system functionality interface comprises:
extended target interface functions and lists are defined.
6. The method for extending Android system functionality of claim 5, wherein the defining of the extended target system functionality interface comprises:
defining a communication interface ID of the target interface function; and each target interface function corresponds to a communication interface ID and does not conflict with the communication interface ID generated by the Android interface definition language.
7. The method for expanding Android system functions of claim 4, wherein the static variables are obtained in a manner that:
searching a JAVA file generated by compiling the Android interface definition language file;
and/or the presence of a gas in the gas,
defined according to preset rules.
8. The method for extending Android system functionality of claim 6, wherein the defining the extended target client class comprises:
and acquiring the communication mechanism of the expanded target system function interface, and storing the communication mechanism into the member variable defined by the expanded target client class.
9. The method for extending Android system functionality of claim 8, further comprising:
and sending the communication interface ID, the static variable and the input parameter of the target interface function to the expanded target server class according to the protocol format of the communication mechanism.
10. The method for extending Android system functionality of claim 4, wherein the extended target server class comprises:
the onTransact function is reloaded.
11. The method for extending Android system functionality of claim 1, wherein the extended target server class comprises:
and realizing the function of the expanded target system functional interface.
12. The method for extending Android system functionality of claim 10, wherein the reload onTransact function comprises:
when the received communication interface ID sent by the self-expanded target client class is equal to the communication interface ID of the corresponding target interface function in the expanded target system function interface, checking the temporary certificate of the static variable, and calling the corresponding target interface function;
otherwise, calling the parent ontact function for processing.
13. A computer-readable storage medium, on which a method program for extending Android system functionality is stored, which, when executed by a processor, carries out the steps of the method of any of claims 1 to 12.
14. An apparatus comprising a memory, a processor and a method program for extending Android system functionality stored and executable on the memory, the processor implementing the steps of the method of any of claims 1-12 when executing the method program for extending Android system functionality.
CN202011106553.7A 2020-10-15 2020-10-15 Method, equipment and computer storage medium for expanding Android system function Active CN112256249B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011106553.7A CN112256249B (en) 2020-10-15 2020-10-15 Method, equipment and computer storage medium for expanding Android system function

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011106553.7A CN112256249B (en) 2020-10-15 2020-10-15 Method, equipment and computer storage medium for expanding Android system function

Publications (2)

Publication Number Publication Date
CN112256249A true CN112256249A (en) 2021-01-22
CN112256249B CN112256249B (en) 2024-09-17

Family

ID=74243537

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011106553.7A Active CN112256249B (en) 2020-10-15 2020-10-15 Method, equipment and computer storage medium for expanding Android system function

Country Status (1)

Country Link
CN (1) CN112256249B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113296834A (en) * 2021-05-21 2021-08-24 南京大学 Reverse engineering-based android closed source service type information extraction method
CN113360184A (en) * 2021-06-04 2021-09-07 曙光信息产业(北京)有限公司 Software migration method and device among multiple ecosystems, computer equipment and storage medium
CN115098076A (en) * 2022-07-18 2022-09-23 扬州航盛科技有限公司 Code generation method for Android system
CN117675742A (en) * 2023-12-06 2024-03-08 广州方舟信息科技有限公司 Communication data processing methods, devices, electronic equipment and storage media

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6173439B1 (en) * 1998-03-11 2001-01-09 International Business Machines Corporation Interface mechanism and method for accessing non-object oriented data from within an object oriented framework
US6405363B1 (en) * 1998-03-11 2002-06-11 International Business Machines Corporation Class casting support for run-time extensible items in an object oriented framework
CA2501364A1 (en) * 2003-10-24 2005-04-24 Microsoft Corporation Mechanism for providing extended functionality to command line instructions
US20100058364A1 (en) * 2008-08-29 2010-03-04 Sherrill Justin L Application programming interface enhancement
CN103297465A (en) * 2012-02-24 2013-09-11 上海盛轩网络科技有限公司 Web page server extension method and system
CN109101271A (en) * 2018-07-27 2018-12-28 郑州云海信息技术有限公司 A kind of program extended method and relevant apparatus
CN109710428A (en) * 2018-12-27 2019-05-03 杭州数梦工场科技有限公司 A kind of dynamic call method and device for realizing class
CN109871207A (en) * 2019-03-07 2019-06-11 张艳秋 A kind of framework extension device and method
CN110413259A (en) * 2018-04-28 2019-11-05 中兴通讯股份有限公司 Android service framework, the method and device for realizing expansion service
CN111400070A (en) * 2020-03-24 2020-07-10 广州华多网络科技有限公司 Terminal equipment and cross-process interface calling implementation and execution method thereof

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6173439B1 (en) * 1998-03-11 2001-01-09 International Business Machines Corporation Interface mechanism and method for accessing non-object oriented data from within an object oriented framework
US6405363B1 (en) * 1998-03-11 2002-06-11 International Business Machines Corporation Class casting support for run-time extensible items in an object oriented framework
CA2501364A1 (en) * 2003-10-24 2005-04-24 Microsoft Corporation Mechanism for providing extended functionality to command line instructions
US20100058364A1 (en) * 2008-08-29 2010-03-04 Sherrill Justin L Application programming interface enhancement
CN103297465A (en) * 2012-02-24 2013-09-11 上海盛轩网络科技有限公司 Web page server extension method and system
CN110413259A (en) * 2018-04-28 2019-11-05 中兴通讯股份有限公司 Android service framework, the method and device for realizing expansion service
CN109101271A (en) * 2018-07-27 2018-12-28 郑州云海信息技术有限公司 A kind of program extended method and relevant apparatus
CN109710428A (en) * 2018-12-27 2019-05-03 杭州数梦工场科技有限公司 A kind of dynamic call method and device for realizing class
CN109871207A (en) * 2019-03-07 2019-06-11 张艳秋 A kind of framework extension device and method
CN111400070A (en) * 2020-03-24 2020-07-10 广州华多网络科技有限公司 Terminal equipment and cross-process interface calling implementation and execution method thereof

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
JNIENV: "IPC_Binder_java_1", pages 1 - 5, Retrieved from the Internet <URL:《https://www.cnblogs.com/jnienv/p/10575595.html》> *
陈强: "Android底层接口与驱动开发技术详解", 31 August 2012, pages: 166 - 175 *
陈莉君;张超;: "Android进程间通信Binder扩展模型的设计与实现", 西安邮电大学学报, no. 03 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113296834A (en) * 2021-05-21 2021-08-24 南京大学 Reverse engineering-based android closed source service type information extraction method
CN113296834B (en) * 2021-05-21 2023-11-03 南京大学 Android closed source service type information extraction method based on reverse engineering
CN113360184A (en) * 2021-06-04 2021-09-07 曙光信息产业(北京)有限公司 Software migration method and device among multiple ecosystems, computer equipment and storage medium
CN115098076A (en) * 2022-07-18 2022-09-23 扬州航盛科技有限公司 Code generation method for Android system
CN117675742A (en) * 2023-12-06 2024-03-08 广州方舟信息科技有限公司 Communication data processing methods, devices, electronic equipment and storage media

Also Published As

Publication number Publication date
CN112256249B (en) 2024-09-17

Similar Documents

Publication Publication Date Title
CN112256249B (en) Method, equipment and computer storage medium for expanding Android system function
US10740115B2 (en) Structural identification of dynamically-generated, pattern-based classes
US7231635B2 (en) Remote incremental program verification using API definitions
CN108062252A (en) A kind of information interacting method, method for managing object and device and system
EP1934815A1 (en) Extensible mechanism for object composition
US11726810B2 (en) Systemic extensible blockchain object model comprising a first-class object model and a distributed ledger technology
CN111651169B (en) Block chain intelligent contract operation method and system based on web container
CN111309303A (en) Code generation method and device, computer equipment and storage medium
CN117931374A (en) Application processing method, device, equipment and storage medium based on container isolation
CN115113916B (en) Linux kernel decoupling method and device and readable storage medium
CN103530165B (en) A kind of java solution that is applied to Internet of Things industry
CN107589940B (en) Software development auxiliary system based on Lua scripting language
CN117313127A (en) Data access authority control method and device, electronic equipment and storage medium
US20240004616A1 (en) Runtime support for role types that extend underlying types
CN112732240B (en) Java component generation method and device
CN111506301B (en) Method for bypassing system restriction reflection call and related equipment
CN119201292A (en) Information calling method, device, computer program product and electronic device
KR100624512B1 (en) Method for implementing object-oriented programming and memory for storing structure therefor
CN116700827A (en) Loading method, device and medium for enumeration data
CN120578370A (en) GraalVM-based multilingual collaborative development method, graalVM-based multilingual collaborative development equipment and medium
CN117149263A (en) Method and server for persistence of extended configuration center of split source framework
CN117369773A (en) Method, apparatus, device and medium for managing code resources
CN118963742A (en) SDK generation processing method and device
CN112114844A (en) A dedicated system for electric energy meter based on virtual machine

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant