一个基于 Linux 的 Android 兼容层的设计与实现
江帆 · 2017
Absence of applications’ variety is a key reason why desktop Linux distributions aren’t popular among desktop operating system users. To overcome this problem, two main technologies, which are system virtual machine and compatibility layer, are adopted to solve applications’ cross platform running. System virtual machine need to run an entire additional operating system and user space environment in a VM just to run one app, which imposes high performance overhead. Thus, the goal of this thesis is to develop a compatibility layer which allow Android applications to run on desktop Linux distributions as native processes. Besides taking advantage of the high performance hardware of desktop system, some key points are concerned to promote the compatibility of the layer. A traditional method of building a compatibility layer is summarized by analyzing multiple existing ones. Based on a thorough analysis of Android system architecture, this thesis put forward a technical route of the Android compatibility layer: 1) to run Java virtual machine of Android on x86 architecture, 2) to run core system services of Android on desktop environment, 3) organize all components by the fashion of Android boot process. Both Android and desktop Linux distributions are built on the top of the Linux kernel. Based on the multi-architecture support of Bionic C, we can get binary and ABI compatibility easily to support Android native programs and run Android’s Java virtual machine on x86 furthermore. Using ART as the default Java VM and translating arm libraries on the fly through Intel Houdini, we successfully make JNI call arm libraries on x86 architecture. This promotes compatibility significantly. Apps cannot run on desktop environment properly without the support of Android system Services. Huge gap of software and hardware between Android devices and desktop Linux systems makes it difficult to transplant Android services to the desktop environment. SurfaceFlinger, the composing service, together with the InputManagerService should be paid great attention among the services. This thesis puts forward a compact method to transplant the SurfaceFlinger, which allows the Android UI rendering process and SurfaceFlinger's graphic compositing process to use GPU for hardware acceleration. It’s far more concise than existing method. By translating events from X Window System to Linux raw event to emulate touchscreen events which can be recognized by the InputManagerService, user can use mouse to interact with Android applications. The compatibility layer also provides a multi-window architecture to let user use several Apps simultaneously. All the components of the system are organized by the fashion of Android boot process. A prototype built on these compatibility mechanisms shows better compatibility and graphic performance than existing ones. It allows user to use multiple Apps the same time and interact with them like other desktop applications.
Cited by 0 works.