anbox-platform-sdk
1.23.0
Anbox Platform SDK API documentation
|
Anbox loads an external platform plugin through its internal platform integration. A platform plugin is always in the form of a dynamic library that is loaded by Anbox at runtime. Whenever loading a plugin, Anbox will go through the following steps to verify if the platform plugin is installed properly and implements the standards-compliant API.
If a platform fails verification, Anbox refuses to load it and will terminate with an error.
This page walks through how to create a platform plugin step-by-step. It's highly recommanded to review the examples before proceeding.
The first requirement is to set up a proper development environment. In order to easily integrate the platform plugin into Anbox and avoid any ABI issues, the only available development environment is Ubuntu 18.04(64-bit). Using any other Ubuntu distributions is not recommended. Ubuntu 18.04 can be obtained from here.
The following build dependencies are needed to use the SDK.
The easiest way to build a plugin is to use the CMake (https://cmake.org/) build system for the plugin. A CMakeLists.txt file should be created and placed in the project root directory. In the plugin's CMakeLists.txt file, the SDK can be imported directly using find_package
and setting the CMAKE_PREFIX_PATH
to include a path to the SDK. Then the following target is imported and available to the rest of the cmake build process:
anbox-platform-sdk-internal
- the SDK's interface library that must be linked againstThe following is an example CMakeLists.txt which can be used to compile a plugin:
A source file named <plugin_name>_platform.cpp
is expected to reside in the project's root directory, alongside CMakeLists.txt. Below is how a platform plugin project layout looks like.
This is the minimum required to start building an Anbox platform plugin. The example minimal platform provides a skeleton of raw platform plugin implementation that may be copied and modified for quicker development.
As is shown in the CMakeLists.txt above, you have to specify CMAKE_PREFIX_PATH
configuration setting where the Anbox Platform SDK is located via the CMake command-line interface. With it, CMake can easily find and include the SDK's interface library, header files and testing tool targets. You can run the following commands to build your plugin from the plugin's root directory.
The SDK supplies a tool called anbox-platform-tester
which allows validation of platform plugin implementation. The anbox-platform-tester
performs various tests to ensure the plugin is correctly implemented and behaves the way Anbox expect it to behave.
A platform plugin dynamic library can be tested with the anbox-platform-tester
like this:
or simply run make test
in the build directory.
The platform tester will print out a detailed report of the test results.
Note: A production ready platform plugin needs to pass all test cases without exceptions.