Service-oriented system based on Android system and implementation method
By introducing a service system into the Android system, using communication components and management components, the decoupling of UI and business logic is achieved, the integrity and stability problems between APPs are solved, and the development efficiency and portability of large APPs are improved. sex.
Patent Information
- Application Number
- CN202210537954.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-18
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2042-05-18
AI Technical Summary
In the existing android system-based on-board systems, the integrity and stability between APPs are difficult to achieve, resulting in insufficient development flexibility and portability, especially in the development of multi-functional large APPs, which have compiled errors and crash problems.
Adopt a service-based system based on Android system, through communication components, management components and business components between the UI and servers, and use common interfaces to define modules, request/response distributors, IOC containers, AOP tools, Context management tools and startups. Manager, establishes a communication protocol model, realizes decoupling of UI and business logic and service-oriented development.
It improves the stability of large APPs, simplifies the development methods of business services, shortens the development cycle, and improves the flexibility and portability of the software.
Smart Images

Figure CN114840186B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of automobile system development, and more specifically relates to a service-oriented system based on an Android system and an implementation method thereof. Background Art
[0002] In the process of automobile intelligence, the smart cockpit is an important component that carries the interaction with the user. The smart host carries the function of accepting user input behavior and displaying rich information content. The multiple applications installed on the smart host provide users with rich functions. In the existing smart hosts, it is common practice to install various ecological software and vehicle control software on the Android system. However, these various software are still developed in the way of the Android system of mobile phones, and it is difficult to achieve the integrity between the various software. In the design of the new generation of car systems, the previous form of multiple apps operating alone has been abandoned, and a multifunctional super app will become the mainstream. In order to ensure the stability and portability of the super app, requirements are put forward for a service-oriented system based on the Android system.
[0003] At present, in the car system based on Android system, APPs are relatively independent, and the use of SDK by APPs is also directly through interface calls, without API (application interface) approach. When the SDK interface changes, especially the callback interface changes, if the application developer does not make corresponding modifications, the entire application will fail to compile or crash, which greatly affects the flexibility of development. This development method is extremely uncontrollable in the development cycle of an app with rich functions and multi-person collaboration.
[0004] For example, Chinese patent CN201910452883.2 discloses a method and device for customized service based on Android platform JavaScript, which describes a service development method for Android platform based on webview. This method mainly uses the native webview and js bridging functions to call native services through webview running js code. This method relies on the development of front-end web pages in use, which has little to do with Android development, and the running speed of webview is relatively weak compared with native applications, which is not suitable for the development of large apps. For example, Chinese patent CN201811012655.5 discloses a reflection-based Android application microservice method and system, which describes a development method of Android application microservices implemented using JAVA launch technology. This method is intended to solve the problem of long search time for function call stack after reflection, which is an optimization of reflection technology in application. The above-mentioned prior art one is mainly a service implementation method for H5 applications, but it is not suitable for large APPs due to its low performance. Prior art two is mainly suitable for the optimization of reflection technology points, and there is no description of the overall architecture of large APPs. Summary of the invention
[0005] To solve the above problems, the present invention provides a service-oriented system and implementation method based on the Android system, which greatly improves the stability of APPs with more functions. At the same time, the system can simplify the development method of business services, shorten the development cycle, improve the flexibility of software products, and enhance the portability of software.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is as follows: a service-oriented system based on the Android system, including a UI end capable of data interaction and a server end, wherein the server end includes:
[0007] Communication component, used for data interaction with the UI end;
[0008] Multiple business components to implement preset services;
[0009] The management component establishes a dependency with the business component, and the communication component can call the services in the corresponding business component through the management component according to the preset method.
[0010] As an optimization, the communication component includes,
[0011] General interface definition module, used for calling event requests on the UI side;
[0012] The request / response distributor is used to parse the event request from the UI end and distribute it to the management component, and return the service response called by the management component according to the event request to the UI end.
[0013] As an optimization, the management component includes,
[0014] IOC container,
[0015] AOP tool, used to scan multiple business components, form beans for each scanned business component aspect, and assemble them, generate corresponding distribution mapping paths according to corresponding factory methods, inject the assembled beans into the IOC container, and form dependencies with the distribution mapping paths;
[0016] Context management tool, used to establish private context for each business component and establish monitoring for each business component;
[0017] The startup manager is used to start business components.
[0018] Based on the above service-oriented system, the present invention also provides a service-oriented system implementation method based on the Android system, including:
[0019] Formulate a communication protocol model for data interaction between the UI and the server;
[0020] The AOP tool in the management component scans each business component, forms a bean for each scanned business component aspect, and assembles it, generates a corresponding distribution mapping path according to the corresponding factory method, injects the assembled bean into the IOC container, and forms a dependency with the distribution mapping path;
[0021] The context management tool establishes a private context for each component and establishes monitoring for each business component;
[0022] The event request on the UI side calls the interface of the general interface definition module;
[0023] The request / response dispatcher performs address resolution on the event request;
[0024] The request / response dispatcher queries the IOC container according to the resolved address, and obtains the corresponding business component path and calling method according to the corresponding dependency relationship;
[0025] Call the service in the corresponding business component and return the call result to the UI.
[0026] As an optimization, the communication protocol model is formulated using a binder mechanism based on the Android system.
[0027] As an optimization, the communication protocol model includes a request model, a response model and a monitoring model;
[0028] The request model includes a request line and a request header, wherein the request line is used to set the service and method to be requested, and the request header is used to set the corresponding interface parameters;
[0029] The response model includes a response line and a response body, the response line includes a response status, a response type, a service name and a method name, and the response body includes the service data returned by the request;
[0030] The monitoring model includes a monitoring header and a monitoring callback body. The monitoring header is used to indicate the data source, and the monitoring callback body includes a callback method for monitoring data transmission.
[0031] As an optimization, the business component provides services in the form of microservices.
[0032] The present invention is used for service-oriented development of various applications within the Android system. It reconstructs the development of the previous single MVP / MVVM mode APK, fully decouples the View layer from the business logic, and provides display data to the View in a service-oriented manner. The service system has greatly improved the stability of APPs with more functions. At the same time, the system can simplify the development method of business services and shorten the development cycle. For manufacturers with ROM development capabilities, this method can shorten the development cycle of the manufacturer's cockpit software, improve the flexibility of software products, and enhance the portability of the software. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a schematic diagram of the system of the present invention;
[0034] Figure 2 It is a schematic diagram of the communication protocol model;
[0035] Figure 3 This is a schematic diagram of the request model;
[0036] Figure 4 is a schematic diagram of the response model;
[0037] Figure 5 This is a schematic diagram of the monitoring model. DETAILED DESCRIPTION
[0038] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0039] Example: See Figure 1 ,
[0040] A service-oriented system based on an Android system includes a UI end and a server end capable of data interaction, wherein the server end includes:
[0041] A communication component is used to interact with the UI end for data; the communication component includes:
[0042] Common interface definition module (common interface), used for calling event requests on the UI side;
[0043] The request / response dispatcher is used to parse the event request from the UI and distribute it to the management component, and return the service response called by the management component according to the event request to the UI.
[0044] Multiple business components to implement preset services;
[0045] The management component establishes a dependency with the business component, and the communication component can call the service in the corresponding business component through the management component according to the preset method. The management component includes:
[0046] IOC container,
[0047] AOP tool, used to scan multiple business components, form beans for each scanned business component aspect, and assemble them, generate corresponding distribution mapping paths according to corresponding factory methods, inject the assembled beans into the IOC container, and form dependencies with the distribution mapping paths;
[0048] Context management tool, used to establish private context for each business component and establish monitoring for each business component;
[0049] The startup manager is used to start business components.
[0050] Specifically, each business module or business component runs on the system. The management of each component is jointly completed by the startup manager, context management tool, AOP tool, and IOC container. Requests from the UI end or the View layer are distributed to each component through the common interface and the dispatcher for completion. The service-oriented system based on the Android system provided by the present invention realizes the separation of UI and business logic on the basis of ensuring application functions, and the businesses can be split and combined, and the business functions are provided to the UI end (View layer) in the form of microservices.
[0051] Based on the above service-oriented system, the present invention also provides a service-oriented system implementation method based on the Android system, including:
[0052] Develop a communication protocol model for data interaction between the UI and the server. In specific implementation, the basic communication uses the binder mechanism of the Android system. Under this mechanism, develop a set of basic data communication protocol models that meet the application scenarios to achieve data interaction between the UI or View and business components or services, such as Figure 2 The communication protocol model is applied to the communication protocol layer, wherein the communication protocol model includes a request model, a response model and a monitoring model;
[0053] like Figure 3 As shown, the request model includes a request line and a request header, the request line is used to set the service and method to be requested, and the request header is used to set the corresponding interface parameters.
[0054] like Figure 4 As shown, the response model includes a response line and a response body. The response line includes a response status, a response type, a service name and a method name. The response body includes the service data returned by the request.
[0055] like Figure 5 As shown, the monitoring model includes a monitoring header and a monitoring callback body, wherein the monitoring header is used to indicate the data source, and the monitoring callback body includes a callback method for monitoring data transmission.
[0056] The AOP tool in the management component scans each business component, forms a bean for each scanned business component aspect, and assembles it, generates the corresponding distribution mapping path according to the corresponding factory method, injects the assembled bean into the IOC container, and forms a dependency with the distribution mapping path.
[0057] The context management tool establishes a private context for each component and establishes monitoring for each business component;
[0058] The event request on the UI side calls the interface of the general interface definition module;
[0059] The request / response dispatcher performs address resolution on the event request;
[0060] The request / response dispatcher queries the IOC container according to the resolved address, and obtains the corresponding business component path and calling method according to the corresponding dependency relationship;
[0061] Call the service in the corresponding business component and return the call result to the UI.
[0062] Specifically, the startup process of the system is as follows:
[0063] Step 1: Initialize the system main context (main context).
[0064] Step 2: Start the manager to scan components.
[0065] Step 3: The IOC container starts.
[0066] Step 4: Start the AOP tool.
[0067] Step 5: The AOP tool scans each component configuration.
[0068] Step 6: Form a bean for each scanned component aspect and assemble it.
[0069] Step 7: Get the corresponding factory method and generate the corresponding distribution mapping path.
[0070] Step 8: Inject the assembled bean into the IOC container and form a dependency with the path in Step 7.
[0071] Step 9: After receiving the completion of Step 8, the startup manager in Step 2 starts the business component (module).
[0072] Step 10: The context management tool establishes a private context for each component and establishes monitoring for each business component.
[0073] Step 11: The main system startup is completed.
[0074] Step 12: Component startup is complete.
[0075] During the startup process, the core point is the injection of the IOC container and forming dependencies with various components, so that the corresponding method can be found during distribution.
[0076] The system distribution process is:
[0077] Step 1: The UI or View layer event calls the common interface.
[0078] Step 2: Dispatcher performs address resolution based on the incoming request line.
[0079] Step 3: Dispatcher assembles the parsed address according to the IOC container rules and queries it in the IOC container. It uses reflection to find the corresponding business module and its related methods.
[0080] Step 4: The business module calls its own internal method and returns the result.
[0081] For monitoring services, the Dispatcher will search for the corresponding business components in the IOC container to add monitoring.
[0082] In addition, the system is deployed in the system through a jar package or APK. Deployment through a jar file requires starting the main file in the Jar package when the systemReady() callback is called. Deployment through an APK requires configuring the APK to be self-starting.
[0083] The present invention is used for service-oriented development of various applications within the Android system. It reconstructs the development of the previous single MVP / MVVM mode APK, fully decouples the View layer from the business logic, and provides display data to the View in a service-oriented manner. The service system has greatly improved the stability of APPs with more functions. At the same time, the system can simplify the development method of business services and shorten the development cycle. For manufacturers with ROM development capabilities, this method can shorten the development cycle of the manufacturer's cockpit software, improve the flexibility of software products, and enhance the portability of the software.
[0084] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.
Claims
1. A service-oriented system based on Android system, characterized in that: It includes a UI end and a server end capable of data interaction, and the server end includes: A communication component is used to interact with the UI end for data; the communication component includes: General interface definition module, used for calling event requests on the UI side; The request / response distributor is used to parse the event request from the UI end and distribute it to the management component, and return the service response called by the management component according to the event request to the UI end; Multiple business components to implement preset services; The management component establishes a dependency with the business component, and the communication component can call the service in the corresponding business component through the management component according to a preset method; the management component includes: IOC container, AOP tool, used to scan multiple business components, form beans for each scanned business component aspect, and assemble them, generate corresponding distribution mapping paths according to corresponding factory methods, inject the assembled beans into the IOC container, and form dependencies with the distribution mapping paths; Context management tool, used to establish private context for each business component and establish monitoring for each business component; The startup manager is used to start business components.
2. A method for implementing a service-oriented system based on an Android system, characterized in that: include, Formulate a communication protocol model for data interaction between the UI and the server; The AOP tool in the management component scans each business component, forms a bean for each scanned business component aspect, and assembles it, generates a corresponding distribution mapping path according to the corresponding factory method, injects the assembled bean into the IOC container, and forms a dependency with the distribution mapping path; The context management tool establishes a private context for each component and establishes monitoring for each business component; The event request on the UI side calls the interface of the general interface definition module; The request / response dispatcher performs address resolution on the event request; The request / response dispatcher queries the IOC container according to the resolved address, and obtains the corresponding business component path and calling method according to the corresponding dependency relationship; Call the service in the corresponding business component and return the call result to the UI.
3. The method for implementing a service-oriented system based on the Android system according to claim 2, characterized in that: The communication protocol model is formulated using a binder mechanism based on the Android system.
4. The method for implementing a service-oriented system based on the Android system according to claim 3 is characterized in that: The communication protocol model includes a request model, a response model and a monitoring model; The request model includes a request line and a request header, wherein the request line is used to set the service and method to be requested, and the request header is used to set the corresponding interface parameters; The response model includes a response line and a response body, the response line includes a response status, a response type, a service name and a method name, and the response body includes the service data returned by the request; The monitoring model includes a monitoring header and a monitoring callback body, wherein the monitoring header is used to indicate the data source, and the monitoring callback body includes a callback method for monitoring data transmission.
5. The method for implementing a service-oriented system based on the Android system according to claim 3 is characterized in that: The business components provide services in the form of microservices.
