Android系统架构分析.pptx

上传人:yyf 文档编号:3675698 上传时间:2019-09-20 格式:PPTX 页数:25 大小:1.90MB
返回 下载 相关 举报
Android系统架构分析.pptx_第1页
第1页 / 共25页
Android系统架构分析.pptx_第2页
第2页 / 共25页
Android系统架构分析.pptx_第3页
第3页 / 共25页
Android系统架构分析.pptx_第4页
第4页 / 共25页
Android系统架构分析.pptx_第5页
第5页 / 共25页
点击查看更多>>
资源描述

《Android系统架构分析.pptx》由会员分享,可在线阅读,更多相关《Android系统架构分析.pptx(25页珍藏版)》请在三一文库上搜索。

1、Android 长征开始-系统架构 分析 Android System Analysis v3 Android系统体系概述 活动用户界面部件通常对应一个屏 幕 意向接收设置并回应提示或状态改变, 并激活应用程序 服务没有前端界面的后台任务 内容提供应用程序可以共享数据 应用程序构建模块 Android框架 4 JNI JAVA C/汇编 1. 最低层是linux kernel,主要负责内存管理、进程调度 等系统管理以及终端的硬件驱动。Binder driver,google 为android设计的一个增强系统的进程间通信能力的模 块。 2. Kernel的上一层是libraries,包含了核心

2、库、第三方库和android虚 拟机。android并没有直接采用传统的j2se或j2me的java虚拟机,而是 自己建立了一个称为dalvik的虚拟机,号称更节省字节码的空间,性能 更好。但这也成为了google与sun关于java版权争议点。 3. Framework是android为应用开发者设计的一套软件框架,提供了丰富的api和一些 现成的开发元素。Framework是采用java语言实现的。在NDK出来之前,android应 用开发者基本上只能用java来开发应用。 Android使用JNI连接了libraries和framework。 4. Application就是在frame

3、work的 基础上开发的各种应用。 v6 本地库 Bionic Libc 函数库(Funtion Libraries) 本地服务(Native Servers) 硬件抽象库(Hardware Abstraction Libraries) Libraries Android includes a set of C/C+ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application fra

4、mework. Some of the core libraries are listed below: System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices Media Libraries - based on PacketVideos OpenCORE; the libraries support playback and recording of many popular audio an

5、d video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications LibWebCore - a modern web browser engine which powers both the A

6、ndroid browser and an embeddable web view SGL - the underlying 2D graphics engine 3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer FreeType - bitmap and vector fo

7、nt rendering SQLite - a powerful and lightweight relational database engine available to all applications v7 SQLite 轻量级事务数据存储 多数平台数据存储的后端 v8 Dalvik 虚拟机 完全为Android定制的虚拟机,基于QEMU 提供应用程序可移植性和运行环境的一致性 运行优化的dex格式文件和Dalvik字节码 Java .class/.jar 在创建的时候就被转换成为了 .dex 为嵌入式环境设计 支持每设备多个虚拟机进程 高度CPU优化的字节码解释器 高效内存使用 应

8、用程序框架 活动管理器 包管理器 窗口管理器 资源管理器 内容提供器 视图系统 通知管理器 电话管理器 各种服务 Application Framework By providing an open development platform, Android offers developers the ability to build extremely rich and innovative applications. Developers are free to take advantage of the device hardware, access location informati

9、on, run background services, set alarms, add notifications to the status bar, and much, much more. Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capab

10、ilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user. Underlying all applications is a set of services and systems, including: A rich and extensible set

11、of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data A Resource Manager, providing access to

12、non-code resources such as localized strings, graphics, and layout files A Notification Manager that enables all applications to display custom alerts in the status bar An Activity Manager that manages the lifecycle of applications and provides a common navigation backstack 应用程序 联系人 主页 电话 浏览器 愤怒的小鸟

13、Applications Android will ship with a set of core applications including an email client, SMS program, calendar, maps, browser, contacts, and others. All applications are written using the Java programming language. AJAX 网页应用程序 使JavaScript可直接绘图 DOM可以创建UI特效 Android目前不支持HTML5,但有Gears Google Reader Gma

14、il Android 2.2 5月19日Google I/O 2010 新特性: 全新的JIT编译器 额外的可用RAM 增强支持OpenGL ES 2.0 支持Flash 10.1 APP2SD将支持软件安装到存储卡 修复多点触摸传感器的问题 激活轨迹球闪光色彩设置 增加FM收音机支持 Android系统深入探究 一、进程管理 进程 当应用程序的第一个组件需要运行时,Android就创建 一个只包含一个线程的Linux的进程 默认情况下,应用程序的所有组件都在这个进程中的 线程中执行 每一个进程都被一个manifest file控制 当内存资源很紧张的时候,Android会暂时中止掉一些 优先

15、级较低的进程 线程 在一个进程的主线程中,所有的组件都将被初始化。 可以通过Java传统的Thread类进行创建 Android操作系统会尽量长时间的保持线程 活动控制 层次比线程和进程更高一些 如相册,短信编辑器 每个活动,包含以下四个关键状态 (1) 一个活动被放在活动栈的最上方,并且开始运行 (2) 该活动不再成为系统的焦点,但是它依然可见。系统保 存了它的状态,它处于暂停状态。然而,如果内存情况十分 糟糕,这个活动会被结束掉。 (3) 该活动已经完全模糊,几乎被另一个活动替代。系统仍 然保存了它的状态,对于用户来说,它处于不可见状态。一 旦内存需要空间,该活动就会被结束掉。 (4) 活

16、动被暂停或中止,系统将这个活动的内存收回,直接 结束该进程或者调用该活动的结束程序。 活动的状态过程 完全生命周期 开始于 onCreate(Bundle) 结束于onDestroy()。 可见生命周期 开始于onStart() 结束于onStop() 前台生命周期 开始于onResume() 结束于onPause() 服务系统 没有可视化的用户接口,而是在后台运行 继承service类的子类 音乐播放器 播放界面为活动 后台播放为服务 广播接收系统 负责接收和反馈广播信息 时间变化 电池没电 用户切换了语言模式 BroadcastReceiver的子类 二、内存管理 存储选项 开发者根据自己

17、特定的需要来选择存储解决方案 存储选项包括: 共享机制 即便应用程序中止,数据依然保存 内部存储 一旦应用程序中止,内部存储的数据会被全部删除 外部存储 可以是可插拔的移动媒体(如SD卡),或者内部的不可插拔的存储器 数据库存储 完整的SQLite数据库 网络连接 使用网络中的服务器来存储和取回数据 内容提供系统(Content provider) 帮助应用程序存储和收回数据 Android系统中共享数据的唯一方式 Android并没有提供共享存储区域 Android包含了许多类型的内容提供系统 视频,音频,图片,名片等格式 也可以创建一个自定义的内容提供系统 (ContentProvider

18、的子类) 采用数据库模型 每一行代表一个记录 每一列代表一个特定的类型或含义 三、电源管理 基于Linux的PM(Power Managerment) 允许根据目前的电池容量调整设备的配置 增加了许多新的电源管理措施 通过锁和定时器来切换系统的状态,使系统的功耗降至最低 系统正常开机后进入到AWAKE状态 背景光会从最亮慢慢调节到用户设定的亮度 系统屏幕关闭计时器开始计时 在计时时间到之前,如果有任何活动(activity)发生,如触 屏、按键等事件,则将重置计时器,系统保持在唤醒( AWAKE)状态 如果有应用程序在这段时间内申请了全唤醒锁(Full wake lock ),那么系统也将保持

19、在唤醒状态,除非用户按下电源开关 键。 在唤醒状态下如果电池电量低或者是用AC供电,屏幕关闭计时 器时间到并且选中“外接供电时保持屏幕点亮”选项,背景光 会被强制调节到渐暗(DIM)的状态 如果屏幕关闭计时器时间到并且没有全唤醒锁或者用户按了电 源开关键,那么系统状态将被切换到通知(NOTIFICATION) 系统在Sleep状态时如果检测到任何一个唤醒资源(Wakeup source), 则CPU会从睡眠状态被唤醒,并且调用相关的驱动 的恢复执行函数,接下来马上调用前期注册的early suspend驱 动的恢复执行函数,最后系统状态回到唤醒状态。 四、I/O和驱动(HAL) HAL(硬件抽

20、像层) 把Android framework与Linux kernel完全隔开 让Android不至于过度依赖Linux kernel 让Android更好的独立发展 五、Wideget引擎 微件是一种基于互联网的Web小应用 小巧轻便、易于开发、与操作系统耦合度低和功能完整 是Web2.0的典型应用之一 Iphone、Gphone、Opera、Nokia系列高端手机都在把内置微件服务作 为标配。 提供商 主流的移动软件提供商(ACCESS,Opera ,Picsel, Sun ,SurfKitchen 以 及Yahoo ) 终端厂商主导的解决方案(如:诺基亚的WebRuntime,Widse

21、ts 以及摩托 罗拉的WebUI ) 谷歌widget 使用了Javascipt及XML等技术 可运行在Android操作系统上,大大增强了Android的视图效果 Android widget的局限 功能 界面类是RemoteViews而不是View或ViewGroup 只支持少数布局和控件 布局:LinearLayout, FrameLayout, RelativeLayout 控件:button, TextView, ImageView, ImageButton, ProgressBar, AnalogClock, Chronometer(类似timer) android管理widget的策略: 只有当一个widget的所有实例都被delete了,该widget 才会被disable。否则,被delete的widget实例仍然会在 后台运行,只是界面没显示。 25

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 建筑/环境 > 装饰装潢


经营许可证编号:宁ICP备18001539号-1