blob: e433f1c4a52af5811e24726e6558a91fb0176236 [file] [log] [blame]
Clay Murphyf9d451e2014-10-21 18:11:12 -07001page.title=Android Interfaces
Robert Ly35f2fda2013-01-29 16:27:05 -08002@jd:body
3
4<!--
Heidi von Markham1e7b8b72015-03-09 10:13:48 -07005 Copyright 2015 The Android Open Source Project
Robert Ly35f2fda2013-01-29 16:27:05 -08006
7 Licensed under the Apache License, Version 2.0 (the "License");
8 you may not use this file except in compliance with the License.
9 You may obtain a copy of the License at
10
11 http://www.apache.org/licenses/LICENSE-2.0
12
13 Unless required by applicable law or agreed to in writing, software
14 distributed under the License is distributed on an "AS IS" BASIS,
15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 See the License for the specific language governing permissions and
17 limitations under the License.
18-->
19<div id="qv-wrapper">
20 <div id="qv">
21 <h2>In this document</h2>
22 <ol id="auto-toc">
23 </ol>
24 </div>
25</div>
26
Heidi von Markhama8481622015-04-13 12:26:23 -070027<p>
28Android gives you the freedom to implement your own device specifications and
29drivers. The hardware abstraction layer (HAL) provides a standard method for
30creating software hooks between the Android platform stack and your hardware.
31The Android operating system is also open source, so you can contribute your own
32interfaces and enhancements.
33</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080034
Heidi von Markhama8481622015-04-13 12:26:23 -070035<p>
36To ensure devices maintain a high level of quality and offer a consistent user
37experience, each device must pass tests in the compatibility test suite (CTS).
38The CTS verifies devices meet a quality standard that ensures apps run reliably
39and users have a good experience. For details on the CTS, see
40<a href="{@docRoot}compatibility/index.html">Compatibility</a>.
41</p>
Robert Ly35f2fda2013-01-29 16:27:05 -080042
Heidi von Markhama8481622015-04-13 12:26:23 -070043<h2 id="Android system architecture">Android system architecture</h2>
Robert Ly35f2fda2013-01-29 16:27:05 -080044
Heidi von Markhama8481622015-04-13 12:26:23 -070045<p>
46Before porting Android to your hardware, take a moment to understand the Android
47system architecture at a high level. Because your drivers and the HAL interact
48with Android, knowing how Android works can help you navigate the many layers of
49code in the Android Open Source Project (AOSP) source tree.
Robert Ly35f2fda2013-01-29 16:27:05 -080050</p>
51
Heidi von Markham1e7b8b72015-03-09 10:13:48 -070052<img src="images/ape_fwk_all.png">
Robert Ly35f2fda2013-01-29 16:27:05 -080053
54<p class="img-caption"><strong>Figure 1.</strong> Android System Architecture</p>
55
Heidi von Markhama8481622015-04-13 12:26:23 -070056<h3 id="Application framework">Application framework</h3>
Heidi von Markham1e7b8b72015-03-09 10:13:48 -070057<p>
Heidi von Markhama8481622015-04-13 12:26:23 -070058The application framework is used most often by application developers. As a
59hardware developer, you should be aware of developer APIs as many map directly
60to the underlying HAL interfaces and can provide helpful information about
61implementing drivers.
Robert Ly35f2fda2013-01-29 16:27:05 -080062</p>
Heidi von Markhama8481622015-04-13 12:26:23 -070063
64<h3 id="Binder IPC">Binder IPC</h3>
65<p>
66The Binder Inter-Process Communication (IPC) mechanism allows the application
67framework to cross process boundaries and call into the Android system services
68code. This enables high level framework APIs to interact with Android system
69services. At the application framework level, this communication is hidden from
70the developer and things appear to "just work."
Clay Murphy768b82a2013-11-12 11:32:41 -080071</p>
Heidi von Markhama8481622015-04-13 12:26:23 -070072
73<h3 id="System services">System services</h3>
74<p>
75Functionality exposed by application framework APIs communicates with system
76services to access the underlying hardware. Services are modular, focused
77components such as Window Manager, Search Service, or Notification Manager.
78Android includes two groups of services: <em>system</em> (services such as
79Window Manager and Notification Manager) and <em>media</em> (services involved
80in playing and recording media).
81</p>
82
83<h3 id="Hardware Abstraction Layer">Hardware abstraction layer (HAL)</h3>
84<p>
85The HAL is a standard interface that allows the Android system to call into the
86device driver layer while being agnostic about the lower-level implementations
87of drivers and hardware.
88</p>
89
90<img src="images/ape_fwk_hal.png">
91
92<p class="img-caption"><strong>Figure 2.</strong> Hardware abstraction layer
93(HAL) components</p>
94
95<p>
96You must implement the corresponding HAL (and driver) for the specific hardware
97your product provides. HAL implementations are typically built into shared
98library modules (<code>.so</code> files). Android does not mandate a standard
99interaction between your HAL implementation and your device drivers, so you have
100free reign to do what is best for your situation. However, to enable the Android
101system to correctly interact with your hardware, you <strong>must</strong> abide
102by the contract defined in each hardware-specific HAL interface.
103</p>
104
105<h3 id="Linux kernel">Linux Kernel</h3>
106<p>
107Developing your device drivers is similar to developing a typical Linux device
108driver. Android uses a version of the Linux kernel with a few special additions
109such as wake locks (a memory management system that is more agressive in
110preserving memory), the Binder IPC driver, and other features important for a
111mobile embedded platform. These additions are primarily for system functionality
112and do not affect driver development.
113
114<p>
115You can use any version of the kernel as long as it supports the required
116features (such as the binder driver). However, we recommend using the latest
117version of the Android kernel. For details on the latest Android kernel, see <a href="{@docRoot}source/building-kernels.html" >Building Kernels</a>.
118</p>