Merge "adding fountain framebuffer object sdk sample" into ics-mr0
diff --git a/apps/Fallback/res/values-am/strings.xml b/apps/Fallback/res/values-am/strings.xml
index 0c89122..34a3564 100644
--- a/apps/Fallback/res/values-am/strings.xml
+++ b/apps/Fallback/res/values-am/strings.xml
@@ -18,5 +18,5 @@
     xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
     <string name="appTitle" msgid="161410001913116606">"Fallback"</string>
     <string name="title" msgid="8156274565006125136">"የማይደገፍ ድርጊት"</string>
-    <string name="error" msgid="6539615832923362301">"ያድርጊት በአሁኑ ጊዜ የማይደገፍ ነው።"</string>
+    <string name="error" msgid="6539615832923362301">"ድርጊቱ በአሁኑ ጊዜ የማይደገፍ ነው።"</string>
 </resources>
diff --git a/apps/Fallback/res/values-hi/strings.xml b/apps/Fallback/res/values-hi/strings.xml
new file mode 100644
index 0000000..b2a2e90
--- /dev/null
+++ b/apps/Fallback/res/values-hi/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--  Copyright (C) 2007 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+ -->
+
+<resources xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <string name="appTitle" msgid="161410001913116606">"Fallback"</string>
+    <string name="title" msgid="8156274565006125136">"असमर्थित क्रिया"</string>
+    <string name="error" msgid="6539615832923362301">"वह क्रिया वर्तमान में समर्थित नहीं है."</string>
+</resources>
diff --git a/build/sdk.atree b/build/sdk.atree
index 53970a0..c63623f 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -37,6 +37,8 @@
 # Platform Tools Component
 ##############################################################################
 
+development/sdk/plat_tools_source.properties  platform-tools/source.properties
+
 # host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/
 bin/adb                                 strip platform-tools/adb
 bin/aapt                                strip platform-tools/aapt
@@ -48,7 +50,11 @@
 bin/dexdump                                   platform-tools/dexdump
 framework/dx.jar                              platform-tools/lib/dx.jar
 
-development/sdk/plat_tools_source.properties  platform-tools/source.properties
+
+# Framework include for Renderscript
+frameworks/base/libs/rs/scriptc               platform-tools/renderscript/include
+external/clang/lib/Headers                    platform-tools/renderscript/clang-include
+external/clang/LICENSE.TXT                    platform-tools/renderscript/clang-include/LICENSE.TXT
 
 ##############################################################################
 # Platform Component
@@ -66,11 +72,6 @@
 # the aidl precompiled include
 obj/framework.aidl platforms/${PLATFORM_NAME}/framework.aidl
 
-# Framework include for Renderscript
-frameworks/base/libs/rs/scriptc  platforms/${PLATFORM_NAME}/renderscript/include
-external/clang/lib/Headers       platforms/${PLATFORM_NAME}/renderscript/clang-include
-external/clang/LICENSE.TXT       platforms/${PLATFORM_NAME}/renderscript/clang-include/LICENSE.TXT
-
 # emulator skins from sdk.git
 development/tools/emulator/skins/QVGA      platforms/${PLATFORM_NAME}/skins/QVGA
 development/tools/emulator/skins/WQVGA432  platforms/${PLATFORM_NAME}/skins/WQVGA432
@@ -151,7 +152,6 @@
 #
 # PLEASE KEEP THE SAMPLES IN ALPHABETICAL ORDER.
 #
-development/samples/AccessibilityService       samples/${PLATFORM_NAME}/AccessibilityService
 development/samples/AccelerometerPlay          samples/${PLATFORM_NAME}/AccelerometerPlay
 development/samples/ActionBarCompat            samples/${PLATFORM_NAME}/ActionBarCompat
 development/samples/AndroidBeamDemo            samples/${PLATFORM_NAME}/AndroidBeamDemo
@@ -170,7 +170,8 @@
 development/samples/NotePad                    samples/${PLATFORM_NAME}/NotePad
 development/samples/NFCDemo                    samples/${PLATFORM_NAME}/NFCDemo
 development/samples/RandomMusicPlayer          samples/${PLATFORM_NAME}/RandomMusicPlayer
-development/samples/SampleSpellCheckerService  samples/${PLATFORM_NAME}/SampleSpellCheckerService
+development/samples/SpellChecker/SampleSpellCheckerService samples/${PLATFORM_NAME}/SpellChecker/SampleSpellCheckerService
+development/samples/SpellChecker/HelloSpellChecker samples/${PLATFORM_NAME}/SpellChecker/HelloSpellChecker
 development/samples/SampleSyncAdapter          samples/${PLATFORM_NAME}/SampleSyncAdapter
 development/samples/SearchableDictionary       samples/${PLATFORM_NAME}/SearchableDictionary
 development/samples/SipDemo                    samples/${PLATFORM_NAME}/SipDemo
diff --git a/samples/AccessibilityService/AndroidManifest.xml b/samples/AccessibilityService/AndroidManifest.xml
deleted file mode 100644
index 1b5f794..0000000
--- a/samples/AccessibilityService/AndroidManifest.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!-- Copyright (C) 2010 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-
-          http://www.apache.org/licenses/LICENSE-2.0
-
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-      package="com.example.android.clockback"
-      android:versionCode="1"
-      android:versionName="1.0">
-
-    <uses-permission android:name="android.permission.VIBRATE" />
-
-    <application android:label="@string/clockback_setup_title">
-
-        <!-- We declare our service here -->
-        <service android:name=".ClockBackService">
-            <!-- This intent filter is a clue for the system that this is an accessibility service -->
-            <intent-filter>
-                <action android:name="android.accessibilityservice.AccessibilityService" />
-            </intent-filter>
-        </service>
-
-    </application>
-
-    <!-- Accessibility API appeared in SDK version 4 (Android 1.6) -->
-    <uses-sdk android:minSdkVersion="4" />
-
-</manifest>
diff --git a/samples/AccessibilityService/_index.html b/samples/AccessibilityService/_index.html
deleted file mode 100644
index d6adbf2..0000000
--- a/samples/AccessibilityService/_index.html
+++ /dev/null
@@ -1,120 +0,0 @@
-<p>
-  This is an example of an accessibility service that provides custom feedback for the Clock application which comes by default with Android devices. It demonstrates the following key features of the Android accessibility APIs:
-</p>
-<ol>
-  <li>
-    Simple demonstration of how to use the accessibility APIs.
-  </li>
-  <li>
-    Hands-on example of various ways to utilize the accessibility API for providing alternative and complementary feedback.
-  </li>
-  <li>
-    Providing application specific feedback &mdash; the service handles only accessibility events from the Clock application.
-  </li>
-  <li>
-    Providing dynamic, context-dependent feedback &mdash; feedback type changes depending on the ringer mode.
-  </li>
-  <li>
-    Application specific UI enhancement &mdash; application domain knowledge is utilized to enhance the provided feedback.
-  </li>
-</ol>
-<p>
-  <strong>
-    Note: This code sample will work only on devices shipped with the default Clock application. If you are
-    running Android 1.6 of Android 2.0 you should enable first ClockBack and then TalkBack since in these
-    releases accessibility services are notified in the order of registration.
-  </strong>
-</p>
-<p>
-  Steps to exercise the ClockBack example:
-</p>
-<ol>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Enable accessibility and all default accessibility services:<br/>
-        Settings &rarr; Accessibility &rarr; select the Accessibility, TalkBack, KickBack, and SoundBack checkboxes
-      </li>
-      <li>
-        <strong>Result:</strong> The system provides spoken, audible, and haptic feedback.
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Explore the feedback provided by the system:<br/>
-        Poke around with the trackball.
-      </li>
-      <li>
-        <strong>Result:</strong> You are somehow familiar with the type of the provided feedback.
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Go to the Clock application and try to change the time of an alarm:<br/>
-        All applications &rarr; Clock &rarr; Alarms (left corner) &rarr; Select an alarm &rarr; Time &mdash; explore the plus, minus buttons, hour and minute edit boxes.
-      </li>
-      <li>
-        <strong>Result:</strong> The hour and minute edit boxes are announced without any clue which is the hour and which is the minute one (you can guess from the arrangement).
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Enable ClockBack:<br>
-        Settings &rarr; Accessibility &rarr; ClockBack &mdash; select the checkbox (assuming you have installed the APK).
-      </li>
-      <li>
-        <strong>Result:</strong> We have active accessibility service for providing application specific feedback for the Clock application.
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Go to the Clock application and try to change the time of an alarm:<br/>
-        All applications &rarr; Clock &rarr; Alarms (left corner) &rarr; Select an alarm &rarr; Time &mdash; explore the hour and minute edit boxes.
-      </li>
-      <li>
-        <strong>Result:</strong> The hour and minute edit boxes are now spoken. This is an example of application specific feedback that utilizes domain information to enhance the user experience.
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Set the ringer to vibration mode and explore the provided feedback:<br/>
-        Use the device button for reducing the ringer volume until it is in vibration mode. Move around the Clock application and outside of that application.
-      </li>
-      <li>
-        <strong>Result:</strong> The Clock application provides custom audible and default haptic feedback. The rest of the system provides the default feedback.
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Set the ringer to muted mode and explore the provided feedback:<br/>
-        Use the device button for reducing the ringer volume until it is in muted mode. Move around the Clock application and outside of that application.
-      </li>
-      <li>
-        <strong>Result:</strong> The Clock application provides only custom haptic feedback. The rest of the system provides the default feedback. Now we are providing custom context dependent feedback based on the device state (ringer mode).
-      </li>
-    </ul>
-  </li>
-  <li>
-    <ul>
-      <li>
-        <strong>Action:</strong> Write an accessibility service:<br/>
-        The <a href="http://code.google.com/p/eyes-free/">Eyes-Free open source project</a> has more accessibility-related resources. To contribute, visit the project page or post to the <a href="http://groups.google.com/group/eyes-free">mailing list</a>.
-      </li>
-      <li>
-        <strong>Result:</strong> One more cool application has been written.
-      </li>
-    </ul>
-  </li>
-</ol>
diff --git a/samples/AccessibilityService/res/values/strings.xml b/samples/AccessibilityService/res/values/strings.xml
deleted file mode 100644
index a9913c2..0000000
--- a/samples/AccessibilityService/res/values/strings.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
-    <!-- VALUES -->
-
-    <!-- Setting up the user interface vibration feedback service -->
-    <string name="clockback_setup_title">ClockBack</string>
-
-    <!-- String value for announcing the increase hours buttons -->
-    <string name="value_increase_hours">Increase hours</string>
-
-    <!-- String value for announcing the increase minutes buttons -->
-    <string name="value_increase_minutes">Increase minutes</string>
-
-    <!-- String value for announcing the decrease hours buttons -->
-    <string name="value_decrease_hours">Decrease hours</string>
-
-    <!-- String value for announcing the decrease minutes buttons -->
-    <string name="value_decrease_minutes">Decrease minutes</string>
-
-    <!-- String value for announcing one hour input -->
-    <string name="value_hour">hour</string>
-
-    <!-- String value for announcing the hours input -->
-    <string name="value_hours">hours</string>
-
-    <!-- String value for announcing one minute input -->
-    <string name="value_minute">minute</string>
-
-    <!-- String value for announcing the minutes input -->
-    <string name="value_minutes">minutes</string>
-
-    <!-- String value for announcing audible ringer mode -->
-    <string name="value_ringer_audible">Ringer audible</string>
-
-    <!-- String value for announcing vibrating ringer mode -->
-    <string name="value_ringer_vibrate">Ringer vibrate</string>
-
-    <!-- String value for announcing silent ringer mode-->
-    <string name="value_ringer_silent">Ringer silent</string>
-
-    <!-- TEMPLATES -->
-
-    <!-- String template for announcing the screen on -->
-    <string name="template_screen_on">Screen on. Volume %1$s percent.</string>
-
-    <!-- String template for announcing the screen off -->
-    <string name="template_screen_off">Screen off. Volume %1$s percent.</string>
-
-</resources>
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 4a4a7c3..2bda4a7 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -36,7 +36,7 @@
     <!-- For android.media.audiofx.Visualizer -->
     <uses-permission android:name="android.permission.RECORD_AUDIO" />
 
-    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="13" />
+    <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="14" />
 
     <!-- We will request access to the camera, saying we require a camera
          of some sort but not one with autofocus capability. -->
@@ -242,7 +242,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <!-- Fragment Samples -->
 
         <activity android:name=".app.FragmentAlertDialog"
@@ -541,6 +541,45 @@
             </intent-filter>
         </activity>
 
+        <!-- ============================ -->
+        <!--  Accessibility examples strings  -->
+        <!-- ============================ -->
+
+        <activity android:name=".accessibility.ClockBackActivity"
+            android:label="@string/accessibility_service">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <service android:name=".accessibility.ClockBackService"
+            android:label="@string/accessibility_service_label">
+            <intent-filter>
+                <action android:name="android.accessibilityservice.AccessibilityService" />
+            </intent-filter>
+        </service>
+
+        <activity android:name=".accessibility.TaskListActivity"
+                  android:label="@string/accessibility_query_window"
+                  android:enabled="@bool/atLeastIceCreamSandwich">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <service android:name=".accessibility.TaskBackService"
+                 android:label="@string/accessibility_query_window_label"
+                 android:enabled="@bool/atLeastIceCreamSandwich">
+            <intent-filter>
+                <action android:name="android.accessibilityservice.AccessibilityService" />
+            </intent-filter>
+            <meta-data
+                android:name="android.accessibilityservice"
+                android:resource="@xml/taskbackconfig" />
+        </service>
+
         <!-- Instrumentation Samples -->
 
         <activity android:name=".app.LocalSample" android:label="@string/activity_local_sample">
@@ -816,8 +855,17 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".app.ActionBarActionProviderActivity"
-                android:label="@string/action_bar_action_provider"
+        <activity android:name=".app.ActionBarSettingsActionProviderActivity"
+                android:label="@string/action_bar_settings_action_provider"
+                android:enabled="@bool/atLeastIceCreamSandwich">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".app.ActionBarShareActionProviderActivity"
+                android:label="@string/action_bar_share_action_provider"
                 android:enabled="@bool/atLeastIceCreamSandwich">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -2128,7 +2176,7 @@
         <!-- ************************************* -->
 
         <activity android:name=".graphics.kube.Kube" android:label="Graphics/OpenGL ES/Kube"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2152,7 +2200,7 @@
         <activity android:name=".graphics.CompressedTextureActivity"
                 android:label="Graphics/OpenGL ES/Compressed Texture"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2162,7 +2210,7 @@
         <activity android:name=".graphics.CubeMapActivity"
                 android:label="Graphics/OpenGL ES/Cube Map"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2173,7 +2221,7 @@
         <activity android:name=".graphics.FrameBufferObjectActivity"
                 android:label="Graphics/OpenGL ES/Frame Buffer Object"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2183,7 +2231,7 @@
         <activity android:name=".graphics.GLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/GLSurfaceView"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2193,7 +2241,7 @@
         <activity android:name=".graphics.GLES20Activity"
                 android:label="Graphics/OpenGL ES/OpenGL ES 2.0"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2202,7 +2250,7 @@
 
         <activity android:name=".graphics.MatrixPaletteActivity"
                 android:label="Graphics/OpenGL ES/Matrix Palette Skinning"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2212,27 +2260,17 @@
         <activity android:name=".graphics.TranslucentGLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/Translucent GLSurfaceView"
                 android:theme="@style/Theme.Translucent"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
 
-        <activity android:name=".graphics.HiddenActivity"
-                android:label="Graphics/OpenGL ES/Hidden Activity"
-                android:theme="@android:style/Theme.Translucent"
-                android:configChanges="orientation|keyboardHidden">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.SAMPLE_CODE" />
-            </intent-filter>
-        </activity>
-        
         <activity android:name=".graphics.TriangleActivity"
                 android:label="Graphics/OpenGL ES/Textured Triangle"
                 android:theme="@android:style/Theme.Holo.Dialog"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2242,7 +2280,7 @@
         <activity android:name=".graphics.spritetext.SpriteTextActivity"
                 android:label="Graphics/OpenGL ES/Sprite Text"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2252,7 +2290,7 @@
         <activity android:name=".graphics.TouchRotateActivity"
                 android:label="Graphics/OpenGL ES/Touch Rotate"
                 android:theme="@android:style/Theme.NoTitleBar"
-                android:configChanges="orientation|keyboardHidden">
+                android:configChanges="keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -2473,7 +2511,7 @@
 
         <activity android:name=".graphics.TouchPaint" android:label="Graphics/Touch Paint"
                 android:theme="@style/Theme.Black"
-                android:configChanges="keyboard|keyboardHidden|navigation|orientation">
+                android:configChanges="keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|smallestScreenSize">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
diff --git a/samples/ApiDemos/_index.html b/samples/ApiDemos/_index.html
index 002ca15..281364c 100644
--- a/samples/ApiDemos/_index.html
+++ b/samples/ApiDemos/_index.html
@@ -20,9 +20,12 @@
 <p><strong>Update:</strong> The following are some of the new demos for Android 4.0:</p>
 <ul>
 <li><a
-href="src/com/example/android/apis/preference/PreferencesFromCode.html">SwitchPreference</a></li>
+href="src/com/example/android/apis/preference/PreferencesFromCode.html">Switch Preference</a></li>
 <li><a
-href="src/com/example/android/apis/app/ActionBarActionProviderActivity.html">ShareActionProvider
+href="src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.html">Settings Action Provider
+</a></li>
+<li><a
+href="src/com/example/android/apis/app/ActionBarShareActionProviderActivity.html">Share Action Provider
 </a></li>
 <li><a href="src/com/example/android/apis/view/SearchViewActionBar.html">Collapsible action
 view</a></li>
@@ -33,6 +36,9 @@
 <li><a href="src/com/example/android/apis/graphics/TouchPaint.html">Stylus and hover
 support</a></li>
 <li><a href="src/com/example/android/apis/view/Switches.html">Switch widget</a></li>
+<li><a
+  href="src/com/example/android/apis/accessibility/TaskBackService.html">Window
+  Querying Accessibility Service</a></li>
 </ul>
 </div>
 
diff --git a/samples/ApiDemos/res/drawable-hdpi/ic_launcher_settings.png b/samples/ApiDemos/res/drawable-hdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..c02bd42
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-hdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/ic_launcher_settings.png b/samples/ApiDemos/res/drawable-mdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..05cdd9a
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-mdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-xhdpi/ic_launcher_settings.png b/samples/ApiDemos/res/drawable-xhdpi/ic_launcher_settings.png
new file mode 100644
index 0000000..2b2907b
--- /dev/null
+++ b/samples/ApiDemos/res/drawable-xhdpi/ic_launcher_settings.png
Binary files differ
diff --git a/samples/ApiDemos/res/layout/accessibility_service.xml b/samples/ApiDemos/res/layout/accessibility_service.xml
new file mode 100644
index 0000000..169379b
--- /dev/null
+++ b/samples/ApiDemos/res/layout/accessibility_service.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/accessibility_service_instructions"
+        />
+
+    <ImageButton android:id="@+id/button"
+        android:background="@drawable/ic_launcher_settings"
+        android:layout_width="32dip"
+        android:layout_height="32dip"
+        android:layout_marginTop="50dip"
+        android:layout_gravity="center"
+        android:scaleType="fitCenter"
+        android:adjustViewBounds="true" />
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/action_bar_settings_action_provider.xml b/samples/ApiDemos/res/layout/action_bar_settings_action_provider.xml
new file mode 100644
index 0000000..dd9807b
--- /dev/null
+++ b/samples/ApiDemos/res/layout/action_bar_settings_action_provider.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="match_parent"
+    android:layout_gravity="center"
+    android:focusable="true"
+    android:addStatesFromChildren="true"
+    android:background="?android:attr/actionBarItemBackground"
+    style="?android:attr/actionButtonStyle">
+
+    <ImageButton android:id="@+id/button"
+        android:background="@drawable/ic_launcher_settings"
+        android:layout_width="32dip"
+        android:layout_height="32dip"
+        android:layout_gravity="center"
+        android:scaleType="fitCenter"
+        android:adjustViewBounds="true" />
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/tasklist_main.xml b/samples/ApiDemos/res/layout/tasklist_main.xml
new file mode 100644
index 0000000..3226344
--- /dev/null
+++ b/samples/ApiDemos/res/layout/tasklist_main.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2011 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/accessibility_query_window_instructions"
+        />
+
+    <com.example.android.apis.accessibility.TaskListView
+        android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_marginTop="50dip"
+        android:layout_marginBottom="50dip"
+        android:layout_weight="1"
+        android:drawSelectorOnTop="false" />
+
+    <ImageButton android:id="@+id/button"
+        android:background="@drawable/ic_launcher_settings"
+        android:layout_width="32dip"
+        android:layout_height="32dip"
+        android:layout_marginTop="50dip"
+        android:layout_gravity="center"
+        android:scaleType="fitCenter"
+        android:adjustViewBounds="true" />
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/tasklist_row.xml b/samples/ApiDemos/res/layout/tasklist_row.xml
new file mode 100644
index 0000000..029eb04
--- /dev/null
+++ b/samples/ApiDemos/res/layout/tasklist_row.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright (C) 2011 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="horizontal"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:weightSum="1"
+    android:baselineAligned="false">
+
+    <TextView android:id="@+id/tasklist_label"
+        android:textSize="20dp"
+        android:textStyle="bold"
+        android:layout_height="48dp"
+        android:layout_width="300dip"
+     />
+
+    <CheckBox android:id="@+id/tasklist_finished"
+        android:checked="false" android:layout_height="48dp"
+        android:layout_weight=".25"
+        android:layout_width="wrap_content" />
+
+</LinearLayout>
diff --git a/samples/ApiDemos/res/menu/action_bar_settings_action_provider.xml b/samples/ApiDemos/res/menu/action_bar_settings_action_provider.xml
new file mode 100644
index 0000000..b72a7d1
--- /dev/null
+++ b/samples/ApiDemos/res/menu/action_bar_settings_action_provider.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 Google Inc.
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <item android:id="@+id/menu_item_action_provider_action_bar"
+        android:showAsAction="ifRoom"
+        android:title="@string/action_bar_settings"
+        android:actionProviderClass="com.example.android.apis.app.ActionBarSettingsActionProviderActivity$SettingsActionProvider"/>
+
+    <item android:id="@+id/menu_item_action_provider_overflow"
+        android:showAsAction="never"
+        android:title="@string/action_bar_settings"
+        android:actionProviderClass="com.example.android.apis.app.ActionBarSettingsActionProviderActivity$SettingsActionProvider"/>
+
+</menu>
diff --git a/samples/ApiDemos/res/menu/action_bar_action_provider.xml b/samples/ApiDemos/res/menu/action_bar_share_action_provider.xml
similarity index 100%
rename from samples/ApiDemos/res/menu/action_bar_action_provider.xml
rename to samples/ApiDemos/res/menu/action_bar_share_action_provider.xml
diff --git a/samples/AccessibilityService/res/raw/sound_ringer_normal.ogg b/samples/ApiDemos/res/raw/sound_ringer_normal.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_ringer_normal.ogg
rename to samples/ApiDemos/res/raw/sound_ringer_normal.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_ringer_silent.ogg b/samples/ApiDemos/res/raw/sound_ringer_silent.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_ringer_silent.ogg
rename to samples/ApiDemos/res/raw/sound_ringer_silent.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_ringer_vibrate.ogg b/samples/ApiDemos/res/raw/sound_ringer_vibrate.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_ringer_vibrate.ogg
rename to samples/ApiDemos/res/raw/sound_ringer_vibrate.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_screen_off.ogg b/samples/ApiDemos/res/raw/sound_screen_off.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_screen_off.ogg
rename to samples/ApiDemos/res/raw/sound_screen_off.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_screen_on.ogg b/samples/ApiDemos/res/raw/sound_screen_on.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_screen_on.ogg
rename to samples/ApiDemos/res/raw/sound_screen_on.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_view_clicked.ogg b/samples/ApiDemos/res/raw/sound_view_clicked.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_view_clicked.ogg
rename to samples/ApiDemos/res/raw/sound_view_clicked.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_view_focused_or_selected.ogg b/samples/ApiDemos/res/raw/sound_view_focused_or_selected.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_view_focused_or_selected.ogg
rename to samples/ApiDemos/res/raw/sound_view_focused_or_selected.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_screen_on.ogg b/samples/ApiDemos/res/raw/sound_view_hover_enter.ogg
similarity index 100%
copy from samples/AccessibilityService/res/raw/sound_screen_on.ogg
copy to samples/ApiDemos/res/raw/sound_view_hover_enter.ogg
Binary files differ
diff --git a/samples/AccessibilityService/res/raw/sound_window_state_changed.ogg b/samples/ApiDemos/res/raw/sound_window_state_changed.ogg
similarity index 100%
rename from samples/AccessibilityService/res/raw/sound_window_state_changed.ogg
rename to samples/ApiDemos/res/raw/sound_window_state_changed.ogg
Binary files differ
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 45d4755..b1a57b0 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -731,7 +731,9 @@
     <string name="action_bar_mechanics">App/Action Bar/Action Bar Mechanics</string>
     <string name="action_bar_usage">App/Action Bar/Action Bar Usage</string>
     <string name="action_bar_tabs">App/Action Bar/Action Bar Tabs</string>
-    <string name="action_bar_action_provider">App/Action Bar/Action Provider</string>
+    <string name="action_bar_settings_action_provider">App/Action Bar/Action Provider/Settings Action Provider</string>
+    <string name="action_bar_share_action_provider">App/Action Bar/Action Provider/Share Action Provider</string>
+    <string name="action_bar_settings_action_provider_no_handling">Handling in onOptionsItemSelected avoided</string>
 
     <string name="action_bar_search">Search</string>
     <string name="action_bar_add">Add</string>
@@ -741,6 +743,7 @@
     <string name="action_bar_sort_alpha">Alphabetically</string>
     <string name="action_bar_sort_size">By size</string>
     <string name="action_bar_share_with">Share with...</string>
+    <string name="action_bar_settings">Settings</string>
 
     <string name="action_bar_display_options">App/Action Bar/Display Options</string>
     <string name="toggle_home_as_up">DISPLAY_HOME_AS_UP</string>
@@ -1283,4 +1286,42 @@
     <string name="dismiss">Dismiss</string>
 
     <string name="share">Share</string>
-</resources>
+
+    <!-- ============================ -->
+    <!--  Accessibility examples strings  -->
+    <!-- ============================ -->
+
+    <string name="accessibility_service">Accessibility/Accessibility Service</string>
+    <string name="accessibility_service_label">ClockBack</string>
+    <string name="accessibility_service_instructions">
+        1. Enable TalkBack (Settings -> Accessibility -> TalkBack).
+        \n\n2. Enable Explore-byTouch (Settings -> Accessibility -> Explore by Touch).
+        \n\n3. Touch explore the Clock application and the home screen.
+        \n\n4. Go to the Clock application and change the time of an alarm.
+        \n\n5. Enable ClockBack (Settings -> Accessibility -> ClockBack).
+        \n\n6. Go to the Clock application and change an alarm.
+        \n\n7. Set the ringer to vibration mode and change an alarm.
+        \n\n8. Set the ringer to muted mode and change an alarm.
+    </string>
+
+    <string name="value_ringer_audible">Ringer audible</string>
+    <string name="value_ringer_vibrate">Ringer vibrate</string>
+    <string name="value_ringer_silent">Ringer silent</string>
+    <string name="template_screen_on">Screen on. Volume %1$s percent.</string>
+    <string name="template_screen_off">Screen off. Volume %1$s percent.</string>
+
+    <string name="accessibility_query_window">Accessibility/Accessibility Node Querying</string>
+    <string name="accessibility_query_window_label">QueryBack</string>
+    <string name="accessibility_query_window_description">Task App Accessibility Service</string>
+    <string name="accessibility_query_window_instructions">
+        1. Enable QueryBack (Settings -> Accessibility -> QueryBack).
+        \n\n2. Enable Explore-byTouch (Settings -> Accessibility -> Explore by Touch).
+        \n\n3. Touch explore the list.
+    </string>
+
+    <string name="task_name">Task</string>
+    <string name="task_complete_template">Task %1$s %2$s</string>
+    <string name="task_complete">is complete</string>
+    <string name="task_not_complete">is not complete</string>
+
+  </resources>
diff --git a/samples/ApiDemos/res/xml/taskbackconfig.xml b/samples/ApiDemos/res/xml/taskbackconfig.xml
new file mode 100644
index 0000000..5dc0cf5
--- /dev/null
+++ b/samples/ApiDemos/res/xml/taskbackconfig.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright (C) 2011 The Android Open Source Project
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+ -->
+
+<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
+    android:accessibilityEventTypes="typeAllMask"
+    android:packageNames="com.example.android.apis"
+    android:accessibilityFeedbackType="feedbackSpoken"
+    android:notificationTimeout="100"
+    android:canRetrieveWindowContent="true"
+    android:description="@string/accessibility_query_window_description" />
diff --git a/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java b/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java
new file mode 100644
index 0000000..75fb1ff
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackActivity.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.accessibility;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.view.View;
+import android.widget.ImageButton;
+
+import com.example.android.apis.R;
+
+/**
+ * This is the entry activity for a sample that demonstrates how to implement an
+ * {@link android.accessibilityservice.AccessibilityService}.
+ */
+public class ClockBackActivity extends Activity {
+
+    /** An intent for launching the system settings. */
+    private static final Intent sSettingsIntent =
+        new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.accessibility_service);
+
+        // Add a shortcut to the accessibility settings.
+        ImageButton button = (ImageButton) findViewById(R.id.button);
+        button.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(sSettingsIntent);
+            }
+        });
+    }
+}
diff --git a/samples/AccessibilityService/src/com/example/android/clockback/ClockBackService.java b/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackService.java
similarity index 74%
rename from samples/AccessibilityService/src/com/example/android/clockback/ClockBackService.java
rename to samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackService.java
index 5746716..d5cd2a3 100644
--- a/samples/AccessibilityService/src/com/example/android/clockback/ClockBackService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/ClockBackService.java
@@ -14,7 +14,9 @@
  * limitations under the License.
  */
 
-package com.example.android.clockback;
+package com.example.android.apis.accessibility;
+
+import com.example.android.apis.R;
 
 import android.accessibilityservice.AccessibilityService;
 import android.accessibilityservice.AccessibilityServiceInfo;
@@ -54,19 +56,7 @@
  *     Providing dynamic, context-dependent feedback &mdash; feedback type changes
  *     depending on the ringer state.
  *   </li>
- *   <li>
- *     Application specific UI enhancement - application domain knowledge is
- *     utilized to enhance the provided feedback.
- *   </li>
  * </ol>
- * <p>
- *   <strong>
- *     Note: This code sample will work only on devices shipped with the default Clock
- *     application. If you are running Android 1.6 of Android 2.0 you should enable first
- *     ClockBack and then TalkBack since in these releases accessibility services are
- *     notified in the order of registration.
- *   </strong>
- * </p>
  */
 public class ClockBackService extends AccessibilityService {
 
@@ -147,56 +137,6 @@
     /** The space string constant. */
     private static final String SPACE = " ";
 
-    /**
-     * The class name of the number picker buttons with no text we want to
-     * announce in the Clock application.
-     */
-    private static final String CLASS_NAME_NUMBER_PICKER_BUTTON_CLOCK = "android.widget.NumberPickerButton";
-
-    /**
-     * The class name of the number picker buttons with no text we want to
-     * announce in the AlarmClock application.
-     */
-    private static final String CLASS_NAME_NUMBER_PICKER_BUTTON_ALARM_CLOCK = "com.android.internal.widget.NumberPickerButton";
-
-    /**
-     * The class name of the edit text box for hours and minutes we want to
-     * better announce.
-     */
-    private static final String CLASS_NAME_EDIT_TEXT = "android.widget.EditText";
-
-    /**
-     * Mapping from integer to string resource id where the keys are generated
-     * from the {@link AccessibilityEvent#getText()},
-     * {@link AccessibilityEvent#getItemCount()} and
-     * {@link AccessibilityEvent#getCurrentItemIndex()} properties.
-     * <p>
-     * Note: In general, computing these mappings includes the widget position on
-     * the screen. This is fragile and should be used as a last resort since
-     * changing the layout could potentially change the widget position. This is
-     * a workaround since the widgets of interest are image buttons that do not
-     * have contentDescription attribute set (plus/minus buttons) or no other
-     * information in the accessibility event is available to distinguish them
-     * aside of their positions on the screen (hour/minute inputs).<br/>
-     * If you are owner of the target application (Clock in this case) you
-     * should add contentDescription attribute to all image buttons such that a
-     * screen reader knows how to speak them. For input fields (while not
-     * applicable for the hour and minute inputs since they are not empty) a
-     * hint text should be set to enable better announcement.
-     * </p>
-     */
-    private static final SparseArray<Integer> sEventDataMappedStringResourceIds = new SparseArray<Integer>();
-    static {
-        sEventDataMappedStringResourceIds.put(110, R.string.value_increase_hours);
-        sEventDataMappedStringResourceIds.put(1140, R.string.value_increase_minutes);
-        sEventDataMappedStringResourceIds.put(1120, R.string.value_decrease_hours);
-        sEventDataMappedStringResourceIds.put(1160, R.string.value_decrease_minutes);
-        sEventDataMappedStringResourceIds.put(1111, R.string.value_hour);
-        sEventDataMappedStringResourceIds.put(1110, R.string.value_hours);
-        sEventDataMappedStringResourceIds.put(1151, R.string.value_minute);
-        sEventDataMappedStringResourceIds.put(1150, R.string.value_minutes);
-    }
-
     /** Mapping from integers to vibration patterns for haptic feedback. */
     private static final SparseArray<long[]> sVibrationPatterns = new SparseArray<long[]>();
     static {
@@ -215,6 +155,9 @@
         sVibrationPatterns.put(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, new long[] {
                 0L, 25L, 50L, 25L, 50L, 25L
         });
+        sVibrationPatterns.put(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER, new long[] {
+                0L, 15L, 10L, 15L, 15L, 10L
+        });
         sVibrationPatterns.put(INDEX_SCREEN_ON, new long[] {
                 0L, 10L, 10L, 20L, 20L, 30L
         });
@@ -226,11 +169,18 @@
     /** Mapping from integers to raw sound resource ids. */
     private static SparseArray<Integer> sSoundsResourceIds = new SparseArray<Integer>();
     static {
-        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_CLICKED, R.raw.sound_view_clicked);
-        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED, R.raw.sound_view_clicked);
-        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_SELECTED, R.raw.sound_view_focused_or_selected);
-        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_FOCUSED, R.raw.sound_view_focused_or_selected);
-        sSoundsResourceIds.put(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED, R.raw.sound_window_state_changed);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_CLICKED,
+                R.raw.sound_view_clicked);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED,
+                R.raw.sound_view_clicked);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_SELECTED,
+                R.raw.sound_view_focused_or_selected);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_FOCUSED,
+                R.raw.sound_view_focused_or_selected);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED,
+                R.raw.sound_window_state_changed);
+        sSoundsResourceIds.put(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER,
+                R.raw.sound_view_hover_enter);
         sSoundsResourceIds.put(INDEX_SCREEN_ON, R.raw.sound_screen_on);
         sSoundsResourceIds.put(INDEX_SCREEN_OFF, R.raw.sound_screen_off);
         sSoundsResourceIds.put(INDEX_RINGER_SILENT, R.raw.sound_ringer_silent);
@@ -304,7 +254,9 @@
                 case MESSAGE_VIBRATE:
                     int key = message.arg1;
                     long[] pattern = sVibrationPatterns.get(key);
-                    mVibrator.vibrate(pattern, -1);
+                    if (pattern != null) {
+                        mVibrator.vibrate(pattern, -1);
+                    }
                     return;
                 case MESSAGE_STOP_VIBRATE:
                     mVibrator.cancel();
@@ -473,12 +425,6 @@
      *             Let some other services provide audible feedback (SounBack) and haptic
      *             feedback (KickBack).
      * </p>
-     * Note: In the above description an assumption is made that all default feedback
-     *       services are enabled. Such services are TalkBack, SoundBack, and KickBack.
-     *       Also the feature of defining a service as the default for a given feedback
-     *       type will be available in Android 2.2 and above. For previous releases the package
-     *       specific accessibility service must be registered first i.e. checked in the
-     *       settings.
      *
      * @param ringerMode The device ringer mode.
      */
@@ -593,19 +539,6 @@
                 utterance.append(SPACE);
             }
 
-            // Here we do a bit of enhancement of the UI presentation by using the semantic
-            // of the event source in the context of the Clock application.
-            if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED
-                    && CLASS_NAME_EDIT_TEXT.equals(event.getClassName())) {
-                // If the source is an edit text box and we have a mapping based on
-                // its position in the items of the container parent of the event source
-                // we append that value as well. We say "XX hours" and "XX minutes".
-                String resourceValue = getEventDataMappedStringResource(event);
-                if (resourceValue != null) {
-                    utterance.append(resourceValue);
-                }
-            }
-
             return utterance.toString();
         }
 
@@ -617,71 +550,10 @@
             return utterance.toString();
         }
 
-        // No text and content description for the plus and minus buttons, so we lookup
-        // custom values based on the event's itemCount and currentItemIndex properties.
-        CharSequence className = event.getClassName();
-
-        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_FOCUSED
-                && (CLASS_NAME_NUMBER_PICKER_BUTTON_ALARM_CLOCK.equals(className)
-                || CLASS_NAME_NUMBER_PICKER_BUTTON_CLOCK.equals(className))) {
-            String resourceValue = getEventDataMappedStringResource(event);
-            utterance.append(resourceValue);
-        }
-
         return utterance.toString();
     }
 
     /**
-     * Returns a string resource mapped based on the accessibility event
-     * data, specifically the
-     * {@link AccessibilityEvent#getText()},
-     * {@link AccessibilityEvent#getItemCount()}, and
-     * {@link AccessibilityEvent#getCurrentItemIndex()} properties.
-     *
-     * @param event The {@link AccessibilityEvent} to process.
-     * @return The mapped string if such exists, null otherwise.
-     */
-    private String getEventDataMappedStringResource(AccessibilityEvent event) {
-        int lookupIndex = computeLookupIndex(event);
-        int resourceId = sEventDataMappedStringResourceIds.get(lookupIndex);
-        return getString(resourceId);
-    }
-
-    /**
-     * Computes an index for looking up the custom text for views which either
-     * do not have text/content description or the position information
-     * is the only oracle for deciding from which widget was an accessibility
-     * event generated. The index is computed based on
-     * {@link AccessibilityEvent#getText()},
-     * {@link AccessibilityEvent#getItemCount()}, and
-     * {@link AccessibilityEvent#getCurrentItemIndex()} properties.
-     *
-     * @param event The event from which to compute the index.
-     * @return The lookup index.
-     */
-    private int computeLookupIndex(AccessibilityEvent event) {
-        int lookupIndex = event.getItemCount();
-        int divided = event.getCurrentItemIndex();
-
-        while (divided > 0) {
-            lookupIndex *= 10;
-            divided /= 10;
-        }
-
-        lookupIndex += event.getCurrentItemIndex();
-        lookupIndex *= 10;
-
-        // This is primarily for handling the zero hour/zero minutes cases
-        if (!event.getText().isEmpty()
-                && ("1".equals(event.getText().get(0).toString()) || "01".equals(event.getText()
-                        .get(0).toString()))) {
-            lookupIndex++;
-        }
-
-        return lookupIndex;
-    }
-
-    /**
      * Plays an earcon given its id.
      *
      * @param earconId The id of the earcon to be played.
@@ -690,10 +562,12 @@
         String earconName = mEarconNames.get(earconId);
         if (earconName == null) {
             // We do not know the sound id, hence we need to load the sound.
-            int resourceId = sSoundsResourceIds.get(earconId);
-            earconName = "[" + earconId + "]";
-            mTts.addEarcon(earconName, getPackageName(), resourceId);
-            mEarconNames.put(earconId, earconName);
+            Integer resourceId = sSoundsResourceIds.get(earconId);
+            if (resourceId != null) {
+                earconName = "[" + earconId + "]";
+                mTts.addEarcon(earconName, getPackageName(), resourceId);
+                mEarconNames.put(earconId, earconName);
+            }
         }
 
         mTts.playEarcon(earconName, QUEUING_MODE_INTERRUPT, null);
diff --git a/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java
new file mode 100644
index 0000000..c7088be
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskBackService.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.example.android.apis.accessibility;
+
+import com.example.android.apis.R;
+
+import android.accessibilityservice.AccessibilityService;
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.view.accessibility.AccessibilityRecord;
+import android.speech.tts.TextToSpeech;
+import android.speech.tts.TextToSpeech.OnInitListener;
+
+import java.util.Locale;
+
+/**
+ * This class demonstrates how an accessibility service can query
+ * window content to improve the feedback given to the user.
+ */
+public class TaskBackService extends AccessibilityService implements OnInitListener {
+
+    /** Tag for logging. */
+    private static final String LOG_TAG = "TaskBackService/onAccessibilityEvent";
+
+    /** Comma separator. */
+    private static final String SEPARATOR = ", ";
+
+    /** The class name of TaskListView - for simplicity we speak only its items. */
+    private static final String TASK_LIST_VIEW_CLASS_NAME =
+        "com.example.android.apis.accessibility.TaskListView";
+
+    /** Flag whether Text-To-Speech is initialized. */
+    private boolean mTextToSpeechInitialized;
+
+    /** Handle to the Text-To-Speech engine. */
+    private TextToSpeech mTts;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onServiceConnected() {
+        // Initializes the Text-To-Speech engine as soon as the service is connected.
+        mTts = new TextToSpeech(getApplicationContext(), this);
+    }
+
+    /**
+     * Processes an AccessibilityEvent, by traversing the View's tree and
+     * putting together a message to speak to the user.
+     */
+    @Override
+    public void onAccessibilityEvent(AccessibilityEvent event) {
+        if (!mTextToSpeechInitialized) {
+            Log.e(LOG_TAG, "Text-To-Speech engine not ready.  Bailing out.");
+            return;
+        }
+
+        // This AccessibilityNodeInfo represents the view that fired the
+        // AccessibilityEvent. The following code will use it to traverse the
+        // view hierarchy, using this node as a starting point.
+        //
+        // NOTE: Every method that returns an AccessibilityNodeInfo may return null,
+        // because the explored window is in another process and the
+        // corresponding View might be gone by the time your request reaches the
+        // view hierarchy.
+        AccessibilityNodeInfo source = event.getSource();
+        if (source == null) {
+            return;
+        }
+
+        // Grab the parent of the view that fired the event.
+        AccessibilityNodeInfo rowNode = getListItemNodeInfo(source);
+        if (rowNode == null) {
+            return;
+        }
+
+        // Using this parent, get references to both child nodes, the label and the checkbox.
+        AccessibilityNodeInfo labelNode = rowNode.getChild(0);
+        if (labelNode == null) {
+            rowNode.recycle();
+            return;
+        }
+
+        AccessibilityNodeInfo completeNode = rowNode.getChild(1);
+        if (completeNode == null) {
+            rowNode.recycle();
+            return;
+        }
+
+        // Determine what the task is and whether or not it's complete, based on
+        // the text inside the label, and the state of the check-box.
+        if (rowNode.getChildCount() < 2 || !rowNode.getChild(1).isCheckable()) {
+            rowNode.recycle();
+            return;
+        }
+
+        CharSequence taskLabel = labelNode.getText();
+        final boolean isComplete = completeNode.isChecked();
+
+        String completeStr = null;
+        if (isComplete) {
+            completeStr = getString(R.string.task_complete);
+        } else {
+            completeStr = getString(R.string.task_not_complete);
+        }
+
+        String taskStr = getString(R.string.task_complete_template, taskLabel, completeStr);
+        StringBuilder utterance = new StringBuilder(taskStr);
+
+        // The custom ListView added extra context to the event by adding an
+        // AccessibilityRecord to it. Extract that from the event and read it.
+        final int records = event.getRecordCount();
+        for (int i = 0; i < records; i++) {
+            AccessibilityRecord record = event.getRecord(i);
+            CharSequence contentDescription = record.getContentDescription();
+            if (!TextUtils.isEmpty(contentDescription )) {
+                utterance.append(SEPARATOR);
+                utterance.append(contentDescription);
+            }
+        }
+
+        // Announce the utterance.
+        mTts.speak(utterance.toString(), TextToSpeech.QUEUE_FLUSH, null);
+        Log.d(LOG_TAG, utterance.toString());
+    }
+
+    private AccessibilityNodeInfo getListItemNodeInfo(AccessibilityNodeInfo source) {
+        AccessibilityNodeInfo current = source;
+        while (true) {
+            AccessibilityNodeInfo parent = current.getParent();
+            if (parent == null) {
+                return null;
+            }
+            if (TASK_LIST_VIEW_CLASS_NAME.equals(parent.getClassName())) {
+                return current;
+            }
+            // NOTE: Recycle the infos.
+            AccessibilityNodeInfo oldCurrent = current;
+            current = parent;
+            oldCurrent.recycle();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onInterrupt() {
+        /* do nothing */
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onInit(int status) {
+        // Set a flag so that the TaskBackService knows that the Text-To-Speech
+        // engine has been initialized, and can now handle speaking requests.
+        if (status == TextToSpeech.SUCCESS) {
+            mTts.setLanguage(Locale.US);
+            mTextToSpeechInitialized = true;
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        if (mTextToSpeechInitialized) {
+            mTts.shutdown();
+        }
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java
new file mode 100644
index 0000000..4f7f384
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListActivity.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.example.android.apis.accessibility;
+
+import com.example.android.apis.R;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.view.View;
+import android.widget.ImageButton;
+
+/** Starts up the task list that will interact with the AccessibilityService sample. */
+public class TaskListActivity extends ListActivity {
+
+    /** An intent for launching the system settings. */
+    private static final Intent sSettingsIntent =
+        new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS);
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.tasklist_main);
+
+        // Hard-coded hand-waving here.
+        boolean[] checkboxes = {true, true, false, true, false, false, false};
+        String[] labels = {"Take out Trash", "Do Laundry",
+                           "Conquer World", "Nap", "Do Taxes",
+                           "Abolish IRS", "Tea with Aunt Sharon" };
+
+        TaskAdapter myAdapter = new TaskAdapter(this, labels, checkboxes);
+        this.setListAdapter(myAdapter);
+
+        // Add a shortcut to the accessibility settings.
+        ImageButton button = (ImageButton) findViewById(R.id.button);
+        button.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                startActivity(sSettingsIntent);
+            }
+        });
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java
new file mode 100644
index 0000000..a4b17cb
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/TaskListView.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package com.example.android.apis.accessibility;
+
+import com.example.android.apis.R;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.accessibility.AccessibilityEvent;
+import android.widget.BaseAdapter;
+import android.widget.CheckBox;
+import android.widget.ListView;
+import android.widget.TextView;
+
+
+/** Acts as a go-between for all AccessibilityEvents sent from items in the ListView, providing the
+ *  option of sending more context to an AccessibilityService by adding more AccessiblityRecords to
+ *  an event.
+ */
+public class TaskListView extends ListView {
+
+    public TaskListView(Context context, AttributeSet attributeSet) {
+        super(context, attributeSet);
+    }
+
+    /**
+     * This method will fire whenever a child event wants to send an AccessibilityEvent.  As a
+     * result, it's a great place to add more AccessibilityRecords, if you want.  In this case,
+     * the code is grabbing the position of the item in the list, and assuming that to be the
+     * priority for the task.
+     */
+    @Override
+    public boolean onRequestSendAccessibilityEvent(View child, AccessibilityEvent event) {
+        // Add a record for ourselves as well.
+        AccessibilityEvent record = AccessibilityEvent.obtain();
+        super.onInitializeAccessibilityEvent(record);
+
+        int priority = (Integer) child.getTag();
+        String priorityStr = "Priority: " + priority;
+        record.setContentDescription(priorityStr);
+
+        event.appendRecord(record);
+        return true;
+    }
+}
+
+/** Adds Accessibility information to individual child views of rows in the list. */
+final class TaskAdapter extends BaseAdapter{
+
+    private String[] mLabels = null;
+    private boolean[] mCheckboxes = null;
+    private Context mContext = null;
+
+    public TaskAdapter(Context context, String[] labels, boolean[] checkboxes) {
+        super();
+        mContext = context;
+        mLabels = labels;
+        mCheckboxes = checkboxes;
+    }
+
+    @Override
+    public int getCount() {
+        return mLabels.length;
+    }
+
+    /** Expands the views for individual list entries, and sets content descriptions for use by the
+     *  TaskBackAccessibilityService.
+     */
+    @Override
+    public View getView(int position, View convertView, ViewGroup parent) {
+        if(convertView == null) {
+            LayoutInflater inflater = LayoutInflater.from(mContext);
+            convertView = inflater.inflate(R.layout.tasklist_row, parent, false);
+        }
+
+        CheckBox checkbox = (CheckBox) convertView.findViewById(R.id.tasklist_finished);
+        checkbox.setChecked(mCheckboxes[position]);
+
+        TextView label = (TextView)(convertView.findViewById(R.id.tasklist_label));
+        label.setText(mLabels[position]);
+
+        String contentDescription = new StringBuilder()
+                .append(mContext.getString(R.string.task_name))
+                .append(' ')
+                .append(mLabels[position]).toString();
+        label.setContentDescription(contentDescription);
+
+        convertView.setTag(position);
+
+        return convertView;
+    }
+
+    @Override
+    public Object getItem(int position) {
+        return mLabels[position];
+    }
+
+    @Override
+    public long getItemId(int position) {
+        return position;
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/accessibility/_index.html b/samples/ApiDemos/src/com/example/android/apis/accessibility/_index.html
new file mode 100644
index 0000000..7506cb3
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/accessibility/_index.html
@@ -0,0 +1,23 @@
+<dl>
+  <dt><a href="ClockBackService.html">Accessibility Service</a></dt>
+  <dd>
+    This is an example of an accessibility service that provides custom feedback for the Clock
+    application which comes by default with Android devices. It is a hands-on example of various
+    ways to utilize the accessibility API for providing alternative and complementary feedback.
+    The sample demonstrates how to provide application specific feedback &mdash; the service
+    handles only accessibility events from the Clock application. Further, the sample demonstrates
+    how to provide dynamic, context-dependent feedback &mdash; feedback type changes depending on
+    the ringer mode.
+  </dd>
+<dt>
+
+<dl>
+  <dt><a href="TaskBackService.html">Window Querying Accessibility Service</a></dt>
+  <dd>
+    Demonstrates several new accessibility features in Ice Cream Sandwich,
+    including the ability for an AccessibilityService to traverse the view
+    hierarchy using AccessibilityNodeInfo objects, service configuration via
+    xml files, and adding additional information to AccessibilityEvents using
+    AccessibilityRecords.
+  </dd>
+</dl>
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java
new file mode 100644
index 0000000..4748762
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarSettingsActionProviderActivity.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.apis.app;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+import android.provider.Settings;
+import android.view.ActionProvider;
+import android.view.LayoutInflater;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.ImageButton;
+import android.widget.Toast;
+
+import com.example.android.apis.R;
+
+/**
+ * This activity demonstrates how to implement an {@link android.view.ActionProvider}
+ * for adding functionality to the Action Bar. In particular this demo creates an
+ * ActionProvider for launching the system settings and adds a menu item with that
+ * provider.
+ */
+public class ActionBarSettingsActionProviderActivity extends Activity {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        getMenuInflater().inflate(R.menu.action_bar_settings_action_provider, menu);
+        return true;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // If this callback does not handle the item click, onPerformDefaultAction
+        // of the ActionProvider is invoked. Hence, the provider encapsulates the
+        // complete functionality of the menu item.
+        Toast.makeText(this, R.string.action_bar_settings_action_provider_no_handling,
+                Toast.LENGTH_SHORT).show();
+        return false;
+    }
+
+    public static class SettingsActionProvider extends ActionProvider {
+
+        /** An intent for launching the system settings. */
+        private static final Intent sSettingsIntent = new Intent(Settings.ACTION_SETTINGS);
+
+        /** Context for accessing resources. */
+        private final Context mContext;
+
+        /**
+         * Creates a new instance.
+         *
+         * @param context Context for accessing resources.
+         */
+        public SettingsActionProvider(Context context) {
+            super(context);
+            mContext = context;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public View onCreateActionView() {
+            // Inflate the action view to be shown on the action bar.
+            LayoutInflater layoutInflater = LayoutInflater.from(mContext);
+            View view = layoutInflater.inflate(R.layout.action_bar_settings_action_provider, null);
+            ImageButton button = (ImageButton) view.findViewById(R.id.button);
+            // Attach a click listener for launching the system settings.
+            button.setOnClickListener(new View.OnClickListener() {
+                @Override
+                public void onClick(View v) {
+                    mContext.startActivity(sSettingsIntent);
+                }
+            });
+            return view;
+        }
+
+        /**
+         * {@inheritDoc}
+         */
+        @Override
+        public boolean onPerformDefaultAction() {
+            // This is called if the host menu item placed in the overflow menu of the
+            // action bar is clicked and the host activity did not handle the click.
+            mContext.startActivity(sSettingsIntent);
+            return true;
+        }
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.java
similarity index 96%
rename from samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.java
rename to samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.java
index 2d6bfd7..4f37b8d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.java
@@ -38,7 +38,7 @@
  * a menu item with ShareActionProvider as its action provider. The
  * ShareActionProvider is responsible for managing the UI for sharing actions.
  */
-public class ActionBarActionProviderActivity extends Activity {
+public class ActionBarShareActionProviderActivity extends Activity {
 
     private static final String SHARED_FILE_NAME = "shared.png";
 
@@ -51,7 +51,7 @@
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         // Inflate your menu.
-        getMenuInflater().inflate(R.menu.action_bar_action_provider, menu);
+        getMenuInflater().inflate(R.menu.action_bar_share_action_provider, menu);
 
         // Set file with share history to the provider and set the share intent.
         MenuItem actionItem = menu.findItem(R.id.menu_item_share_action_provider_action_bar);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/_index.html b/samples/ApiDemos/src/com/example/android/apis/app/_index.html
index 4333d57..9400bc9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/_index.html
+++ b/samples/ApiDemos/src/com/example/android/apis/app/_index.html
@@ -160,10 +160,12 @@
 default Honeycomb theme includes the Action Bar by default and a menu resource is used to populate
 the menu data itself. If you'd like to see how these things work under the hood, see
 Mechanics.</dd>
-  <dt><a href="ActionBarActionProviderActivity.html">ActionProvider</a></dt>
-  <dd>Shows how to use an ActionProvider to supply a menu item with a specialized action view and
-  handle standard menu item clicks in one place. Demonstrated using the streamlined sharing UI
-  added in ICS. </dd>
+  <dt><a href="ActionBarActionProviderSettingsActivity.html">Settings Action Provider</a></dt>
+  <dd>Shows how to implement an ActionProvider for launching the system settings that supplies a
+  menu item with a specialized action view and handles standard menu item clicks in one place.</dd>
+  <dt><a href="ActionBarShareActionProviderActivity.html">Share Action Provider</a></dt>
+  <dd>Shows how to use a ShareActionProvider to embed sharing functionality in your application
+  via the streamlined sharing UI added in ICS. </dd>
   <dt><a href="ActionBarDisplayOptions.html">Display Options</a></dt>
   <dd>Shows how various Action Bar display option flags can be combined and their effects.</dd>
 </dl>
diff --git a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
index a5a5c96..f983d7a 100644
--- a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
+++ b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
@@ -18,6 +18,8 @@
 
 import android.app.Activity;
 import android.os.Bundle;
+import android.view.View;
+import android.view.WindowManager;
 
 
 /**
@@ -33,7 +35,19 @@
 
         // Set the layout for this activity.  You can find it
         // in res/layout/hello_activity.xml
-        setContentView(R.layout.hello_activity);
+        View view = getLayoutInflater().inflate(R.layout.hello_activity, null);
+        setContentView(view);
+
+        WindowManager.LayoutParams params = getWindow().getAttributes();
+        params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+        getWindow().setAttributes(params);
+        view.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
+            @Override public void onSystemUiVisibilityChange(int visibility) {
+                WindowManager.LayoutParams params = getWindow().getAttributes();
+                params.systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
+                getWindow().setAttributes(params);
+            }
+        });
     }
 }
 
diff --git a/samples/Home/AndroidManifest.xml b/samples/Home/AndroidManifest.xml
index 229171f..2e489eb 100644
--- a/samples/Home/AndroidManifest.xml
+++ b/samples/Home/AndroidManifest.xml
@@ -32,8 +32,7 @@
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.EXPAND_STATUS_BAR"/>
 
-    <application android:persistent="true"
-          android:label="@string/home_title"
+    <application android:label="@string/home_title"
           android:icon="@drawable/ic_launcher_home">
 
         <activity android:name="Home"
diff --git a/samples/SoftKeyboard/AndroidManifest.xml b/samples/SoftKeyboard/AndroidManifest.xml
index 61b5131..3d30779 100755
--- a/samples/SoftKeyboard/AndroidManifest.xml
+++ b/samples/SoftKeyboard/AndroidManifest.xml
@@ -8,5 +8,12 @@
             </intent-filter>
             <meta-data android:name="android.view.im" android:resource="@xml/method" />
         </service>
+
+        <activity android:name=".ImePreferences" android:label="@string/settings_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+            </intent-filter>
+        </activity>
+
     </application>
 </manifest>
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/icon_en_gb.png b/samples/SoftKeyboard/res/drawable-hdpi/icon_en_gb.png
new file mode 100644
index 0000000..53088d9
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/icon_en_gb.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-hdpi/icon_en_us.png b/samples/SoftKeyboard/res/drawable-hdpi/icon_en_us.png
new file mode 100644
index 0000000..bc8b66e
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-hdpi/icon_en_us.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-mdpi/icon_en_gb.png b/samples/SoftKeyboard/res/drawable-mdpi/icon_en_gb.png
new file mode 100644
index 0000000..03c665a
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-mdpi/icon_en_gb.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/drawable-mdpi/icon_en_us.png b/samples/SoftKeyboard/res/drawable-mdpi/icon_en_us.png
new file mode 100644
index 0000000..da8d43f
--- /dev/null
+++ b/samples/SoftKeyboard/res/drawable-mdpi/icon_en_us.png
Binary files differ
diff --git a/samples/SoftKeyboard/res/values/strings.xml b/samples/SoftKeyboard/res/values/strings.xml
index bc645b2..952a629 100644
--- a/samples/SoftKeyboard/res/values/strings.xml
+++ b/samples/SoftKeyboard/res/values/strings.xml
@@ -28,4 +28,14 @@
     <string name="label_go_key">Go</string>
     <string name="label_next_key">Next</string>
     <string name="label_send_key">Send</string>
+
+    <!-- Labels for subtype -->
+    <string name="label_subtype_generic">%s</string>
+    <string name="label_subtype_en_GB">English (GB)</string>
+
+    <!-- Titles for ImePreference -->
+    <string name="settings_name">Sample Soft Keyboard Settings</string>
+    <string name="language_selection_title">Input languages</string>
+    <string name="select_language">Select input languages</string>
+    <string name="general_category">General</string>
 </resources>
diff --git a/samples/SoftKeyboard/res/xml/ime_preferences.xml b/samples/SoftKeyboard/res/xml/ime_preferences.xml
new file mode 100644
index 0000000..1e973a6
--- /dev/null
+++ b/samples/SoftKeyboard/res/xml/ime_preferences.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 Google Inc.
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+        android:title="@string/settings_name">
+</PreferenceScreen>
diff --git a/samples/SoftKeyboard/res/xml/method.xml b/samples/SoftKeyboard/res/xml/method.xml
index d246624..2f2d6f0 100644
--- a/samples/SoftKeyboard/res/xml/method.xml
+++ b/samples/SoftKeyboard/res/xml/method.xml
@@ -20,4 +20,17 @@
 <!-- The attributes in this XML file provide configuration information -->
 <!-- for the Search Manager. -->
 
-<input-method xmlns:android="http://schemas.android.com/apk/res/android" />
+<input-method xmlns:android="http://schemas.android.com/apk/res/android"
+        android:settingsActivity="com.example.android.softkeyboard.ImePreferences"
+>
+    <subtype
+        android:label="@string/label_subtype_generic"
+        android:icon="@drawable/icon_en_us"
+        android:imeSubtypeLocale="en_US"
+        android:imeSubtypeMode="keyboard" />
+    <subtype
+        android:label="@string/label_subtype_en_GB"
+        android:icon="@drawable/icon_en_gb"
+        android:imeSubtypeLocale="en_GB"
+        android:imeSubtypeMode="keyboard" />
+</input-method>
diff --git a/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsFragment.java b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsFragment.java
new file mode 100644
index 0000000..b3b7c8c
--- /dev/null
+++ b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsFragment.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a part of the inputmethod-common static Java library.
+ * The original source code can be found at frameworks/opt/inputmethodcommon of Android Open Source
+ * Project.
+ */
+
+package com.android.inputmethodcommon;
+
+import android.content.Context;
+import android.graphics.drawable.Drawable;
+import android.os.Bundle;
+import android.preference.PreferenceFragment;
+
+/**
+ * This is a helper class for an IME's settings preference fragment. It's recommended for every
+ * IME to have its own settings preference fragment which inherits this class.
+ */
+public abstract class InputMethodSettingsFragment extends PreferenceFragment
+        implements InputMethodSettingsInterface {
+    private final InputMethodSettingsImpl mSettings = new InputMethodSettingsImpl();
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        final Context context = getActivity();
+        setPreferenceScreen(getPreferenceManager().createPreferenceScreen(context));
+        mSettings.init(context, getPreferenceScreen());
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setInputMethodSettingsCategoryTitle(int resId) {
+        mSettings.setInputMethodSettingsCategoryTitle(resId);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setInputMethodSettingsCategoryTitle(CharSequence title) {
+        mSettings.setInputMethodSettingsCategoryTitle(title);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerTitle(int resId) {
+        mSettings.setSubtypeEnablerTitle(resId);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerTitle(CharSequence title) {
+        mSettings.setSubtypeEnablerTitle(title);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerIcon(int resId) {
+        mSettings.setSubtypeEnablerIcon(resId);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerIcon(Drawable drawable) {
+        mSettings.setSubtypeEnablerIcon(drawable);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onResume() {
+        super.onResume();
+        mSettings.updateSubtypeEnabler();
+    }
+}
diff --git a/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsImpl.java b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsImpl.java
new file mode 100644
index 0000000..722148d
--- /dev/null
+++ b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsImpl.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This is a part of the inputmethod-common static Java library.
+ * The original source code can be found at frameworks/opt/inputmethodcommon of Android Open Source
+ * Project.
+ */
+
+package com.android.inputmethodcommon;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.drawable.Drawable;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+import android.text.TextUtils;
+import android.view.inputmethod.InputMethodInfo;
+import android.view.inputmethod.InputMethodManager;
+import android.view.inputmethod.InputMethodSubtype;
+
+import java.util.List;
+
+/* package private */ class InputMethodSettingsImpl implements InputMethodSettingsInterface {
+    private Preference mSubtypeEnablerPreference;
+    private int mInputMethodSettingsCategoryTitleRes;
+    private CharSequence mInputMethodSettingsCategoryTitle;
+    private int mSubtypeEnablerTitleRes;
+    private CharSequence mSubtypeEnablerTitle;
+    private int mSubtypeEnablerIconRes;
+    private Drawable mSubtypeEnablerIcon;
+    private InputMethodManager mImm;
+    private InputMethodInfo mImi;
+    private Context mContext;
+
+    /**
+     * Initialize internal states of this object.
+     * @param context the context for this application.
+     * @param prefScreen a PreferenceScreen of PreferenceActivity or PreferenceFragment.
+     * @return true if this application is an IME and has two or more subtypes, false otherwise.
+     */
+    public boolean init(final Context context, final PreferenceScreen prefScreen) {
+        mContext = context;
+        mImm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
+        mImi = getMyImi(context, mImm);
+        if (mImi == null || mImi.getSubtypeCount() <= 1) {
+            return false;
+        }
+        mSubtypeEnablerPreference = new Preference(context);
+        mSubtypeEnablerPreference
+                .setOnPreferenceClickListener(new OnPreferenceClickListener() {
+                    @Override
+                    public boolean onPreferenceClick(Preference preference) {
+                        final CharSequence title = getSubtypeEnablerTitle(context);
+                        final Intent intent =
+                                new Intent(Settings.ACTION_INPUT_METHOD_SUBTYPE_SETTINGS);
+                        intent.putExtra(Settings.EXTRA_INPUT_METHOD_ID, mImi.getId());
+                        if (!TextUtils.isEmpty(title)) {
+                            intent.putExtra(Intent.EXTRA_TITLE, title);
+                        }
+                        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
+                                | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
+                                | Intent.FLAG_ACTIVITY_CLEAR_TOP);
+                        context.startActivity(intent);
+                        return true;
+                    }
+                });
+        prefScreen.addPreference(mSubtypeEnablerPreference);
+        updateSubtypeEnabler();
+        return true;
+    }
+
+    private static InputMethodInfo getMyImi(Context context, InputMethodManager imm) {
+        final List<InputMethodInfo> imis = imm.getInputMethodList();
+        for (int i = 0; i < imis.size(); ++i) {
+            final InputMethodInfo imi = imis.get(i);
+            if (imis.get(i).getPackageName().equals(context.getPackageName())) {
+                return imi;
+            }
+        }
+        return null;
+    }
+
+    private static String getEnabledSubtypesLabel(
+            Context context, InputMethodManager imm, InputMethodInfo imi) {
+        if (context == null || imm == null || imi == null) return null;
+        final List<InputMethodSubtype> subtypes = imm.getEnabledInputMethodSubtypeList(imi, true);
+        final StringBuilder sb = new StringBuilder();
+        final int N = subtypes.size();
+        for (int i = 0; i < N; ++i) {
+            final InputMethodSubtype subtype = subtypes.get(i);
+            if (sb.length() > 0) {
+                sb.append(", ");
+            }
+            sb.append(subtype.getDisplayName(context, imi.getPackageName(),
+                    imi.getServiceInfo().applicationInfo));
+        }
+        return sb.toString();
+    }
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setInputMethodSettingsCategoryTitle(int resId) {
+        mInputMethodSettingsCategoryTitleRes = resId;
+        updateSubtypeEnabler();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setInputMethodSettingsCategoryTitle(CharSequence title) {
+        mInputMethodSettingsCategoryTitleRes = 0;
+        mInputMethodSettingsCategoryTitle = title;
+        updateSubtypeEnabler();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerTitle(int resId) {
+        mSubtypeEnablerTitleRes = resId;
+        updateSubtypeEnabler();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerTitle(CharSequence title) {
+        mSubtypeEnablerTitleRes = 0;
+        mSubtypeEnablerTitle = title;
+        updateSubtypeEnabler();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerIcon(int resId) {
+        mSubtypeEnablerIconRes = resId;
+        updateSubtypeEnabler();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void setSubtypeEnablerIcon(Drawable drawable) {
+        mSubtypeEnablerIconRes = 0;
+        mSubtypeEnablerIcon = drawable;
+        updateSubtypeEnabler();
+    }
+
+    private CharSequence getSubtypeEnablerTitle(Context context) {
+        if (mSubtypeEnablerTitleRes != 0) {
+            return context.getString(mSubtypeEnablerTitleRes);
+        } else {
+            return mSubtypeEnablerTitle;
+        }
+    }
+
+    public void updateSubtypeEnabler() {
+        if (mSubtypeEnablerPreference != null) {
+            if (mSubtypeEnablerTitleRes != 0) {
+                mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes);
+            } else if (!TextUtils.isEmpty(mSubtypeEnablerTitle)) {
+                mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitle);
+            }
+            final String summary = getEnabledSubtypesLabel(mContext, mImm, mImi);
+            if (!TextUtils.isEmpty(summary)) {
+                mSubtypeEnablerPreference.setSummary(summary);
+            }
+            if (mSubtypeEnablerIconRes != 0) {
+                mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes);
+            } else if (mSubtypeEnablerIcon != null) {
+                mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon);
+            }
+        }
+    }
+}
diff --git a/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsInterface.java b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsInterface.java
new file mode 100644
index 0000000..f41e224
--- /dev/null
+++ b/samples/SoftKeyboard/src/com/android/inputmethodcommon/InputMethodSettingsInterface.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+/**
+ * This is a part of the inputmethod-common static Java library.
+ * The original source code can be found at frameworks/opt/inputmethodcommon of Android Open Source
+ * Project.
+ */
+
+package com.android.inputmethodcommon;
+
+import android.graphics.drawable.Drawable;
+
+/**
+ * InputMethodSettingsInterface is the interface for adding IME related preferences to
+ * PreferenceActivity or PreferenceFragment.
+ */
+public interface InputMethodSettingsInterface {
+    /**
+     * Sets the title for the input method settings category with a resource ID.
+     * @param resId The resource ID of the title.
+     */
+    public void setInputMethodSettingsCategoryTitle(int resId);
+
+    /**
+     * Sets the title for the input method settings category with a CharSequence.
+     * @param title The title for this preference.
+     */
+    public void setInputMethodSettingsCategoryTitle(CharSequence title);
+
+    /**
+     * Sets the title for the input method enabler preference for launching subtype enabler with a
+     * resource ID.
+     * @param resId The resource ID of the title.
+     */
+    public void setSubtypeEnablerTitle(int resId);
+
+    /**
+     * Sets the title for the input method enabler preference for launching subtype enabler with a
+     * CharSequence.
+     * @param title The title for this preference.
+     */
+    public void setSubtypeEnablerTitle(CharSequence title);
+
+    /**
+     * Sets the icon for the preference for launching subtype enabler with a resource ID.
+     * @param resId The resource id of an optional icon for the preference.
+     */
+    public void setSubtypeEnablerIcon(int resId);
+
+    /**
+     * Sets the icon for the Preference for launching subtype enabler with a Drawable.
+     * @param drawable The drawable of an optional icon for the preference.
+     */
+    public void setSubtypeEnablerIcon(Drawable drawable);
+}
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/CandidateView.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/CandidateView.java
index 7cadead..33ee467 100755
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/CandidateView.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/CandidateView.java
@@ -1,17 +1,17 @@
 /*
- * Copyright (C) 2008-2009 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package com.example.android.softkeyboard;
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java
new file mode 100644
index 0000000..db6c1d9
--- /dev/null
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/ImePreferences.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.softkeyboard;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import com.android.inputmethodcommon.InputMethodSettingsFragment;
+
+/**
+ * Displays the IME preferences inside the input method setting.
+ */
+public class ImePreferences extends PreferenceActivity {
+    @Override
+    public Intent getIntent() {
+        final Intent modIntent = new Intent(super.getIntent());
+        modIntent.putExtra(EXTRA_SHOW_FRAGMENT, Settings.class.getName());
+        modIntent.putExtra(EXTRA_NO_HEADERS, true);
+        return modIntent;
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // We overwrite the title of the activity, as the default one is "Voice Search".
+        setTitle(R.string.settings_name);
+    }
+
+    public static class Settings extends InputMethodSettingsFragment {
+        @Override
+        public void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+            setInputMethodSettingsCategoryTitle(R.string.language_selection_title);
+            setSubtypeEnablerTitle(R.string.select_language);
+
+            // Load the preferences from an XML resource
+            addPreferencesFromResource(R.xml.ime_preferences);
+        }
+    }
+}
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboard.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboard.java
index 1798442..67787dc 100644
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboard.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboard.java
@@ -1,17 +1,17 @@
 /*
- * Copyright (C) 2008-2009 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package com.example.android.softkeyboard;
@@ -19,14 +19,14 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.content.res.XmlResourceParser;
+import android.graphics.drawable.Drawable;
 import android.inputmethodservice.Keyboard;
-import android.inputmethodservice.Keyboard.Key;
-import android.inputmethodservice.Keyboard.Row;
 import android.view.inputmethod.EditorInfo;
 
 public class LatinKeyboard extends Keyboard {
 
     private Key mEnterKey;
+    private Key mSpaceKey;
     
     public LatinKeyboard(Context context, int xmlLayoutResId) {
         super(context, xmlLayoutResId);
@@ -43,6 +43,8 @@
         Key key = new LatinKey(res, parent, x, y, parser);
         if (key.codes[0] == 10) {
             mEnterKey = key;
+        } else if (key.codes[0] == ' ') {
+            mSpaceKey = key;
         }
         return key;
     }
@@ -68,8 +70,7 @@
                 mEnterKey.label = res.getText(R.string.label_next_key);
                 break;
             case EditorInfo.IME_ACTION_SEARCH:
-                mEnterKey.icon = res.getDrawable(
-                        R.drawable.sym_keyboard_search);
+                mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_search);
                 mEnterKey.label = null;
                 break;
             case EditorInfo.IME_ACTION_SEND:
@@ -78,13 +79,18 @@
                 mEnterKey.label = res.getText(R.string.label_send_key);
                 break;
             default:
-                mEnterKey.icon = res.getDrawable(
-                        R.drawable.sym_keyboard_return);
+                mEnterKey.icon = res.getDrawable(R.drawable.sym_keyboard_return);
                 mEnterKey.label = null;
                 break;
         }
     }
-    
+
+    void setSpaceIcon(final Drawable icon) {
+        if (mSpaceKey != null) {
+            mSpaceKey.icon = icon;
+        }
+    }
+
     static class LatinKey extends Keyboard.Key {
         
         public LatinKey(Resources res, Keyboard.Row parent, int x, int y, XmlResourceParser parser) {
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboardView.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboardView.java
index 7464607..489c283 100644
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboardView.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/LatinKeyboardView.java
@@ -1,26 +1,27 @@
 /*
- * Copyright (C) 2008-2009 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package com.example.android.softkeyboard;
 
 import android.content.Context;
 import android.inputmethodservice.Keyboard;
-import android.inputmethodservice.KeyboardView;
 import android.inputmethodservice.Keyboard.Key;
+import android.inputmethodservice.KeyboardView;
 import android.util.AttributeSet;
+import android.view.inputmethod.InputMethodSubtype;
 
 public class LatinKeyboardView extends KeyboardView {
 
@@ -43,4 +44,10 @@
             return super.onLongPress(key);
         }
     }
+
+    void setSubtypeOnSpaceKey(final InputMethodSubtype subtype) {
+        final LatinKeyboard keyboard = (LatinKeyboard)getKeyboard();
+        keyboard.setSpaceIcon(getResources().getDrawable(subtype.getIconResId()));
+        invalidateAllKeys();
+    }
 }
diff --git a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
index 50b3536..7c4a17e 100644
--- a/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
+++ b/samples/SoftKeyboard/src/com/example/android/softkeyboard/SoftKeyboard.java
@@ -1,17 +1,17 @@
 /*
- * Copyright (C) 2008-2009 Google Inc.
- * 
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy of
- * the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ * Copyright (C) 2008-2009 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations under
- * the License.
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
  */
 
 package com.example.android.softkeyboard;
@@ -19,8 +19,8 @@
 import android.inputmethodservice.InputMethodService;
 import android.inputmethodservice.Keyboard;
 import android.inputmethodservice.KeyboardView;
+import android.text.InputType;
 import android.text.method.MetaKeyKeyListener;
-import android.util.Log;
 import android.view.KeyCharacterMap;
 import android.view.KeyEvent;
 import android.view.View;
@@ -28,6 +28,7 @@
 import android.view.inputmethod.EditorInfo;
 import android.view.inputmethod.InputConnection;
 import android.view.inputmethod.InputMethodManager;
+import android.view.inputmethod.InputMethodSubtype;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -52,8 +53,10 @@
      * that are primarily intended to be used for on-screen text entry.
      */
     static final boolean PROCESS_HARD_KEYS = true;
-    
-    private KeyboardView mInputView;
+
+    private InputMethodManager mInputMethodManager;
+
+    private LatinKeyboardView mInputView;
     private CandidateView mCandidateView;
     private CompletionInfo[] mCompletions;
     
@@ -79,6 +82,7 @@
      */
     @Override public void onCreate() {
         super.onCreate();
+        mInputMethodManager = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
         mWordSeparators = getResources().getString(R.string.word_separators);
     }
     
@@ -107,7 +111,7 @@
      * a configuration change.
      */
     @Override public View onCreateInputView() {
-        mInputView = (KeyboardView) getLayoutInflater().inflate(
+        mInputView = (LatinKeyboardView) getLayoutInflater().inflate(
                 R.layout.input, null);
         mInputView.setOnKeyboardActionListener(this);
         mInputView.setKeyboard(mQwertyKeyboard);
@@ -149,21 +153,21 @@
         
         // We are now going to initialize our state based on the type of
         // text being edited.
-        switch (attribute.inputType&EditorInfo.TYPE_MASK_CLASS) {
-            case EditorInfo.TYPE_CLASS_NUMBER:
-            case EditorInfo.TYPE_CLASS_DATETIME:
+        switch (attribute.inputType & InputType.TYPE_MASK_CLASS) {
+            case InputType.TYPE_CLASS_NUMBER:
+            case InputType.TYPE_CLASS_DATETIME:
                 // Numbers and dates default to the symbols keyboard, with
                 // no extra features.
                 mCurKeyboard = mSymbolsKeyboard;
                 break;
                 
-            case EditorInfo.TYPE_CLASS_PHONE:
+            case InputType.TYPE_CLASS_PHONE:
                 // Phones will also default to the symbols keyboard, though
                 // often you will want to have a dedicated phone keyboard.
                 mCurKeyboard = mSymbolsKeyboard;
                 break;
                 
-            case EditorInfo.TYPE_CLASS_TEXT:
+            case InputType.TYPE_CLASS_TEXT:
                 // This is general text editing.  We will default to the
                 // normal alphabetic keyboard, and assume that we should
                 // be doing predictive text (showing candidates as the
@@ -173,23 +177,23 @@
                 
                 // We now look for a few special variations of text that will
                 // modify our behavior.
-                int variation = attribute.inputType &  EditorInfo.TYPE_MASK_VARIATION;
-                if (variation == EditorInfo.TYPE_TEXT_VARIATION_PASSWORD ||
-                        variation == EditorInfo.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
+                int variation = attribute.inputType & InputType.TYPE_MASK_VARIATION;
+                if (variation == InputType.TYPE_TEXT_VARIATION_PASSWORD ||
+                        variation == InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD) {
                     // Do not display predictions / what the user is typing
                     // when they are entering a password.
                     mPredictionOn = false;
                 }
                 
-                if (variation == EditorInfo.TYPE_TEXT_VARIATION_EMAIL_ADDRESS 
-                        || variation == EditorInfo.TYPE_TEXT_VARIATION_URI
-                        || variation == EditorInfo.TYPE_TEXT_VARIATION_FILTER) {
+                if (variation == InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS
+                        || variation == InputType.TYPE_TEXT_VARIATION_URI
+                        || variation == InputType.TYPE_TEXT_VARIATION_FILTER) {
                     // Our predictions are not useful for e-mail addresses
                     // or URIs.
                     mPredictionOn = false;
                 }
                 
-                if ((attribute.inputType&EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
+                if ((attribute.inputType & InputType.TYPE_TEXT_FLAG_AUTO_COMPLETE) != 0) {
                     // If this is an auto-complete text view, then our predictions
                     // will not be shown and instead we will allow the editor
                     // to supply their own.  We only show the editor's
@@ -245,8 +249,15 @@
         // Apply the selected keyboard to the input view.
         mInputView.setKeyboard(mCurKeyboard);
         mInputView.closing();
+        final InputMethodSubtype subtype = mInputMethodManager.getCurrentInputMethodSubtype();
+        mInputView.setSubtypeOnSpaceKey(subtype);
     }
-    
+
+    @Override
+    public void onCurrentInputMethodSubtypeChanged(InputMethodSubtype subtype) {
+        mInputView.setSubtypeOnSpaceKey(subtype);
+    }
+
     /**
      * Deal with the editor reporting movement of its cursor.
      */
@@ -284,7 +295,7 @@
             }
             
             List<String> stringList = new ArrayList<String>();
-            for (int i=0; i<(completions != null ? completions.length : 0); i++) {
+            for (int i = 0; i < completions.length; i++) {
                 CompletionInfo ci = completions[i];
                 if (ci != null) stringList.add(ci.getText().toString());
             }
@@ -435,7 +446,7 @@
                 && mInputView != null && mQwertyKeyboard == mInputView.getKeyboard()) {
             int caps = 0;
             EditorInfo ei = getCurrentInputEditorInfo();
-            if (ei != null && ei.inputType != EditorInfo.TYPE_NULL) {
+            if (ei != null && ei.inputType != InputType.TYPE_NULL) {
                 caps = getCurrentInputConnection().getCursorCapsMode(attr.inputType);
             }
             mInputView.setShifted(mCapsLock || caps != 0);
diff --git a/samples/SpellChecker/Android.mk b/samples/SpellChecker/Android.mk
new file mode 100644
index 0000000..5053e7d
--- /dev/null
+++ b/samples/SpellChecker/Android.mk
@@ -0,0 +1 @@
+include $(call all-subdir-makefiles)
diff --git a/samples/AccessibilityService/Android.mk b/samples/SpellChecker/HelloSpellChecker/Android.mk
old mode 100644
new mode 100755
similarity index 81%
rename from samples/AccessibilityService/Android.mk
rename to samples/SpellChecker/HelloSpellChecker/Android.mk
index e47b6f6..1c76f23
--- a/samples/AccessibilityService/Android.mk
+++ b/samples/SpellChecker/HelloSpellChecker/Android.mk
@@ -5,8 +5,8 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := AccessibilityService
-
 LOCAL_SDK_VERSION := current
 
+LOCAL_PACKAGE_NAME := HelloSpellChecker
+
 include $(BUILD_PACKAGE)
diff --git a/samples/SpellChecker/HelloSpellChecker/AndroidManifest.xml b/samples/SpellChecker/HelloSpellChecker/AndroidManifest.xml
new file mode 100644
index 0000000..0a6b906
--- /dev/null
+++ b/samples/SpellChecker/HelloSpellChecker/AndroidManifest.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2011, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.hellospellchecker"
+    android:versionCode="1"
+    android:versionName="1.0" >
+
+    <uses-sdk android:minSdkVersion="14" />
+
+    <application
+        android:label="@string/app_name" >
+        <activity
+            android:label="@string/app_name"
+            android:name=".HelloSpellCheckerActivity" >
+            <intent-filter >
+                <action android:name="android.intent.action.MAIN" />
+
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+
+</manifest>
diff --git a/samples/SpellChecker/HelloSpellChecker/_index.html b/samples/SpellChecker/HelloSpellChecker/_index.html
new file mode 100755
index 0000000..414c629
--- /dev/null
+++ b/samples/SpellChecker/HelloSpellChecker/_index.html
@@ -0,0 +1,5 @@
+<p>A simple activity that requests spelling suggestions from a spell checker service, using the <code><a
+href="../../../reference/android/view/textservice/TextServicesManager.html">TextServicesManager</a></code>
+and <code><a href="../../../reference/android/view/textservice/SpellCheckerSession.html">SpellCheckerSession</a></code>
+APIs introduced in Android 4.0 (API level 14).</p>
+<p>For an example that implements a custom spell checker service, see the <a href="../SampleSpellCheckerService/index.html">Spell Checker</a> sample app.</p>
diff --git a/samples/SpellChecker/HelloSpellChecker/res/layout/main.xml b/samples/SpellChecker/HelloSpellChecker/res/layout/main.xml
new file mode 100644
index 0000000..3d443e4
--- /dev/null
+++ b/samples/SpellChecker/HelloSpellChecker/res/layout/main.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2011, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    android:orientation="vertical" >
+
+    <TextView
+        android:id="@+id/main"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content" />
+
+</LinearLayout>
diff --git a/samples/SpellChecker/HelloSpellChecker/res/values/strings.xml b/samples/SpellChecker/HelloSpellChecker/res/values/strings.xml
new file mode 100644
index 0000000..fbcb2db
--- /dev/null
+++ b/samples/SpellChecker/HelloSpellChecker/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/**
+ * Copyright (c) 2011, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<resources>
+
+    <string name="app_name">HelloSpellChecker</string>
+
+</resources>
diff --git a/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java b/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java
new file mode 100644
index 0000000..6550981
--- /dev/null
+++ b/samples/SpellChecker/HelloSpellChecker/src/com/example/android/hellospellchecker/HelloSpellCheckerActivity.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.hellospellchecker;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.textservice.SpellCheckerSession;
+import android.view.textservice.SuggestionsInfo;
+import android.view.textservice.TextInfo;
+import android.view.textservice.TextServicesManager;
+import android.view.textservice.SpellCheckerSession.SpellCheckerSessionListener;
+import android.widget.TextView;
+import java.lang.StringBuilder;
+
+public class HelloSpellCheckerActivity extends Activity implements SpellCheckerSessionListener {
+    private static final String TAG = HelloSpellCheckerActivity.class.getSimpleName();
+    private TextView mMainView;
+    private SpellCheckerSession mScs;
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+        mMainView = (TextView)findViewById(R.id.main);
+    }
+
+    @Override
+    public void onResume() {
+        super.onResume();
+        final TextServicesManager tsm = (TextServicesManager) getSystemService(
+                Context.TEXT_SERVICES_MANAGER_SERVICE);
+        mScs = tsm.newSpellCheckerSession(null, null, this, true);
+        if (mScs != null) {
+            // Instantiate TextInfo for each query
+            // TextInfo can be passed a sequence number and a cookie number to identify the result
+            mScs.getSuggestions(new TextInfo("tgis"), 3);
+            mScs.getSuggestions(new TextInfo("hllo"), 3);
+            mScs.getSuggestions(new TextInfo("helloworld"), 3);
+        } else {
+            Log.e(TAG, "Couldn't obtain the spell checker service.");
+        }
+    }
+
+    @Override
+    public void onPause() {
+        super.onPause();
+        if (mScs != null) {
+            mScs.close();
+        }
+    }
+
+    @Override
+    public void onGetSuggestions(final SuggestionsInfo[] arg0) {
+        final StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < arg0.length; ++i) {
+            // Returned suggestions are contained in SuggestionsInfo
+            final int len = arg0[i].getSuggestionsCount();
+            sb.append('\n');
+            for (int j = 0; j < len; ++j) {
+                sb.append("," + arg0[i].getSuggestionAt(j));
+            }
+            sb.append(" (" + len + ")");
+        }
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                mMainView.append(sb.toString());
+            }
+        });
+    }
+}
diff --git a/samples/SampleSpellCheckerService/Android.mk b/samples/SpellChecker/SampleSpellCheckerService/Android.mk
similarity index 100%
rename from samples/SampleSpellCheckerService/Android.mk
rename to samples/SpellChecker/SampleSpellCheckerService/Android.mk
diff --git a/samples/SampleSpellCheckerService/AndroidManifest.xml b/samples/SpellChecker/SampleSpellCheckerService/AndroidManifest.xml
similarity index 100%
rename from samples/SampleSpellCheckerService/AndroidManifest.xml
rename to samples/SpellChecker/SampleSpellCheckerService/AndroidManifest.xml
diff --git a/samples/SampleSpellCheckerService/_index.html b/samples/SpellChecker/SampleSpellCheckerService/_index.html
similarity index 100%
rename from samples/SampleSpellCheckerService/_index.html
rename to samples/SpellChecker/SampleSpellCheckerService/_index.html
diff --git a/samples/SampleSpellCheckerService/res/values/strings.xml b/samples/SpellChecker/SampleSpellCheckerService/res/values/strings.xml
similarity index 100%
rename from samples/SampleSpellCheckerService/res/values/strings.xml
rename to samples/SpellChecker/SampleSpellCheckerService/res/values/strings.xml
diff --git a/samples/SampleSpellCheckerService/res/xml/spell_checker_settings.xml b/samples/SpellChecker/SampleSpellCheckerService/res/xml/spell_checker_settings.xml
similarity index 100%
rename from samples/SampleSpellCheckerService/res/xml/spell_checker_settings.xml
rename to samples/SpellChecker/SampleSpellCheckerService/res/xml/spell_checker_settings.xml
diff --git a/samples/SampleSpellCheckerService/res/xml/spellchecker.xml b/samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml
similarity index 100%
rename from samples/SampleSpellCheckerService/res/xml/spellchecker.xml
rename to samples/SpellChecker/SampleSpellCheckerService/res/xml/spellchecker.xml
diff --git a/samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java b/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
similarity index 100%
rename from samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
rename to samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SampleSpellCheckerService.java
diff --git a/samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsActivity.java b/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsActivity.java
similarity index 100%
rename from samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsActivity.java
rename to samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsActivity.java
diff --git a/samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsFragment.java b/samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsFragment.java
similarity index 100%
rename from samples/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsFragment.java
rename to samples/SpellChecker/SampleSpellCheckerService/src/com/example/android/samplespellcheckerservice/SpellCheckerSettingsFragment.java
diff --git a/samples/SpellChecker/_index.html b/samples/SpellChecker/_index.html
new file mode 100644
index 0000000..d60c8ca
--- /dev/null
+++ b/samples/SpellChecker/_index.html
@@ -0,0 +1 @@
+<p>A set of samples that demonstrate how to create/use spell checker APIs.</p>
diff --git a/samples/Support4Demos/AndroidManifest.xml b/samples/Support4Demos/AndroidManifest.xml
index 6a05b73..6d71b03 100644
--- a/samples/Support4Demos/AndroidManifest.xml
+++ b/samples/Support4Demos/AndroidManifest.xml
@@ -226,5 +226,21 @@
         <service android:name=".content.LocalServiceBroadcaster$LocalService"
                 android:stopWithTask="true" />
 
+        <activity android:name=".accessibility.AccessibilityManagerSupportActivity"
+                android:label="@string/accessibility_manager_title">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".accessibility.AccessibilityDelegateSupportActivity"
+                android:label="@string/accessibility_delegate_title">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
     </application>
 </manifest>
diff --git a/samples/Support4Demos/res/layout/accessibility_delegate.xml b/samples/Support4Demos/res/layout/accessibility_delegate.xml
new file mode 100644
index 0000000..333f90d
--- /dev/null
+++ b/samples/Support4Demos/res/layout/accessibility_delegate.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/accessibility_delegate_instructions"/>
+
+    <view class="com.example.android.supportv4.accessibility.AccessibilityDelegateSupportActivity$AccessibilityDelegateSupportView"
+        android:layout_width="wrap_content"
+        android:layout_height="50dip"
+        android:layout_marginTop="50dip"
+        android:background="@android:drawable/btn_default"/>
+
+</LinearLayout>
diff --git a/samples/Support4Demos/res/layout/accessibility_manager.xml b/samples/Support4Demos/res/layout/accessibility_manager.xml
new file mode 100644
index 0000000..e8814c4
--- /dev/null
+++ b/samples/Support4Demos/res/layout/accessibility_manager.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:orientation="vertical">
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/accessibility_manager_instructions"/>
+
+        <TextView
+            android:id="@+id/accessibility_state"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="50dip"/>
+
+    </LinearLayout>
+
+</ScrollView>
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
index 4e8d9de..8f70fd3 100644
--- a/samples/Support4Demos/res/values/strings.xml
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -102,4 +102,24 @@
     <string name="start_service">Start Service</string>
     <string name="stop_service">Stop Service</string>
 
+    <!-- Accessibility API -->
+
+    <string name="accessibility_manager_title">Accessibility/Accessibility Manager</string>
+    <string name="accessibility_manager_instructions">
+        1. Enable TalkBack from Settings->Accessibility.
+        \n2. Go back to this activity.
+        \n3. Disable TalkBack from Settings->Accessibility.</string>
+    <string name="accessibility_manager_no_enabled_services">No enabled accessibility services or API level lower than ICS.</string>
+    <string name="accessibility_manager_enabled_service">ENABLED ACCESSIBILITY SERVICES:
+        \n\nService: %1$s\nFeedback: %2$s\nDescription: %3$s\nSettings: %4$s\n</string>
+    <string name="accessibility_manager_accessibility_state">Accessibility enabled: %1$s</string>
+
+    <string name="accessibility_delegate_title">Accessibility/Accessibility Delegate</string>
+    <string name="accessibility_delegate_instructions">
+        1. Enable TalkBack from Settings->Accessibility.
+        \n2. Go back to this activity.
+        \n3. Touch the button below.</string>
+    <string name="accessibility_delegate_button">Button</string>
+    <string name="accessibility_delegate_custom_text_added">Custom text added via an accessibility delegate.</string>
+
 </resources>
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityDelegateSupportActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityDelegateSupportActivity.java
new file mode 100644
index 0000000..6fcf855
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityDelegateSupportActivity.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.supportv4.accessibility;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.view.AccessibilityDelegateCompat;
+import android.support.v4.view.ViewCompat;
+import android.support.v4.view.accessibility.AccessibilityNodeInfoCompat;
+import android.util.AttributeSet;
+import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+
+import com.example.android.supportv4.R;
+
+/**
+ * This class demonstrates how to use the support library to register
+ * a View.AccessibilityDelegate that customizes the accessibility
+ * behavior of a View. Aiming to maximize simplicity this example
+ * tweaks the text reported to accessibility services but using
+ * these APIs a client can inject any accessibility functionality into
+ * a View.
+ */
+public class AccessibilityDelegateSupportActivity extends Activity {
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.accessibility_delegate);
+    }
+
+    /**
+     * This class represents a View that is customized via an AccessibilityDelegate
+     * as opposed to inheritance. An accessibility delegate can be used for adding
+     * accessibility to custom Views, i.e. ones that extend classes from android.view,
+     * in a backwards compatible fashion. Note that overriding a method whose return
+     * type or arguments are not part of a target platform APIs makes your application
+     * not backwards compatible with that platform version.
+     */
+    public static class AccessibilityDelegateSupportView extends View {
+
+        public AccessibilityDelegateSupportView(Context context, AttributeSet attrs) {
+            super(context, attrs);
+            installAccessibilityDelegate();
+        }
+
+        private void installAccessibilityDelegate() {
+            // The accessibility delegate enables customizing accessibility behavior
+            // via composition as opposed as inheritance. The main benefit is that
+            // one can write a backwards compatible application by setting the delegate
+            // only if the API level is high enough i.e. the delegate is part of the APIs.
+            // The easiest way to achieve that is by using the support library which
+            // takes the burden of checking API version and knowing which API version
+            // introduced the delegate off the developer.
+            ViewCompat.setAccessibilityDelegate(this, new AccessibilityDelegateCompat() {
+                @Override
+                public void onPopulateAccessibilityEvent(View host, AccessibilityEvent event) {
+                    super.onPopulateAccessibilityEvent(host, event);
+                    // Note that View.onPopulateAccessibilityEvent was introduced in
+                    // ICS and we would like to tweak a bit the text that is reported to
+                    // accessibility services via the AccessibilityEvent.
+                    event.getText().add(getContext().getString(
+                            R.string.accessibility_delegate_custom_text_added));
+                }
+
+                @Override
+                public void onInitializeAccessibilityNodeInfo(View host,
+                        AccessibilityNodeInfoCompat info) {
+                    super.onInitializeAccessibilityNodeInfo(host, info);
+                    // Note that View.onInitializeAccessibilityNodeInfo was introduced in
+                    // ICS and we would like to tweak a bit the text that is reported to
+                    // accessibility services via the AccessibilityNodeInfo.
+                    info.setText(getContext().getString(
+                            R.string.accessibility_delegate_custom_text_added));
+                }
+            });
+        }
+    }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
new file mode 100644
index 0000000..1004270
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/AccessibilityManagerSupportActivity.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.supportv4.accessibility;
+
+import android.accessibilityservice.AccessibilityServiceInfo;
+import android.app.Activity;
+import android.app.Service;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.support.v4.android.accessibilityservice.AccessibilityServiceInfoCompat;
+import android.support.v4.view.accessibility.AccessibilityManagerCompat;
+import android.support.v4.view.accessibility.AccessibilityManagerCompat.AccessibilityStateChangeListenerCompat;
+import android.view.accessibility.AccessibilityManager;
+import android.widget.TextView;
+import android.widget.Toast;
+
+import com.example.android.supportv4.R;
+
+import java.util.List;
+
+/**
+ * <p>
+ * This class demonstrates how to use the support library to register
+ * an AccessibilityManager.AccessibilityStateChangeListener introduced
+ * in ICS to watch changes to the global accessibility state on the
+ * device in a backwards compatible manner.
+ * </p>
+ * <p>
+ * This class also demonstrates how to use the support library to query
+ * information about enabled accessibility services via APIs introduced
+ * in ICS in a backwards compatible manner.
+ * </p>
+ */
+public class AccessibilityManagerSupportActivity extends Activity {
+
+    /** Handle to the accessibility manager service. */
+    private AccessibilityManager mAccessibilityManager;
+
+    /** Handle to the View showing accessibility services summary */
+    private TextView mAccessibilityStateView;
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.accessibility_manager);
+        mAccessibilityManager = (AccessibilityManager) getSystemService(
+                Service.ACCESSIBILITY_SERVICE);
+        mAccessibilityStateView = (TextView) findViewById(R.id.accessibility_state);
+        registerAccessibilityStateChangeListener();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void onResume() {
+        super.onResume();
+        updateAccessibilityStateView();
+    }
+
+    /**
+     * Registers an AccessibilityStateChangeListener that show a Toast
+     * when the global accessibility state on the device changes.
+     */
+    private void registerAccessibilityStateChangeListener() {
+        // The AccessibilityStateChange listener APIs were added in ICS. Therefore to be
+        // backwards compatible we use the APIs in the support library. Note that if the
+        // platform API version is lower and the called API is not available no listener
+        // is added and you will not receive a call of onAccessibilityStateChanged.
+        AccessibilityManagerCompat.addAccessibilityStateChangeListener(mAccessibilityManager,
+                new AccessibilityStateChangeListenerCompat() {
+            @Override
+            public void onAccessibilityStateChanged(boolean enabled) {
+                Toast.makeText(AccessibilityManagerSupportActivity.this,
+                        getString(R.string.accessibility_manager_accessibility_state, enabled),
+                        Toast.LENGTH_SHORT).show();
+            }
+        });
+    }
+
+    /**
+     * Updates the content of a TextView with description of the enabled
+     * accessibility services.
+     */
+    private void updateAccessibilityStateView() {
+        // The API for getting the enabled accessibility services based on feedback
+        // type was added in ICS. Therefore to be backwards compatible we use the
+        // APIs in the support library. Note that if the platform API version is lower
+        // and the called API is not available an empty list of services is returned.
+        List<AccessibilityServiceInfo> enabledServices =
+            AccessibilityManagerCompat.getEnabledAccessibilityServiceList(mAccessibilityManager,
+                    AccessibilityServiceInfo.FEEDBACK_SPOKEN);
+        if (!enabledServices.isEmpty()) {
+            StringBuilder builder = new StringBuilder();
+            final int enabledServiceCount = enabledServices.size();
+            for (int i = 0; i < enabledServiceCount; i++) {
+                AccessibilityServiceInfo service = enabledServices.get(i);
+                // Some new APIs were added in ICS for getting more information about
+                // an accessibility service. Again accessed them via the support library.
+                ResolveInfo resolveInfo = AccessibilityServiceInfoCompat.getResolveInfo(service);
+                String serviceDescription = getString(
+                        R.string.accessibility_manager_enabled_service,
+                        resolveInfo.loadLabel(getPackageManager()),
+                        AccessibilityServiceInfoCompat.feedbackTypeToString(service.feedbackType),
+                        AccessibilityServiceInfoCompat.getDescription(service),
+                        AccessibilityServiceInfoCompat.getSettingsActivityName(service));
+                builder.append(serviceDescription);
+            }
+            mAccessibilityStateView.setText(builder);
+        } else {
+            // Either no services or the platform API version is not high enough.
+            mAccessibilityStateView.setText(getString(
+                    R.string.accessibility_manager_no_enabled_services));
+        }
+    }
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/accessibility/_index.html b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/_index.html
new file mode 100644
index 0000000..03f2fba
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/accessibility/_index.html
@@ -0,0 +1,20 @@
+
+<p>This section includes samples showing the use of the accessibility
+features of the static support library.</p>
+
+<h3>Accessibility Manager</h3>
+<dl>
+  <dt><a href="AccessibilityManagerSupportActivity.html">Accessibility Manager</a></dt>
+  <dd>This sample demonstrates how to use the support library to register an
+  AccessibilityManager.AccessibilityStateChangeListener to watch changes to
+  the global accessibility state and AccessibilityManager to query information
+  about enabled accessibility services.</dd>
+</dl>
+
+<h3>Accessibility Delegate</h3>
+<dl>
+  <dt><a href="AccessibilityDelegateSupportActivity.html">AccessibilityDelegate</a></dt>
+  <dd>This sample demonstrates how to use the support library to register a
+  View.AccessibilityDelegate that customizes the accessibility behavior of
+  this View.</dd>
+</dl>
diff --git a/samples/source.properties b/samples/source.properties
index 7cb1d33..c21a041 100644
--- a/samples/source.properties
+++ b/samples/source.properties
@@ -1,4 +1,4 @@
 Pkg.UserSrc=false
-Pkg.Revision=1
+Pkg.Revision=2
 AndroidVersion.ApiLevel=14
 #AndroidVersion.CodeName=
diff --git a/sdk/images_armeabi-v7a_source.properties b/sdk/images_armeabi-v7a_source.properties
index aa7d1aa..9499576 100644
--- a/sdk/images_armeabi-v7a_source.properties
+++ b/sdk/images_armeabi-v7a_source.properties
@@ -1,6 +1,6 @@
 Pkg.Desc=Android SDK Platform 4.0
 Pkg.UserSrc=false
-Pkg.Revision=1
+Pkg.Revision=2
 AndroidVersion.ApiLevel=14
 #AndroidVersion.CodeName=
 SystemImage.Abi=armeabi-v7a
diff --git a/sdk/plat_tools_source.properties b/sdk/plat_tools_source.properties
index 189bca5..3da9448 100644
--- a/sdk/plat_tools_source.properties
+++ b/sdk/plat_tools_source.properties
@@ -1,2 +1,2 @@
 Pkg.UserSrc=false
-Pkg.Revision=8
\ No newline at end of file
+Pkg.Revision=10
\ No newline at end of file
diff --git a/sdk/platform_source.properties b/sdk/platform_source.properties
index 5e3ef13..5a6c4df 100644
--- a/sdk/platform_source.properties
+++ b/sdk/platform_source.properties
@@ -1,7 +1,7 @@
 Pkg.Desc=Android SDK Platform 4.0
 Pkg.UserSrc=false
 Platform.Version=4.0
-Pkg.Revision=1
+Pkg.Revision=2
 AndroidVersion.ApiLevel=14
 #AndroidVersion.CodeName=
 Layoutlib.Api=7
diff --git a/tools/emulator/system/camera/CallbackNotifier.cpp b/tools/emulator/system/camera/CallbackNotifier.cpp
index a877b40..f974b86 100755
--- a/tools/emulator/system/camera/CallbackNotifier.cpp
+++ b/tools/emulator/system/camera/CallbackNotifier.cpp
@@ -219,6 +219,18 @@
         }
     }
 
+    if (isMessageEnabled(CAMERA_MSG_PREVIEW_FRAME)) {
+        camera_memory_t* cam_buff =
+            mGetMemoryCB(-1, camera_dev->getFrameBufferSize(), 1, NULL);
+        if (NULL != cam_buff && NULL != cam_buff->data) {
+            memcpy(cam_buff->data, frame, camera_dev->getFrameBufferSize());
+            mDataCB(CAMERA_MSG_PREVIEW_FRAME, cam_buff, 0, NULL, mCBOpaque);
+            cam_buff->release(cam_buff);
+        } else {
+            LOGE("%s: Memory failure in CAMERA_MSG_PREVIEW_FRAME", __FUNCTION__);
+        }
+    }
+
     if (mTakingPicture) {
         /* This happens just once. */
         mTakingPicture = false;
diff --git a/tools/emulator/system/camera/EmulatedCamera.cpp b/tools/emulator/system/camera/EmulatedCamera.cpp
index 9cabe75..8fde263 100755
--- a/tools/emulator/system/camera/EmulatedCamera.cpp
+++ b/tools/emulator/system/camera/EmulatedCamera.cpp
@@ -88,11 +88,19 @@
 
 status_t EmulatedCamera::Initialize()
 {
+    /* Preview formats supported by this HAL. */
+    char preview_formats[1024];
+    snprintf(preview_formats, sizeof(preview_formats), "%s,%s,%s",
+             CameraParameters::PIXEL_FORMAT_YUV420SP,
+             CameraParameters::PIXEL_FORMAT_YUV420P,
+             CameraParameters::PIXEL_FORMAT_RGBA8888);
+
     /*
      * Fake required parameters.
      */
 
-    mParameters.set(CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES, "320x240,0x0");
+    mParameters.set(CameraParameters::KEY_SUPPORTED_JPEG_THUMBNAIL_SIZES,
+                    "320x240,0x0");
     mParameters.set(CameraParameters::KEY_MAX_EXPOSURE_COMPENSATION, "6");
     mParameters.set(CameraParameters::KEY_MIN_EXPOSURE_COMPENSATION, "-6");
     mParameters.set(CameraParameters::KEY_EXPOSURE_COMPENSATION_STEP, "0.5");
@@ -109,7 +117,7 @@
      * is explicitly stated when set_buffers_geometry is called on the preview
      * window object. */
     mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FORMATS,
-                    CameraParameters::PIXEL_FORMAT_YUV420SP);
+                    preview_formats);
     mParameters.setPreviewFormat(CameraParameters::PIXEL_FORMAT_YUV420SP);
 
     /* We don't relay on the actual frame rates supported by the camera device,
@@ -121,7 +129,7 @@
     mParameters.set(CameraParameters::KEY_PREVIEW_FPS_RANGE, "5,30");
     mParameters.setPreviewFrameRate(24);
 
-    /* Only PIXEL_FORMAT_YUV420P is accepted by camera framework in emulator! */
+    /* Only PIXEL_FORMAT_YUV420P is accepted by video framework in emulator! */
     mParameters.set(CameraParameters::KEY_VIDEO_FRAME_FORMAT,
                     CameraParameters::PIXEL_FORMAT_YUV420P);
     mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_FORMATS,
@@ -132,8 +140,10 @@
      * Not supported features
      */
 
-    mParameters.set(CameraParameters::KEY_SUPPORTED_FOCUS_MODES, CameraParameters::FOCUS_MODE_FIXED);
-    mParameters.set(CameraParameters::KEY_FOCUS_MODE, CameraParameters::FOCUS_MODE_FIXED);
+    mParameters.set(CameraParameters::KEY_SUPPORTED_FOCUS_MODES,
+                    CameraParameters::FOCUS_MODE_FIXED);
+    mParameters.set(CameraParameters::KEY_FOCUS_MODE,
+                    CameraParameters::FOCUS_MODE_FIXED);
 
     return NO_ERROR;
 }
@@ -398,62 +408,6 @@
     new_param.unflatten(str8_param);
     mParameters = new_param;
 
-    /*
-     * In emulation, there are certain parameters that are required by the
-     * framework to be exact, and supported by the camera. Since we can't predict
-     * the values of such parameters, we must dynamically update them as they
-     * are set by the framework.
-     */
-
-    /* Supported preview size. */
-    const char* check = mParameters.get(CameraParameters::KEY_PREVIEW_SIZE);
-    if (check != NULL) {
-        const char* current =
-            mParameters.get(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES);
-        if (strstr(current, check) == NULL) {
-            /* Required size doesn't exist in the list. Add it. */
-            char* to_add = AddValue(current, check);
-            if (to_add != NULL) {
-                LOGD("+++ %s: Added %s to supported preview sizes",
-                     __FUNCTION__, check);
-                mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_SIZES, to_add);
-                free(to_add);
-            }
-        }
-    }
-
-    /* Supported preview frame rate. */
-    check = mParameters.get(CameraParameters::KEY_PREVIEW_FRAME_RATE);
-    if (check != NULL) {
-        const char* current =
-            mParameters.get(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES);
-        if (strstr(current, check) == NULL) {
-            char* to_add = AddValue(current, check);
-            if (to_add != NULL) {
-                LOGD("+++ %s: Added %s to supported preview frame rates",
-                     __FUNCTION__, check);
-                mParameters.set(CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATES, to_add);
-                free(to_add);
-            }
-        }
-    }
-
-    /* Supported picture size. */
-    check = mParameters.get(CameraParameters::KEY_PICTURE_SIZE);
-    if (check != NULL) {
-        const char* current =
-            mParameters.get(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES);
-        if (strstr(current, check) == NULL) {
-            char* to_add = AddValue(current, check);
-            if (to_add != NULL) {
-                LOGD("+++ %s: Added %s to supported picture sizes",
-                     __FUNCTION__, check);
-                mParameters.set(CameraParameters::KEY_SUPPORTED_PICTURE_SIZES, to_add);
-                free(to_add);
-            }
-        }
-    }
-
     return NO_ERROR;
 }
 
@@ -542,9 +496,24 @@
     } else {
         mParameters.getPreviewSize(&width, &height);
     }
-    /* Lets see what should we use for the frame pixel format. */
-    const char* pix_fmt =
-        mParameters.get(CameraParameters::KEY_VIDEO_FRAME_FORMAT);
+    /* Lets see what should we use for the frame pixel format. Note that there
+     * are two parameters that define pixel formats for frames sent to the
+     * application via notification callbacks:
+     * - KEY_VIDEO_FRAME_FORMAT, that is used when recording video, and
+     * - KEY_PREVIEW_FORMAT, that is used for preview frame notification.
+     * We choose one or the other, depending on "recording-hint" property set by
+     * the framework that indicating intention: video, or preview. */
+    const char* pix_fmt = NULL;
+    const char* is_video = mParameters.get(EmulatedCamera::RECORDING_HINT_KEY);
+    if (is_video == NULL) {
+        is_video = CameraParameters::FALSE;
+    }
+    if (strcmp(is_video, CameraParameters::TRUE) == 0) {
+        /* Video recording is requested. Lets see if video frame format is set. */
+        pix_fmt = mParameters.get(CameraParameters::KEY_VIDEO_FRAME_FORMAT);
+    }
+    /* If this was not video recording, or video frame format is not set, lets
+     * use preview pixel format for the main framebuffer. */
     if (pix_fmt == NULL) {
         pix_fmt = mParameters.getPreviewFormat();
     }
@@ -553,6 +522,8 @@
         mPreviewWindow.stopPreview();
         return EINVAL;
     }
+
+    /* Convert framework's pixel format to the FOURCC one. */
     uint32_t org_fmt;
     if (strcmp(pix_fmt, CameraParameters::PIXEL_FORMAT_YUV420P) == 0) {
         org_fmt = V4L2_PIX_FMT_YUV420;
@@ -934,8 +905,9 @@
  * Common keys
  ***************************************************************************/
 
-const char EmulatedCamera::FACING_KEY[]       = "prop-facing";
-const char EmulatedCamera::ORIENTATION_KEY[]  = "prop-orientation";
+const char EmulatedCamera::FACING_KEY[]         = "prop-facing";
+const char EmulatedCamera::ORIENTATION_KEY[]    = "prop-orientation";
+const char EmulatedCamera::RECORDING_HINT_KEY[] = "recording-hint";
 
 /****************************************************************************
  * Common string values
diff --git a/tools/emulator/system/camera/EmulatedCamera.h b/tools/emulator/system/camera/EmulatedCamera.h
index 8afdd83..0a7584e 100755
--- a/tools/emulator/system/camera/EmulatedCamera.h
+++ b/tools/emulator/system/camera/EmulatedCamera.h
@@ -402,6 +402,7 @@
 public:
     static const char FACING_KEY[];
     static const char ORIENTATION_KEY[];
+    static const char RECORDING_HINT_KEY[];
 
      /****************************************************************************
      * Common string values