Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 1 | page.title=Android 3.1 Platform |
| 2 | sdk.platform.version=3.1 |
| 3 | sdk.platform.apiLevel=12 |
| 4 | @jd:body |
| 5 | |
| 6 | <div id="qv-wrapper"> |
| 7 | <div id="qv"> |
| 8 | |
| 9 | <h2>In this document</h2> |
| 10 | <ol> |
| 11 | <li><a href="#relnotes">Revisions</a></li> |
| 12 | <li><a href="#api">API Overview</a></li> |
| 13 | <li><a href="#api-level">API Level</a></li> |
| 14 | <li><a href="#apps">Built-in Applications</a></li> |
| 15 | <li><a href="#locs">Locales</a></li> |
| 16 | <li><a href="#skins">Emulator Skins</a></li> |
| 17 | </ol> |
| 18 | |
| 19 | <h2>Reference</h2> |
| 20 | <ol> |
| 21 | <li><a |
Dirk Dougherty | a43c477 | 2011-06-26 17:14:12 -0700 | [diff] [blame] | 22 | href="{@docRoot}sdk/api_diff/12/changes.html">API |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 23 | Differences Report »</a> </li> |
| 24 | </ol> |
| 25 | |
| 26 | <h2>See Also</h2> |
| 27 | <ol> |
| 28 | <li><a href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing |
Dirk Dougherty | a43c477 | 2011-06-26 17:14:12 -0700 | [diff] [blame] | 29 | Apps for Android 3.x</a></li> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 30 | </ol> |
| 31 | |
| 32 | </div> |
| 33 | </div> |
| 34 | |
| 35 | |
| 36 | <p><em>API Level:</em> <strong>{@sdkPlatformApiLevel}</strong></p> |
| 37 | |
| 38 | <p>For developers, the Android {@sdkPlatformVersion} platform is available as a |
| 39 | downloadable component for the Android SDK. The downloadable platform includes |
| 40 | an Android library and system image, as well as a set of emulator skins and |
| 41 | more. The downloadable platform includes no external libraries.</p> |
| 42 | |
| 43 | <p>To get started developing or testing against Android {@sdkPlatformVersion}, |
| 44 | use the Android SDK Manager to download the platform into your SDK. For more |
| 45 | information, see <a href="{@docRoot}sdk/adding-components.html">Adding SDK |
| 46 | Components</a>. If you are new to Android, <a |
| 47 | href="{@docRoot}sdk/index.html">download the SDK Starter Package</a> first.</p> |
| 48 | |
| 49 | <p>For a high-level introduction to Android {@sdkPlatformVersion}, see the <a |
| 50 | href="{@docRoot}sdk/android-{@sdkPlatformVersion}-highlights.html">Platform |
| 51 | Highlights</a>.</p> |
| 52 | |
| 53 | <p class="note"><strong>Reminder:</strong> If you've already published an |
| 54 | Android application, please test and optimize your application on Android 3.0 |
| 55 | and Android 3.1 as soon as possible. You should do so to be sure your |
| 56 | application provides the best experience possible on the latest Android-powered |
| 57 | devices. For information about what you can do, read <a |
| 58 | href="{@docRoot}guide/practices/optimizing-for-3.0.html">Optimizing Apps for |
| 59 | Android 3.0</a>.</p> |
| 60 | |
| 61 | |
| 62 | <h2 id="relnotes">Revisions</h2> |
| 63 | |
| 64 | <p>To determine what revision of the Android {@sdkPlatformVersion} platform you |
| 65 | have installed, refer to the "Installed Packages" listing in the Android SDK and |
| 66 | AVD Manager.</p> |
| 67 | |
| 68 | |
| 69 | <div class="toggle-content opened" style="padding-left:1em;"> |
| 70 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 71 | <p><a href="#" onclick="return toggleContent(this)"> |
| 72 | <img src="{@docRoot}assets/images/triangle-opened.png" |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 73 | class="toggle-content-img" alt="" /> |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 74 | Android {@sdkPlatformVersion}, Revision 3</a> <em>(July 2011)</em> |
| 75 | </a></p> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 76 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 77 | <div class="toggle-content-toggleme" style="padding-left:2em;"> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 78 | |
| 79 | <dl> |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 80 | <dt>Dependencies:</dt> |
| 81 | <dd> |
| 82 | <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r12</a> or |
| 83 | higher.</p> |
| 84 | </dd> |
| 85 | <dt>Notes:</dt> |
| 86 | <dd> |
| 87 | <p>Improvements to the platform's rendering library to support the visual layout editor in the ADT |
| 88 | Eclipse plugin. This revision allows for more drawing features in ADT and fixes several |
| 89 | bugs in the previous rendering library. It also unlocks several editor features that were added in |
| 90 | ADT 12.</p> |
| 91 | </dd> |
| 92 | </dl> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 93 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 94 | </div> |
| 95 | </div> |
| 96 | |
| 97 | |
| 98 | <div class="toggle-content closed" style="padding-left:1em;"> |
| 99 | |
| 100 | <p><a href="#" onclick="return toggleContent(this)"> |
| 101 | <img src="{@docRoot}assets/images/triangle-closed.png" |
| 102 | class="toggle-content-img" alt="" /> |
| 103 | Android {@sdkPlatformVersion}, Revision 2</a> <em>(May 2011)</em> |
| 104 | </a></p> |
| 105 | |
| 106 | <div class="toggle-content-toggleme" style="padding-left:2em;"> |
| 107 | |
| 108 | <dl> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 109 | <dt>Dependencies:</dt> |
| 110 | <dd> |
| 111 | <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r11</a> or |
| 112 | higher.</p> |
| 113 | </dd> |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 114 | <dt>Notes:</dt> |
| 115 | <dd> |
| 116 | <p>Fixes an issue with the visual layout editor rendering library that prevented Android 3.1 from |
| 117 | running in ADT.</p> |
| 118 | </dd> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 119 | </dl> |
| 120 | |
Scott Main | 5465e05 | 2011-07-26 18:29:44 -0700 | [diff] [blame] | 121 | </div> |
| 122 | </div> |
| 123 | |
| 124 | |
| 125 | <div class="toggle-content closed" style="padding-left:1em;"> |
| 126 | |
| 127 | <p><a href="#" onclick="return toggleContent(this)"> |
| 128 | <img src="{@docRoot}assets/images/triangle-closed.png" |
| 129 | class="toggle-content-img" alt="" /> |
| 130 | Android {@sdkPlatformVersion}, Revision 1</a> <em>(May 2011)</em> |
| 131 | </a></p> |
| 132 | |
| 133 | <div class="toggle-content-toggleme" style="padding-left:2em;"> |
| 134 | |
| 135 | <dl> |
| 136 | <dt>Dependencies:</dt> |
| 137 | <dd> |
| 138 | <p>Requires <a href="{@docRoot}sdk/tools-notes.html">SDK Tools r11</a> or |
| 139 | higher.</p> |
| 140 | </dd> |
| 141 | </dl> |
| 142 | |
| 143 | </div> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 144 | </div> |
| 145 | |
| 146 | |
| 147 | <h2 id="#api" style="margin-top:1.5em;">API Overview</h2> |
| 148 | |
| 149 | <p>The sections below provide a technical overview of what's new for developers |
| 150 | in Android 3.1, including new features and changes in the framework API since |
| 151 | the previous version.</p> |
| 152 | |
| 153 | <h3 id="usb">USB APIs</h3> |
| 154 | |
| 155 | <p>Android 3.1 introduces powerful new APIs for |
| 156 | integrating connected peripherals with applications running on the platform. |
| 157 | The APIs are based on a USB (Universal Serial Bus) stack and services that are |
| 158 | built into the platform, including support for both USB host and device |
| 159 | interactions. Using the APIs, developers can create applications that are able to |
| 160 | discover, communicate with, and manage a variety of device types connected over |
| 161 | USB. </p> |
| 162 | |
| 163 | <p>The stack and APIs distinguish two basic types of USB hardware, based on |
Dirk Dougherty | 58610ba | 2011-05-16 10:41:34 -0700 | [diff] [blame] | 164 | whether the Android-powered device is acting as host or the external hardware |
| 165 | is acting as host: </p> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 166 | |
| 167 | <ul> |
| 168 | <li>A <em>USB device</em> is a piece of connected hardware that depends on the |
| 169 | Android-powered device to serve as host. For example, most input devices, mice, |
| 170 | and joysticks are USB devices, as are many cameras, hubs, and so on.</li> |
| 171 | <li>A <em>USB accessory</em> is a piece of connected hardware that has a USB |
| 172 | host controller, provides power, and is designed to communicate with |
| 173 | Android-powered devices over USB, A variety of peripherals can connect as |
| 174 | accessories, from robotics controllers to musical equipment, exercise bicycles, |
| 175 | and more.</li> |
| 176 | </ul> |
| 177 | |
| 178 | <p>For both types — USB devices and USB accessories — the |
| 179 | platform's USB APIs support discovery by intent broadcast when attached or |
| 180 | detached, as well as standard interfaces, endpoints, and transfer modes |
| 181 | (control, bulk, and interrupt).</p> |
| 182 | |
| 183 | <p>The USB APIs are available in the package {@link android.hardware.usb}. The |
| 184 | central class is {@link android.hardware.usb.UsbManager}, which provides |
| 185 | helper methods for identifying and communicating with |
| 186 | both USB devices and USB accessories. Applications can acquire an instance of |
| 187 | {@link android.hardware.usb.UsbManager} and then query for the list of attached |
| 188 | devices or accessories and then communicate with or manage them. |
| 189 | {@link android.hardware.usb.UsbManager} also declares intent actions that the |
| 190 | system broadcasts, to announce when a USB device or accessory is attached or |
| 191 | detached.</p> |
| 192 | |
| 193 | <p>Other classes include:</p> |
| 194 | |
| 195 | <ul> |
| 196 | <li>{@link android.hardware.usb.UsbDevice}, a class representing external |
| 197 | hardware connected as a USB device (with the Android-powered device acting as |
| 198 | host).</li> |
| 199 | <li>{@link android.hardware.usb.UsbAccessory}, representing external hardware |
| 200 | connected as the USB host (with the Android-powered device acting as a USB |
| 201 | device).</li> |
| 202 | <li>{@link android.hardware.usb.UsbInterface} and {@link |
| 203 | android.hardware.usb.UsbEndpoint}, which provide access to standard USB |
| 204 | interfaces and endpoints for a device.</li> |
| 205 | <li>{@link android.hardware.usb.UsbDeviceConnection} and {@link |
| 206 | android.hardware.usb.UsbRequest}, for sending and receiving data and control |
| 207 | messages to or from a USB device, sychronously and asynchronously. |
| 208 | <li>{@link android.hardware.usb.UsbConstants}, which provides constants for |
| 209 | declaring endpoint types, device classes, and so on.</li> |
| 210 | </ul> |
| 211 | |
| 212 | <p>Note that although the USB stack is built into the platform, actual support |
| 213 | for USB host and open accessory modes on specific devices is determined by |
| 214 | their manufacturers. In particular, host mode relies on appropriate USB |
| 215 | controller hardware in the Android-powered device. </p> |
| 216 | |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 217 | <p>Additionally, developers can request filtering on Google Play, such that |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 218 | their applications are not availabe to users whose devices do not provide the |
| 219 | appropriate USB support. To request filtering, add one or both of the elements |
| 220 | below to the application manifest, as appropriate: </p> |
| 221 | |
| 222 | <ul> |
| 223 | <li>If the application should only be visible to devices that support USB |
| 224 | host mode (connection of USB devices), declare this element: |
| 225 | <p style="margin-left:1.5em;"><code><uses-feature |
| 226 | android:name="android.hardware.usb.host" |
| 227 | android:required="true"></code></p> |
| 228 | </li> |
| 229 | <li>If the application should only be visible to devices that support USB |
| 230 | accessories (connection of USB hosts), declare this element: |
| 231 | <p style="margin-left:1.5em;"><code><uses-feature |
| 232 | android:name="android.hardware.usb.accessory" |
| 233 | android:required="true"></code></p> |
| 234 | </li> |
| 235 | </ul> |
| 236 | |
| 237 | <p>For complete information about how to develop applications that interact with |
| 238 | USB accessories, please see the |
| 239 | <a href="{@docRoot}guide/topics/usb/index.html">developer documentation</a>.</p> |
| 240 | |
| 241 | <p class="note">To look at sample applications that use the USB host API, see <a |
| 242 | href="{@docRoot}resources/samples/USB/AdbTest/index.html">ADB Test</a> and <a |
| 243 | href="{@docRoot}resources/samples/USB/MissileLauncher/index.html">Missile |
| 244 | Launcher</a></p> |
| 245 | |
| 246 | <h3>MTP/PTP API</h3> |
| 247 | |
| 248 | <p>Android 3.1 exposes a new MTP API that lets applications interact directly |
| 249 | with connected cameras and other PTP devices. The new API makes it easy for an |
| 250 | application to receive notifications when devices are attached and removed, |
| 251 | manage files and storage on those devices, and transfer files and metadata to |
| 252 | and from them. The MTP API implements the PTP (Picture Transfer Protocol) subset |
| 253 | of the MTP (Media Transfer Protocol) specification.</p> |
| 254 | |
| 255 | <p>The MTP API is available in the {@link android.mtp} package and provides |
| 256 | these classes: </p> |
| 257 | |
| 258 | <ul> |
| 259 | <li>The {@link android.mtp.MtpDevice} encapsulates an MTP device that is |
| 260 | connected over the USB host bus. An application can instantiate an object of |
| 261 | this type and then use its methods to get information about the device and |
| 262 | objects stored on it, as well as opening the connection and transferring data. |
| 263 | Some of the methods include: |
| 264 | <ul> |
| 265 | <li>{@link android.mtp.MtpDevice#getObjectHandles(int, int, int) |
| 266 | getObjectHandles()} returns a list of handles for all objects on the device that |
| 267 | match a specified format and parent. To get information about an object, an |
| 268 | application can pass a handle to {@link android.mtp.MtpDevice#getObjectInfo(int) |
| 269 | getObjectInfo()}.</li> |
| 270 | <li>{@link android.mtp.MtpDevice#importFile(int, java.lang.String) |
| 271 | importFile()} lets an application copy data for an object to a file in external |
| 272 | storage. This call may block for an arbitrary amount of time depending on the |
| 273 | size of the data and speed of the devices, so should be made from a spearate |
| 274 | thread.</li> |
| 275 | <li>{@link |
| 276 | android.mtp.MtpDevice#open(android.hardware.usb.UsbDeviceConnection) open()} |
| 277 | lets an application open a connected MTP/PTP device. </li> |
| 278 | <li>{@link android.mtp.MtpDevice#getThumbnail(int) getThumbnail()} returns |
| 279 | the thumbnail of the object as a byte array. </li> |
| 280 | </ul> |
| 281 | </li> |
| 282 | <li>{@link android.mtp.MtpStorageInfo} holds information about about a storage |
| 283 | unit on an MTP device, corresponding to the StorageInfo Dataset described in |
| 284 | section 5.2.2 of the MTP specification. Methods in the class let an application |
| 285 | get a storage unit’s description string, free space, maximum storage capacity, |
| 286 | storage ID, and volume identifier.</li> |
| 287 | <li>{@link android.mtp.MtpDeviceInfo} holds information about an MTP device |
| 288 | corresponding to the DeviceInfo Dataset described in section 5.1.1 of the MTP |
| 289 | specification. Methods in the class let applications get a device’s |
| 290 | manufacturer, model, serial number, and version.</li> |
| 291 | <li>{@link android.mtp.MtpObjectInfo} holds information about an object stored |
| 292 | on an MTP device, corresponding to the ObjectInfo Dataset described in section |
| 293 | 5.3.1 of the MTP specification. Methods in the class let applications get an |
| 294 | object’s size, data format, association type, creation date, and thumbnail |
| 295 | information.</li> |
| 296 | <li>{@link android.mtp.MtpConstants} provides constants for declaring MTP file |
| 297 | format codes, association type, and protection status.</li> |
| 298 | </ul> |
| 299 | |
| 300 | <h3 id="motionevents">Support for new input devices and motion events</h3> |
| 301 | |
| 302 | <p>Android 3.1 extends the input subsystem to support new input devices and new |
| 303 | types of motion events, across all views and windows. Developers can build on |
| 304 | these capabilities to let users interact with their applications using mice, |
| 305 | trackballs, joysticks, gamepads, and other devices, in addition to keyboards and |
| 306 | touchscreens. </p> |
| 307 | |
| 308 | <p>For handling mouse, scrollwheel, and trackball input, the platform supports |
| 309 | two new motion event actions:</p> |
| 310 | <ul> |
| 311 | <li>{@link android.view.MotionEvent#ACTION_SCROLL}, which describes the pointer |
| 312 | location at which a non-touch scroll motion, such as from a mouse scroll wheel, |
| 313 | took place. In the MotionEvent, the value of the {@link |
| 314 | android.view.MotionEvent#AXIS_HSCROLL} and {@link |
| 315 | android.view.MotionEvent#AXIS_VSCROLL} axes specify the relative scroll |
| 316 | movement. </li> |
| 317 | <li>{@link android.view.MotionEvent#ACTION_HOVER_MOVE}, reports the current |
| 318 | position of the mouse when no buttons are pressed, as well as any intermediate |
| 319 | points since the last <code>HOVER_MOVE</code> event. Hover enter and exit |
| 320 | notifications are not yet supported.</li> |
| 321 | </ul> |
| 322 | |
| 323 | <p>To support joysticks and gamepads, the {@link android.view.InputDevice} class |
| 324 | includes these new input device sources:</p> |
| 325 | <ul> |
| 326 | <li>{@link android.view.InputDevice#SOURCE_CLASS_JOYSTICK} — the source |
| 327 | device has joystick axes.</li> |
| 328 | <li>{@link android.view.InputDevice#SOURCE_CLASS_BUTTON} — the source |
| 329 | device has buttons or keys.</li> |
| 330 | <li>{@link android.view.InputDevice#SOURCE_GAMEPAD} — the source device |
| 331 | has gamepad buttons such as {@link android.view.KeyEvent#KEYCODE_BUTTON_A} |
| 332 | or {@link android.view.KeyEvent#KEYCODE_BUTTON_B}. Implies |
| 333 | {@link android.view.InputDevice#SOURCE_CLASS_BUTTON}</li> |
| 334 | <li>{@link android.view.InputDevice#SOURCE_JOYSTICK} — the source device |
| 335 | has joystick axes. Implies SOURCE_CLASS_JOYSTICK.</li> |
| 336 | </ul> |
| 337 | |
| 338 | <p>To describe motion events from these new sources, as well as those from mice |
| 339 | and trackballs, the platform now defines axis codes on {@link |
| 340 | android.view.MotionEvent}, similar to how it defines key codes on {@link |
| 341 | android.view.KeyEvent}. New axis codes for joysticks |
| 342 | and game controllers include |
| 343 | {@link android.view.MotionEvent#AXIS_HAT_X}, {@link |
| 344 | android.view.MotionEvent#AXIS_HAT_Y}, {@link |
| 345 | android.view.MotionEvent#AXIS_RTRIGGER}, {@link |
| 346 | android.view.MotionEvent#AXIS_ORIENTATION}, {@link |
| 347 | android.view.MotionEvent#AXIS_THROTTLE}, and many others. |
| 348 | Existing {@link android.view.MotionEvent} axes are represented by {@link |
| 349 | android.view.MotionEvent#AXIS_X}, {@link android.view.MotionEvent#AXIS_Y}, |
| 350 | {@link android.view.MotionEvent#AXIS_PRESSURE}, {@link |
| 351 | android.view.MotionEvent#AXIS_SIZE}, {@link |
| 352 | android.view.MotionEvent#AXIS_TOUCH_MAJOR}, {@link |
| 353 | android.view.MotionEvent#AXIS_TOUCH_MINOR}, {@link |
| 354 | android.view.MotionEvent#AXIS_TOOL_MAJOR}, {@link |
| 355 | android.view.MotionEvent#AXIS_TOOL_MINOR}, and {@link |
| 356 | android.view.MotionEvent#AXIS_ORIENTATION}.</p> |
| 357 | |
| 358 | <p>Additionally, {@link android.view.MotionEvent} defines a number of generic |
| 359 | axis codes that are used when the framework does not know how to map a |
| 360 | particular axis. Specific devices can use the generic axis codes to pass custom |
| 361 | motion data to applications. For a full list of axes and their intended |
| 362 | interpretations, see the {@link android.view.MotionEvent} class documentation. |
| 363 | </p> |
| 364 | |
| 365 | <p>The platform provides motion events to applications in batches, so a single |
| 366 | event may contain a current position and multiple so-called historical movements. |
| 367 | Applications should use {@link android.view.MotionEvent#getHistorySize()} to get |
| 368 | the number of historical samples, then retrieve and process all historical |
| 369 | samples in order using {@link |
| 370 | android.view.MotionEvent#getHistoricalAxisValue(int, int, int) |
| 371 | getHistoricalAxisValue()}. After that, applications should process the current |
| 372 | sample using {@link android.view.MotionEvent#getAxisValue(int) getAxisValue()}. |
| 373 | </p> |
| 374 | |
| 375 | <p>Some axes can be retrieved using special accessor methods. For example, |
| 376 | instead of calling {@link android.view.MotionEvent#getAxisValue(int) |
| 377 | getAxisValue()}, applications can call {@link android.view.MotionEvent#getX(int) |
| 378 | getX()}. Axes that have built-in accessors include {@link |
| 379 | android.view.MotionEvent#AXIS_X}, {@link android.view.MotionEvent#AXIS_Y}, |
| 380 | {@link android.view.MotionEvent#AXIS_PRESSURE}, {@link |
| 381 | android.view.MotionEvent#AXIS_SIZE}, {@link |
| 382 | android.view.MotionEvent#AXIS_TOUCH_MAJOR}, {@link |
| 383 | android.view.MotionEvent#AXIS_TOUCH_MINOR}, {@link |
| 384 | android.view.MotionEvent#AXIS_TOOL_MAJOR}, {@link |
| 385 | android.view.MotionEvent#AXIS_TOOL_MINOR}, and {@link |
| 386 | android.view.MotionEvent#AXIS_ORIENTATION}.</p> |
| 387 | |
| 388 | <p>Each input device has a unique, system-assigned ID and may also provide |
| 389 | multiple sources. When a device provides multiple sources, more than one source |
| 390 | can provide axis data using the same axis. For example, a touch event coming |
| 391 | from the touch source uses the X axis for screen position data, while a joystick |
| 392 | event coming from the joystick source will use the X axis for the stick position |
| 393 | instead. For this reason, it's important for applications to interpret axis |
| 394 | values according to the source from which they originate. When handling a motion |
| 395 | event, applications should use methods on the {@link android.view.InputDevice} |
| 396 | class to determine the axes supported by a device or source. Specifically, |
| 397 | applications can use {@link android.view.InputDevice#getMotionRanges() |
| 398 | getMotionRanges()} to query for all axes of a device or all axes of a given |
| 399 | source of the device. In both cases, the range information for axes returned in |
| 400 | the {@link android.view.InputDevice.MotionRange} object specifies the source for |
| 401 | each axis value.</p> |
| 402 | |
| 403 | <p>Finally, since the motion events from joysticks, gamepads, mice, and |
| 404 | trackballs are not touch events, the platform adds a new callback method for |
| 405 | passing them to a {@link android.view.View} as "generic" motion events. |
| 406 | Specifically, it reports the non-touch motion events to |
| 407 | {@link android.view.View}s through a call to {@link |
| 408 | android.view.View#onGenericMotionEvent(android.view.MotionEvent) |
| 409 | onGenericMotionEvent()}, rather than to {@link |
| 410 | android.view.View#onTouchEvent(android.view.MotionEvent) |
| 411 | onTouchEvent()}.</p> |
| 412 | |
| 413 | <p>The platform dispatches generic motion events differently, depending on the |
| 414 | event source class. {@link android.view.InputDevice#SOURCE_CLASS_POINTER} events |
| 415 | go to the {@link android.view.View} under the pointer, similar to how touch |
| 416 | events work. All others go to the currently focused {@link android.view.View}. |
| 417 | For example, this means a {@link android.view.View} must take focus in order to |
| 418 | receive joystick events. If needed, applications can handle these events at the |
| 419 | level of Activity or Dialog by implementing {@link |
| 420 | android.view.View#onGenericMotionEvent(android.view.MotionEvent) |
| 421 | onGenericMotionEvent()} there instead.</p> |
| 422 | |
| 423 | <p class="note">To look at a sample application that uses joystick motion |
| 424 | events, see <a |
Scott Main | cd1b08e | 2011-12-27 16:22:27 -0800 | [diff] [blame] | 425 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.html">GameControllerInput</a> |
| 426 | and <a |
| 427 | href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameView.html">GameView</a>.</p> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 428 | |
| 429 | <h3>RTP API</h3> |
| 430 | |
| 431 | <p>Android 3.1 exposes an API to its built-in RTP (Real-time Transport Protocol) |
| 432 | stack, which applications can use to manage on-demand or interactive data |
| 433 | streaming. In particular, apps that provide VOIP, push-to-talk, conferencing, |
| 434 | and audio streaming can use the API to initiate sessions and transmit or receive |
| 435 | data streams over any available network.</p> |
| 436 | |
| 437 | <p>The RTP API is available in the {@link android.net.rtp} package. Classes |
| 438 | include: </p> |
| 439 | <ul> |
| 440 | <li>{@link android.net.rtp.RtpStream}, the base class of streams that send and |
| 441 | receive network packets with media payloads over RTP.</li> |
| 442 | <li>{@link android.net.rtp.AudioStream}, a subclass of {@link |
| 443 | android.net.rtp.RtpStream} that carries audio payloads over RTP.</li> |
| 444 | <li>{@link android.net.rtp.AudioGroup}, a local audio hub for managing and |
| 445 | mixing the device speaker, microphone, and {@link android.net.rtp.AudioStream}.</li> |
| 446 | <li>{@link android.net.rtp.AudioCodec}, which holds a collection of codecs that |
| 447 | you define for an {@link android.net.rtp.AudioStream}.</li> |
| 448 | </ul> |
| 449 | |
| 450 | <p>To support audio conferencing and similar usages, an application instantiates |
| 451 | two classes as endpoints for the stream:</p> |
| 452 | |
| 453 | <ul> |
| 454 | <li>{@link android.net.rtp.AudioStream} specifies a remote endpoint and consists |
| 455 | of network mapping and a configured {@link android.net.rtp.AudioCodec}.</li> |
| 456 | <li>{@link android.net.rtp.AudioGroup} represents the local endpoint for one |
| 457 | or more {@link android.net.rtp.AudioStream}s. The {@link android.net.rtp.AudioGroup} mixes |
| 458 | all the {@link android.net.rtp.AudioStream}s and optionally interacts with the device |
| 459 | speaker and the microphone at the same time.</li> |
| 460 | </ul> |
| 461 | |
| 462 | <p>The simplest usage involves a single remote endpoint and local endpoint. |
| 463 | For more complex usages, please refer to the limitations described for |
| 464 | {@link android.net.rtp.AudioGroup}.</p> |
| 465 | |
| 466 | <p>To use the RTP API, applications must request permission from the user by |
| 467 | declaring <code><uses-permission |
| 468 | android:name="android.permission.INTERNET"></code> |
| 469 | in their manifest files. To acquire the device microphone, the <code><uses-permission |
| 470 | android:name="android.permission.RECORD_AUDIO"></code> permission is also required.</p> |
| 471 | |
| 472 | <h3 id="resizewidgets">Resizable app widgets</h3> |
| 473 | |
| 474 | <p>Starting in Android 3.1, developers can make their homescreen widgets |
| 475 | resizeable — horizontally, vertically, or on both axes. Users touch-hold a |
| 476 | widget to show its resize handles, then drag the horizontal and/or vertical |
| 477 | handles to change the size on the layout grid. </p> |
| 478 | |
| 479 | <p>Developers can make any Home screen widget resizeable by defining a |
| 480 | <code>resizeMode</code> attribute in the widget's {@link |
| 481 | android.appwidget.AppWidgetProviderInfo} metadata. Values for the |
| 482 | <code>resizeMode</code> attribute include "horizontal", "vertical", and "none". |
| 483 | To declare a widget as resizeable horizontally and vertically, supply the value |
| 484 | "horizontal|vertical". |
| 485 | |
| 486 | <p>Here's an example: </p> |
| 487 | |
| 488 | <pre><appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" |
| 489 | android:minWidth="294dp" |
| 490 | android:minHeight="72dp" |
| 491 | android:updatePeriodMillis="86400000" |
| 492 | android:previewImage="@drawable/preview" |
| 493 | android:initialLayout="@layout/example_appwidget" |
| 494 | android:configure="com.example.android.ExampleAppWidgetConfigure" |
| 495 | android:resizeMode="horizontal|vertical" > |
| 496 | </appwidget-provider></pre> |
| 497 | |
| 498 | <p>For more information about Home screen widgets, see the <a |
| 499 | href="{@docRoot}guide/topics/appwidgets/index.html">App Widgets</a> |
| 500 | documentation.</p> |
| 501 | |
| 502 | <h3 id="animation" style="margin-top:1.25em;">Animation framework</h3> |
| 503 | |
| 504 | <ul> |
| 505 | <li>New ViewPropertyAnimator class |
| 506 | <ul> |
| 507 | <li>A new {@link android.view.ViewPropertyAnimator} class provides a |
| 508 | convenient |
| 509 | way for developers to animate select properties on {@link android.view.View} objects. The class |
| 510 | automaties and optimizes the animation of the properties and makes it easier to |
| 511 | manage multiple simulataneous animations on a {@link android.view.View} object. |
| 512 | <p>Using the {@link android.view.ViewPropertyAnimator} is straightforward. To animate properties for |
| 513 | a {@link android.view.View}, call {@link android.view.View#animate()} to |
| 514 | construct a {@link android.view.ViewPropertyAnimator} object for that {@link android.view.View}. Use the |
| 515 | methods on the {@link android.view.ViewPropertyAnimator} to specify what property to |
| 516 | animate and how to animate it. For example, to fade the {@link android.view.View} to transparent, |
| 517 | call <code>alpha(0);</code>. The {@link android.view.ViewPropertyAnimator} object |
| 518 | handles the details of configuring the underlying {@link |
| 519 | android.animation.Animator} class and starting it, then rendering the |
| 520 | animation.</p></li> |
| 521 | </ul> |
| 522 | </li> |
| 523 | <li>Animation background color |
| 524 | <ul> |
| 525 | <li>New {@link android.view.animation.Animation#getBackgroundColor()} and |
| 526 | {@link android.view.animation.Animation#setBackgroundColor(int)} methods let |
| 527 | you get/set the background color behind animations, for window animations |
| 528 | only. Currently the background must be black, with any desired alpha level.</li> |
| 529 | </ul> |
| 530 | </li> |
| 531 | <li>Getting animated fraction from <code>ViewAnimator</code> |
| 532 | <ul> |
| 533 | <li>A new {@link android.animation.ValueAnimator#getAnimatedFraction()} |
| 534 | method |
| 535 | lets you get the current animation fraction — the elapsed/interpolated |
| 536 | fraction used in the most recent frame update — from a {@link |
| 537 | android.animation.ValueAnimator}.</li> |
| 538 | </ul> |
| 539 | </li> |
| 540 | </ul> |
| 541 | |
| 542 | <h3 "ui">UI framework</h3> |
| 543 | <ul> |
| 544 | <li>Forced rendering of a layer |
| 545 | <ul> |
| 546 | <li>A new {@link android.view.View#buildLayer()} method lets an application |
| 547 | force a View's layer to be created and the View rendered into it immediately. |
| 548 | For example, an application could use this method to render a View into its |
| 549 | layer before starting an animation. If the View is complex, rendering it into |
| 550 | the layer before starting the animation will avoid skipping frames.</li> |
| 551 | </ul> |
| 552 | </li> |
| 553 | <li>Camera distance |
| 554 | <ul> |
| 555 | <li>Applications can use a new method |
| 556 | {@link android.view.View#setCameraDistance(float)} to set the distance from the |
| 557 | camera |
| 558 | to a View. This gives applications improved control over 3D transformations of |
| 559 | the View, such as rotations. </li> |
| 560 | </ul> |
| 561 | </li> |
| 562 | <li>Getting a calendar view from a DatePicker |
| 563 | <ul> |
| 564 | <li>A new {@link android.widget.DatePicker#getCalendarView()} method |
| 565 | lets you get a {@link android.widget.CalendarView} from a {@link |
| 566 | android.widget.DatePicker} |
| 567 | instance.</li> |
| 568 | </ul> |
| 569 | </li> |
| 570 | <li>Getting callbacks when views are detached |
| 571 | <ul> |
| 572 | <li>A new {@link android.view.View.OnAttachStateChangeListener} lets you |
| 573 | receive |
| 574 | callbacks when a View is attached or detached from its window. Use {@link |
| 575 | android.view.View#addOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) addOnAttachStateChangeListener()} |
| 576 | to add a listener and {@link |
| 577 | android.view.View#removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener) addOnAttachStateChangeListener()} to remove it.</li> |
| 578 | </ul> |
| 579 | </li> |
| 580 | <li>Fragment breadcrumb listener, new onInflate() signature |
| 581 | <ul> |
| 582 | <li>A new method, {@link |
| 583 | android.app.FragmentBreadCrumbs#setOnBreadCrumbClickListener(android.app.FragmentBreadCrumbs.OnBreadCrumbClickListener) setOnBreadCrumbClickListener()}, |
| 584 | provides a hook to let |
| 585 | applications intercept fragment-breadcrumb clicks and take any action needed |
| 586 | before going to the backstack entry or fragment that was clicked. </li> |
| 587 | <li>In the {@link android.app.Fragment} class, {@link |
| 588 | android.app.Fragment#onInflate(android.util.AttributeSet, android.os.Bundle) |
| 589 | onInflate(attrs, savedInstanceState)} is deprecated. Please use {@link |
| 590 | android.app.Fragment#onInflate(android.app.Activity, android.util.AttributeSet, |
| 591 | android.os.Bundle) onInflate(activity, attrs, savedInstanceState)} instead.</li> |
| 592 | </ul> |
| 593 | </li> |
| 594 | <li>Display search result in new tab |
| 595 | <ul> |
| 596 | <li>An {@link android.app.SearchManager#EXTRA_NEW_SEARCH} data key for {@link |
| 597 | android.content.Intent#ACTION_WEB_SEARCH} intents lets you open a search in a |
| 598 | new browser tab, rather than in an existing one.</li> |
| 599 | </ul> |
| 600 | </li> |
| 601 | |
| 602 | <li>Drawable text cursor |
| 603 | <ul> |
| 604 | <li>You can now specify a drawable to use as the text cursor using the new |
| 605 | resource attribute {@link android.R.attr#textCursorDrawable}.</li> |
| 606 | </ul> |
| 607 | </li> |
| 608 | <li>Setting displayed child in remote views |
| 609 | <ul> |
| 610 | <li>A new convenience method, {@link |
| 611 | android.widget.RemoteViews#setDisplayedChild(int, int) setDisplayedChild(viewId, |
| 612 | childIndex)}, is available in {@link android.widget.RemoteViews} subclasses, to |
| 613 | let you set the child displayed in {@link android.widget.ViewAnimator} and |
| 614 | {@link android.widget.AdapterViewAnimator} subclasses such as {@link |
| 615 | android.widget.AdapterViewFlipper}, {@link android.widget.StackView}, {@link |
| 616 | android.widget.ViewFlipper}, and {@link android.widget.ViewSwitcher}.</li> |
| 617 | </ul> |
| 618 | </li> |
| 619 | <li>Generic keys for gamepads and other input devices |
| 620 | <ul> |
| 621 | <li>{@link android.view.KeyEvent} adds a range of generic keycodes to |
| 622 | accommodate gamepad buttons. The class also adds |
| 623 | {@link android.view.KeyEvent#isGamepadButton(int)} and several other |
| 624 | helper methods for working with keycodes.</li> |
| 625 | </ul> |
| 626 | </li> |
| 627 | </ul> |
| 628 | |
| 629 | <h3 id="graphics" style="margin-top:1.3em;">Graphics</h3> |
| 630 | |
| 631 | <ul> |
| 632 | <li>Helpers for managing bitmaps |
| 633 | <ul> |
| 634 | <li>{@link android.graphics.Bitmap#setHasAlpha(boolean)} lets an app indicate that |
| 635 | all of the pixels in a Bitmap are known to be opaque (false) or that some of the |
| 636 | pixels may contain non-opaque alpha values (true). Note, for some configs (such |
| 637 | as RGB_565) this call is ignored, since it does not support per-pixel alpha |
| 638 | values. This is meant as a drawing hint, as in some cases a bitmap that is known |
| 639 | to be opaque can take a faster drawing case than one that may have non-opaque |
| 640 | per-pixel alpha values. </li> |
| 641 | <li>{@link android.graphics.Bitmap#getByteCount()} gets a Bitmap's size in |
| 642 | bytes.</li> |
| 643 | <li>{@link android.graphics.Bitmap#getGenerationId()} lets an application find |
| 644 | out whether a Bitmap has been modified, such as for caching.</li> |
| 645 | <li>{@link android.graphics.Bitmap#sameAs(android.graphics.Bitmap)} determines |
| 646 | whether a given Bitmap differs from the current Bitmap, in dimension, |
| 647 | configuration, or pixel data. </li> |
| 648 | </ul> |
| 649 | </li> |
| 650 | <li>Setting camera location and rotation |
| 651 | <ul> |
| 652 | <li>{@link android.graphics.Camera} adds two new methods {@link |
| 653 | android.graphics.Camera#rotate(float, float, float) rotate()} and {@link |
| 654 | android.graphics.Camera#setLocation(float, float, float) setLocation()} for |
| 655 | control of the |
| 656 | camera's location, for 3D transformations.</li> |
| 657 | </ul> |
| 658 | </li> |
| 659 | </ul> |
| 660 | |
| 661 | <h3 id="network" style="margin-top:1.25em;">Network</h3> |
| 662 | |
| 663 | <ul> |
| 664 | <li>High-performance Wi-Fi lock |
| 665 | <ul> |
| 666 | <li>A new high-performance Wi-Fi lock lets applications maintain |
| 667 | high-performance Wi-Fi connections even when the device screen is off. |
| 668 | Applications that stream music, video, or voice for long periods can acquire the |
| 669 | high-performance Wi-Fi lock to ensure streaming performance even when the screen |
| 670 | is off. Because it uses more power, applications should acquire the |
| 671 | high-performance Wi-Fi when there is a need for a long-running active |
| 672 | connection. |
| 673 | <p>To create a high-performance lock, pass {@link |
| 674 | android.net.wifi.WifiManager#WIFI_MODE_FULL_HIGH_PERF} as the lock mode in a |
| 675 | call to {@link android.net.wifi.WifiManager#createWifiLock(int, |
| 676 | java.lang.String) createWifiLock()}.</p></li> |
| 677 | </ul> |
| 678 | </li> |
| 679 | <li>More traffic stats |
| 680 | <ul> |
| 681 | <li>Applications can now access statistics about more types of network usage |
| 682 | using new methods in {@link android.net.TrafficStats}. Applications can use the |
| 683 | methods to get UDP stats, packet count, TCP transmit/receive payload bytes and |
| 684 | segments for a given UID.</li> |
| 685 | </ul> |
| 686 | </li> |
| 687 | <li>SIP auth username |
| 688 | <ul> |
| 689 | <li>Applications can now get and set the SIP auth username for a profile |
| 690 | using |
| 691 | the new methods {@link android.net.sip.SipProfile#getAuthUserName() |
| 692 | getAuthUserName()} and {@link |
| 693 | android.net.sip.SipProfile.Builder#setAuthUserName(java.lang.String) |
| 694 | setAuthUserName()}.</li> |
| 695 | </ul> |
| 696 | </li> |
| 697 | </ul> |
| 698 | |
| 699 | |
| 700 | <h3 id="download" style="margin-top:1.25em;">Download Manager</h3> |
| 701 | <ul> |
| 702 | <li>Handling of completed downloads |
| 703 | <ul> |
| 704 | <li>Applications can now initiate downloads that notify users only on |
| 705 | completion. To initiate this type of download, applications pass {@link |
| 706 | android.app.DownloadManager.Request#VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION} |
| 707 | in the {@link |
| 708 | android.app.DownloadManager.Request#setNotificationVisibility(int) |
| 709 | setNotificationVisibility()} method of |
| 710 | the a request object.</li> |
| 711 | <li>A new method, {@link |
| 712 | android.app.DownloadManager#addCompletedDownload(java.lang.String, |
| 713 | java.lang.String, boolean, java.lang.String, java.lang.String, long, boolean) |
| 714 | addCompletedDownload()}, lets an application add a file to the |
| 715 | downloads database, so that it can be managed by the Downloads application.</li> |
| 716 | </ul> |
| 717 | </li> |
| 718 | <li>Show downloads sorted by size |
| 719 | <ul> |
| 720 | <li>Applications can start the Downloads application in sort-by-size mode by |
| 721 | adding the new extra {@link |
| 722 | android.app.DownloadManager#INTENT_EXTRAS_SORT_BY_SIZE} to an {@link |
| 723 | android.app.DownloadManager#ACTION_VIEW_DOWNLOADS} intent.</li> |
| 724 | </ul> |
| 725 | </li> |
| 726 | </ul> |
| 727 | |
| 728 | <h3 id="ime" style="margin-top:1.25em;">IME framework</h3> |
| 729 | |
| 730 | <ul> |
| 731 | <li>Getting an input method's extra value key |
| 732 | <ul><li>The {@link android.view.inputmethod.InputMethodSubtype} adds the |
| 733 | method |
| 734 | {@link |
| 735 | android.view.inputmethod.InputMethodSubtype#containsExtraValueKey(java.lang.String) containsExtraValueKey()} to check whether an ExtraValue string is stored |
| 736 | for the subtype and |
| 737 | the method {@link |
| 738 | android.view.inputmethod.InputMethodSubtype#getExtraValueOf(java.lang.String) |
| 739 | getExtraValueOf()} to extract a specific key value from the ExtraValue hashmap. |
| 740 | </li> |
| 741 | </ul> |
| 742 | </li> |
| 743 | </ul> |
| 744 | |
| 745 | <h3 id="media" style="margin-top:1.25em;">Media</h3> |
| 746 | |
| 747 | <ul> |
| 748 | <li>New streaming audio formats |
| 749 | <ul> |
| 750 | <li>The media framework adds built-in support for raw ADTS AAC content, for |
| 751 | improved streaming audio, as well as support for FLAC audio, for highest quality |
| 752 | (lossless) compressed audio content. See the <a |
| 753 | href="{@docRoot}guide/appendix/media-formats.html">Supported Media Formats</a> |
| 754 | document for more information.</p></li> |
| 755 | </ul> |
| 756 | </li> |
| 757 | </ul> |
| 758 | |
| 759 | <h3 id="launchcontrols" style="margin-top:1.25em;">Launch controls on stopped |
| 760 | applications</h3> |
| 761 | |
| 762 | <p>Starting from Android 3.1, the system's package manager keeps track of |
| 763 | applications that are in a stopped state and provides a means of controlling |
| 764 | their launch from background processes and other applications.</p> |
| 765 | |
| 766 | <p>Note that an application's stopped state is not the same as an Activity's |
| 767 | stopped state. The system manages those two stopped states separately.</p> |
| 768 | |
| 769 | <p>The platform defines two new intent flags that let a sender specify |
| 770 | whether the Intent should be allowed to activate components in stopped |
| 771 | application.</p> |
| 772 | |
| 773 | <ul> |
| 774 | <li>{@link android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES} — |
| 775 | Include intent filters of stopped applications in the list of potential targets |
| 776 | to resolve against. </li> |
| 777 | <li>{@link android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES} — |
| 778 | Exclude intent filters of stopped applications from the list of potential |
| 779 | targets.</li> |
| 780 | </ul> |
| 781 | |
| 782 | <p>When neither or both of these flags is defined in an intent, the default |
| 783 | behavior is to include filters of stopped applications in the list of |
| 784 | potential targets.</p> |
| 785 | |
| 786 | <p>Note that the system adds {@link |
| 787 | android.content.Intent#FLAG_EXCLUDE_STOPPED_PACKAGES} <em>to all broadcast |
| 788 | intents</em>. It does this to prevent broadcasts from background services from |
| 789 | inadvertently or unnecessarily launching components of stoppped applications. |
| 790 | A background service or application can override this behavior by adding the |
| 791 | {@link android.content.Intent#FLAG_INCLUDE_STOPPED_PACKAGES} flag to broadcast |
| 792 | intents that should be allowed to activate stopped applications.</p> |
| 793 | |
| 794 | <p>Applications are in a stopped state when they are first installed but are not |
| 795 | yet launched and when they are manually stopped by the user (in Manage |
| 796 | Applications).</p> |
| 797 | |
| 798 | <h3 id="installnotification">Notification of application first launch and upgrade</h3> |
| 799 | |
| 800 | <p>The platform adds improved notification of application first launch and |
| 801 | upgrades through two new intent actions:</p> |
| 802 | |
| 803 | <ul> |
| 804 | <li>{@link android.content.Intent#ACTION_PACKAGE_FIRST_LAUNCH} — Sent to |
| 805 | the installer package of an application when that application is first launched |
| 806 | (that is, the first time it is moved out of a stopped state). The data |
| 807 | contains the name of the package. </li> |
| 808 | |
| 809 | <li>{@link android.content.Intent#ACTION_MY_PACKAGE_REPLACED} — Notifies |
| 810 | an application that it was updated, with a new version was installed over |
| 811 | an existing version. This is only sent to the application that was replaced. It |
| 812 | does not contain any additional data. To receive it, declare an intent filter |
| 813 | for this action. You can use the intent to trigger code that helps get your |
| 814 | application back in proper running shape after an upgrade. |
| 815 | |
| 816 | <p>This intent is sent directly to the application, but only if the application |
| 817 | was upgraded while it was in started state (not in a stopped state).</p></li> |
| 818 | |
| 819 | </ul> |
| 820 | |
Dirk Dougherty | a43c477 | 2011-06-26 17:14:12 -0700 | [diff] [blame] | 821 | <h3 id="other">Core utilities</h3> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 822 | |
| 823 | <ul> |
| 824 | <li>LRU cache |
| 825 | <ul> |
| 826 | <li>A new {@link android.util.LruCache} class lets your applications benefit |
| 827 | from efficient caching. Applications can use the class to reduce the time spent |
| 828 | computing or downloading data from the network, while maintaining a sensible |
| 829 | memory footprint for the cached data.{@link android.util.LruCache} is a cache |
| 830 | that holds strong references to a limited number of values. Each time a value is |
| 831 | accessed, it is moved to the head of a queue. When a value is added to a full |
| 832 | cache, the value at the end of that queue is evicted and may become eligible for |
| 833 | garbage collection.</li> |
| 834 | </ul> |
| 835 | </li> |
| 836 | <li>File descriptor as <code>int</code> |
| 837 | <ul> |
| 838 | <li>You can now get the native file descriptor int for a {@link |
| 839 | android.os.ParcelFileDescriptor} using either of the new methods {@link |
| 840 | android.os.ParcelFileDescriptor#getFd()} or {@link |
| 841 | android.os.ParcelFileDescriptor#detachFd()}. </li> |
| 842 | </ul> |
| 843 | </li> |
| 844 | </ul> |
| 845 | |
| 846 | |
| 847 | |
| 848 | |
| 849 | |
| 850 | |
| 851 | <h3 id="webkit" style="margin-top:1.25em;">WebKit</h3> |
| 852 | |
| 853 | <ul> |
| 854 | |
| 855 | <li>File scheme cookies |
| 856 | <ul> |
| 857 | <li>The {@link android.webkit.CookieManager} now supports cookies that use |
| 858 | the |
| 859 | <code>file:</code> URI scheme. You can use {@link |
| 860 | android.webkit.CookieManager#setAcceptFileSchemeCookies(boolean) |
| 861 | setAcceptFileSchemeCookies()} to |
| 862 | enable/disable support for file scheme cookies, before constructing an instance |
| 863 | of <code>WebView</code> or <code>CookieManager</code>. In a |
| 864 | <code>CookieManager</code> instance, you can check whether file scheme cookies |
| 865 | is enabled by calling {@link |
| 866 | android.webkit.CookieManager#allowFileSchemeCookies()}.</li> |
| 867 | </ul> |
| 868 | </li> |
| 869 | <li>Notification of login request |
| 870 | <ul> |
| 871 | <li>To support the browser autologin features introduced in Android 3.0, the |
| 872 | new |
| 873 | method {@link |
| 874 | android.webkit.WebViewClient#onReceivedLoginRequest(android.webkit.WebView,java.lang.String, java.lang.String, java.lang.String) onReceivedLoginRequest()} |
| 875 | notifies the host |
| 876 | application that an autologin request for the user was processed. </li> |
| 877 | </ul> |
| 878 | </li> |
| 879 | <li>Removed classes and interfaces |
| 880 | <ul> |
| 881 | <li>Several classes and interfaces were removed from the public API, after |
| 882 | previously being in deprecated state. See the <a |
| 883 | href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API |
| 884 | Differences Report</a> for more information.</p></li> |
| 885 | </ul> |
| 886 | </li> |
| 887 | </ul> |
| 888 | |
| 889 | |
| 890 | |
| 891 | <h3 id="browser" style="margin-top:1.25em;">Browser</h3> |
| 892 | |
| 893 | <p>The Browser application adds the following features to support web |
| 894 | applications:</p> |
| 895 | |
| 896 | <ul> |
| 897 | <li>Support for inline playback of video embedded in HTML5 |
| 898 | <code><video></code> tag. Playback is hardware-accelerated where possible. |
| 899 | </li> |
| 900 | <li>Layer support for fixed position elements for all sites (mobile and |
| 901 | desktop).</li> |
| 902 | </ul> |
| 903 | |
| 904 | |
| 905 | |
| 906 | |
| 907 | |
| 908 | <h3 id="features">New feature constants</h3> |
| 909 | |
| 910 | <p>The platform adds new hardware feature constants that developers can declare |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 911 | in their application manifests, to inform external entities such as Google |
| 912 | Play of the application's requirement for new hardware capabilities supported |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 913 | in this version of the platform. Developers declare these and other feature |
| 914 | constants in <a |
| 915 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code |
| 916 | <uses-feature>}</a> manifest elements. |
| 917 | |
| 918 | <ul> |
| 919 | <li>{@link android.content.pm.PackageManager#FEATURE_USB_ACCESSORY |
| 920 | android.hardware.usb.accessory} — The application uses the <a href="#usb">USB |
| 921 | API</a> to communicate with external hardware devices connected over USB and |
| 922 | function as hosts.</li> |
| 923 | <li>{@link android.content.pm.PackageManager#FEATURE_USB_HOST |
| 924 | android.hardware.usb.host} — The application uses the <a href="#usb">USB API</a> |
| 925 | to communicate with external hardware devices connected over USB and function as |
| 926 | devices.</li> |
| 927 | </ul> |
| 928 | |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 929 | <p>Google Play filters applications based on features declared in <a |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 930 | href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code |
| 931 | <uses-feature>}</a> manifest elements. For more information about |
| 932 | declaring features in an application manifest, read <a |
Dirk Dougherty | 4d7bc655 | 2012-01-27 17:56:49 -0800 | [diff] [blame] | 933 | href="{@docRoot}guide/appendix/market-filters.html">Google Play |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 934 | Filters</a>.</p> |
| 935 | |
| 936 | |
| 937 | |
| 938 | <h3 id="api-diff">API Differences Report</h3> |
| 939 | |
| 940 | <p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API |
| 941 | Level |
| 942 | {@sdkPlatformApiLevel}), see the <a |
| 943 | href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API |
| 944 | Differences Report</a>.</p> |
| 945 | |
| 946 | |
| 947 | |
| 948 | |
| 949 | |
| 950 | <h2 id="api-level">API Level</h2> |
| 951 | |
| 952 | <p>The Android {@sdkPlatformVersion} platform delivers an updated version of |
| 953 | the framework API. The Android {@sdkPlatformVersion} API |
| 954 | is assigned an integer identifier — |
| 955 | <strong>{@sdkPlatformApiLevel}</strong> — that is |
| 956 | stored in the system itself. This identifier, called the "API Level", allows the |
| 957 | system to correctly determine whether an application is compatible with |
| 958 | the system, prior to installing the application. </p> |
| 959 | |
| 960 | <p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, |
| 961 | you need compile the application against the Android library that is provided in |
| 962 | the Android {@sdkPlatformVersion} SDK platform. Depending on your needs, you |
| 963 | might |
| 964 | also need to add an <code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> |
| 965 | attribute to the <code><uses-sdk></code> element in the application's |
| 966 | manifest.</p> |
| 967 | |
| 968 | <p>For more information about how to use API Level, see the <a |
| 969 | href="{@docRoot}guide/appendix/api-levels.html">API Levels</a> document. </p> |
| 970 | |
| 971 | |
| 972 | <h2 id="apps">Built-in Applications</h2> |
| 973 | |
| 974 | <p>The system image included in the downloadable platform provides these |
| 975 | built-in applications:</p> |
| 976 | |
| 977 | <table style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 978 | <tr> |
| 979 | <td style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 980 | <ul> |
| 981 | <li>API Demos</li> |
| 982 | <li>Browser</li> |
| 983 | <li>Calculator</li> |
| 984 | <li>Camera</li> |
| 985 | <li>Clock</li> |
| 986 | <li>Contacts</li> |
| 987 | <li>Custom Locale</li> |
| 988 | <li>Dev Tools</li> |
| 989 | <li>Downloads</li> |
| 990 | <li>Email</li> |
| 991 | </ul> |
| 992 | </td> |
| 993 | <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> |
| 994 | <ul> |
| 995 | <li>Gallery</li> |
| 996 | <li>Gestures Builder</li> |
| 997 | <li>Messaging</li> |
| 998 | <li>Music</li> |
| 999 | <li>Search</li> |
| 1000 | <li>Settings</li> |
| 1001 | <li>Spare Parts</li> |
| 1002 | <li>Speech Recorder</li> |
| 1003 | <li>Widget Preview</li> |
| 1004 | </ul> |
| 1005 | </td> |
| 1006 | </tr> |
| 1007 | </table> |
| 1008 | |
| 1009 | |
| 1010 | <h2 id="locs" style="margin-top:.75em;">Locales</h2> |
| 1011 | |
| 1012 | <p>The system image included in the downloadable SDK platform provides a variety |
| 1013 | of |
| 1014 | built-in locales. In some cases, region-specific strings are available for the |
| 1015 | locales. In other cases, a default version of the language is used. The |
| 1016 | languages that are available in the Android 3.0 system |
| 1017 | image are listed below (with <em>language</em>_<em>country/region</em> locale |
| 1018 | descriptor).</p> |
| 1019 | |
| 1020 | <table style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1021 | <tr> |
| 1022 | <td style="border:0;padding-bottom:0;margin-bottom:0;"> |
| 1023 | <ul> |
| 1024 | <li>Arabic, Egypt (ar_EG)</li> |
| 1025 | <li>Arabic, Israel (ar_IL)</li> |
| 1026 | <li>Bulgarian, Bulgaria (bg_BG)</li> |
| 1027 | <li>Catalan, Spain (ca_ES)</li> |
| 1028 | <li>Czech, Czech Republic (cs_CZ)</li> |
| 1029 | <li>Danish, Denmark(da_DK)</li> |
| 1030 | <li>German, Austria (de_AT)</li> |
| 1031 | <li>German, Switzerland (de_CH)</li> |
| 1032 | <li>German, Germany (de_DE)</li> |
| 1033 | <li>German, Liechtenstein (de_LI)</li> |
| 1034 | <li>Greek, Greece (el_GR)</li> |
| 1035 | <li>English, Australia (en_AU)</li> |
| 1036 | <li>English, Canada (en_CA)</li> |
| 1037 | <li>English, Britain (en_GB)</li> |
| 1038 | <li>English, Ireland (en_IE)</li> |
| 1039 | <li>English, India (en_IN)</li> |
| 1040 | <li>English, New Zealand (en_NZ)</li> |
| 1041 | <li>English, Singapore(en_SG)</li> |
| 1042 | <li>English, US (en_US)</li> |
Scott Main | b16965c | 2012-01-30 23:33:01 -0800 | [diff] [blame] | 1043 | <li>English, South Africa (en_ZA)</li> |
Dirk Dougherty | b7c7f15 | 2011-03-25 11:54:46 -0700 | [diff] [blame] | 1044 | <li>Spanish (es_ES)</li> |
| 1045 | <li>Spanish, US (es_US)</li> |
| 1046 | <li>Finnish, Finland (fi_FI)</li> |
| 1047 | <li>French, Belgium (fr_BE)</li> |
| 1048 | <li>French, Canada (fr_CA)</li> |
| 1049 | <li>French, Switzerland (fr_CH)</li> |
| 1050 | <li>French, France (fr_FR)</li> |
| 1051 | <li>Hebrew, Israel (he_IL)</li> |
| 1052 | <li>Hindi, India (hi_IN)</li> |
| 1053 | </ul> |
| 1054 | </td> |
| 1055 | <td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;"> |
| 1056 | <li>Croatian, Croatia (hr_HR)</li> |
| 1057 | <li>Hungarian, Hungary (hu_HU)</li> |
| 1058 | <li>Indonesian, Indonesia (id_ID)</li> |
| 1059 | <li>Italian, Switzerland (it_CH)</li> |
| 1060 | <li>Italian, Italy (it_IT)</li> |
| 1061 | <li>Japanese (ja_JP)</li> |
| 1062 | <li>Korean (ko_KR)</li> |
| 1063 | <li>Lithuanian, Lithuania (lt_LT)</li> |
| 1064 | <li>Latvian, Latvia (lv_LV)</li> |
| 1065 | <li>Norwegian bokmål, Norway (nb_NO)</li> |
| 1066 | <li>Dutch, Belgium (nl_BE)</li> |
| 1067 | <li>Dutch, Netherlands (nl_NL)</li> |
| 1068 | <li>Polish (pl_PL)</li> |
| 1069 | <li>Portuguese, Brazil (pt_BR)</li> |
| 1070 | <li>Portuguese, Portugal (pt_PT)</li> |
| 1071 | <li>Romanian, Romania (ro_RO)</li> |
| 1072 | <li>Russian (ru_RU)</li></li> |
| 1073 | <li>Slovak, Slovakia (sk_SK)</li> |
| 1074 | <li>Slovenian, Slovenia (sl_SI)</li> |
| 1075 | <li>Serbian (sr_RS)</li> |
| 1076 | <li>Swedish, Sweden (sv_SE)</li> |
| 1077 | <li>Thai, Thailand (th_TH)</li> |
| 1078 | <li>Tagalog, Philippines (tl_PH)</li> |
| 1079 | <li>Turkish, Turkey (tr_TR)</li> |
| 1080 | <li>Ukrainian, Ukraine (uk_UA)</li> |
| 1081 | <li>Vietnamese, Vietnam (vi_VN)</li> |
| 1082 | <li>Chinese, PRC (zh_CN)</li> |
| 1083 | <li>Chinese, Taiwan (zh_TW)</li> |
| 1084 | </td> |
| 1085 | </tr> |
| 1086 | </table> |
| 1087 | |
| 1088 | <p class="note"><strong>Note:</strong> The Android platform may support more |
| 1089 | locales than are included in the SDK system image. All of the supported locales |
| 1090 | are available in the <a href="http://source.android.com/">Android Open Source |
| 1091 | Project</a>.</p> |
| 1092 | |
| 1093 | <h2 id="skins">Emulator Skins</h2> |
| 1094 | |
| 1095 | <p>The downloadable platform includes the following emulator skin:</p> |
| 1096 | |
| 1097 | <ul> |
| 1098 | <li> |
| 1099 | WXGA (1280x800, medium density, xlarge screen) |
| 1100 | </li> |
| 1101 | </ul> |
| 1102 | |
| 1103 | <p>For more information about how to develop an application that displays |
| 1104 | and functions properly on all Android-powered devices, see <a |
| 1105 | href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple |
| 1106 | Screens</a>.</p> |