Wednesday, January 19, 2011

Android Technology Native API Compatibility

Managed code running in Dalvik can call into native code provided in the application .apk file as an ELF .so file compiled for the appropriate device hardware architecture. Device implementations MUST include support for code running in the managed environment to call into native code, using the standard Java Native
Interface (JNI) semantics. The following APIs MUST be available to native code:
- libc (C library)
- libm (math library)
- JNI interface
- libz (Zlib compression)
- liblog (Android logging)
- Minimal support for C++
- Support for OpenGL, as described below


Device implementations MUST support OpenGL ES 1.0. Devices that lack hardware acceleration MUST implement OpenGL ES 1.0 using a software renderer. Device implementations SHOULD implement as much of OpenGL ES 1.1 as the device hardware supports. Device implementations SHOULD provide an implementation for OpenGL ES 2.0, if the hardware is capable of reasonable performance on those APIs.
These libraries MUST be source-compatible (i.e. header compatible) and binarycompatible (for a given processor architecture) with the versions provided in Bionic by the Android Open Source project. Since the Bionic implementations are not fully compatible with other implementations such as the GNU C library, device
implementers SHOULD use the Android implementation. If device implementers use a different implementation of these libraries, they MUST ensure header, binary, and behavioral compatibility.

Device implementations MUST accurately report the native Application Binary Interface (ABI) supported by the device, via the android.os.Build.CPU_ABI API. The ABI MUST be one of the entries documented in the latest version of the Android NDK, in the file docs/CPU-ARCH-ABIS.txt. Note that additional releases of the Android NDK may introduce support for additional ABIs. Native code compatibility is challenging. For this reason, it should be repeated that device implementers are VERY strongly encouraged to use the upstream implementations of the libraries listed above, to help ensure compatibility.

0 comments:

Post a Comment