CORC  > 软件研究所  > 基础软件国家工程研究中心  > 学位论文
题名一个基于 Linux 的 Android 兼容层的设计与实现
作者江帆
学位类别硕士
答辩日期2017-05
授予单位中国科学院大学
授予地点北京
导师贺也平
关键词Android Linux 操作系统兼容性 移植
学位专业计算机软件与理论
中文摘要

应用程序少是基于 GNU/Linux 的各种桌面发行版没能在桌面操作系统领域大量流行的重要原因。借用其他平台的应用程序是解决桌面 Linux 系统应用程序少的一种思路。一般使用系统虚拟机和兼容层技术解决应用程序跨平台执行的问题。系统虚拟机因为要在 host 系统运行一个完整的 guest 系统而带来很高的额外性能开销。本文目标是设计并实现一个 Android 兼容层,旨在使 Android 应用程序不经修改即可在桌面Linux系统上以本地进程的形式运行,在充分利用桌面系统的高性能硬件资源的同时,兼顾一些影响兼容性的关键技术。

通过分析现有兼容层技术,总结出兼容层技术地一般方法。在详细分析 Android系统架构的基础上,提出 Android 兼容层的技术路线:1)使 Android Java 虚拟机在x86 架构下运行;2)使 Android 系统服务在桌面环境下运行;3)以 Android 系统开机过程为线索组织各个组件。

Android 和桌面 Linux 发行版一样使用 Linux 作为系统内核。通过面向 x86 架构编译 AOSP 源码,并基于 Bionic C 的多架构支持可以解决二进制文件兼容和系统调用支持问题,实现 Android 本地程序在桌面 Linux 系统上执行。进而实现 Android Java虚拟机在桌面 x86 架构下执行。本文以 ART 作为默认 Java 虚拟机,以 Intel Houdini作为动态二进制翻译机制,并使用 NativeBridge 将两者解耦,成功实现 JNI 在 x86 架构下调用 arm 共享库的问题,极大的增加了系统兼容性。

Android 应用程序在桌面 Linux 系统上的正确执行离不开 Android 系统服务的支持。Android 设备和桌面 Linux 系统软硬件环境的巨大差异使得一些系统服务并不能通过简单的交叉编译移植到桌面环境执行。其中最值得关注的是 Android 的图形合成系统 SurfaceFlinger 和输入系统 InputManagerService。本文提出一种比现有方案更加简洁高效的图形系统移植方案,实现了 Android 应用程序的 UI 渲染过程和SurfaceFlinger 的图像合成过程能均够使用 GPU 进行硬件加速。通过将 X Window 鼠标事件模拟为 InputManagerService 可识别的触屏点击事件,实现通过鼠标和 Android应用进行交互。此外,在深入分析 Android GUI 系统的基础上,给出一种简洁的多窗口架构,使用户可以同时使用多个 Android 应用程序。

最后,在研究 Android 系统开机过程的基础上,通过定制 Init 进程的行为,有序组织 Android 兼容层的各个组件。

基于这些关键技术,本文开发了一个 Android 兼容层原型。相对于已有 Android兼容层方案,该原型具备更好地兼容性和图形性能,用户能像桌面应用程序一样和Android 应用程序交互,并可同时使用多个 Android 应用。

英文摘要

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.

内容类型学位论文
源URL[http://ir.iscas.ac.cn/handle/311060/18900]  
专题软件研究所_基础软件国家工程研究中心_学位论文
作者单位中国科学院软件研究所
推荐引用方式
GB/T 7714
江帆. 一个基于 Linux 的 Android 兼容层的设计与实现[D]. 北京. 中国科学院大学. 2017.
个性服务
查看访问统计
相关权益政策
暂无数据
收藏/分享
所有评论 (0)
暂无评论
 

除非特别说明,本系统中所有内容都受版权保护,并保留所有权利。


©版权所有 ©2017 CSpace - Powered by CSpace