[go: up one dir, main page]

WO2019205828A1 - Android service framework, and method and device for implementing extended service - Google Patents

Android service framework, and method and device for implementing extended service Download PDF

Info

Publication number
WO2019205828A1
WO2019205828A1 PCT/CN2019/078182 CN2019078182W WO2019205828A1 WO 2019205828 A1 WO2019205828 A1 WO 2019205828A1 CN 2019078182 W CN2019078182 W CN 2019078182W WO 2019205828 A1 WO2019205828 A1 WO 2019205828A1
Authority
WO
WIPO (PCT)
Prior art keywords
module
extended service
service
interface
extended
Prior art date
Application number
PCT/CN2019/078182
Other languages
French (fr)
Chinese (zh)
Inventor
吴鹏
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2019205828A1 publication Critical patent/WO2019205828A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates

Definitions

  • the present invention relates to the field of Android technologies, and in particular, to an Android service framework, a method and apparatus for implementing an extended service.
  • Android is currently a very popular open source intelligent mobile terminal operating system.
  • OEMs original equipment manufacturers
  • the original functions of the Android framework are often used due to their own functional requirements. Responsibilities are extended, which inevitably leads to modifications to the framework Android source code.
  • the invention provides an Android service framework and a method and a device for implementing the extended service, which are used to solve the problem that the subsequent upgrade risk is too large caused by the expansion method of directly modifying the source code in the prior art.
  • an Android service framework including: an extended service module, an extended service management module, and an extended service proxy module; wherein the extended service module includes the first An Android Interface Definition Language (AIDL) file, the first AIDL file includes: an interface pointing to a predetermined function function; the extended service management module includes a second AIDL file, and the second AIDL file includes An interface to the predetermined extended service module, the extended service proxy module, configured to receive an application request that invokes a predetermined function, and search for an extended service module corresponding to the predetermined function function by using the extended service management module.
  • ADL Android Interface Definition Language
  • the method further includes: a native service module and a native service management module; wherein the native service management module includes a third AIDL file, and the third AIDL file includes: an interface to the extended service management module And, the interface to the scheduled native service module.
  • a method for implementing an extended service comprising: an extended service proxy module receiving an application request for invoking a predetermined service; The service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and implements a predetermined service by using the extended service module.
  • the extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and includes: the extended service proxy module acquires the original service management module according to the application request. An interface of the extended service management module; the extended service proxy module searches an interface of the extended service module in the extended service management module according to an interface of the extended service management module.
  • the implementing the predetermined service by using the extended service module includes: when the extended service proxy module invokes the extended service module by using an interface of the extended service module, the extended service module searches for An interface corresponding to a predetermined function function of the predetermined service; the extended service module invokes the predetermined function function through the interface.
  • the method further includes: the extended service module returning a result of executing the predetermined function function to the extended service proxy module.
  • an apparatus for implementing an extended service comprising: an extended service proxy module, configured to receive an application request for invoking a predetermined service, and obtain an extension for implementing the predetermined service according to the application request An interface of the service module; the extended service module is configured to implement a predetermined service.
  • the extended service proxy module is configured to: acquire an interface of the extended service management module in a native service management module according to the application request; and perform the extended service according to an interface of the extended service management module.
  • the interface of the extended service module is searched in the management module.
  • the extended service module is configured to: when the extended service proxy module invokes the extended service module through an interface of the extended service module, search for a predetermined function that implements the predetermined service A corresponding interface through which the predetermined function function is called.
  • the extended service module is further configured to return a result of executing the predetermined function function to the extended service proxy module.
  • a storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement The method described in the two aspects.
  • FIG. 1 is a schematic structural diagram of an Android service framework according to a first embodiment of the present invention
  • FIG. 2 is a flow chart of a method for implementing an extended service according to a second embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of an apparatus for implementing an extended service according to a third embodiment of the present invention.
  • FIG. 4 is a schematic diagram of an Android service framework according to a fourth embodiment of the present invention.
  • FIG. 5 is a schematic diagram showing a comparison between a native service call and an extended service call according to a fourth embodiment of the present invention.
  • Figure 6 is a flow chart showing the construction of a service framework in accordance with a fourth embodiment of the present invention.
  • the present invention provides an Android service framework, a method and an apparatus for implementing the extended service, and the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
  • a first embodiment of the present invention provides an Android service framework.
  • the schematic diagram of the framework is as shown in FIG. 1 , and specifically includes an extended service module 101 , an extended service management module 102 , and an extended service proxy module 103 .
  • the extended service module includes the first An Android Interface Definition Language (AIDL) file, the first AIDL file includes: an interface pointing to a predetermined function function; the extended service management module includes a second AIDL file, and the second AIDL file includes: a predetermined extension service module
  • the extended service proxy module is configured to receive an application request that invokes a predetermined function, and find an extended service module corresponding to the predetermined function by using the extended service management module.
  • AIDL is a description language for the inter-process communication interface of Android.
  • Android developers define the communication interface between processes by defining AIDL files.
  • the AIDL file corresponding to the extended service module 101 is a first AIDL file, where each extended interface that can be provided by the extended service module and each function function for implementing the extended service module function corresponding to each extended interface are defined.
  • the AIDL file corresponding to the extended service management module 102 is a second AIDL file, wherein a method for obtaining a reference of each extended service module is defined.
  • the application can be called by the extended service proxy module 103 through an interface defined in the AIDL file. Point to the service process of the Android operating system, specifically pointing to the corresponding extended service module in the service process.
  • the extended service module can be established multiple times, and each extended service module can implement services corresponding to one Android system native service, such as extended battery management service corresponding to battery management service in Android system, extended window The management service corresponds to the window management service in the Android system.
  • the extended service module can be implemented by adding a Get/Set access interface, by adopting a static object combination method or by using a reflection method.
  • each extension service module can integrate the corresponding Android system native service object into its own object structure, so that the extended service module can access the data and functions of the native service at any time.
  • the AIDL file corresponding to the extended service management module also needs to define N interfaces that can point to the respective extended service modules, and when a new extended service module is established, the extension is performed.
  • the AIDL file corresponding to the service management module adds an interface to the extended service module to complete the redirection.
  • the corresponding AIDL file is first defined, and then the function of obtaining the interface referenced by each extended service module is implemented in the Android operating system process, and the extended service management module is added to the Android system native service management module. In the list, to achieve and use the extended service management module through the Android native system service management module.
  • the corresponding AIDL file is first defined, and then the function of obtaining each extended interface is implemented in the Android operating system process.
  • the Android system cannot directly Calling to the extended service module, that is, for the Android native framework, these extended service modules do not exist at all, so there is no coupling between code and function, and their existence does not affect the correctness of the native framework, nor There is a risk of a missed combination of code merges during platform upgrades, and the application itself is unable to retrieve these extended service modules from the system's native service management.
  • the Android service framework of this embodiment further includes a native service module and a native service management module, wherein the native service management module includes a third AIDL file, and the third AIDL file includes: an interface to the extended service management module, and points to a predetermined native The interface of the service module.
  • the extended service module is independent of the native Android service framework, and the extended service module and the native Android are reduced.
  • the degree of coupling between the service frameworks makes the subsequent code upgrade and maintenance easier, and solves the problem that the subsequent upgrade risk is too large caused by the expansion method of directly modifying the source code in the prior art.
  • the second embodiment of the present invention provides a method for implementing an extended service.
  • the method is applied to the Android service framework of the first embodiment of the present invention.
  • the method flowchart is as shown in FIG. 2, and specifically includes steps S201 and S202:
  • the extended service proxy module receives an application request that invokes a predetermined service.
  • the extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and implements the predetermined service by using the extended service module.
  • the extended service proxy module obtains an interface of the extended service module that implements the predetermined service according to the application request, the following steps are specifically included:
  • the extended service proxy module acquires an interface of the extended service management module in the native service management module according to the application request.
  • the extended service proxy module searches for an interface of the extended service module in the extended service management module according to the interface of the extended service management module.
  • the extended service management module is added to the list of the native service management module, and the application programming interface (API, Application Programming Interface) on the extended service proxy module is extended when the application needs to invoke the predetermined extended service.
  • the interface of the extended service management module is obtained in the native service management module, and the call interface of the predetermined extended service module that can implement the predetermined service is obtained through redirection.
  • the extended service proxy module invokes the extended service module through the interface of the extended service module
  • the extended service module searches for an interface corresponding to a predetermined function function that implements the predetermined service, and calls a predetermined function function through the interface to implement the predetermined extended service. Further, after the predetermined function function implements the predetermined extension service, the extension service module may return a result of executing the predetermined function function to the extension service agent module to complete the feedback to the application.
  • the second embodiment of the present invention is obtained by extending the step-by-step call of the service proxy module on the service architecture of the first embodiment, so that the application calling process for the extended service does not enter any native service, but is extended by the service.
  • the management module directly redirects the call to the corresponding extended service modules to implement the extended service function, reduces the coupling degree between the extended service module and the native Android service framework, and makes subsequent code upgrade and maintenance easier, and solves the prior art. Directly modify the extension of the source code caused by the problem of excessive upgrade risk.
  • a third embodiment of the present invention provides an apparatus for implementing an extended service.
  • the device structure is shown in FIG. 3, and specifically includes a coupled extended service proxy module 301 and an extended service module 302, where the extended service proxy module 301 is used. And receiving an application request for invoking the predetermined service, acquiring an interface of the extended service module that implements the predetermined service according to the application request; and the extended service module 302 is configured to implement the predetermined service.
  • the apparatus for implementing the extended service in the third embodiment of the present invention can be used in any mobile terminal operating in Android as an apparatus for implementing an extended service on the basis of a native system.
  • the extended service proxy module 301 is specifically configured to: obtain an interface of the extended service management module in the native service management module according to the application request; and search for the extended service module in the extended service management module according to the interface of the extended service management module.
  • Interface The extended service management module is written into the Android system native service module, and is configured to manage each extended service module in the device that implements the extended service, and the extended service proxy module 301 receives the application request for calling the predetermined service and passes the native service management module.
  • the interface for obtaining the extended service management module calls the extended service management module, and finds an interface of the extended service module corresponding to the extended service in the extended service management module.
  • the extended service module can be established multiple times, and each extended service module can implement services corresponding to one Android system native service, such as extended battery management service corresponding to battery management service in Android system, extended window
  • the management service corresponds to the window management service in the Android system.
  • the Get/Set access interface, the static object combination or the reflection method may be used to implement the extended service module and its corresponding Android system native.
  • each extension service module can combine the corresponding Android system native service object into its own object structure, so that the extended service module can access the data and functions of the native service at any time.
  • the extended service proxy module invokes the extended service module through the interface of the extended service module
  • the extended service module searches for an interface corresponding to a predetermined function function that implements the predetermined service, and calls a predetermined function function through the interface to implement the predetermined extended service.
  • the extension service module may return a result of executing the predetermined function function to the extension service agent module, and the feedback to the application has been completed. Since the extended service module is not written into the Android system native service, the Android system cannot directly call the extended service module. That is, for the Android native framework, these extended service modules simply do not exist, so there is no coupling of code and function. Whether they exist or not will not affect the correctness of the native framework, nor will it create the risk of missed integration when the platform is upgraded, and the application itself cannot retrieve these extended service modules from the system native service management. .
  • the third embodiment of the present invention can be applied to any mobile terminal using Android as an operating system as an apparatus for implementing an extended service based on a native system.
  • the call to the step-by-step call of the extended service proxy module does not enter any native service, which reduces the coupling between the extended service module and the native Android service framework, making subsequent code upgrade and maintenance easier and solving the existing
  • the problem of excessive upgrade risk caused by the direct modification of the source code in the technology is too large.
  • a fourth embodiment of the present invention provides an Android service framework that can implement extended services, and a schematic diagram of the framework is shown in FIG.
  • the application layer of the Android service framework runs multiple applications.
  • the native service framework of the Android service framework the native service module that implements various native services and the native service management module that manages each native service module are implemented, and the application needs to implement the native service.
  • the native service management module directly calls the native service to implement the function.
  • the extended service framework of the Android service framework the extended service module that implements various extended services is included, and each extended service module can only correspond to one native service.
  • the module, the extended service framework further includes an extended service management module for defining and managing an interface directed to each extended service module, and an interface wrapper module (corresponding to the extended service proxy module of the first embodiment of the present invention),
  • the layer application provides a corresponding interface
  • the interface wrapper module may be an interface wrapper module separately established for each extended service module, or a unified interface wrapper module established for the extended service management module.
  • the native service call and extended service call process in this embodiment will be described in detail below with reference to FIG.
  • the dashed arrow indicates the process by which the application invokes the system's native service
  • the solid arrow indicates the process by which the application invokes the extended service.
  • the application invokes the native service manager (corresponding to the native service management module in the first embodiment of the present invention) to obtain an interface for implementing the native service module corresponding to the native service, and the interface wrapper module uses the interface to pass the process.
  • Inter-Process Communication calls the native service module to implement the corresponding native service.
  • the application invokes the interface wrapper module of the extension service 1 (the interface wrapper module of the extension service 1 shown in FIG. 5 is a separate interface wrapper module established for the extension service module 1, and in this embodiment Another case: the interface wrapper module established for the extended service management module is not shown in FIG.
  • the interface wrapper module obtains the interface of the extended service management module, and obtains the corresponding extended service corresponding in the extended service management module.
  • the service module 1 is extended, and finally the extended service module is called by the IPC to implement the corresponding extended service. Due to the extended service framework, the extended service module is not written into the native service manager of the Android system, and the Android system cannot directly call the extended service module. That is, for the Android native framework, these extended service modules simply do not exist, so It will generate the coupling of code and function. Their existence will not affect the correctness of the native framework, and it will not cause the risk of missed integration when the platform is upgraded, and the application itself cannot be managed from the system native service. Retrieved in these extended service modules.
  • the construction process of the Android service framework that can implement the extended service in this embodiment will be described below with reference to FIG.
  • the construction process of the foregoing Android service framework includes steps S601 to S608:
  • the extended service management module is running in an operating system process of the Android, and is configured to implement an interface defined by the AIDL file to obtain a reference of each extended service module;
  • the extended service module is running in an operating system process of the Android, and is configured to implement an interface for acquiring each function function defined by the corresponding AIDL file;
  • the extended service framework already contains multiple extension services, if you want to continue adding new extension service modules, after defining the AIDL file of the new extension service module and implementing it in the operating system, The redirection of the new extended service module is added to the AIDL file of the extended service management module, so that the application can correctly call the newly added extended service module to implement the new extended service.
  • a fifth embodiment of the present invention provides a storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the second embodiment The method described.
  • the storage medium may include a ROM/RAM, a magnetic disk, an optical disk, and a USB flash drive.

Landscapes

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

Abstract

Disclosed in the present invention are an Android service framework, and a method and device for implementing an extended service. The service framework comprises: an extended service module, an extended service management module, and an extended service agent module. The extended service module comprises a first AIDL file for pointing to an interface of a predetermined function; the extended service management module comprises a second AIDL file for pointing to an interface of a predetermined extended service module; the extended service agent module is configured to receive an application request of calling the predetermined function, and query the extended service module corresponding to the predetermined function by means of the extended service management module.

Description

Android服务框架、实现扩展服务的方法及装置Android service framework, method and device for implementing extended service
交叉引用cross reference
本发明要求在2018年4月28日提交中国专利局、申请号为201810398695.1、发明名称为“Android服务框架、实现扩展服务的方法及装置”的中国专利申请的优先权,该申请的全部内容通过引用结合在本发明中。The invention claims the priority of the Chinese patent application filed on April 28, 2018, the Chinese Patent Office, the application number is 201, 810, 398, 691, and the invention is entitled "Android service framework, method and device for implementing extended service", the entire content of which is The references are incorporated in the present invention.
技术领域Technical field
本发明涉及Android技术领域,特别是涉及一种Android服务框架、实现扩展服务的方法及装置。The present invention relates to the field of Android technologies, and in particular, to an Android service framework, a method and apparatus for implementing an extended service.
背景技术Background technique
Android是当前一种非常流行的开源智能移动终端操作系统,在各个原始设备制造商(OEM,Original Equipment Manufacturer)的实际集成和开发过程中,经常会因为自身功能需求而对Android框架中原有功能或职责进行扩展,这必然导致对框架Android源码的修改。Android is currently a very popular open source intelligent mobile terminal operating system. In the actual integration and development process of various original equipment manufacturers (OEMs), the original functions of the Android framework are often used due to their own functional requirements. Responsibilities are extended, which inevitably leads to modifications to the framework Android source code.
从软件框架设计的角度看,对Android原生框架修改的最佳的方式就是以增加形式扩展而非以修改形式来进行功能扩展,由于扩展功能的需求是逐步提出来的,所以通常最直接也是最简易的做法就是直接修改框架源码以快速实现功能扩展。但这种直接修改原生文件的扩展方式会将Android框架的源码改得面目全非,尤其是Android系统碎片化相对比较严重,在各个版本,各个平台上衍生出来的不同项目的差异化需求也各不相同,这种直接修改的方式对于后续的平台版本升级来说费时费力而且风险很大,代码的合并一旦 出现多合或者漏合就很可能引发极为隐秘而难于排查的故障。From the perspective of software framework design, the best way to modify the Android native framework is to expand the form instead of modifying it. Because the requirements of the extended function are gradually proposed, it is usually the most direct and most The easy way is to modify the framework source directly to quickly implement the feature extension. However, this method of directly modifying the native file extension will change the source code of the Android framework to be beyond recognition. In particular, the fragmentation of the Android system is relatively serious. The differentization requirements of different projects derived from each version and platform are also different. This direct modification is time consuming and risky for subsequent platform version upgrades. Once the code merges, it may be very difficult to troubleshoot.
发明内容Summary of the invention
本发明提供一种Android服务框架、实现扩展服务的方法及装置,用以解决现有技术中直接修改源码的扩展方式造成的后续升级风险过大的问题。The invention provides an Android service framework and a method and a device for implementing the extended service, which are used to solve the problem that the subsequent upgrade risk is too large caused by the expansion method of directly modifying the source code in the prior art.
为解决上述技术问题,根据本发明实施例的第一个方面,提供一种Android服务框架,包括:扩展服务模块、扩展服务管理模块和扩展服务代理模块;其中,所述扩展服务模块包括第一安卓接口定义语言(AIDL,Android Interface Definition Language)文件,所述第一AIDL文件中包括:指向预定功能函数的接口;所述扩展服务管理模块包括第二AIDL文件,所述第二AIDL文件中包括:指向预定扩展服务模块的接口;所述扩展服务代理模块,用于接收调用预定功能函数的应用请求,并通过所述扩展服务管理模块查找所述预定功能函数对应的扩展服务模块。In order to solve the above technical problem, according to a first aspect of the embodiments of the present invention, an Android service framework is provided, including: an extended service module, an extended service management module, and an extended service proxy module; wherein the extended service module includes the first An Android Interface Definition Language (AIDL) file, the first AIDL file includes: an interface pointing to a predetermined function function; the extended service management module includes a second AIDL file, and the second AIDL file includes An interface to the predetermined extended service module, the extended service proxy module, configured to receive an application request that invokes a predetermined function, and search for an extended service module corresponding to the predetermined function function by using the extended service management module.
在一实施方式中,还包括:原生服务模块和原生服务管理模块;其中,所述原生服务管理模块包括第三AIDL文件,所述第三AIDL文件中包括:指向所述扩展服务管理模块的接口,以及,指向预定原生服务模块的接口。In an embodiment, the method further includes: a native service module and a native service management module; wherein the native service management module includes a third AIDL file, and the third AIDL file includes: an interface to the extended service management module And, the interface to the scheduled native service module.
根据本发明实施例第二个方面,还提供一种实现扩展服务的方法,应用权利要求1或2所述的Android服务框架,包括:扩展服务代理模块接收调用预定服务的应用请求;所述扩展服务代理模块根据所述应用请求获取实现所述预定服务的扩展服务模块的接口,并通过所述扩展服务模块实现预定服务。According to a second aspect of the embodiments of the present invention, a method for implementing an extended service, the Android service framework of claim 1 or 2, comprising: an extended service proxy module receiving an application request for invoking a predetermined service; The service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and implements a predetermined service by using the extended service module.
在一实施方式中,所述扩展服务代理模块根据所述应用请求获取实现所述预定服务的扩展服务模块的接口,包括:所述扩展服务代理模块根据所述 应用请求在原生服务管理模块中获取所述扩展服务管理模块的接口;所述扩展服务代理模块根据所述扩展服务管理模块的接口在所述扩展服务管理模块中查找所述扩展服务模块的接口。In an embodiment, the extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and includes: the extended service proxy module acquires the original service management module according to the application request. An interface of the extended service management module; the extended service proxy module searches an interface of the extended service module in the extended service management module according to an interface of the extended service management module.
在一实施方式中,通过所述扩展服务模块实现预定服务,包括:在所述扩展服务代理模块通过所述扩展服务模块的接口调用所述扩展服务模块的情况下,所述扩展服务模块查找实现所述预定服务的预定功能函数对应的接口;所述扩展服务模块通过所述接口调用所述预定功能函数。In an embodiment, the implementing the predetermined service by using the extended service module includes: when the extended service proxy module invokes the extended service module by using an interface of the extended service module, the extended service module searches for An interface corresponding to a predetermined function function of the predetermined service; the extended service module invokes the predetermined function function through the interface.
在一实施方式中,所述扩展服务模块通过所述接口调用所述预定功能函数之后,还包括:所述扩展服务模块向所述扩展服务代理模块返回执行所述预定功能函数的结果。In an embodiment, after the extended service module invokes the predetermined function function through the interface, the method further includes: the extended service module returning a result of executing the predetermined function function to the extended service proxy module.
根据本发明实施例第三个方面,还提供一种实现扩展服务的装置,包括:扩展服务代理模块,用于接收调用预定服务的应用请求,根据所述应用请求获取实现所述预定服务的扩展服务模块的接口;所述扩展服务模块,用于实现预定服务。According to a third aspect of the embodiments of the present invention, there is provided an apparatus for implementing an extended service, comprising: an extended service proxy module, configured to receive an application request for invoking a predetermined service, and obtain an extension for implementing the predetermined service according to the application request An interface of the service module; the extended service module is configured to implement a predetermined service.
在一实施方式中,所述扩展服务代理模块用于:根据所述应用请求在原生服务管理模块中获取所述扩展服务管理模块的接口;根据所述扩展服务管理模块的接口在所述扩展服务管理模块中查找所述扩展服务模块的接口。In an embodiment, the extended service proxy module is configured to: acquire an interface of the extended service management module in a native service management module according to the application request; and perform the extended service according to an interface of the extended service management module. The interface of the extended service module is searched in the management module.
在一实施方式中,所述扩展服务模块,用于:在所述扩展服务代理模块通过所述扩展服务模块的接口调用所述扩展服务模块的情况下,查找实现所述预定服务的预定功能函数对应的接口,通过所述接口调用所述预定功能函数。In an embodiment, the extended service module is configured to: when the extended service proxy module invokes the extended service module through an interface of the extended service module, search for a predetermined function that implements the predetermined service A corresponding interface through which the predetermined function function is called.
在一实施方式中,所述扩展服务模块,还用于向所述扩展服务代理模块返回执行所述预定功能函数的结果。In an embodiment, the extended service module is further configured to return a result of executing the predetermined function function to the extended service proxy module.
根据本发明实施例第四个方面,还提供一种存储介质,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如第二方面所述的方法。According to a fourth aspect of the embodiments of the present invention, there is also provided a storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement The method described in the two aspects.
附图说明DRAWINGS
图1是本发明第一实施例的Android服务框架结构示意图;1 is a schematic structural diagram of an Android service framework according to a first embodiment of the present invention;
图2是本发明第二实施例的实现扩展服务的方法流程图;2 is a flow chart of a method for implementing an extended service according to a second embodiment of the present invention;
图3是本发明第三实施例的实现扩展服务的装置结构示意图;3 is a schematic structural diagram of an apparatus for implementing an extended service according to a third embodiment of the present invention;
图4是本发明第四实施例的Android服务框架示意图;4 is a schematic diagram of an Android service framework according to a fourth embodiment of the present invention;
图5是本发明第四实施例的原生服务调用与扩展服务调用对比示意图;FIG. 5 is a schematic diagram showing a comparison between a native service call and an extended service call according to a fourth embodiment of the present invention; FIG.
图6是本发明第四实施例的服务框架构建流程图。Figure 6 is a flow chart showing the construction of a service framework in accordance with a fourth embodiment of the present invention.
具体实施方式detailed description
为了解决现有技术通过直接修改源码的扩展方式造成的后续升级风险过大的问题。本发明提供了一种Android服务框架、实现扩展服务的方法及装置,以下结合附图以及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不限定本发明。In order to solve the problem of excessive risk of subsequent upgrades caused by the prior art directly modifying the extension of the source code. The present invention provides an Android service framework, a method and an apparatus for implementing the extended service, and the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
本发明的第一实施例提供了一种Android服务框架,其框架结构示意图如图1所示,具体包括扩展服务模块101、扩展服务管理模块102和扩展服务代理模块103,扩展服务模块包括第一安卓接口定义语言(AIDL,Android Interface Definition Language)文件,第一AIDL文件中包括:指向预定功能函数的接口;扩展服务管理模块包括第二AIDL文件,第二AIDL文件中包 括:指向预定扩展服务模块的接口;扩展服务代理模块,用于接收调用预定功能函数的应用请求,并通过扩展服务管理模块查找预定功能函数对应的扩展服务模块。A first embodiment of the present invention provides an Android service framework. The schematic diagram of the framework is as shown in FIG. 1 , and specifically includes an extended service module 101 , an extended service management module 102 , and an extended service proxy module 103 . The extended service module includes the first An Android Interface Definition Language (AIDL) file, the first AIDL file includes: an interface pointing to a predetermined function function; the extended service management module includes a second AIDL file, and the second AIDL file includes: a predetermined extension service module The extended service proxy module is configured to receive an application request that invokes a predetermined function, and find an extended service module corresponding to the predetermined function by using the extended service management module.
应当了解的是,AIDL是一种Android内部进程间通信接口的描述语言,Android开发人员通过定义AIDL文件来定义进程间的通信接口。在本实施例中,扩展服务模块101对应的AIDL文件为第一AIDL文件,其中定义了扩展服务模块可提供的各扩展接口及各扩展接口对应的各个用于实现扩展服务模块功能的功能函数,扩展服务管理模块102对应的AIDL文件为第二AIDL文件,其中定义了获取各个扩展服务模块引用的方法,在实际使用时,通过AIDL文件中定义的接口才能把应用对扩展服务代理模块103的调用指向到Android操作系统的服务进程中,具体指向到服务进程中相应的扩展服务模块中。It should be understood that AIDL is a description language for the inter-process communication interface of Android. Android developers define the communication interface between processes by defining AIDL files. In this embodiment, the AIDL file corresponding to the extended service module 101 is a first AIDL file, where each extended interface that can be provided by the extended service module and each function function for implementing the extended service module function corresponding to each extended interface are defined. The AIDL file corresponding to the extended service management module 102 is a second AIDL file, wherein a method for obtaining a reference of each extended service module is defined. In actual use, the application can be called by the extended service proxy module 103 through an interface defined in the AIDL file. Point to the service process of the Android operating system, specifically pointing to the corresponding extended service module in the service process.
为了实现更多的扩展功能需求,扩展服务模块可以建立多个,每个扩展服务模块可实现的服务均对应一个Android系统原生的服务,如扩展电池管理服务对应Android系统中电池管理服务、扩展窗口管理服务对应Android系统中窗口管理服务等。在扩展服务模块的运行过程中,需要与其对应的Android系统原生服务发生互访时,可以通过添加Get/Set访问接口,通过采用静态对象组合方法或者采通过用反射的方法来实现扩展服务模块与其对应的Android系统原生服务的互访,每个扩展服务模块在实现时可以把相应的Android系统原生服务对象组合到自己的对象结构中,使扩展服务模块可以随时访问原生服务的数据和功能。并且,在扩展服务模块存在N个的情况下,扩展服务管理模块对应的AIDL文件中也需要定义N个可以指向各个扩展服务模块的接口,当有新的扩展服务模块建立的情况下,在扩展服务管理模块 对应的AIDL文件新增指向该扩展服务模块的接口,以完成重定向。In order to realize more extended function requirements, the extended service module can be established multiple times, and each extended service module can implement services corresponding to one Android system native service, such as extended battery management service corresponding to battery management service in Android system, extended window The management service corresponds to the window management service in the Android system. In the running process of the extended service module, when the mutual access of the Android system native service needs to be visited, the extended service module can be implemented by adding a Get/Set access interface, by adopting a static object combination method or by using a reflection method. Corresponding Android system native service mutual visit, each extension service module can integrate the corresponding Android system native service object into its own object structure, so that the extended service module can access the data and functions of the native service at any time. Moreover, in the case that there are N extended service modules, the AIDL file corresponding to the extended service management module also needs to define N interfaces that can point to the respective extended service modules, and when a new extended service module is established, the extension is performed. The AIDL file corresponding to the service management module adds an interface to the extended service module to complete the redirection.
在扩展服务管理模块实现时,首先定义其对应的AIDL文件,随后在Android操作系统进程中实现其获取各个扩展服务模块引用的接口的功能,并把扩展服务管理模块加入到Android系统原生服务管理模块的列表中,以实现通过Android原生系统服务管理模块获取并使用扩展服务管理模块。在扩展服务模块实现时,首先定义其对应的AIDL文件,随后在Android操作系统进程中实现其获取各个扩展接口的功能,由于扩展服务模块没有写入Android系统原生服务管理模块中,Android系统无法直接调用到扩展服务模块,即对Android原生框架来讲,这些扩展服务模块根本是不存在的,因此不会产生代码和功能的耦合,它们的存在与否不会影响原生框架的正确性,也不会产生平台升级时的代码合并时少合漏合的风险,而且应用本身也是无法从系统原生服务管理中检索到这些扩展服务模块的。When the extended service management module is implemented, the corresponding AIDL file is first defined, and then the function of obtaining the interface referenced by each extended service module is implemented in the Android operating system process, and the extended service management module is added to the Android system native service management module. In the list, to achieve and use the extended service management module through the Android native system service management module. When the extended service module is implemented, the corresponding AIDL file is first defined, and then the function of obtaining each extended interface is implemented in the Android operating system process. Since the extended service module is not written into the native service management module of the Android system, the Android system cannot directly Calling to the extended service module, that is, for the Android native framework, these extended service modules do not exist at all, so there is no coupling between code and function, and their existence does not affect the correctness of the native framework, nor There is a risk of a missed combination of code merges during platform upgrades, and the application itself is unable to retrieve these extended service modules from the system's native service management.
本实施例的Android服务框架还包括原生服务模块和原生服务管理模块,其中,原生服务管理模块包括第三AIDL文件,第三AIDL文件中包括:指向扩展服务管理模块的接口,以及,指向预定原生服务模块的接口。The Android service framework of this embodiment further includes a native service module and a native service management module, wherein the native service management module includes a third AIDL file, and the third AIDL file includes: an interface to the extended service management module, and points to a predetermined native The interface of the service module.
本实施例的Android服务框架在调用过程中,通过只将扩展服务管理模块写入到原生的Android服务框架中,使扩展服务模块相对于原生的Android服务框架独立,降低扩展服务模块与原生的Android服务框架之间的耦合度,使后续代码升级和维护更加简单,解决了现有技术中直接修改源码的扩展方式造成的后续升级风险过大的问题。In the calling process of the Android service framework of this embodiment, by only writing the extended service management module to the native Android service framework, the extended service module is independent of the native Android service framework, and the extended service module and the native Android are reduced. The degree of coupling between the service frameworks makes the subsequent code upgrade and maintenance easier, and solves the problem that the subsequent upgrade risk is too large caused by the expansion method of directly modifying the source code in the prior art.
本发明的第二实施例提出了一种实现扩展服务的方法,该方法应用本发明第一实施例的Android服务框架,其方法流程图如图2所示,具体包括步 骤S201和S202:The second embodiment of the present invention provides a method for implementing an extended service. The method is applied to the Android service framework of the first embodiment of the present invention. The method flowchart is as shown in FIG. 2, and specifically includes steps S201 and S202:
S201,扩展服务代理模块接收调用预定服务的应用请求;S201. The extended service proxy module receives an application request that invokes a predetermined service.
S202,扩展服务代理模块根据应用请求获取实现预定服务的扩展服务模块的接口,并通过扩展服务模块实现预定服务。S202. The extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and implements the predetermined service by using the extended service module.
在扩展服务代理模块根据应用请求获取实现预定服务的扩展服务模块的接口时,具体包括以下步骤:When the extended service proxy module obtains an interface of the extended service module that implements the predetermined service according to the application request, the following steps are specifically included:
S11,扩展服务代理模块根据应用请求在原生服务管理模块中获取扩展服务管理模块的接口;S11. The extended service proxy module acquires an interface of the extended service management module in the native service management module according to the application request.
S12,扩展服务代理模块根据扩展服务管理模块的接口在扩展服务管理模块中查找扩展服务模块的接口。S12. The extended service proxy module searches for an interface of the extended service module in the extended service management module according to the interface of the extended service management module.
在本发明的第一实施例中,扩展服务管理模块被加入到原生服务管理模块的列表中,在应用需要调用预定扩展服务时,通过扩展服务代理模块上的应用编程接口(API,Application Programming Interface,相当于本发明第一实施例中的接口)在原生服务管理模块中获取扩展服务管理模块的接口,并通过重定向,获取可以实现预定服务的预定扩展服务模块的调用接口。In the first embodiment of the present invention, the extended service management module is added to the list of the native service management module, and the application programming interface (API, Application Programming Interface) on the extended service proxy module is extended when the application needs to invoke the predetermined extended service. Corresponding to the interface in the first embodiment of the present invention, the interface of the extended service management module is obtained in the native service management module, and the call interface of the predetermined extended service module that can implement the predetermined service is obtained through redirection.
在扩展服务代理模块通过扩展服务模块的接口调用扩展服务模块的情况下,扩展服务模块查找实现预定服务的预定功能函数对应的接口,通过该接口调用预定功能函数以实现预定扩展服务。进一步地,在预定功能函数实现预定扩展服务后,扩展服务模块可以向扩展服务代理模块返回执行预定功能函数的结果,以完成对应用的反馈。In the case that the extended service proxy module invokes the extended service module through the interface of the extended service module, the extended service module searches for an interface corresponding to a predetermined function function that implements the predetermined service, and calls a predetermined function function through the interface to implement the predetermined extended service. Further, after the predetermined function function implements the predetermined extension service, the extension service module may return a result of executing the predetermined function function to the extension service agent module to complete the feedback to the application.
本发明的第二实施例在第一实施例的服务架构上,通过扩展服务代理模块的的逐步调用获取,使应用对扩展服务的调用流程不会再进入任何原生服务内部,而是由扩展服务管理模块直接重定向调用到相应的各个扩展服务模 块以实现扩展服务功能,降低扩展服务模块与原生的Android服务框架之间的耦合度,使后续代码升级和维护更加简单,解决了现有技术中直接修改源码的扩展方式造成的后续升级风险过大的问题。The second embodiment of the present invention is obtained by extending the step-by-step call of the service proxy module on the service architecture of the first embodiment, so that the application calling process for the extended service does not enter any native service, but is extended by the service. The management module directly redirects the call to the corresponding extended service modules to implement the extended service function, reduces the coupling degree between the extended service module and the native Android service framework, and makes subsequent code upgrade and maintenance easier, and solves the prior art. Directly modify the extension of the source code caused by the problem of excessive upgrade risk.
本发明的第三实施例提供了一种实现扩展服务的装置,其装置结构示意图如图3所示,具体包括耦合的扩展服务代理模块301以及扩展服务模块302,其中,扩展服务代理模块301用于接收调用预定服务的应用请求,根据应用请求获取实现预定服务的扩展服务模块的接口;扩展服务模块302用于实现预定服务。应当了解的是,本发明的第三实施例中的实现扩展服务的装置可以用于任意一种以Android为操作系统的移动终端中,作为在原生系统的基础上实现扩展服务的装置。A third embodiment of the present invention provides an apparatus for implementing an extended service. The device structure is shown in FIG. 3, and specifically includes a coupled extended service proxy module 301 and an extended service module 302, where the extended service proxy module 301 is used. And receiving an application request for invoking the predetermined service, acquiring an interface of the extended service module that implements the predetermined service according to the application request; and the extended service module 302 is configured to implement the predetermined service. It should be understood that the apparatus for implementing the extended service in the third embodiment of the present invention can be used in any mobile terminal operating in Android as an apparatus for implementing an extended service on the basis of a native system.
在本实施例中,扩展服务代理模块301具体用于:根据应用请求在原生服务管理模块中获取扩展服务管理模块的接口;以及根据扩展服务管理模块的接口在扩展服务管理模块中查找扩展服务模块的接口。其中,扩展服务管理模块被写入到Android系统原生服务模块中,用于管理实现扩展服务的装置中的各个扩展服务模块,扩展服务代理模块301接收调用预定服务的应用请求后通过原生服务管理模块中获取扩展服务管理模块的接口调用扩展服务管理模块,并在扩展服务管理模块中查找相应实现扩展服务的扩展服务模块的接口。In this embodiment, the extended service proxy module 301 is specifically configured to: obtain an interface of the extended service management module in the native service management module according to the application request; and search for the extended service module in the extended service management module according to the interface of the extended service management module. Interface. The extended service management module is written into the Android system native service module, and is configured to manage each extended service module in the device that implements the extended service, and the extended service proxy module 301 receives the application request for calling the predetermined service and passes the native service management module. The interface for obtaining the extended service management module calls the extended service management module, and finds an interface of the extended service module corresponding to the extended service in the extended service management module.
为了实现更多的扩展功能需求,扩展服务模块可以建立多个,每个扩展服务模块可实现的服务均对应一个Android系统原生的服务,如扩展电池管理服务对应Android系统中电池管理服务、扩展窗口管理服务对应Android系统中窗口管理服务等。在扩展服务模块的运行过程中,需要与其对应的 Android系统原生服务发生互访时,可以通过添加Get/Set访问接口,静态对象组合或者采用反射的方法以实现扩展服务模块与其对应的Android系统原生服务的互访,每个扩展服务模块在实现时可以把相应的Android系统原生服务对象组合到自己的对象结构中,使扩展服务模块可以随时访问原生服务的数据和功能。In order to realize more extended function requirements, the extended service module can be established multiple times, and each extended service module can implement services corresponding to one Android system native service, such as extended battery management service corresponding to battery management service in Android system, extended window The management service corresponds to the window management service in the Android system. In the running process of the extended service module, when the mutual access of the Android system native service needs to be exchanged, the Get/Set access interface, the static object combination or the reflection method may be used to implement the extended service module and its corresponding Android system native. The mutual access of the service, each extension service module can combine the corresponding Android system native service object into its own object structure, so that the extended service module can access the data and functions of the native service at any time.
在扩展服务代理模块通过扩展服务模块的接口调用扩展服务模块的情况下,扩展服务模块查找实现预定服务的预定功能函数对应的接口,通过该接口调用预定功能函数以实现预定扩展服务。进一步地,在预定功能函数实现预定扩展服务后,扩展服务模块可以向扩展服务代理模块返回执行预定功能函数的结果,已完成对应用的反馈。由于扩展服务模块没有写入Android系统原生服务中,Android系统无法直接调用到扩展服务模块,即对Android原生框架来讲,这些扩展服务模块根本是不存在的,因此不会产生代码和功能的耦合,它们的存在与否不会影响原生框架的正确性,也不会产生平台升级时的代码合并时少合漏合的风险,而且应用本身也是无法从系统原生服务管理中检索到这些扩展服务模块。In the case that the extended service proxy module invokes the extended service module through the interface of the extended service module, the extended service module searches for an interface corresponding to a predetermined function function that implements the predetermined service, and calls a predetermined function function through the interface to implement the predetermined extended service. Further, after the predetermined function function implements the predetermined extension service, the extension service module may return a result of executing the predetermined function function to the extension service agent module, and the feedback to the application has been completed. Since the extended service module is not written into the Android system native service, the Android system cannot directly call the extended service module. That is, for the Android native framework, these extended service modules simply do not exist, so there is no coupling of code and function. Whether they exist or not will not affect the correctness of the native framework, nor will it create the risk of missed integration when the platform is upgraded, and the application itself cannot retrieve these extended service modules from the system native service management. .
本发明的第三实施例可以用于任意一种以Android为操作系统的移动终端中,作为在原生系统的基础上实现扩展服务的装置。对扩展服务代理模块的的逐步调用获取的调用不会进入任何原生服务内部,降低了扩展服务模块与原生的Android服务框架之间的耦合度,使后续代码升级和维护更加简单,解决了现有技术中直接修改源码的扩展方式造成的后续升级风险过大的问题。The third embodiment of the present invention can be applied to any mobile terminal using Android as an operating system as an apparatus for implementing an extended service based on a native system. The call to the step-by-step call of the extended service proxy module does not enter any native service, which reduces the coupling between the extended service module and the native Android service framework, making subsequent code upgrade and maintenance easier and solving the existing The problem of excessive upgrade risk caused by the direct modification of the source code in the technology is too large.
本发明的第四实施例提供了一种可以实现扩展服务的Android服务框架, 其框架示意图如图4所示。Android服务框架的应用层中运行多个应用,在Android服务框架的原生服务框架中,包含实现各种原生服务的原生服务模块和管理各个原生服务模块的原生服务管理模块,应用需要实现原生服务的功能时,可通过原生服务管理模块直接调用原生服务进行功能实现,在Android服务框架的扩展服务框架中,包含实现各种扩展服务的扩展服务模块,且每个扩展服务模块只能对应一个原生服务模块,扩展服务框架中还包含扩展服务管理模块,用于定义和管理指向各扩展服务模块的接口,还包含接口包装模块(相当于本发明第一实施例的扩展服务代理模块),为了向应用层应用提供相应的接口,接口包装模块可以为对每个扩展服务模块单独建立的接口包装模块,也可以为对扩展服务管理模块建立的统一的接口包装模块。A fourth embodiment of the present invention provides an Android service framework that can implement extended services, and a schematic diagram of the framework is shown in FIG. The application layer of the Android service framework runs multiple applications. In the native service framework of the Android service framework, the native service module that implements various native services and the native service management module that manages each native service module are implemented, and the application needs to implement the native service. In the function, the native service management module directly calls the native service to implement the function. In the extended service framework of the Android service framework, the extended service module that implements various extended services is included, and each extended service module can only correspond to one native service. The module, the extended service framework further includes an extended service management module for defining and managing an interface directed to each extended service module, and an interface wrapper module (corresponding to the extended service proxy module of the first embodiment of the present invention), The layer application provides a corresponding interface, and the interface wrapper module may be an interface wrapper module separately established for each extended service module, or a unified interface wrapper module established for the extended service management module.
下面结合图5对本实施例中原生服务调用与扩展服务调用过程进行详细的描述。在图5中,虚线箭头表示应用调用系统原生服务的过程,实线箭头表示应用调用扩展服务的过程。The native service call and extended service call process in this embodiment will be described in detail below with reference to FIG. In Figure 5, the dashed arrow indicates the process by which the application invokes the system's native service, and the solid arrow indicates the process by which the application invokes the extended service.
在应用调用系统原生服务时,应用调用原生服务管理器(相当于本发明第一实施例中的原生服务管理模块)获取实现原生服务对应的原生服务模块的接口,接口包装模块使用上述接口通过进程间通信(IPC,Inter-Process Communication)调用该原生服务模块以实现相应原生服务。在应用调用扩展服务时,应用调用扩展服务1的接口包装模块(在图5中示出的扩展服务1的接口包装模块为对扩展服务模块1建立的独立的接口包装模块,而本实施例中的另一种情况:为扩展服务管理模块建立的接口包装模块并未在图5中示出),接口包装模块获取扩展服务管理模块的接口,并在扩展服务管理模块中获取实现扩展服务对应的扩展服务模块1,最后通过IPC调用该扩展服务模块以实现相应扩展服务。由于扩展服务框架中,扩展服务模块没有写入 Android系统原生服务管理器中,Android系统无法直接调用到扩展服务模块,即对Android原生框架来讲,这些扩展服务模块根本是不存在的,因此不会产生代码和功能的耦合,它们的存在与否不会影响原生框架的正确性,也不会产生平台升级时的代码合并时少合漏合的风险,而且应用本身也是无法从系统原生服务管理中检索到这些扩展服务模块的。When the application invokes the system native service, the application invokes the native service manager (corresponding to the native service management module in the first embodiment of the present invention) to obtain an interface for implementing the native service module corresponding to the native service, and the interface wrapper module uses the interface to pass the process. Inter-Process Communication (IPC) calls the native service module to implement the corresponding native service. When the application invokes the extension service, the application invokes the interface wrapper module of the extension service 1 (the interface wrapper module of the extension service 1 shown in FIG. 5 is a separate interface wrapper module established for the extension service module 1, and in this embodiment Another case: the interface wrapper module established for the extended service management module is not shown in FIG. 5), the interface wrapper module obtains the interface of the extended service management module, and obtains the corresponding extended service corresponding in the extended service management module. The service module 1 is extended, and finally the extended service module is called by the IPC to implement the corresponding extended service. Due to the extended service framework, the extended service module is not written into the native service manager of the Android system, and the Android system cannot directly call the extended service module. That is, for the Android native framework, these extended service modules simply do not exist, so It will generate the coupling of code and function. Their existence will not affect the correctness of the native framework, and it will not cause the risk of missed integration when the platform is upgraded, and the application itself cannot be managed from the system native service. Retrieved in these extended service modules.
下面结合图6对本实施例中可以实现扩展服务的Android服务框架的构建流程进行描述。其中,上述Android服务框架的构建流程包括步骤S601至S608:The construction process of the Android service framework that can implement the extended service in this embodiment will be described below with reference to FIG. The construction process of the foregoing Android service framework includes steps S601 to S608:
S601,定义扩展服务管理模块的AIDL文件(相当于本发明第一实施例中的第二AIDL文件),其中定义了扩展服务管理模块获取各个扩展服务模块引用的接口;S601, defining an AIDL file of the extended service management module (corresponding to the second AIDL file in the first embodiment of the present invention), wherein the interface for the extension service management module to obtain the reference of each extended service module is defined;
S602,实现扩展服务管理模块;扩展服务管理模块是运行在Android的操作系统进程中的,用于实现AIDL文件所定义的获取各个扩展服务模块引用的接口;S602, implementing an extended service management module; the extended service management module is running in an operating system process of the Android, and is configured to implement an interface defined by the AIDL file to obtain a reference of each extended service module;
S603,将扩展服务管理模块加入到原生服务列表,即通过Android原生系统服务管理器可以获取并使用扩展服务管理模块;S603, adding the extended service management module to the native service list, that is, the extended service management module can be obtained and used by the Android native system service manager;
S604,定义扩展服务模块的AIDL文件,其中定义了该扩展服务模块所提供的各个扩展接口,各个扩展接口用于指向该扩展服务模块提供的各个功能函数;S604, defining an AIDL file of the extended service module, where each extended interface provided by the extended service module is defined, and each extended interface is used to point to each function function provided by the extended service module;
S605,实现扩展服务模块;扩展服务模块是运行在Android的操作系统进程中的,用于实现其对应的AIDL文件所定义的获取各个功能函数的接口;S605, implementing an extended service module; the extended service module is running in an operating system process of the Android, and is configured to implement an interface for acquiring each function function defined by the corresponding AIDL file;
S606,选择是否采用统一的接口包装模块;S606, selecting whether to adopt a unified interface packaging module;
S607,如果选择使用统一接口包装模块,则建立扩展服务管理模块的应 用接口包装模块;S607, if the unified interface wrapper module is selected, the application interface wrapper module of the extended service management module is established;
S608,如果未选择使用统一接口包装模块,则建立各个扩展服务模块的应用的独立接口包装模块。S608. If the unified interface wrapper module is not selected, the independent interface wrapper module of each extended service module application is established.
应当了解的是,在扩展服务框架中已经包含多个扩展服务的情况下,若想继续添加新的扩展服务模块,则在定义新的扩展服务模块的AIDL文件并在操作系统中实现后,在扩展服务管理模块的AIDL文件中添加对该新扩展服务模块的重定向,使应用可以正确的调用到该新添加的扩展服务模块,以实现新的扩展服务。It should be understood that if the extended service framework already contains multiple extension services, if you want to continue adding new extension service modules, after defining the AIDL file of the new extension service module and implementing it in the operating system, The redirection of the new extended service module is added to the AIDL file of the extended service management module, so that the application can correctly call the newly added extended service module to implement the new extended service.
本发明的第五实施例提供一种存储介质,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如第二实施例所述的方法。其中,所述的存储介质可以包括ROM/RAM、磁碟、光盘、U盘。A fifth embodiment of the present invention provides a storage medium storing one or more programs, the one or more programs being executable by one or more processors to implement the second embodiment The method described. The storage medium may include a ROM/RAM, a magnetic disk, an optical disk, and a USB flash drive.
尽管为示例目的,已经公开了本发明的部分实施例,本领域的技术人员将意识到各种改进、增加和取代也是可能的,因此,本发明的范围应当不限于上述实施例。Although some embodiments of the present invention have been disclosed for purposes of illustration, those skilled in the art will recognize that various modifications, additions and substitutions are possible. Therefore, the scope of the present invention should not be limited to the embodiments described above.

Claims (11)

  1. 一种Android服务框架,其特征在于,包括:An Android service framework, which is characterized by:
    扩展服务模块、扩展服务管理模块和扩展服务代理模块;其中,An extended service module, an extended service management module, and an extended service proxy module; wherein
    所述扩展服务模块包括第一安卓接口定义语言AIDL文件,所述第一AIDL文件中包括:指向预定功能函数的接口;The extended service module includes a first Android interface definition language AIDL file, and the first AIDL file includes: an interface pointing to a predetermined function function;
    所述扩展服务管理模块包括第二AIDL文件,所述第二AIDL文件中包括:指向预定扩展服务模块的接口;The extended service management module includes a second AIDL file, and the second AIDL file includes: an interface that points to a predetermined extended service module;
    所述扩展服务代理模块,用于接收调用预定功能函数的应用请求,并通过所述扩展服务管理模块查找所述预定功能函数对应的扩展服务模块。The extended service proxy module is configured to receive an application request that invokes a predetermined function, and search for an extended service module corresponding to the predetermined function function by using the extended service management module.
  2. 如权利要求1所述的Android服务框架,其特征在于,还包括:The Android service framework of claim 1 further comprising:
    原生服务模块和原生服务管理模块;Native service module and native service management module;
    其中,所述原生服务管理模块包括第三AIDL文件,所述第三AIDL文件中包括:指向所述扩展服务管理模块的接口,以及,指向预定原生服务模块的接口。The native service management module includes a third AIDL file, and the third AIDL file includes: an interface that points to the extended service management module, and an interface that points to a predetermined native service module.
  3. 一种实现扩展服务的方法,应用权利要求1或2所述的Android服务框架,其特征在于,包括:A method for implementing an extended service, the Android service framework of claim 1 or 2, comprising:
    扩展服务代理模块接收调用预定服务的应用请求;The extended service proxy module receives an application request that invokes a predetermined service;
    所述扩展服务代理模块根据所述应用请求获取实现所述预定服务的扩展服务模块的接口,并通过所述扩展服务模块实现预定服务。And the extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, and implements a predetermined service by using the extended service module.
  4. 如权利要求3所述的方法,其特征在于,所述扩展服务代理模块根据所述应用请求获取实现所述预定服务的扩展服务模块的接口,包括:The method of claim 3, wherein the extended service proxy module acquires an interface of the extended service module that implements the predetermined service according to the application request, including:
    所述扩展服务代理模块根据所述应用请求在原生服务管理模块中获取所述扩展服务管理模块的接口;The extended service proxy module acquires an interface of the extended service management module in a native service management module according to the application request;
    所述扩展服务代理模块根据所述扩展服务管理模块的接口在所述扩展服务管理模块中查找所述扩展服务模块的接口。And the extended service proxy module searches an interface of the extended service module in the extended service management module according to an interface of the extended service management module.
  5. 如权利要求4所述的方法,其特征在于,通过所述扩展服务模块实现预定服务,包括:The method of claim 4, wherein the implementing the predetermined service by the extended service module comprises:
    在所述扩展服务代理模块通过所述扩展服务模块的接口调用所述扩展服务模块的情况下,所述扩展服务模块查找实现所述预定服务的预定功能函数对应的接口;And in the case that the extended service proxy module invokes the extended service module through an interface of the extended service module, the extended service module searches for an interface corresponding to a predetermined function function that implements the predetermined service;
    所述扩展服务模块通过所述接口调用所述预定功能函数。The extended service module invokes the predetermined function function through the interface.
  6. 如权利要求5所述的方法,其特征在于,所述扩展服务模块通过所述接口调用所述预定功能函数之后,还包括:The method of claim 5, wherein after the extension service module invokes the predetermined function function through the interface, the method further includes:
    所述扩展服务模块向所述扩展服务代理模块返回执行所述预定功能函数的结果。The extended service module returns a result of executing the predetermined function function to the extended service proxy module.
  7. 一种实现扩展服务的装置,其特征在于,包括:An apparatus for implementing an extended service, comprising:
    扩展服务代理模块,用于接收调用预定服务的应用请求,根据所述应用请求获取实现所述预定服务的扩展服务模块的接口;An extended service proxy module, configured to receive an application request that invokes a predetermined service, and obtain an interface of an extended service module that implements the predetermined service according to the application request;
    所述扩展服务模块,用于实现预定服务。The extended service module is configured to implement a predetermined service.
  8. 如权利要求7所述的装置,其特征在于,所述扩展服务代理模块用于:The apparatus of claim 7, wherein the extended service agent module is configured to:
    根据所述应用请求在原生服务管理模块中获取所述扩展服务管理模块的接口;Acquiring an interface of the extended service management module in the native service management module according to the application request;
    根据所述扩展服务管理模块的接口在所述扩展服务管理模块中查找所述扩展服务模块的接口。And searching, according to the interface of the extended service management module, an interface of the extended service module in the extended service management module.
  9. 如权利要求8所述的装置,其特征在于,所述扩展服务模块,用于:The apparatus according to claim 8, wherein said extended service module is configured to:
    在所述扩展服务代理模块通过所述扩展服务模块的接口调用所述扩展服 务模块的情况下,查找实现所述预定服务的预定功能函数对应的接口,通过所述接口调用所述预定功能函数。And in the case that the extended service proxy module invokes the extended service module through an interface of the extended service module, searching for an interface corresponding to a predetermined function function that implements the predetermined service, and calling the predetermined function function through the interface.
  10. 如权利要求9所述的装置,其特征在于,所述扩展服务模块,还用于向所述扩展服务代理模块返回执行所述预定功能函数的结果。The apparatus according to claim 9, wherein said extended service module is further configured to return a result of executing said predetermined function function to said extended service proxy module.
  11. 一种存储介质,其特征在于,所述存储介质存储有一个或者多个程序,所述一个或者多个程序可被一个或者多个处理器执行,以实现如权利要求3-6任一项所述的方法。A storage medium, characterized in that the storage medium stores one or more programs, the one or more programs being executable by one or more processors to implement any one of claims 3-6 The method described.
PCT/CN2019/078182 2018-04-28 2019-03-14 Android service framework, and method and device for implementing extended service WO2019205828A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810398695.1 2018-04-28
CN201810398695.1A CN110413259B (en) 2018-04-28 2018-04-28 Android service framework, method and device for realizing extended service

Publications (1)

Publication Number Publication Date
WO2019205828A1 true WO2019205828A1 (en) 2019-10-31

Family

ID=68293493

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/078182 WO2019205828A1 (en) 2018-04-28 2019-03-14 Android service framework, and method and device for implementing extended service

Country Status (2)

Country Link
CN (1) CN110413259B (en)
WO (1) WO2019205828A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328297A (en) * 2020-11-30 2021-02-05 北京技德系统技术有限公司 Method and device for upgrading Android system running compatibly on Linux

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112181514B (en) 2019-09-18 2021-08-20 华为技术有限公司 Plug-in implementation method and plug-in implementation system
CN111352611B (en) * 2020-03-04 2022-02-01 四川长虹电器股份有限公司 Method for realizing UI and data separation in Android application
CN111766992B (en) * 2020-05-29 2022-04-22 维沃移动通信有限公司 Information display method and device, electronic equipment and storage medium
CN112256249B (en) * 2020-10-15 2024-09-17 深圳Tcl新技术有限公司 Method, equipment and computer storage medium for expanding Android system function
CN116700834B (en) * 2023-08-07 2023-10-24 天津华来科技股份有限公司 App modularized loading method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104731581A (en) * 2015-02-03 2015-06-24 惠州Tcl移动通信有限公司 Frame code modifying method and device based on Android system
CN104866294A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android software function
CN104866292A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending software function
US20160259652A1 (en) * 2015-03-03 2016-09-08 Software Robotics Corporation Limited Software robots for programmatically controlling computer programs to perform tasks
CN106792196A (en) * 2016-12-26 2017-05-31 深圳Tcl新技术有限公司 Television set main interface display methods and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
MX2012004397A (en) * 2009-10-13 2012-08-15 Square Inc Systems and methods for financial transaction through miniaturized card reader.
WO2014160479A1 (en) * 2013-03-13 2014-10-02 Arizona Board Of Regents, A Body Corporate Of The State Of Arizona, Acting For And On Behalf Of Arizone State University Systems and apparatuses for a secure mobile cloud framework for mobile computing and communication
CN102866891B (en) * 2012-09-12 2016-09-14 惠州Tcl移动通信有限公司 A kind of framework integrated approach based on android system and system
CN104854561B (en) * 2012-10-16 2018-05-11 思杰系统有限公司 Application program for application management framework encapsulates
CN102929638B (en) * 2012-11-07 2014-08-13 广州市动景计算机科技有限公司 Method and system for expanding Web application (App) functions
CN103902293B (en) * 2014-03-28 2017-02-01 上海下一代广播电视网应用实验室有限公司 Android based radio and television network browser middleware system constructing method
CN105204848B (en) * 2015-08-27 2018-08-14 深圳创维-Rgb电子有限公司 Function solidification is carried out using binary program and the method and system of service are provided
CN106598642B (en) * 2016-11-07 2020-05-15 北京奇虎科技有限公司 Method and device for using service in plug-in
CN107402768B (en) * 2017-07-31 2020-06-30 四川长虹电器股份有限公司 Reusable and extensible Android application development method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104866294A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending Android software function
CN104866292A (en) * 2014-02-25 2015-08-26 北京娜迦信息科技发展有限公司 Method and device for extending software function
CN104731581A (en) * 2015-02-03 2015-06-24 惠州Tcl移动通信有限公司 Frame code modifying method and device based on Android system
US20160259652A1 (en) * 2015-03-03 2016-09-08 Software Robotics Corporation Limited Software robots for programmatically controlling computer programs to perform tasks
CN106792196A (en) * 2016-12-26 2017-05-31 深圳Tcl新技术有限公司 Television set main interface display methods and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328297A (en) * 2020-11-30 2021-02-05 北京技德系统技术有限公司 Method and device for upgrading Android system running compatibly on Linux

Also Published As

Publication number Publication date
CN110413259B (en) 2022-07-29
CN110413259A (en) 2019-11-05

Similar Documents

Publication Publication Date Title
WO2019205828A1 (en) Android service framework, and method and device for implementing extended service
US10949191B2 (en) Patch-upgrade-based file processing method and apparatus, terminal, and storage medium
KR101619557B1 (en) Computer application packages with customizations
CN114077462B (en) Method, device, equipment and medium for software operating system to call Android HIDL interface
US9477727B2 (en) Abstracting data for use by a mobile device having occasional connectivity
JP6192534B2 (en) Virtual application extension point
CN101192937B (en) A hot deployable method and its system
US20140237463A1 (en) Dynamically generate and execute a context-specific patch installation procedure on a computing system
CN105955787B (en) A kind of plug-in loading method and device for android system
CN105094922A (en) Application installation-free operation control method and device
CN101727475B (en) Method, device and system for acquiring database access process
CN109299172B (en) Data source access method and device based on Spring Boot in different environments
CN109729121B (en) Cloud storage system and method for realizing custom data processing in cloud storage system
US20150277941A1 (en) Method and system for linking to shared library
KR102052776B1 (en) Installation engine and package format for parallelizable, reliable installations
US8887181B1 (en) Application add-on platform
CN109857374B (en) Development method and device of mobile application
US11880694B2 (en) System and method for behavior injection in cloud computing platforms or applications
WO2019157891A1 (en) Application installation method and application installer generating method
CN103885784B (en) Method for establishing Android platform with security module and plugging function
CN108595160B (en) Method and storage medium for calling native object by JS
CN104503760B (en) The method and device of acquisition system highest authority
CN108804236B (en) AIDL file sharing method and system
WO2024093409A1 (en) Service component calling method and apparatus, and computer device and storage medium
US10705815B2 (en) Split installation of a software product

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19791668

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.03.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 19791668

Country of ref document: EP

Kind code of ref document: A1