WO2023124967A1 - 软件操作系统调用Android HIDL接口的方法、设备及介质 - Google Patents

软件操作系统调用Android HIDL接口的方法、设备及介质 Download PDF

Info

Publication number
WO2023124967A1
WO2023124967A1 PCT/CN2022/138656 CN2022138656W WO2023124967A1 WO 2023124967 A1 WO2023124967 A1 WO 2023124967A1 CN 2022138656 W CN2022138656 W CN 2022138656W WO 2023124967 A1 WO2023124967 A1 WO 2023124967A1
Authority
WO
WIPO (PCT)
Prior art keywords
android
operating system
interface
hidl
hal
Prior art date
Application number
PCT/CN2022/138656
Other languages
English (en)
French (fr)
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 WO2023124967A1 publication Critical patent/WO2023124967A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading

Definitions

  • the present application relates to the field of computer technology, for example, to a method, device and medium for a software operating system to call an Android Hardware Abstract Layer (Hardware Abstract Layer, HAL) Interface Definition Language (HAL Interface Definition Language, HIDL) interface.
  • HAL Hardware Abstract Layer
  • HAL Interface Definition Language HAL Interface Definition Language
  • Android is an operating system (Operating System) based on the Linux kernel, which is widely used in mobile devices such as mobile phones and tablet PCs (Tablet PC).
  • Android's system architecture from top to bottom is mainly the system application layer (System Apps), framework layer (Framework), HAL and Linux kernel layer (Linux Kernel).
  • HAL 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 bottom layer of Android.
  • the interface of Android HAL (Android HAL interface) mainly includes dynamic library passthrough (Passthrough) HAL interface (Android dynamic library HAL interface) and Binder cross-process interface (Android HIDL interface).
  • This application provides a method, device and medium for calling an Android HIDL interface by a software operating system.
  • This application provides a method for a software operating system to call an Android HIDL interface, including:
  • the program of the control software operating system calls the Android HAL interface and the compatible packaging library of the Android HAL interface;
  • Controlling the compatible encapsulation library of the Android HAL interface is driven by Binder, querying and obtaining the Client instance of the Android HAL Binder Service;
  • the present application also provides a computer device, which includes a processor and a storage device, the storage device is suitable for storing a plurality of program codes, and the program codes are suitable for being loaded and run by the processor to execute the above-mentioned software
  • the operating system calls the method of the Android HIDL interface.
  • the present application also provides a computer-readable storage medium, in which a plurality of program codes are stored in the computer-readable storage medium, and the program codes are suitable for being loaded and run by a processor to execute the above-mentioned software operating system calling the Android HIDL interface method.
  • Fig. 1 is the schematic flow chart of the method that a kind of software operating system that the application embodiment provides calls Android HIDL interface;
  • Fig. 2 is the operational flow schematic diagram of the method that a kind of software operating system that the application embodiment provides calls the Android HIDL interface;
  • Fig. 3 is the schematic flow chart of the method that another kind of software operating system that the embodiment of the application provides calls the Android HIDL interface;
  • Fig. 4 is a schematic diagram of the operation flow of a method for resource isolation of a software operating system and an Android HAL provided in an embodiment of the present application;
  • Fig. 5 is a schematic diagram of the operation flow of another method for resource isolation of the software operating system and the Android HAL provided by the embodiment of the present application;
  • Fig. 6 is a schematic structural diagram of a computer device provided by an embodiment of the present application.
  • module and “processor” may include hardware, software or a combination of both.
  • a module may include hardware circuits, a variety of suitable sensors, communication ports, memory, 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 can be implemented in software, hardware or a combination of both.
  • the non-transitory computer readable storage medium includes any suitable medium that can store program code, such as magnetic disks, hard disks, optical disks, flash memory, read only memory, random access memory, and the like.
  • the software operating system refers to the operating system (operating system) written based on computer programming language, that is, the computer management control program.
  • the software operating system may be an operating system other than Android.
  • the software operating system may be a Linux operating system, which refers to an operating system based on a Linux kernel, that is, a Linux system.
  • 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.
  • Service Manager is used to manage various services of Android. (Service), the Client process is the process of using the service, the Server process is the process of providing the service, the Client process, the Server process and the Service Manager do not interact directly, but interact through the Binder driver.
  • the Server process registers services with the Service Manager through the Binder driver, and the Client process queries the Service Manager for services through the Binder driver, and establishes communication with the Server process through the Binder driver according to the queried service, so as to interact with the service in the Server process.
  • the Android HIDL interface refers to the Binder cross-process interface in the Android HAL interface (Android HAL interface), that is, the Android HIDL interface is an interface that uses the Binder mechanism for communication.
  • Android HAL Binder Service refers to the Android HIDL Service or Android HAL service when the Android HIDL interface uses the Binder mechanism for communication.
  • the Client instance of the Android HAL Binder Service refers to the Client process that interacts with the Android HAL Binder Service through the Binder driver. That is, the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism.
  • the NameSpace mechanism refers to a resource isolation mechanism based on the Linux kernel.
  • the resources under each NameSpace are transparent to the resources under other NameSpaces.
  • Different NameSpaces can have processes with the same process number at the same time, because these processes belong to different NameSpace, so there will be no conflicts.
  • user mode each user can only see the processes in their own NameSpace.
  • user mode refers to the running state of the process when executing the user's own program code.
  • the processor runs in the user code with the lowest privilege level; correspondingly, the kernel mode refers to the process falling into the Linux kernel.
  • the running state of the program code at this time the processor is running in the kernel code with the highest privilege level.
  • a software process is an execution entity of a software operating system program.
  • the software process may be a Linux process.
  • the Client instance is the execution entity of the program of the client Client, that is, the Client process.
  • Fig. 1 is the schematic flow chart of the method that a kind of software operating system calling Android HIDL interface provided by the embodiment of the present application, this method can be applied to the software operating system running on the device based on Android HAL, and this device refers to It refers to devices capable of loading and running computer program codes, such devices include computer devices, mobile phones, and tablet computers, and the software operating system refers to software operating systems other than Android, such as operating systems based on the Linux kernel.
  • the method for the software operating system in the embodiment of the present application to call the Android HIDL interface includes the following S101 and S102.
  • S101 The program controlling the software operating system calls the Android HAL interface and a compatible package library of the Android HAL interface.
  • the software process of the software operating system can be controlled to call the preset compatible package library.
  • S102 Control the HAL-compatible encapsulation library based on the Binder driver, query and obtain the Client instance of the Android HAL Binder Service.
  • the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism can be obtained through a compatible package library.
  • the software operating system When the software operating system needs to call the Android HIDL interface in the Android HAL interface to communicate with the hardware of the device, such as communicating with the audio device of the device to obtain audio data, it can control the software process to call the preset compatible package library. Through this compatible package library to obtain the Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism.
  • Compatible wrapper libraries are dynamic libraries for software operating systems.
  • the software process can be controlled to call the compatible encapsulation library by linking the dynamic library.
  • a conventional way of linking a dynamic library in the field of software technology can be used to call a compatible package library, and the way of linking a dynamic library will not be described here.
  • the compatible encapsulation library obtains the Client process based on the Binder mechanism.
  • 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, and the Service Manager drives the Client process through the Binder Information is returned to the compatible package library.
  • the Client process can communicate with the Android HIDL Service to complete the calling of the Android HIDL interface by the software operating system.
  • 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.
  • the Client process queries the Android HIDL Service information in the Service Manager through the Binder driver, and the Client process establishes communication with the Android HIDL Service in the Android HAL process through the Binder driver based on this information, and Android HIDL Service to communicate.
  • the corresponding result can also be called based on the Android HIDL interface, and the result is returned to the HAL compatible package library through the Binder.
  • the result refers to the request processing result fed back by the Android HIDL Service according to the communication request sent by the Client process.
  • the corresponding result can be retrieved based on the Android HIDL interface through the Client process and according to the following operations, and the result can be returned to the HAL compatible packaging library through the Binder to realize communication with the Android HIDL Service:
  • 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 a compatible packaging library, and send the request processing result to the software process through the compatible packaging library.
  • the Client process 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 sent by the software process). After receiving the communication request, the Android HIDL Service will execute 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 packaging library through the Binder driver, and finally the compatible packaging library sends the request processing result to the software process, through the above Compatible with the interaction process of the encapsulation library, Client process, Android HIDL Service and 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.
  • the bridge between the software operating system and the Android HIDL interface is realized through the preset compatible packaging library.
  • This compatible packaging library can provide the software operating system with an interface compatible with the Android HIDL interface for the software operating system to implement. Call, and downward can communicate with the Android HIDL Service through the Client process, 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, thus ensuring the normal operation of the software operating system On Android HAL-based devices, it overcomes the defect that the software operating system cannot run normally on Android HAL-based devices because the software operating system is not compatible with the Android HIDL interface.
  • the method that the software operating system provided in this embodiment calls the Android HIDL interface solves the problem of how to make other software operating systems compatible with the Android HAL interface except Android, so that these software operating systems can run normally on devices based on the Android HAL.
  • the method for calling the Android HIDL interface by the software operating system may include the following S201 to S203.
  • S202 Obtain a Client process that communicates with the Android HIDL Service in the Android HAL process based on the Binder mechanism through a compatible package library.
  • S203 Communicate with the Android HIDL Service through the Client process to complete the calling of the Android HIDL interface by the software operating system.
  • the Client process can be used to communicate with the Android HIDL Service according to the following operations: 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 process the request The result is sent to the compatible packaging library, and the request processing result is sent to the software process through the compatible packaging library.
  • the method for calling the Android HIDL interface by the software operating system can not only include the above-mentioned S101 to S103, but also include S100 before performing the above-mentioned S101 and S103, by performing S100
  • the software operating system and the Android HAL can be resource isolated so that the software operating system and the Android HAL run independently on the device.
  • resource isolation includes: operating environment isolation and file isolation.
  • the software operating system and the Android HAL can be resource-isolated 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 the Android HAL to achieve The software operating system is isolated from the resources of the Android HAL.
  • an isolated container can be created based on the NameSpace mechanism and a software operating system or Android HAL can be run in the isolated container, that is, a system (software operating system or Android HAL) is placed to run in the isolated container, and the Another system (Android HAL or software operating system) runs outside the isolated container, even if the process with the same process number runs in the software operating system and Android HAL at the same time, since the process of a system runs in an isolated container, the software operation There is no conflict between the system and the Android HAL, and both can run normally.
  • the startup process of the device mainly includes the BootLoader boot phase, the Linux kernel startup phase and the software/Android HAL startup phase.
  • the BootLoader guide phase and the Linux kernel startup phase are respectively the same as the BootLoader boot phase and the Linux kernel startup phase in the conventional Android startup method, and the main difference between this embodiment and the conventional Android startup method is the software/Android HAL startup phase.
  • the Linux kernel startup phase when the Linux kernel startup phase is completed, the first kernel state process is converted into a user state process and enters the software/Android HAL startup phase.
  • an isolated container can be created based on the NameSpace mechanism and stored in the isolated container. Start the software operating system or Android HAL to run the software operating system or Android HAL inside the isolated container.
  • an isolated container can be created based on the NameSpace mechanism and the software operating system can be started and run in the isolated container through the following S11 to S12:
  • the conventional Android HAL startup method in the computer technology field can be used to start the Android HAL, such as mounting the Android basic file system, system partition, vendor partition, etc., and simultaneously starting the Android Service Manager, Android HAL Service, Android Native Service and other services.
  • S12 Start the software operating system in the isolated container, so as to run the software operating system in the isolated container.
  • a conventional software startup method in the field of computer technology can also be used to start the software operating system in the isolation container.
  • the software operating system is a Linux operating system
  • starting the Linux operating system in the isolated container includes: mounting the basic file system, Dbus, etc. of the Linux operating system, and simultaneously starting services such as Linux Service.
  • the software operating system can be started and run in the isolated container to realize resource isolation between the Android HAL and the software operating system.
  • an isolated container can be created based on the NameSpace mechanism and the Android HAL can be started and run in the isolated container through the following S21 to S23:
  • a conventional software startup method in the computer technology field can be used to start the software operating system, but since the core service of the software operating system needs to be started after the hardware initialization of the device is completed, in this embodiment, you can first Start the non-core services of the software operating system, and then start the core services of the software operating system after the Android HAL is started, so as to ensure that the software operating system can be successfully started and run normally.
  • the software operating system is a Linux operating system
  • S22 Start the Android HAL in the isolated container, so as to run the Android HAL in the isolated container.
  • the Android HAL can be started by using a conventional Android HAL startup method in the field of computer technology, such as mounting Android's basic file system, system partition, vendor partition, etc., and simultaneously starting Android Service Manager, Android HAL Service, Android Native Service and other services.
  • the Android HAL can be started and run in the isolated container, so as to realize resource isolation between the Android HAL and the software operating system.
  • the computer program can be stored in a computer-readable storage medium.
  • the computer program includes computer program code
  • the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable storage medium may include: any entity or device capable of carrying the computer program code, medium, U disk, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signals, telecommunication signals, and software distribution media, etc.
  • the content contained in the computer-readable storage medium may be appropriately increased or decreased according to the requirements of the legislation and patent practice in the jurisdiction. For example, in some jurisdictions, the computer-readable storage medium does not include the electronic carrier signals and telecommunication signals.
  • the present application also provides a computer device.
  • the computer device includes a processor 10 and a storage device 20, and the storage device 20 can be configured to store a program that executes the method in which the software operating system of the method embodiment calls the Android HIDL interface, and the processor 10 can be It is configured to execute the program in the storage device 20, and the program includes a program that executes the method of calling the Android HIDL interface by the software operating system of the above method embodiment.
  • the computer device may be a control device device formed including various electronic devices.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium can be configured to store a program for executing the method in which the software operating system of the above method embodiment calls the Android HIDL interface, and the program can be loaded and run by a processor to implement The above-mentioned software operating system calls the method of the Android HIDL interface.
  • the computer-readable storage medium may be a storage device formed by including various electronic devices.
  • the computer-readable storage medium in the embodiment of the present application is a non-transitory computer-readable storage medium.
  • the physical devices corresponding to these modules can 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 multiple modules in the figure is only illustrative.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Telephonic Communication Services (AREA)
  • Computer And Data Communications (AREA)

Abstract

提供了一种软件操作系统调用Android HIDL接口的方法、设备及介质。软件操作系统调用Android HIDL接口的方法包括:控制软件操作系统的程序调用Android硬件抽象层HAL接口以及Android HAL接口的兼容封装库,控制Android HAL接口的兼容封装库基于Binder驱动,查询并得到Android HAL Binder Service的Client实例,基于Client实例调取相对应的Android HIDL接口。

Description

软件操作系统调用Android HIDL接口的方法、设备及介质
本申请要求在2021年12月31日提交中国专利局、申请号为202111671966.4的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,例如涉及一种软件操作系统调用Android硬件抽象层(Hardware Abstract Layer,HAL)接口定义语言(HAL Interface Definition Language,HIDL)接口的方法、设备及介质。
背景技术
Android是一种基于Linux内核的操作系统(Operating System),其广泛应用于手机和平板电脑(Tablet PC)等移动设备。Android的系统架构从上到下主要是系统应用层(System Apps)、框架层(Framework)、HAL和Linux内核层(Linux Kernel)。其中,HAL为Android提供了虚拟硬件平台,其可以对Linux内核层进行封装并向上提供接口,屏蔽Android底层的实现细节。Android HAL的接口(Android HAL接口)主要包括动态库直通式(Passthrough)HAL接口(Android动态库HAL接口)和Binder跨进程式接口(Android HIDL接口)等。
由于Android广泛应用于不同类型的移动设备,导致一部分硬件设备供应商仅提供适用于Android的硬件驱动程序,同时由于其他软件操作系统如基于Linux内核的操作系统无法兼容Android HAL接口,导致其他软件操作系统无法在基于Android HAL的移动设备上正常运行,从而极大地限制了其他软件操作系统在这类移动设备上的应用前景。
发明内容
本申请提供一种软件操作系统调用Android HIDL接口的方法、设备及介质。
本申请提供一种软件操作系统调用Android HIDL接口的方法,包括:
控制软件操作系统的程序调用Android HAL接口以及所述Android HAL接口的兼容封装库;
控制所述Android HAL接口的兼容封装库基于Binder驱动,查询并得到Android HAL Binder Service的Client实例;
基于所述Client实例调取相对应的Android HIDL接口。
本申请还提供一种计算机设备,该计算机设备包括处理器和存储装置,所述存储装置适于存储多条程序代码,所述程序代码适于由所述处理器加载并运行以执行上述的软件操作系统调用Android HIDL接口的方法。
本申请还提供一种计算机可读存储介质,该计算机可读存储介质中存储有多条程序代码,所述程序代码适于由处理器加载并运行以执行上述的软件操作系统调用Android HIDL接口的方法。
附图说明
图1是本申请实施例提供的一种软件操作系统调用Android HIDL接口的方法的流程示意图;
图2是本申请实施例提供的一种软件操作系统调用Android HIDL接口的方法的操作流程示意图;
图3是本申请实施例提供的另一种软件操作系统调用Android HIDL接口的方法的流程示意图;
图4是本申请实施例提供的一种对软件操作系统与Android HAL进行资源隔离的方法的操作流程示意图;
图5是本申请实施例提供的另一种对软件操作系统与Android HAL进行资源隔离的方法的操作流程示意图;
图6是本申请实施例提供的一种计算机设备的结构示意图。
具体实施方式
下面参照附图来描述本申请的一些实施方式。这些实施方式仅仅用于解释本申请的技术原理。
在本申请的描述中,“模块”、“处理器”可以包括硬件、软件或者两者的组合。一个模块可以包括硬件电路,多种合适的感应器,通信端口,存储器,也可以包括软件部分,比如程序代码,也可以是软件和硬件的组合。处理器可以是中央处理器、微处理器、数字信号处理器或者其他任何合适的处理器。处理器具有数据和/或信号处理功能。处理器可以以软件方式实现、硬件方式实现或者二者结合方式实现。非暂时性的计算机可读存储介质包括任何合适的可存储程序代码的介质,比如磁碟、硬盘、光碟、闪存、只读存储器、随机存取存储器等等。
这里先解释本申请涉及到的一些术语。
软件操作系统指的是基于计算机编程语言编写的操作系统(operating system),即计算机管理控制程序。在本实施例中软件操作系统可以是除Android以外其他的操作系统。在一个实施方式中软件操作系统可以是Linux操作系统,该Linux操作系统指的是基于Linux内核的操作系统,即Linux系统。
Binder机制指的是Android的一种跨进程通信方式,Binder机制采用C/S架构,其可以包括Client进程、Server进程、Service Manager和Binder驱动四个组件,Service Manager用于管理Android的多种服务(Service),Client进程是使用服务的进程,Server进程是提供服务的进程,Client进程、Server进程和Service Manager之间不直接进行交互,而是通过Binder驱动进行交互。Server进程通过Binder驱动向Service Manager注册服务,Client进程通过Binder驱动向Service Manager查询服务并根据查询到的服务,通过Binder驱动与Server进程建立通信,以便与Server进程中的这个服务进行交互。
Android HIDL接口指的是Android HAL的接口(Android HAL接口)中的Binder跨进程式接口,即Android HIDL接口是采用Binder机制进行通信的接口。Android HAL Binder Service指的是Android HIDL接口在采用Binder机制进行通信时的Android HIDL Service或Android HAL服务,Android HAL Binder Service的Client实例指的是通过Binder驱动与Android HAL Binder Service进行交互的Client进程,即基于Binder机制与Android HAL进程中的Android HIDL Service进行通信的Client进程。
NameSpace机制指的是一种基于Linux内核的资源隔离机制,每个NameSpace(容器)下的资源对于其他NameSpace下的资源都是透明,不同NameSpace可以同时存在相同进程号的进程,由于这些进程属于不同的NameSpace,因此不会产生冲突。在用户态,每个用户只能看到属于自己的NameSpace中的进程。其中,用户态(user mode)指的是进程在执行用户自己的程序代码时的运行状态,此时处理器在特权级最低的用户代码中运行;相应的,内核态指的是进程陷入Linux内核的程序代码时的运行状态,此时处理器处于特权级最高的内核代码中运行。
软件进程(process)是软件操作系统程序的执行实体。当软件操作系统是Linux操作系统时,软件进程可以是Linux进程。
Client实例是客户端Client的程序的执行实体,即Client进程。
参阅附图1,图1是本申请实施例提供的一种软件操作系统调用Android HIDL接口的方法的流程示意图,该方法可以应用于运行在基于Android HAL的设备上的软件操作系统,该设备指的是能够加载并运行计算机程序代码的设备,该设备包括计算机设备、手机和平板电脑等,该软件操作系统指的是除Android 以外其他的软件操作系统,如基于Linux内核的操作系统。如图1所示,本申请实施例中的软件操作系统调用Android HIDL接口的方法包括下列S101和S102。
S101:控制软件操作系统的程序调用Android HAL接口以及Android HAL接口的兼容封装库。
在本实施例中可以控制软件操作系统的软件进程调用预设的兼容封装库。
S102:控制HAL兼容封装库基于Binder驱动,查询并得到Android HAL Binder Service的Client实例。
在本实施例中可以通过兼容封装库获取基于Binder机制与Android HAL进程中的Android HIDL Service进行通信的Client进程。
当软件操作系统需要调用Android HAL接口中的Android HIDL接口与设备的硬件进行通信,比如与设备的音频器件进行通信获取音频数据时,可以控制软件进程调用预设的兼容封装库,通过这个兼容封装库去获取基于Binder机制与Android HAL进程中的Android HIDL Service进行通信的Client进程。兼容封装库是软件操作系统的动态库。在一个实施方式中可以控制软件进程通过链接动态库的方式调用兼容封装库。在本实施方式中可以采用软件技术领域中常规的链接动态库的方式去调用兼容封装库,在此不对链接动态库的方式进行说明。
在本实施例中兼容封装库基于Binder机制获取Client进程。参阅附图2,兼容封装库可以通过Binder驱动去服务管理(Service Manager)中查询与Android HAL进程中的Android HIDL Service进行通信的Client进程,服务管理(Service Manager)通过Binder驱动将这个Client进程的信息返回至兼容封装库。
S103:基于Client实例调取相对应的Android HIDL接口。
在本实施例中可以通过Client进程与Android HIDL Service进行通信,以完成软件操作系统对Android HIDL接口的调用。
Client进程可以基于Binder机制与Android HIDL Service建立通信,从而使软件操作系统完成对Android HIDL接口的调用。
参阅附图2,Client进程通过Binder驱动去服务管理(Service Manager)中查询Android HIDL Service的信息,Client进程根据这个信息并通过Binder驱动与Android HAL进程中的Android HIDL Service建立通信,与Android HIDL Service进行通信。
在一个实施方式中,在基于Client实例调取相对应的Android HIDL接口后,还可以基于Android HIDL接口调取相应的结果,将结果通过Binder返回给HAL兼容封装库。其中,结果指的是Android HIDL Service根据Client进程发送的通 信请求反馈的请求处理结果。在本实施方式中可以通过Client进程并按照下列操作基于Android HIDL接口调取相应的结果,将结果通过Binder返回给HAL兼容封装库,实现与Android HIDL Service的通信:
控制Client进程基于Binder机制向Android HIDL Service发送通信请求,接收Android HIDL Service根据通信请求反馈的请求处理结果以及将请求处理结果发送至兼容封装库,通过兼容封装库将请求处理结果发送至软件进程。
继续参阅附图2,Client进程与Android HIDL Service建立通信后可以通过Binder驱动向Android HIDL Service发送通信请求(这个通信请求是软件进程发出的),Android HIDL Service接收到这个通信请求后会执行相应的请求处理操作并通过Binder驱动将请求处理结果发送至Client进程,Client进程再通过Binder驱动将该请求处理结果发送至兼容封装库,最后由兼容封装库将这个请求处理结果发送至软件进程,通过上述兼容封装库、Client进程、Android HIDL Service和Binder驱动的交互过程,实现了软件进程与Android HIDL Service的交互,即实现了软件进程对Android HIDL接口的调用。
基于上述S101至S103,通过预设的兼容封装库实现了软件操作系统与Android HIDL接口之间的桥接,这个兼容封装库向上可以为软件操作系统提供兼容Android HIDL接口的接口,供软件操作系统进行调用,而向下可以通过Client进程与Android HIDL Service进行通信,使得软件操作系统可以调用到真正的Android HIDL接口,实现了软件操作系统对Android HIDL接口的兼容,从而保证软件操作系统能够正常地运行在基于Android HAL的设备上,克服了相关技术中由于软件操作系统无法兼容Android HIDL接口,导致软件操作系统无法在基于Android HAL的设备上正常运行的缺陷。本实施例提供的软件操作系统调用Android HIDL接口的方法解决了如何使除Android以外其他的软件操作系统兼容Android HAL接口,以使这些软件操作系统能够在基于Android HAL的设备上正常运行的问题。
参阅附图3,在软件操作系统调用Android HIDL接口的方法的另一个实施例中,该软件操作系统调用Android HIDL接口的方法可以包括下列S201至S203。
S201:控制软件操作系统的软件进程调用预设的兼容封装库。
S202:通过兼容封装库获取基于Binder机制与Android HAL进程中的Android HIDL Service进行通信的Client进程。
S203:通过Client进程与Android HIDL Service进行通信,以完成软件操作系统对Android HIDL接口的调用。
在本实施例中可以通过Client进程并按照下列操作与Android HIDL Service进行通信:控制Client进程基于Binder机制向Android HIDL Service发送通信请求,接收Android HIDL Service根据通信请求反馈的请求处理结果以及将请求处理结果发送至兼容封装库,通过兼容封装库将请求处理结果发送至软件进程。
上述S201至S203中的相关操作与前述方法实施例中S101至S103中的相关操作类似,在此不再赘述。
在软件操作系统调用Android HIDL接口的方法的另一个实施例中,该软件操作系统调用Android HIDL接口的方法不仅可以包括上述S101至S103,在执行上述S101和S103之前还可以包括S100,通过执行S100可以对软件操作系统与Android HAL进行资源隔离以使软件操作系统与Android HAL在设备上分别独立运行。其中,资源隔离包括:运行环境隔离和文件隔离等。通过对软件操作系统与Android HAL进行资源隔离,可以保证在基于Android HAL的设备上运行软件操作系统时,软件操作系统与Android HAL不会产生冲突与相互干扰,从而保证软件操作系统的正常运行。
在本实施例的一个实施方式中可以通过更改根目录的方式对软件操作系统与Android HAL进行资源隔离,例如使用chroot(change root directory)命令更改软件操作系统或Android HAL的根目录,以实现对软件操作系统与Android HAL的资源隔离。而在本实施例的另一个实施方式中可以基于NameSpace机制创建隔离容器并在隔离容器内运行软件操作系统或Android HAL,即将一个系统(软件操作系统或Android HAL)放在隔离容器内运行,将另一个系统(Android HAL或软件操作系统)放在隔离容器以外运行,即使在软件操作系统和Android HAL中同时运行相同进程号的进程,由于一个系统的进程是在隔离容器内运行,因此软件操作系统和Android HAL也不会产生冲突,二者均可以正常运行。
设备的启动过程主要包括BootLoader引导阶段、Linux内核启动阶段和软件/Android HAL启动阶段。其中,BootLoader引导阶段和Linux内核启动阶段分别与常规的Android启动方法中的BootLoader引导阶段和Linux内核启动阶段相同,而本实施方式与常规的Android启动方法的主要区别在于软件/Android HAL启动阶段。在本实施方式中,当Linux内核启动阶段完成后首个内核态进程转换成用户态进程进入软件/Android HAL启动阶段,在软件/Android HAL启动阶段中可以基于NameSpace机制创建隔离容器并在隔离容器内启动软件操作系统或Android HAL,以便在隔离容器内运行软件操作系统或Android HAL。
在一个实施方式中,如果首个用户态进程是Android HAL进程,则可以基于NameSpace机制创建隔离容器并通过下列S11至S12在隔离容器内启动并运行软件操作系统:
S11:在启动设备时,若首个用户态进程是Android HAL进程,则启动Android HAL并在Android HAL启动完成后基于NameSpace机制创建隔离容器(容器Service)。
在本实施方式中可以采用计算机技术领域中常规的Android HAL启动方法对Android HAL进行启动,例如挂载Android的基础文件系统、system分区、vendor分区等,同时启动Android Service Manager、Android HAL Service、Android Native Service等服务。
S12:在隔离容器内启动软件操作系统,以在隔离容器内运行软件操作系统。
在本实施方式中同样可以采用计算机技术领域中常规的软件启动方法在隔离容器内启动软件操作系统。参阅附图4,若软件操作系统是Linux操作系统,那么在隔离容器内启动Linux操作系统包括:挂载Linux操作系统的基础文件系统、Dbus等,同时启动Linux Service等服务。
通过上述S11至S12,可以在隔离容器内启动并运行软件操作系统,实现对Android HAL与软件操作系统的资源隔离。
在一个实施方式中,如果首个用户态进程是软件进程,则可以基于NameSpace机制创建隔离容器并通过下列S21至S23在隔离容器内启动并运行Android HAL:
S21:在启动设备时,若首个用户态进程是软件进程,则启动软件操作系统的非核心服务并在非核心服务启动完成后基于NameSpace机制创建隔离容器。
在本实施方式中可以采用计算机技术领域中常规的软件启动方法对软件操作系统进行启动,但由于软件操作系统的核心服务需要在设备完成硬件初始化之后进行启动,因此,在本实施例中可以先启动软件操作系统的非核心服务,在完成Android HAL启动后再启动软件操作系统的核心服务,以保证软件操作系统能够成功启动,正常运行。参阅附图5,若软件操作系统是Linux操作系统,则可以启动Linux操作系统的非核心服务Linux Service并在非核心服务Linux Service启动完成后基于NameSpace机制创建隔离容器,即基于容器Service创建Android容器。
S22:在隔离容器内启动Android HAL,以在隔离容器内运行Android HAL。
在本实施方式中,可以采用计算机技术领域中常规的Android HAL启动方法对Android HAL进行启动,例如挂载Android的基础文件系统、system分区、vendor分区等,同时启动Android Service Manager、Android HAL Service、Android Native Service等服务。
S23:在Android HAL启动完成后继续启动软件操作系统的核心服务。
通过上述S21至S23,可以在隔离容器内启动并运行Android HAL,实现对Android HAL与软件操作系统的资源隔离。
尽管上述实施例中将多个步骤按照特定的先后顺序进行了描述,为了实现本申请的效果,不同的步骤之间并非必须按照这样的顺序执行,其可以同时(并行)执行或以其他顺序执行,这些变化都在本申请的保护范围之内。
本申请实现上述一实施例的方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述多个方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或一些中间形式等。所述计算机可读存储介质可以包括:能够携带所述计算机程序代码的任何实体或装置、介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器、随机存取存储器、电载波信号、电信信号以及软件分发介质等。所述计算机可读存储介质包含的内容可以根据司法管辖区内立法和专利实践的要求进行适当的增减,例如在一些司法管辖区,根据立法和专利实践,计算机可读存储介质不包括电载波信号和电信信号。
如图6所示,本申请还提供了一种计算机设备。在一个计算机设备实施例中,计算机设备包括处理器10和存储装置20,存储装置20可以被配置成存储执行上述方法实施例的软件操作系统调用Android HIDL接口的方法的程序,处理器10可以被配置成执行存储装置20中的程序,该程序包括执行上述方法实施例的软件操作系统调用Android HIDL接口的方法的程序。为了便于说明,仅示出了与本申请实施例相关的部分,技术细节未揭示的,请参照本申请实施例方法部分。该计算机设备可以是包括多种电子设备形成的控制装置设备。
本申请还提供了一种计算机可读存储介质。在一个计算机可读存储介质实施例中,计算机可读存储介质可以被配置成存储执行上述方法实施例的软件操作系统调用Android HIDL接口的方法的程序,该程序可以由处理器加载并运行以实现上述软件操作系统调用Android HIDL接口的方法。为了便于说明,仅示出了与本申请实施例相关的部分,技术细节未揭示的,请参照本申请实施例方法部分。该计算机可读存储介质可以是包括多种电子设备形成的存储装置设备,例如,本申请实施例中计算机可读存储介质是非暂时性的计算机可读存储介质。
由于多个模块的设定仅仅是为了说明本申请的装置的功能单元,这些模块对应的物理器件可以是处理器本身,或者处理器中软件的一部分,硬件的一部分,或者软件和硬件结合的一部分。因此,图中的多个模块的数量仅仅是示意性的。

Claims (10)

  1. 一种软件操作系统调用Android硬件抽象层接口定义语言HIDL接口的方法,包括:
    控制软件操作系统的程序调用Android硬件抽象层HAL接口以及所述Android HAL接口的兼容封装库;
    控制所述Android HAL接口的兼容封装库基于Binder驱动,查询并得到Android HAL Binder Service的Client实例;
    基于所述Client实例调取相对应的Android HIDL接口。
  2. 根据权利要求1所述的软件操作系统调用Android HIDL接口的方法,满足以下至少之一:
    控制软件操作系统的程序调用所述Android HAL接口的兼容封装库,包括:控制所述软件操作系统的软件进程调用所述Android HAL接口的预设的兼容封装库;
    所述控制所述Android HAL接口的兼容封装库基于Binder驱动,查询并得到Android HAL Binder Service的Client实例,包括:通过所述兼容封装库获取基于所述Binder机制与Android HAL进程中的Android HIDL Service进行通信的Client进程;所述基于所述Client实例调取相对应的Android HIDL接口,包括:通过所述Client进程与所述Android HIDL Service进行通信,以完成所述软件操作系统对所述Android HIDL接口的调用;
    或者
    所述软件操作系统是Linux操作系统。
  3. 根据权利要求2所述的软件操作系统调用Android HIDL接口的方法,其中,在所述基于所述Client实例调取相对应的Android HIDL接口之后,还包括:
    基于所述Android HIDL接口调取相应的结果,将所述结果通过Binder返回给所述Android HAL接口的兼容封装库。
  4. 根据权利要求3所述的软件操作系统调用Android HIDL接口的方法,其中,所述基于所述Android HIDL接口调取相应的结果,将所述结果通过Binder返回给所述Android HAL接口的兼容封装库,包括:
    控制所述Client进程基于Binder机制向所述Android HIDL Service发送通信请求,接收所述Android HIDL Service根据所述通信请求反馈的请求处理结果以及将所述请求处理结果发送至所述兼容封装库,通过所述兼容封装库将所述请求处理结果发送至所述软件进程。
  5. 根据权利要求2所述的软件操作系统调用Android HIDL接口的方法,其中,所述控制所述软件操作系统的软件进程调用所述Android HAL接口的预设的兼容封装库,包括:
    控制所述软件进程通过链接动态库的方式调用所述兼容封装库。
  6. 根据权利要求2至5中任一项所述的软件操作系统调用Android HIDL接口的方法,其中,所述方法应用于运行在基于Android HAL的设备上的软件操作系统,在所述控制所述软件操作系统的软件进程调用所述Android HAL接口的预设的兼容封装库之前,还包括:
    对所述软件操作系统与所述Android HAL进行资源隔离,以使所述软件操作系统与所述Android HAL在所述设备上分别独立运行。
  7. 根据权利要求6所述的软件操作系统调用Android HIDL接口的方法,其中,所述对所述软件操作系统与所述Android HAL进行资源隔离,包括:
    基于NameSpace机制创建隔离容器并在所述隔离容器内运行所述软件操作系统或所述Android HAL。
  8. 根据权利要求7所述的软件操作系统调用Android HIDL接口的方法,满足以下至少之一:
    所述基于NameSpace机制创建隔离容器并在所述隔离容器内运行所述软件操作系统或所述Android HAL,包括:在启动所述设备,且首个用户态进程是Android HAL进程的情况下,启动所述Android HAL并在所述Android HAL启动完成后基于所述NameSpace机制创建所述隔离容器;在所述隔离容器内启动所述软件操作系统,以在所述隔离容器内运行所述软件操作系统;
    或者
    所述基于NameSpace机制创建隔离容器并在所述隔离容器内运行所述软件操作系统或所述Android HAL,包括:在启动所述设备,在首个用户态进程是软件进程的情况下,启动所述软件操作系统的非核心服务并在所述非核心服务启动完成后基于所述NameSpace机制创建所述隔离容器;在所述隔离容器内启动所述Android HAL,以在所述隔离容器内运行所述Android HAL;在所述Android HAL启动完成后继续启动所述软件操作系统的核心服务。
  9. 一种计算机设备,包括处理器和存储装置,所述存储装置设置为存储多条程序代码,其中,所述程序代码适于由所述处理器加载并运行以执行权利要求1至8中任一项所述的软件操作系统调用Android硬件抽象层接口定义语言HIDL接口的方法。
  10. 一种计算机可读存储介质,存储有多条程序代码,其中,所述程序代码适于由处理器加载并运行以执行权利要求1至8中任一项所述的软件操作系统调用Android硬件抽象层接口定义语言HIDL接口的方法。
PCT/CN2022/138656 2021-04-07 2022-12-13 软件操作系统调用Android HIDL接口的方法、设备及介质 WO2023124967A1 (zh)

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
CN202110374484.6A CN113190294A (zh) 2021-04-07 2021-04-07 Linux系统调用Android HIDL接口的方法、装置及存储介质
CN202111671966.4 2021-12-31
CN202111671966.4A CN114077462A (zh) 2021-04-07 2021-12-31 软件操作系统调用Android HIDL接口的方法、装置、设备及介质

Publications (1)

Publication Number Publication Date
WO2023124967A1 true WO2023124967A1 (zh) 2023-07-06

Family

ID=76974955

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/138656 WO2023124967A1 (zh) 2021-04-07 2022-12-13 软件操作系统调用Android HIDL接口的方法、设备及介质

Country Status (2)

Country Link
CN (2) CN113190294A (zh)
WO (1) WO2023124967A1 (zh)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113190294A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HIDL接口的方法、装置及存储介质
CN113190280A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HAL动态库的方法、装置及存储介质
CN113590363B (zh) * 2021-09-26 2022-02-25 北京鲸鲮信息系统技术有限公司 数据发送方法、装置、电子设备及存储介质
CN113852718B (zh) * 2021-09-26 2022-11-15 北京字节跳动网络技术有限公司 语音通道建立方法、装置、电子设备及存储介质
CN113840295B (zh) * 2021-09-26 2022-08-09 北京字节跳动网络技术有限公司 移动数据网络建立方法、装置、电子设备及存储介质
CN113904849B (zh) * 2021-10-09 2024-01-09 深圳技德智能科技研究院有限公司 访问网络方法、装置、计算机设备和存储介质
CN114020364B (zh) * 2021-11-16 2024-04-26 北京字节跳动网络技术有限公司 传感器设备适配的方法、装置、电子设备和存储介质
CN113986368A (zh) * 2021-12-29 2022-01-28 北京鲸鲮信息系统技术有限公司 基于Linux的相机控制方法、装置、设备及存储介质
CN114564247A (zh) * 2022-02-23 2022-05-31 北京字节跳动网络技术有限公司 多系统兼容方法及装置、电子设备、存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170371693A1 (en) * 2016-06-23 2017-12-28 Vmware, Inc. Managing containers and container hosts in a virtualized computer system
CN109388473A (zh) * 2018-09-19 2019-02-26 华东计算技术研究所(中国电子科技集团公司第三十二研究所) 基于移动操作系统的Android兼容层实现方法和系统
CN112416511A (zh) * 2016-06-13 2021-02-26 华为技术有限公司 用于虚拟硬件控制的系统和方法
US20210224378A1 (en) * 2019-02-15 2021-07-22 Promon As Securing Virtual-Machine Software Applications
CN113190294A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HIDL接口的方法、装置及存储介质
CN113190280A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HAL动态库的方法、装置及存储介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416511A (zh) * 2016-06-13 2021-02-26 华为技术有限公司 用于虚拟硬件控制的系统和方法
US20170371693A1 (en) * 2016-06-23 2017-12-28 Vmware, Inc. Managing containers and container hosts in a virtualized computer system
CN109388473A (zh) * 2018-09-19 2019-02-26 华东计算技术研究所(中国电子科技集团公司第三十二研究所) 基于移动操作系统的Android兼容层实现方法和系统
US20210224378A1 (en) * 2019-02-15 2021-07-22 Promon As Securing Virtual-Machine Software Applications
CN113190294A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HIDL接口的方法、装置及存储介质
CN113190280A (zh) * 2021-04-07 2021-07-30 北京鲸鲮信息系统技术有限公司 Linux系统调用Android HAL动态库的方法、装置及存储介质
CN114077462A (zh) * 2021-04-07 2022-02-22 北京鲸鲮信息系统技术有限公司 软件操作系统调用Android HIDL接口的方法、装置、设备及介质

Also Published As

Publication number Publication date
CN114077462A (zh) 2022-02-22
CN113190294A (zh) 2021-07-30

Similar Documents

Publication Publication Date Title
WO2023124967A1 (zh) 软件操作系统调用Android HIDL接口的方法、设备及介质
US10225335B2 (en) Apparatus, systems and methods for container based service deployment
CA2768752C (en) Terminal device of non-android platform for executing android applications, and computer readable recording medium for storing program of executing android applications on non-android platform
WO2023124968A1 (zh) 软件操作系统调用Android动态库HAL接口的方法、设备及介质
CN110389829B (zh) 多租户环境中扩展对象的分类与分发
JP6192534B2 (ja) 仮想アプリケーション拡張ポイント
US20190042320A1 (en) Host specific containerized application configuration generation
US9928010B2 (en) Methods and apparatus to re-direct detected access requests in a modularized virtualization topology using virtual hard disks
US11385903B2 (en) Firmware update patch
US10187479B2 (en) Cloud-scale heterogeneous datacenter management infrastructure
US10101915B2 (en) Methods and apparatus to manage inter-virtual disk relations in a modularized virtualization topology using virtual hard disks
US20100205604A1 (en) Systems and methods for efficiently running multiple instances of multiple applications
CN110007980B (zh) 多业务服务端的实现方法和装置
US11301562B2 (en) Function execution based on data locality and securing integration flows
TWI715762B (zh) 虛擬機器創建方法和裝置
US9804789B2 (en) Methods and apparatus to apply a modularized virtualization topology using virtual hard disks
CN104182257A (zh) 应用软件的安装方法和应用软件的安装装置
US20230266984A1 (en) Container-based operating system translation
US10126983B2 (en) Methods and apparatus to enforce life cycle rules in a modularized virtualization topology using virtual hard disks
JP2022100244A (ja) コンテナイメージのロードのための方法および装置
US20200356538A1 (en) Container-based virtualization for testing database system
US8490105B2 (en) Pluggable component interface
CN108804236B (zh) 一种aidl文件的共享方法及系统
US11323331B2 (en) Cloud server and operating method of the same
US11561787B2 (en) Application invocation on specified operating system version

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: 22914222

Country of ref document: EP

Kind code of ref document: A1