Android基础:什么是Android?
Android is a software stack for mobile devices that includes an operating system, middleware and key applications. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java programming language.
Android是针对移动设备的一个软件栈,android包括一个操作系统,一个中间件以及一系列关键的应用。Android SDK提供了用Java编程语言在android平台上开发应用所需的工具和API。
Features 特性
- Application framework enabling reuse and replacement of components
应用框架:使能重用和可替换的组件 - Dalvik virtual machine optimized for mobile devices
Dalvik虚拟机:为移动设备而优化 - Integrated browser based on the open source WebKit engine
集成浏览器:基于开源的WebKit引擎。 - Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)
优化的图形:自定义的2D图形库;基于OpenGL ES 1.0规范的3D图形(可选的硬件加速) - SQLite for structured data storage
SQLite:结构化的数据存储 - Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
媒体支持:通用音频、视频,还有图像格式(MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF) - GSM Telephony (hardware dependent)
GSM电话:(依赖硬件) - Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
- Camera, GPS, compass, and accelerometer (hardware dependent)
照相机,GPS,指南针和加速度计:(依赖硬件) - Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE
丰富的开发环境:包括一个设备模拟器,调试工具,存储和性能简介,还有一个Eclipse IDE的插件。
Android Architecture
Android架构
The following diagram shows the major components of the Android operating system. Each section is described in more detail below.
下图展示了Android操作系统的主要组件。每个组件在下面有更详细的描述。
================================================
应用程序
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.
Android内有一系列的核心应用,包括email客户端,SMS程序,日历,地图,浏览器,电话本及其他。所有的应用都是用Java编程语言写的。
================================================
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 information, run background services, set alarms, add notifications to the status bar, and much, much more.
通过提供一个开放的开发平台,Android提供给开发者建立极其丰富和创新应用的能力。开发者自由地享有硬件设备的优势,访问本地信息,运行后台服务,设置警示,向状态栏添加通知,还有更多……
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 capabilities 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.
开发者能完全访问与核心应用所用的同一个框架APIs。应用架构被设计得能够简化组件的重用;任何应用都可以发布其功能,而其他的应用也就可以使用这些功能(安全限制主题由框架增强)。同样的机制允许用户替换组件。
Underlying all applications is a set of services and systems, including:
在所有的应用之下,有一系列的服务与系统,包括:
- A rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
丰富且可扩展的一系列视图Views,可用于建立应用;包括:lists,grids,text boxs, buttons,以及一个嵌入式的web浏览器。 - 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 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
活动管理器,管理应用的生命周期,并提供了一个通用的导航后台。
For more details and a walkthrough of an application, see the Notepad Tutorial.
更多细节,和一个应用的演练,请看“记事本教程”。
=================================================
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 framework. Some of the core libraries are listed below:
Android包括了一个c/c++库的集合,她们被Android系统的众多组件所使用。通过Android的应用框架,这些功能被开放给开发者。其中的一些核心库如下:
- System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
系统C库——一个继承自BSD的标准C系统实现(libc),被调整成面向基于linux的嵌入式设备。 - Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
媒体库——基于PacketVideo's OpenCORE;该库支持许多流行音频/视频的录制与回放,当然还支持静态的图片文件,包括 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
表面管理器——管理显示子系统,并能无缝地组合多个应用的2D和3D图像层。 - LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
LibWebCore——一个流行的web浏览器引擎,她同时支持Android浏览器和嵌入式的web视图。 - SGL - the underlying 2D graphics engine
SGL——底层的2D图像引擎 - 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
3D libraries——基于OpenGL ES 1.0 APIs的一个实现;该库或是使用硬件的3D加速,或是使用内置的高度优化的3D软件光栅。 - FreeType - bitmap and vector font rendering
FreeType —— 位图和矢量字体渲染 - SQLite - a powerful and lightweight relational database engine available to all applications
SQLite —— 一个强大而轻量的关系数据库引擎,对所有应用可用。
===============================================
Android Runtime 运行时
Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.
Android包括一个核心库的集合,她们提供了Java编程语言的核心库中的绝大多数功能。
Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.
每一个Android应用都在她自己的进程中运行,该进程也属于某个Dalvik虚拟机的实例。Dalvik被设计成能让设备高效地运行多个虚拟机。Dalvik虚拟机执行的是.dex结尾的Dalvik可执行文件格式,该格式被优化为最小内存使用。虚拟机是基于寄存器的,并且运行那些Java编程语言所编译的类,这些类被内置的dx工具转换为.dex格式。
The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.
Dalvik虚拟机依赖Linux内核来提供底层的功能,比如线程和低级内存管理。
===============================================
Linux Kernel
Linux内核
Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model. The kernel also acts as an abstraction layer between the hardware and the rest of the software stack.
Android依赖Linux 2.6来提供核心系统服务,比如安全、存储管理、进程管理、网络栈和驱动模型。该内核同时扮演着介于硬件和软件栈的其余部分之间的一个抽象层。
(下集预告:框架论题:应用基础)