blob: 68257cd89cbc5f02c99bba814b46e31219a5a009 [file] [log] [blame]
Dirk Dougherty9a6b4242011-12-12 13:49:31 -08001page.title=Android 4.0.3 Platform
2sdk.platform.version=4.0.3
3sdk.platform.apiLevel=15
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="#Honeycomb">Previous APIs</a></li>
14 <li><a href="#api-level">API Level</a></li>
15 <li><a href="#apps">Built-in Applications</a></li>
16 <li><a href="#locs">Locales</a></li>
17 <li><a href="#skins">Emulator Skins</a></li>
18</ol>
19
20<h2>Reference</h2>
21<ol>
22<li><a
23href="{@docRoot}sdk/api_diff/14/changes.html">API
24Differences Report &raquo;</a> </li>
25</ol>
26
27</div>
28</div>
29
30<p><em>API Level:</em>&nbsp;<strong>{@sdkPlatformApiLevel}</strong></p>
31
32<p>Android {@sdkPlatformVersion} is an incremental release of the Android 4.x
33(Ice Cream Sandwich) platform family. This release includes new features for
34users and developers, API changes, and various bug fixes.</p>
35
36<p>For developers, the Android {@sdkPlatformVersion} platform is available as a
37downloadable component for the Android SDK. The development platform includes a
38fully compliant Android library and system image as well as a set of emulator
39skins, sample applications, and more. The downloadable platform includes no
40external libraries.</p>
41
42<p>To start developing or testing against Android {@sdkPlatformVersion},
43use the Android SDK Manager to download the platform into your SDK. For more
44information, see <a href="{@docRoot}sdk/adding-components.html">Adding SDK
45Components</a>. If you are new to Android, <a
46href="{@docRoot}sdk/index.html">download the SDK Starter Package</a> first.</p>
47
48<p>For a high-level overview of the new user and developer features, see the
49<a href="http://developer.android.com/sdk/android-4.0-highlights.html">Platform
50Highlights</a>.</p>
51
52
53<h2 id="relnotes">Development Platform Revisions</h2>
54
55<p>The sections below provide notes about successive revisions of the Android
56{@sdkPlatformVersion} development platform for the Android SDK, as denoted by
57revision number. To determine what revisions you have installed in your SDK
58environment, refer to the "Installed Packages" listing in the Android SDK
59Manager.</p>
60
61
62<div class="toggle-content opened" style="padding-left:1em;">
63
64 <p><a href="#" onclick="return toggleContent(this)">
65 <img src="{@docRoot}assets/images/triangle-opened.png"
66class="toggle-content-img" alt="" />
67 Android {@sdkPlatformVersion}, Revision 1</a> <em>(December 2011)</em>
68 </a></p>
69
70 <div class="toggle-content-toggleme" style="padding-left:2em;">
71
72<dl>
73<dt>Initial release. SDK Tools r14 or higher is required.
74 <p class="caution"><strong>Important:</strong> To download the new Android
75 4.x system components from the Android SDK Manager, you must first update the
76 SDK tools to revision 14 or later and restart the Android SDK Manager. If you do not,
77 the Android 4.0 system components will not be available for download.</p>
78</dt>
79</dl>
80
81 </div>
82</div>
83
84
85<h2 id="api">API Overview</h2>
86
87<p>The sections below provide a technical overview of new APIs in Android 4.0.3.</p>
88
89<div class="toggle-content closed" style="padding-left:1em;">
90
91 <p><a href="#" onclick="return toggleContent(this)">
92 <img src="{@docRoot}assets/images/triangle-closed.png"
93class="toggle-content-img" alt="" />
94 <strong>Table of Contents</strong>
95 </a></p>
96
97 <div class="toggle-content-toggleme" style="padding-left:2em;">
98 <ol class="toc" style="margin-left:-1em">
99 <li><a href="#contacts">Social stream API in contacts provider</a></li>
100 <li><a href="#calendar">Calendar provider</a></li>
101 <li><a href="#widgets">Home screen widgets</a></li>
102 <li><a href="#textservices">Spell-checking</a></li>
103 <li><a href="#bluetooth">Bluetooth</a></li>
104 <li><a href="#ui">UI toolkit</a></li>
105 <li><a href="#accessibility">Accessibility</a></li>
106 <li><a href="#tts">Text-to-speech</a></li>
107 <li><a href="#database">Database</a></li>
108 <li><a href="#intents">Intents</a></li>
109 <li><a href="#camera">Camera</a></li>
110 <li><a href="#permissions">Permissions</a></li>
111 </ol>
112 </div>
113</div>
114
115
116
117
118
119<h3 id="contacts">Social stream API in Contacts provider</h3>
120
121<p>Applications that use social stream data such as status updates and check-ins
122can now sync that data with each of the users contacts, providing items in a
123stream along with photos for each.</p>
124
125<p>The database table that contains an individual contacts social stream is
126defined by {@link android.provider.ContactsContract.StreamItems}, the Uri for
127which is nested within the {@link android.provider.ContactsContract.RawContacts}
128directory to which the stream items belong. Each social stream table includes
129several columns for metadata about each stream item, such as an icon
130representing the source (an avatar), a label for the item, the primary text
131content, comments about the item (such as responses from other people), and
132more. Photos associated with a stream are stored in another table, defined by
133{@link android.provider.ContactsContract.StreamItemPhotos}, which is available
134as a sub-directory of the {@link android.provider.ContactsContract.StreamItems}
135Uri.</p>
136
137<p>See {@link android.provider.ContactsContract.StreamItems} and
138{@link android.provider.ContactsContract.StreamItemPhotos} for more information.</p>
139
140<p>To read or write social stream items for a contact, an application must
141request permission from the user by declaring <code>&lt;uses-permission
142android:name="android.permission.READ_SOCIAL_STREAM"&gt;</code> and/or <code>&lt;uses-permission
143android:name="android.permission.WRITE_SOCIAL_STREAM"&gt;</code> in their manifest files.</p>
144
145<h3 id="calendar">Calendar provider</h4>
146<ul>
147<li>Adds the class {@link android.provider.CalendarContract.Colors} to represent
148a color table in the Calendar provider. The class provivdes fields for accessing
149colors available for a given account. Colors are referenced by
150{@link android.provider.CalendarContract.ColorsColumns#COLOR_KEY COLOR_KEY}
151which must be unique for a given account name/type. These values can only be
152updated by the sync adapter.</li>
153<li>Adds {@link android.provider.CalendarContract.CalendarColumns#ALLOWED_AVAILABILITY ALLOWED_AVAILABILITY}
154and
155{@link android.provider.CalendarContract.CalendarColumns#ALLOWED_ATTENDEE_TYPES ALLOWED_ATTENDEE_TYPES}
156for exchange/sync support.</li>
157<li>Adds {@link android.provider.CalendarContract.AttendeesColumns#TYPE_RESOURCE}
158(such as conference rooms) for attendees and
159{@link android.provider.CalendarContract.EventsColumns#AVAILABILITY_TENTATIVE},
160as well as {@link android.provider.CalendarContract.EventsColumns#EVENT_COLOR_KEY}
161for events.</li>
162</ul>
163
164<h3 id="widgets">Home screen widgets</h3>
165
166<p>Starting from Android 4.0, home screen widgets should no longer include their
167own padding. Instead, the system now automatically adds padding for each widget,
168based the characteristics of the current screen. This leads to a more uniform,
169consistent presentation of widgets in a grid. To assist applications that host
170home screen widgets, the platform provides a new method
171{@link android.appwidget.AppWidgetHostView#getDefaultPaddingForWidget(android.content.Context, android.content.ComponentName, android.graphics.Rect)
172getDefaultPaddingForWidget()}. Applications can call this method to get the
173system-defined padding and account for it when computing the number of cells to
174allocate to the widget.</p>
175
176<h3 id="textservices">Spell-checking</h3>
177
178<ul>
179<li>For apps that accessing spell-checker services, a new {@link
180android.view.textservice.SpellCheckerSession#cancel() cancel()} method cancels
181any pending and running spell-checker tasks in a session.</li>
182
183<li>For spell-checker services, a new suggestions flag,
184{@link android.view.textservice.SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS},
185lets the services distinguish higher-confidence suggestions from
186lower-confidence ones. For example, a spell-checker could set the flag if an
187input word is not in the user dictionary but has likely suggestions, or not set
188the flag if an input word is not in the dictionary and has suggestions that are
189likely to be less useful.
190
191<p>Apps connected to the spell-checker can use the {@link
192android.view.textservice.SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS}
193flag in combination with other suggestion attributes, as well as the {@link
194android.view.textservice.SuggestionsInfo#getSuggestionsAttributes()} and {@link
195android.view.textservice.SuggestionsInfo#getSuggestionsCount()} methods, to
196determine whether to mark input words as typos and offer suggestions.</p></li>
197
198<li>A new {@link android.text.style.SuggestionSpan#FLAG_AUTO_CORRECTION} style
199for text spans indicates that auto correction is about to be applied to a
200word/text that the user is typing/composing. This type of suggestion is rendered
201differently, to indicate the auto correction is happening.</li>
202</ul>
203
204<h3 id="bluetooth">Bluetooth</h3>
205<p>New public methods {@link
206android.bluetooth.BluetoothDevice#fetchUuidsWithSdp()} and {@link
207android.bluetooth.BluetoothDevice#getUuids()} let apps determine the features
208(UUIDs) supported by a remote device. In the case of {@link
209android.bluetooth.BluetoothDevice#fetchUuidsWithSdp()}, the system performs a
210service discovery on the remote device to get the UUIDs supported, then
211broadcasts the result in an {@link
212android.bluetooth.BluetoothDevice#ACTION_UUID} intent.</p>
213
214<h3 id="ui">UI toolkit</h3>
215
216<p>New methods {@link android.app.Fragment#setUserVisibleHint(boolean) setUserVisibleHint()} and
217{@link android.app.Fragment#getUserVisibleHint() getUserVisibleHint()} allow a
218fragment to set a hint of whether or not it is currently user-visible. The
219system defers the start of fragments that are not user-visible until the loaders
220for visible fragments have run. The visibility hint is "true" by default.</li>
221</p>
222
223<h3 id="graphics">Graphics</h3>
224
225<ul>
226<li>New method {@link android.graphics.SurfaceTexture#setDefaultBufferSize(int
227width, int height)} in SurfaceTexture sets the default size of the image
228buffers. This method may be used to set the image size when producing images
229with {@link android.graphics.Canvas} (via {@link
230android.view.Surface#lockCanvas}), or OpenGL ES (via an EGLSurface).</li>
231<li>Adds definitions for the enums of the GL_OES_EGL_image_external OpenGL ES extension &mdash;
232{@link android.opengl.GLES11Ext#GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES},
233{@link android.opengl.GLES11Ext#GL_SAMPLER_EXTERNAL_OES},
234{@link android.opengl.GLES11Ext#GL_TEXTURE_BINDING_EXTERNAL_OES}, and
235{@link android.opengl.GLES11Ext#GL_TEXTURE_EXTERNAL_OES}.</li>
236</ul>
237
238<h3 id="accessibility">Accessibility</h3>
239
240<ul>
241<li>Clients of {@link android.widget.RemoteViews} can now use the method {@link
242android.widget.RemoteViews#setContentDescription(int, java.lang.CharSequence)
243setContentDescription()} to set and get the content description of any View in
244the inflated layout.</li>
245
246<li>The methods {@link android.view.accessibility.AccessibilityRecord#getMaxScrollX()},
247{@link android.view.accessibility.AccessibilityRecord#getMaxScrollY()},
248{@link android.view.accessibility.AccessibilityRecord#setMaxScrollX(int) setMaxScrollX()}, and
249{@link android.view.accessibility.AccessibilityRecord#setMaxScrollY(int) setMaxScrollY()}
250allow apps to get and set the maximum scroll offset for an
251{@link android.view.accessibility.AccessibilityRecord} object.</li>
252
253<li>When touch-exploration mode is enabled, a new secure setting
254{@link android.provider.Settings.Secure#ACCESSIBILITY_SPEAK_PASSWORD}
255indicates whether the user requests the IME to speak text entered in password fields, even when
256a headset is not in use. By default, no password text is spoken unless a headset
257is in use.</li>
258</ul>
259
260<h3 id="tts">Text-to-speech</h3>
261
262<ul>
263<li>Adds the new method {@link
264android.speech.tts.TextToSpeech.Engine#getFeatures(java.util.Locale)
265getFeatures()}for querying and enabling network TTS support.
266<li>Adds a new listener class, {@link
267android.speech.tts.UtteranceProgressListener}, that engines can register to
268receive notification of speech-sythesis errors.</li>
269</ul>
270
271<h3 id="database">Database</h3>
272
273<ul>
274<li>A new {@link android.database.CrossProcessCursorWrapper} class lets content
275providers return results for a cross-process query more effieciently. The new
276class is a useful building block for wrapping cursors that will be sent to
277processes remotely. It can also transform normal {@link android.database.Cursor}
278objects into {@link android.database.CrossProcessCursor} objects
279transparently.
280
281<p>The {@link android.database.CrossProcessCursorWrapper} class fixes common
282performance issues and bugs that applications have encountered when
283implementing content providers.</p></li>
284
285<li>The {@link android.database.CursorWindow#CursorWindow(java.lang.String)}
286constructor now takes a name string as input. The system no longer distinguishes
287between local and remote cursor windows, so {@link
288android.database.CursorWindow#CursorWindow(boolean)} is now deprecated.</li>
289</ul>
290
291<h3 id="intents">Intents</h3>
292
293<p>Adds for categories for targeting common types of applications on the
294device, such as {@link android.content.Intent#CATEGORY_APP_BROWSER}, {@link
295android.content.Intent#CATEGORY_APP_CALENDAR}, {@link
296android.content.Intent#CATEGORY_APP_MAPS}, and more.</li>
297
298<h3 id="camera">Camera</h3>
299
300<ul>
301<li>{@link android.media.MediaMetadataRetriever} adds the new constant
302{@link android.media.MediaMetadataRetriever#METADATA_KEY_LOCATION} to let apps
303access retrieve location information for an image or video. </li>
304
305<li>{@link android.media.CamcorderProfile} adds the QVGA (320x240) resolution
306profiles. Quality level is represented by the
307{@link android.media.CamcorderProfile#QUALITY_QVGA}.and
308{@link android.media.CamcorderProfile#QUALITY_TIME_LAPSE_QVGA} constants.</li>
309
310<li>New methods {@link android.hardware.Camera.Parameters#setVideoStabilization(boolean) setVideoStabilization()},
311{@link android.hardware.Camera.Parameters#getVideoStabilization() setVideoStabilization()}, and {android.hardware.Camera.Parameters#isVideoStabilizationSupported() isVideoStabilizationSupported()}
312let you check and manage video stabilization for a {@link android.hardware.Camera}.</li>
313</ul>
314
315<h3 id="Permissions">Permissions</h3>
316
317<p>The following are new permissions:</p>
318<ul>
319<li>{@link android.Manifest.permission#READ_SOCIAL_STREAM} and
320{@link android.Manifest.permission#WRITE_SOCIAL_STREAM}: Allow a sync
321adapter to read and write social stream data to a contact in the shared
322contacts provider.</li>
323</ul>
324
325
326<div class="special" style="margin-top:2em">
327<p>For a detailed view of all API changes in Android {@sdkPlatformVersion} (API Level
328{@sdkPlatformApiLevel}), see the <a
329href="{@docRoot}sdk/api_diff/{@sdkPlatformApiLevel}/changes.html">API Differences Report</a>.</p>
330</div>
331
332
333<h2 id="api-level">API Level</h2>
334
335<p>The Android {@sdkPlatformVersion} API is assigned an integer
336identifier&mdash;<strong>{@sdkPlatformApiLevel}</strong>&mdash;that is stored in the system itself.
337This identifier, called the "API level", allows the system to correctly determine whether an
338application is compatible with the system, prior to installing the application. </p>
339
340<p>To use APIs introduced in Android {@sdkPlatformVersion} in your application, you need compile the
341application against an Android platform that supports API level {@sdkPlatformApiLevel} or
342higher. Depending on your needs, you might also need to add an
343<code>android:minSdkVersion="{@sdkPlatformApiLevel}"</code> attribute to the
344<a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html">{@code &lt;uses-sdk&gt;}</a>
345element.</p>
346
347<p>For more information, see the <a href="{@docRoot}guide/appendix/api-levels.html">API Levels</a>
348document. </p>
349
350
351<h2 id="apps">Built-in Applications</h2>
352
353<p>The system image included in the downloadable platform provides these
354built-in applications:</p>
355
356<table style="border:0;padding-bottom:0;margin-bottom:0;">
357<tr>
358<td style="border:0;padding-bottom:0;margin-bottom:0;">
359<ul>
360<li>API Demos</li>
361<li>Browser</li>
362<li>Calculator</li>
363<li>Calendar</li>
364<li>Camera</li>
365<li>Clock</li>
366<li>Custom Locale</li>
367<li>Dev Tools</li>
368<li>Downloads</li>
369<li>Email</li>
370<li>Gallery</li>
371</ul>
372</td>
373<td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
374<ul>
375<li>Gestures Builder</li>
376<li>Messaging</li>
377<li>Music</li>
378<li>People</li>
379<li>Phone</li>
380<li>Search</li>
381<li>Settings</li>
382<li>Speech Recorder</li>
383<li>Widget Preview</li>
384</ul>
385</td>
386</tr>
387</table>
388
389
390<h2 id="locs" style="margin-top:.75em;">Locales</h2>
391
392<p>The system image included in the downloadable SDK platform provides a variety of built-in
393locales. In some cases, region-specific strings are available for the locales. In other cases, a
394default version of the language is used. The languages that are available in the Android 3.0 system
395image are listed below (with <em>language</em>_<em>country/region</em> locale descriptor).</p>
396
397<table style="border:0;padding-bottom:0;margin-bottom:0;">
398<tr>
399<td style="border:0;padding-bottom:0;margin-bottom:0;">
400<ul>
401<li>Arabic, Egypt (ar_EG)</li>
402<li>Arabic, Israel (ar_IL)</li>
403<li>Bulgarian, Bulgaria (bg_BG)</li>
404<li>Catalan, Spain (ca_ES)</li>
405<li>Czech, Czech Republic (cs_CZ)</li>
406<li>Danish, Denmark(da_DK)</li>
407<li>German, Austria (de_AT)</li>
408<li>German, Switzerland (de_CH)</li>
409<li>German, Germany (de_DE)</li>
410<li>German, Liechtenstein (de_LI)</li>
411<li>Greek, Greece (el_GR)</li>
412<li>English, Australia (en_AU)</li>
413<li>English, Canada (en_CA)</li>
414<li>English, Britain (en_GB)</li>
415<li>English, Ireland (en_IE)</li>
416<li>English, India (en_IN)</li>
417<li>English, New Zealand (en_NZ)</li>
418<li>English, Singapore(en_SG)</li>
419<li>English, US (en_US)</li>
420<li>English, Zimbabwe (en_ZA)</li>
421<li>Spanish (es_ES)</li>
422<li>Spanish, US (es_US)</li>
423<li>Finnish, Finland (fi_FI)</li>
424<li>French, Belgium (fr_BE)</li>
425<li>French, Canada (fr_CA)</li>
426<li>French, Switzerland (fr_CH)</li>
427<li>French, France (fr_FR)</li>
428<li>Hebrew, Israel (he_IL)</li>
429<li>Hindi, India (hi_IN)</li>
430</ul>
431</td>
432<td style="border:0;padding-bottom:0;margin-bottom:0;padding-left:5em;">
433<li>Croatian, Croatia (hr_HR)</li>
434<li>Hungarian, Hungary (hu_HU)</li>
435<li>Indonesian, Indonesia (id_ID)</li>
436<li>Italian, Switzerland (it_CH)</li>
437<li>Italian, Italy (it_IT)</li>
438<li>Japanese (ja_JP)</li>
439<li>Korean (ko_KR)</li>
440<li>Lithuanian, Lithuania (lt_LT)</li>
441<li>Latvian, Latvia (lv_LV)</li>
442<li>Norwegian bokmål, Norway (nb_NO)</li>
443<li>Dutch, Belgium (nl_BE)</li>
444<li>Dutch, Netherlands (nl_NL)</li>
445<li>Polish (pl_PL)</li>
446<li>Portuguese, Brazil (pt_BR)</li>
447<li>Portuguese, Portugal (pt_PT)</li>
448<li>Romanian, Romania (ro_RO)</li>
449<li>Russian (ru_RU)</li></li>
450<li>Slovak, Slovakia (sk_SK)</li>
451<li>Slovenian, Slovenia (sl_SI)</li>
452<li>Serbian (sr_RS)</li>
453<li>Swedish, Sweden (sv_SE)</li>
454<li>Thai, Thailand (th_TH)</li>
455<li>Tagalog, Philippines (tl_PH)</li>
456<li>Turkish, Turkey (tr_TR)</li>
457<li>Ukrainian, Ukraine (uk_UA)</li>
458<li>Vietnamese, Vietnam (vi_VN)</li>
459<li>Chinese, PRC (zh_CN)</li>
460<li>Chinese, Taiwan (zh_TW)</li>
461</td>
462</tr>
463</table>
464
465<p class="note"><strong>Note:</strong> The Android platform may support more
466locales than are included in the SDK system image. All of the supported locales
467are available in the <a href="http://source.android.com/">Android Open Source
468Project</a>.</p>
469
470<h2 id="skins">Emulator Skins</h2>
471
472<p>The downloadable platform includes the following emulator skins:</p>
473
474<ul>
475 <li>
476 QVGA (240x320, low density, small screen)
477 </li>
478 <li>
479 WQVGA400 (240x400, low density, normal screen)
480 </li>
481 <li>
482 WQVGA432 (240x432, low density, normal screen)
483 </li>
484 <li>
485 HVGA (320x480, medium density, normal screen)
486 </li>
487 <li>
488 WVGA800 (480x800, high density, normal screen)
489 </li>
490 <li>
491 WVGA854 (480x854 high density, normal screen)
492 </li>
493 <li>
494 WXGA720 (1280x720, extra-high density, normal screen)
495 </li>
496 <li>
497 WSVGA (1024x600, medium density, large screen)
498 </li>
499 <li>
500 WXGA (1280x800, medium density, xlarge screen)
501 </li>
502</ul>
503
504<p>To test your application on an emulator that represents the latest Android device, you can create
505an AVD with the new WXGA720 skin (it's an xhdpi, normal screen device). Note that the emulator
506currently doesn't support the new on-screen navigation bar for devices without hardware navigation
507buttons, so when using this skin, you must use keyboard keys <em>Home</em> for the Home button,
508<em>ESC</em> for the Back button, and <em>F2</em> or <em>Page-up</em> for the Menu button.</p>
509
510<p>However, due to performance issues in the emulator when running high-resolution screens such as
511the one for the WXGA720 skin, we recommend that you primarily use the traditional WVGA800 skin
512(hdpi, normal screen) to test your application.</p>
513