Method, device, equipment and medium for software operating system to call Android HIDL interface

The method of calling the Android HIDL interface through the software operating system, and using the compatible encapsulation library and Binder driver to achieve communication with the Android HIDL Service, solving the problem that other software operating systems cannot be compatible with the Android HAL interface, ensuring that they operate normally on Android HAL devices .

CN114077462BActive Publication Date: 2025-01-07DOUYIN VISION CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111671966.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-04-07
Filing Date
2021-12-31
Publication Date
2025-01-07
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

Other software-based operating systems are not compatible with the Android HAL interface, resulting in the inability to function properly on mobile devices based on Android HAL.

Method used

The method of calling the Android HIDL interface through the software operating system, using the compatible encapsulation library to query the Client instance of the Android HAL Binder Service based on the Binder driver, and communicate with the Android HIDL Service through the Client process to realize the call of the Android HIDL interface by the software operating system.

Benefits of technology

It realizes compatibility of the software operating system for Android HIDL interface, ensuring that it can run normally on Android HAL-based devices, overcoming compatibility issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114077462B_ABST
    Figure CN114077462B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of computer technology, and specifically provides a method, device, equipment and medium for a software operating system to call an Android HIDL interface, aiming to solve the problem of how to make the software operating system compatible with the Android HIDL interface. To this end, the method of the present invention includes: controlling the software process of the software operating system to call a preset compatible encapsulation library, obtaining a Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism through the compatible encapsulation library, and then communicating with the Android HIDL Service through the Client process to complete the software operating system's call to the Android HIDL interface. The bridge between the software operating system and the Android HIDL interface is realized through the preset compatible encapsulation library. The compatible encapsulation library can provide the software operating system with an interface compatible with the Android HIDL interface for the software operating system to call, and can communicate with the Android HIDL Service through the Client process downward, so that the software operating system can call the real Android HIDL interface, and realize the compatibility of the software operating system with the Android HIDL interface.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] The present invention is a continuation application based on the priority of application number 202110374484.6, and invention name “Method, device and storage medium for Linux system to call Android HIDL interface”, all contents of which are incorporated into the present invention by reference. Technical Field

[0002] The present invention relates to the field of computer technology, and specifically provides a method, device, equipment and medium for a software operating system to call an Android HIDL interface. Background Art

[0003] Android is an operating system based on the Linux kernel, which is widely used in mobile devices such as mobile phones and tablet computers. The Android system architecture is mainly composed of the system application layer (System Apps), the framework layer (Framework), the hardware abstraction layer (HAL) and the Linux kernel layer (Linux Kernel). Among them, the hardware abstraction layer provides a virtual hardware platform for Android, which can encapsulate the Linux kernel layer and provide an interface upward, shielding the implementation details of the Android bottom layer. The interface of the Android hardware abstraction layer HAL (Android HAL interface) mainly includes the dynamic library pass-through HAL interface (Android dynamic library HAL interface) and the Binder cross-process interface (Android HIDL interface).

[0004] At present, due to the widespread use of Android in different types of mobile devices, some hardware equipment suppliers only provide hardware drivers suitable for Android. At the same time, since other software-based operating systems, such as operating systems based on the Linux kernel, are not compatible with the Android HAL interface, other software operating systems cannot run normally on mobile devices based on Android HAL, which greatly limits the application prospects of other software operating systems on such mobile devices.

[0005] Accordingly, the art needs a solution for a software operating system to call an Android HAL interface to solve the above problems. Summary of the invention

[0006] In order to overcome the above-mentioned defects, the present invention is proposed to provide a method, apparatus, device and medium for a software operating system to call the Android HIDL interface, which solves or at least partially solves the technical problem of how to make software operating systems other than Android compatible with the Android HAL interface so that these software operating systems can run normally on devices based on Android HAL.

[0007] In a first aspect, the present invention provides a method for a software operating system to call an Android HIDL interface, comprising:

[0008] The software operating system program calls the Android HAL interface and the compatible encapsulation library of the Android HAL interface;

[0009] The HAL compatible encapsulation library is based on the Binder driver, querying and obtaining the Client instance of the Android HAL Binder Service;

[0010] The corresponding Android HIDL interface is called based on the Client instance.

[0011] In a technical solution of the method for the software operating system to call the Android HIDL interface, the step of "the software operating system program calls the Android HAL interface and the compatible encapsulation library of the Android HAL interface" specifically includes: controlling the software process of the software operating system to call a preset compatible encapsulation library;

[0012] and / or,

[0013] The step of "the HAL compatible encapsulation library queries and obtains the Client instance of the Android HAL Binder Service based on the Binder driver" specifically includes: obtaining the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism through the compatible encapsulation library;

[0014] and / or,

[0015] The step of “calling the corresponding Android HIDL interface based on the Client instance” specifically includes: communicating with the Android HIDL Service through the Client process to complete the calling of the Android HIDL interface by the software operating system;

[0016] and / or,

[0017] The software operating system is the Linux operating system.

[0018] In a technical solution of the method for the above-mentioned software operating system to call the Android HIDL interface, after the step of calling the corresponding Android HIDL interface based on the Client instance, it also includes: calling the corresponding result based on the Android HIDL interface, and returning the result to the HAL compatible encapsulation library through Binder.

[0019] In a technical solution of the method for the software operating system to call the Android HIDL interface, the step of "calling the corresponding result based on the Android HIDL interface and returning the result to the HAL compatible encapsulation library through Binder" specifically includes:

[0020] Control the Client process to send a communication request to the Android HIDL Service based on the Binder mechanism, receive the request processing result fed back by the Android HIDL Service according to the communication request, and send the request processing result to the compatible encapsulation library, and send the request processing result to the software process through the compatible encapsulation library.

[0021] In a technical solution of the method for the software operating system to call the Android HIDL interface, the step of "controlling the software process of the software operating system to call the preset compatible encapsulation library" specifically includes:

[0022] The software process is controlled to call the compatible encapsulation library by linking a dynamic library.

[0023] In a technical solution of the method for the software operating system to call the Android HIDL interface, the method is applied to the software operating system running on the device based on Android HAL. Before the step of "controlling the software process of the software operating system to call the preset compatible encapsulation library", the method further includes:

[0024] The software operating system and the Android HAL are resource isolated so that the software operating system and the Android HAL run independently on the device.

[0025] In a technical solution of the method for the software operating system to call the Android HIDL interface, the step of "isolating resources between the software operating system and the Android HAL" specifically includes:

[0026] An isolated container is created based on the NameSpace mechanism, and the software operating system or the Android HAL is run in the isolated container.

[0027] In a technical solution of the method for the software operating system to call the Android HIDL interface, the steps of "creating an isolated container based on the NameSpace mechanism and running the software operating system or the Android HAL in the isolated container" specifically include:

[0028] When starting the device, if the first user state process is an Android HAL process, start the Android HAL and create an isolated container based on the NameSpace mechanism after the Android HAL is started;

[0029] Starting the software operating system in the isolated container to run the software operating system in the isolated container

[0030] and / or,

[0031] The steps of “creating an isolated container based on the NameSpace mechanism and running the software operating system or the Android HAL in the isolated container” specifically include:

[0032] When starting the device, if the first user state process is a software process, then starting the non-core service of the software operating system and creating an isolated container based on the NameSpace mechanism after the non-core service is started;

[0033] Starting the Android HAL in the isolated container to run the Android HAL in the isolated container;

[0034] After the Android HAL is started, the core service of the software operating system continues to be started.

[0035] In a second aspect, a computer device is provided, which includes a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the method for a software operating system to call an Android HIDL interface as described in any of the technical solutions of the method for a software operating system to call an Android HIDL interface.

[0036] In a third aspect, a computer-readable storage medium is provided, which stores a plurality of program codes, wherein the program codes are suitable for being loaded and run by a processor to execute the method for a software operating system to call an Android HIDL interface as described in any of the technical solutions of the method for a software operating system to call an Android HIDL interface.

[0037] The above one or more technical solutions of the present invention have at least one or more of the following beneficial effects:

[0038] In the technical solution of the present invention, the method of calling the Android HIDL interface by the software operating system can be applied to the software operating system running on the device based on Android HAL, wherein the software operating system refers to the software operating system other than Android, such as the operating system based on the Linux kernel. When the software operating system is running on the device based on Android HAL, the software process of the software operating system can be controlled to call the preset compatible encapsulation library, and the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism is obtained through the compatible encapsulation library, and then the Client process communicates with the Android HIDL Service through the Client process, and the software operating system calls the Android HIDL interface. The bridge between the software operating system and the Android HIDL interface is realized through a preset compatible encapsulation library. This compatible encapsulation library can provide the software operating system with an interface compatible with the Android HIDL interface for the software operating system to call, and can communicate with the Android HIDLService through the Client process downward, so that the software operating system can call the real Android HIDL interface, thereby realizing the compatibility of the software operating system with the Android HIDL interface, thereby ensuring that the software operating system can run normally on devices based on Android HAL, overcoming the defect in the prior art that the software operating system cannot run normally on devices based on Android HAL due to its incompatibility with the Android HIDL interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. Among them:

[0040] Figure 1It is a flowchart of main steps of a method for a software operating system to call an Android HIDL interface according to an embodiment of the present invention;

[0041] Figure 2 is a schematic diagram of the main operation flow of a method for a software operating system to call an Android HIDL interface according to another embodiment of the present invention;

[0042] Figure 3 It is a flowchart of main steps of a method for a software operating system to call an Android HIDL interface according to another embodiment of the present invention;

[0043] Figure 4 It is a schematic diagram of the main operation flow of a method for isolating resources between a software operating system and an Android HAL according to an embodiment of the present invention;

[0044] Figure 5 It is a schematic diagram of the main operation flow of a method for isolating resources between a software operating system and an Android HAL according to another embodiment of the present invention. DETAILED DESCRIPTION

[0045] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0046] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable media that can store program codes, such as magnetic disks, hard disks, optical disks, flash memory, read-only memory, random access memory, etc.

[0047] Here we first explain some terms involved in the present invention.

[0048] The software operating system refers to an operating system written in a computer programming language, i.e., a computer management control program. In this embodiment, the software operating system may be an operating system other than Android. In one embodiment, the software operating system may be a Linux operating system, which refers to an operating system based on a Linux kernel, i.e., a Linux system.

[0049] Binder mechanism refers to a cross-process communication method of Android. Binder mechanism adopts C / S architecture, which can include four components: Client process, Server process, Service Manager and Binder driver. ServiceManager is used to manage various services of Android. Client process is the process that uses the service, and Server process is the process that provides the service. Client process, Server process and Service Manager do not interact directly, but interact through Binder driver. Server process registers service with Service Manager through Binder driver. Client process queries Service Manager for service through Binder driver and establishes communication with Server process through Binder driver according to the queried service, so as to interact with the service in Server process.

[0050] Android HIDL interface refers to the Binder cross-process interface in the interface of Android hardware abstraction layer HAL (Android HAL interface), that is, Android HIDL interface is an interface that uses the Binder mechanism for communication. AndroidHAL Binder Service refers to the AndroidHIDL Service or Android HAL service when the Android HIDL interface uses the Binder mechanism for communication. The Client instance of Android HAL Binder Service refers to the Client process that interacts with Android HAL Binder Service through the Binder driver, that is, the Client process that communicates with Android HIDL Service in Android HAL process based on the Binder mechanism.

[0051] The NameSpace mechanism refers to a resource isolation mechanism based on the Linux kernel. The resources under each NameSpace (container) are transparent to the resources under other NameSpaces. Processes with the same process number can exist in different NameSpaces at the same time. Since these processes belong to different NameSpaces, there will be no conflict. In user mode, each user can only see the processes in his own NameSpace. Among them, user mode refers to the running state of the process when executing the user's own program code. At this time, the processor runs in the user code with the lowest privilege level; correspondingly, kernel mode refers to the running state of the process when it falls into the program code of the Linux kernel. At this time, the processor runs in the kernel code with the highest privilege level.

[0052] A software process is an execution entity of a software operating system program. When the software operating system is a Linux operating system, the software process may be a Linux process.

[0053] The Client instance is the execution entity of the client program, that is, the Client process.

[0054] See attached Figure 1 , Figure 1 The present invention is a flowchart of the main steps of a method for a software operating system to call an Android HIDL interface according to an embodiment of the present invention. The method can be applied to a software operating system running on an Android HAL-based device, which refers to a device capable of loading and running computer program codes, including but not limited to computer devices, mobile phones, and tablet computers. Figure 1 As shown, the method for the software operating system to call the Android HIDL interface in the embodiment of the present invention mainly includes the following steps S101 and S102.

[0055] Step S101: The software operating system program calls the Android HAL interface and the compatible encapsulation library of the Android HAL interface. In this embodiment, the software process of the software operating system can be controlled to call a preset compatible encapsulation library.

[0056] Step S102: The HAL compatible encapsulation library queries and obtains the Client instance of the Android HAL BinderService based on the Binder driver. In this embodiment, the Client process that communicates with the Android HIDL Service in the AndroidHAL process based on the Binder mechanism can be obtained through the compatible encapsulation library.

[0057] When the software operating system needs to call the Android HIDL interface in the Android HAL interface to communicate with the device's hardware, such as communicating with the device's audio device to obtain audio data, the software process can be controlled to call the preset compatible encapsulation library, and through this compatible encapsulation library to obtain the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism. The compatible encapsulation library is a dynamic library of the software operating system. In one embodiment, the software process can be controlled to call the compatible encapsulation library by linking the dynamic library. In this embodiment, the conventional method of linking dynamic libraries in the field of software technology can be used to call the compatible encapsulation library, and the method of linking dynamic libraries is not specifically described here.

[0058] In this embodiment, the compatible encapsulation library also obtains the Client process based on the Binder mechanism. Figure 2 The compatible encapsulation library can query the Client process that communicates with the Android HIDL Service in the Android HAL process in the Service Manager through the Binder driver. The Service Manager returns the information of the Client process to the compatible encapsulation library through the Binder driver.

[0059] Step S103: Retrieve the corresponding Android HIDL interface based on the Client instance. In this embodiment, the Client process can communicate with the Android HIDL Service to complete the calling of the Android HIDL interface by the software operating system.

[0060] The Client process can establish communication with the Android HIDL Service based on the Binder mechanism, so that the software operating system can complete the call to the Android HIDL interface.

[0061] See attached Figure 2 The Client process queries the information of Android HIDL Service in the service manager through the Binder driver. Based on this information, the Client process establishes communication with the Android HIDL Service in the AndroidHAL process through the Binder driver and communicates with the Android HIDL Service.

[0062] Further, in one implementation of an embodiment of the present invention, after the step of calling the corresponding Android HIDL interface based on the Client instance, the corresponding result can also be called based on the Android HIDL interface, and the result can be returned to the HAL compatible encapsulation library through Binder. The result refers to the request processing result fed back by the Android HIDL Service based on the communication request sent by the Client process. Specifically, in this implementation, the corresponding result can be called based on the Android HIDL interface through the Client process and in accordance with the following steps, and the result can be returned to the HAL compatible encapsulation library through Binder to achieve communication with the Android HIDL Service:

[0063] Control the Client process to send a communication request to the Android HIDL Service based on the Binder mechanism, receive the request processing result fed back by the Android HIDL Service based on the communication request, send the request processing result to the compatible encapsulation library, and send the request processing result to the software process through the compatible encapsulation library.

[0064] Continue to refer to the attached Figure 2 After the Client process establishes communication with the Android HIDL Service, it can send a communication request to the Android HIDL Service through the Binder driver (this communication request is issued by the software process). After receiving the communication request, the Android HIDL Service will perform the corresponding request processing operation and send the request processing result to the Client process through the Binder driver. The Client process then sends the request processing result to the compatible encapsulation library through the Binder driver, and finally the compatible encapsulation library sends the request processing result to the software process. Through the interaction process of the above-mentioned compatible encapsulation library, the Client process, the Android HIDL Service and the Binder driver, the interaction between the software process and the Android HIDL Service is realized, that is, the call of the Android HIDL interface by the software process is realized.

[0065] Based on the above steps S101 to S103, the bridge between the software operating system and the Android HIDL interface is realized through the preset compatible encapsulation library. This compatible encapsulation library can provide the software operating system with an interface compatible with the Android HIDL interface for the software operating system to call, and can communicate with the Android HIDL Service through the Client process downward, so that the software operating system can call the real Android HIDL interface, thereby realizing the compatibility of the software operating system with the Android HIDL interface, thereby ensuring that the software operating system can run normally on the Android HAL-based device, overcoming the defect in the prior art that the software operating system cannot run normally on the Android HAL-based device due to the incompatibility of the Android HIDL interface.

[0066] For further information, see Appendix Figure 3 In another embodiment of a method for a software operating system to call an Android HIDL interface according to the present invention, the method for a software operating system to call an Android HIDL interface may include the following steps S201 to S203.

[0067] Step S201: a software process of a control software operating system calls a preset compatible encapsulation library.

[0068] Step S202: Obtain a Client process that communicates with the Android HIDL Service in the Android HAL process based on a Binder mechanism through a compatible encapsulation library.

[0069] Step S203: Communicate with Android HIDL Service through Client process to complete the call of Android HIDL interface by software operating system. In this embodiment, communication with Android HIDL Service can be performed through Client process and in accordance with the following steps: control Client process to send communication request to Android HIDLService based on Binder mechanism, receive request processing result fed back by Android HIDL Service according to communication request and send request processing result to compatible encapsulation library, and send request processing result to software process through compatible encapsulation library.

[0070] It should be noted that the relevant steps in the above steps S201 to S203 are similar to the relevant steps in the above method embodiments S101 to S103, and will not be repeated here.

[0071] Further, in another embodiment of the method for calling the Android HIDL interface by a software operating system according to the present invention, the method for calling the Android HIDL interface by the software operating system may not only include the above-mentioned steps S101 to S103, but may also include step S100 before executing the above-mentioned steps S101 and S103. By executing step S100, the software operating system and the Android HAL may be resource isolated so that the software operating system and the Android HAL can run independently on the device. Among them, resource isolation includes but is not limited to: operating environment isolation and file isolation, etc. By isolating the software operating system and the Android HAL, it can be ensured that when the software operating system is run on a device based on the Android HAL, there will be no conflict or mutual interference between the software operating system and the Android HAL, thereby ensuring the normal operation of the software operating system.

[0072] In one implementation of this embodiment, the software operating system and the Android HAL can be isolated from resources by changing the root directory, for example, using the chroot (change root directory) command to change the root directory of the software operating system or Android HAL to achieve resource isolation between the software operating system and the Android HAL. In another implementation of this embodiment, an isolated container can be created based on the NameSpace mechanism and the software operating system or Android HAL can be run in the isolated container, that is, one system (software operating system or Android HAL) is placed in the isolated container for operation, and another system (Android HAL or software operating system) is placed outside the isolated container for operation. Even if the process with the same process number is run in the software operating system and the Android HAL at the same time, since the process of one system is running in the isolated container, there will be no conflict between the software operating system and the Android HAL, and both can run normally.

[0073] The startup process of the device mainly includes the BootLoader boot phase, the Linux kernel boot phase and the software / Android HAL boot phase. Among them, the BootLoader boot phase and the Linux kernel boot phase are respectively the same as the BootLoader boot phase and the Linux kernel boot phase in the conventional Android boot method, and the main difference between this embodiment and the conventional Android boot method lies in the software / Android HAL startup phase. In this embodiment, after the Linux kernel boot phase is completed, the first kernel state process is converted into a user state process to enter the software / Android HAL startup phase. In the software / Android HAL startup phase, an isolated container can be created based on the NameSpace mechanism and the software operating system or Android HAL can be started in the isolated container, so as to run the software operating system or Android HAL in the isolated container.

[0074] In one embodiment, if the first user-mode process is an Android HAL process, an isolated container may be created based on the NameSpace mechanism and the software operating system may be started and run in the isolated container through the following steps 11 to 12:

[0075] Step 11: When starting the device, if the first user state process is an Android HAL process, start the Android HAL and create an isolated container (container Service) based on the NameSpace mechanism after the Android HAL is started. In this embodiment, the conventional Android HAL startup method in the field of computer technology can be used to start the Android HAL, such as mounting the Android basic file system, system partition, vendor partition, etc., and starting services such as Android Service Manager, Android HAL Service, and Android Native Service.

[0076] Step 12: Start the software operating system in the isolated container to run the software operating system in the isolated container. In this embodiment, the conventional software startup method in the field of computer technology can also be used to start the software operating system in the isolated container. Figure 4 If the software operating system is a Linux operating system, then starting the Linux operating system in the isolated container includes but is not limited to: mounting the basic file system and Dbus of the Linux operating system, and starting services such as LinuxService.

[0077] Through the above steps 11 to 12, the software operating system can be started and run in the isolated container to achieve resource isolation between the Android HAL and the software operating system.

[0078] In one embodiment, if the first user-mode process is a software process, an isolated container may be created based on the NameSpace mechanism and the Android HAL may be started and run in the isolated container through the following steps 21 to 23:

[0079] Step 21: When starting the device, if the first user-mode process is a software process, the non-core service of the software operating system is started and an isolated container is created based on the NameSpace mechanism after the non-core service is started.

[0080] In this embodiment, the conventional software startup method in the field of computer technology can be used to start the software operating system. However, since the core service of the software operating system needs to be started after the device completes hardware initialization, in this embodiment, the non-core service of the software operating system can be started first, and then the core service of the software operating system can be started after the Android HAL is started, so as to ensure that the software operating system can be successfully started and run normally. Figure 5 If the software operating system is a Linux operating system, you can start the non-core service LinuxService of the Linux operating system and create an isolated container based on the NameSpace mechanism after the non-core service Linux Service is started, that is, create an Android container based on the container Service.

[0081] Step 22: Start the Android HAL in the isolated container to run the Android HAL in the isolated container. In this embodiment, the Android HAL can be started by using a conventional Android HAL startup method in the field of computer technology, such as mounting the Android basic file system, system partition, vendor partition, etc., and starting services such as Android Service Manager, Android HAL Service, and Android Native Service.

[0082] Step 23: After the Android HAL is started, continue to start the core services of the software operating system.

[0083] Through the above steps 21 to 23, the Android HAL can be started and run in the isolated container, thereby realizing resource isolation between the Android HAL and the software operating system.

[0084] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0085] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0086] Furthermore, the present invention also provides a computer device. In a computer device embodiment according to the present invention, the computer device includes a processor and a storage device, the storage device can be configured to store a program for executing the method of the software operating system calling the Android HIDL interface of the above method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to the program for executing the method of the software operating system calling the Android HIDL interface of the above method embodiment. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer device can be a control device device formed by various electronic devices.

[0087] Furthermore, the present invention also provides a computer-readable storage medium. In a computer-readable storage medium embodiment according to the present invention, the computer-readable storage medium can be configured to store a program for executing the method of the software operating system calling the Android HIDL interface of the above-mentioned method embodiment, and the program can be loaded and run by the processor to implement the method of the above-mentioned software operating system calling the Android HIDL interface. For ease of explanation, only the parts related to the embodiment of the present invention are shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The computer-readable storage medium can be a storage device formed by various electronic devices. Optionally, the computer-readable storage medium in the embodiment of the present invention is a non-temporary computer-readable storage medium.

[0088] Further, it should be understood that since the setting of each module is only for illustrating the functional units of the device of the present invention, the physical devices corresponding to these modules may be the processor itself, or a part of the software in the processor, a part of the hardware, or a part of the combination of software and hardware. Therefore, the number of each module in the figure is only schematic.

[0089] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A method for a software operating system to call an Android HIDL interface, characterized in that: include: The software operating system program calls the Android HAL interface and the compatible encapsulation library of the Android HAL interface; The compatible encapsulation library queries and obtains the Client instance of Android HAL Binder Service based on Binder driver; Call the corresponding Android HIDL interface based on the Client instance; The method further comprises: Performing resource isolation on the software operating system and the Android HAL so that the software operating system and the Android HAL run independently on the device; The step of “isolating resources of the software operating system and the Android HAL” specifically includes: An isolated container is created based on the NameSpace mechanism, and the software operating system or the Android HAL is run in the isolated container.

2. The method for calling an Android HIDL interface by a software operating system according to claim 1, characterized in that: The step of "the software operating system program calls the Android HAL interface and the compatible encapsulation library of the Android HAL interface" specifically includes: controlling the software process of the software operating system to call a preset compatible encapsulation library; and / or, The step of "the compatible encapsulation library queries and obtains the Client instance of the Android HAL Binder Service based on the Binder driver" specifically includes: obtaining the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism through the compatible encapsulation library; and / or, The step of "calling the corresponding Android HIDL interface based on the Client instance" specifically includes: communicating with the Android HIDL Service through the Client process to complete the call of the Android HIDL interface by the software operating system; and / or, The software operating system is the Linux operating system.

3. The method for calling an Android HIDL interface by a software operating system according to claim 2, characterized in that: After the step of calling the corresponding Android HIDL interface based on the Client instance, the method further includes: calling the corresponding result based on the Android HIDL interface, and returning the result to the compatible encapsulation library through Binder.

4. The method for calling an Android HIDL interface by a software operating system according to claim 3, characterized in that: The step of "calling the corresponding result based on the Android HIDL interface and returning the result to the compatible encapsulation library through Binder" specifically includes: Control the Client process to send a communication request to the Android HIDL Service based on the Binder mechanism, receive the request processing result fed back by the Android HIDL Service according to the communication request, and send the request processing result to the compatible encapsulation library, and send the request processing result to the software process through the compatible encapsulation library.

5. The method for calling an Android HIDL interface by a software operating system according to claim 2, characterized in that: The steps of "controlling the software process of the software operating system to call a preset compatible package library" specifically include: The software process is controlled to call the compatible encapsulation library by linking a dynamic library.

6. The method for calling an Android HIDL interface by a software operating system according to claim 1, characterized in that: The steps of “creating an isolated container based on the NameSpace mechanism and running the software operating system or the Android HAL in the isolated container” specifically include: When starting the device, if the first user state process is an Android HAL process, start the Android HAL and create an isolated container based on the NameSpace mechanism after the Android HAL is started; Starting the software operating system in the isolated container to run the software operating system in the isolated container and / or, The steps of “creating an isolated container based on the NameSpace mechanism and running the software operating system or the Android HAL in the isolated container” specifically include: When starting the device, if the first user state process is a software process, then starting the non-core service of the software operating system and creating an isolated container based on the NameSpace mechanism after the non-core service is started; Starting the Android HAL in the isolated container to run the Android HAL in the isolated container; After the Android HAL is started, the core service of the software operating system continues to be started.

7. A computer device comprising a processor and a storage device, wherein the storage device is suitable for storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by the processor to execute the method for a software operating system to call an Android HIDL interface according to any one of claims 1 to 6.

8. A computer-readable storage medium storing a plurality of program codes, characterized in that: The program code is suitable for being loaded and run by a processor to execute the method of the software operating system calling the Android HIDL interface according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Universal interface design method and device based on Hidl, terminal and readable storage medium

    CN110737428A