auto import from //branches/cupcake/...@130745
diff --git a/Android.mk b/Android.mk
index d67a21e..764e88b 100644
--- a/Android.mk
+++ b/Android.mk
@@ -97,7 +97,9 @@
 	core/java/android/view/IWindowManager.aidl \
 	core/java/android/view/IWindowSession.aidl \
 	core/java/com/android/internal/app/IBatteryStats.aidl \
+	core/java/com/android/internal/app/IUsageStats.aidl \
 	core/java/com/android/internal/gadget/IGadgetService.aidl \
+	core/java/com/android/internal/gadget/IGadgetHost.aidl \
 	core/java/com/android/internal/view/IInputContext.aidl \
 	core/java/com/android/internal/view/IInputContextCallback.aidl \
 	core/java/com/android/internal/view/IInputMethod.aidl \
@@ -173,6 +175,7 @@
 	frameworks/base/core/java/android/view/MotionEvent.aidl \
 	frameworks/base/core/java/android/view/Surface.aidl \
 	frameworks/base/core/java/android/view/WindowManager.aidl \
+	frameworks/base/core/java/android/widget/RemoteViews.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputContext.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethod.aidl \
 	frameworks/base/core/java/com/android/internal/view/IInputMethodCallback.aidl \
diff --git a/api/3.xml b/api/3.xml
index 9d9ce98..66cdbe8 100644
--- a/api/3.xml
+++ b/api/3.xml
@@ -79027,7 +79027,7 @@
  type="java.lang.String"
  transient="false"
  volatile="false"
- value=""name ASC""
+ value=""bucket_display_name""
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -79385,7 +79385,7 @@
  type="java.lang.String"
  transient="false"
  volatile="false"
- value=""name ASC""
+ value=""_display_name""
  static="true"
  final="true"
  deprecated="not deprecated"
diff --git a/api/current.xml b/api/current.xml
index 935454a..55994fb 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -144,6 +144,17 @@
  visibility="public"
 >
 </field>
+<field name="BIND_GADGET"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.BIND_GADGET&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="BIND_INPUT_METHOD"
  type="java.lang.String"
  transient="false"
@@ -595,6 +606,17 @@
  visibility="public"
 >
 </field>
+<field name="MOUNT_FORMAT_FILESYSTEMS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.MOUNT_FORMAT_FILESYSTEMS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="MOUNT_UNMOUNT_FILESYSTEMS"
  type="java.lang.String"
  transient="false"
@@ -606,6 +628,17 @@
  visibility="public"
 >
 </field>
+<field name="PACKAGE_USAGE_STATS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.PACKAGE_USAGE_STATS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="PERSISTENT_ACTIVITY"
  type="java.lang.String"
  transient="false"
@@ -1013,6 +1046,17 @@
  visibility="public"
 >
 </field>
+<field name="UPDATE_DEVICE_STATS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.permission.UPDATE_DEVICE_STATS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="VIBRATE"
  type="java.lang.String"
  transient="false"
@@ -1571,6 +1615,17 @@
  visibility="public"
 >
 </field>
+<field name="allowSingleTap"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843353"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="allowTaskReparenting"
  type="int"
  transient="false"
@@ -1626,6 +1681,17 @@
  visibility="public"
 >
 </field>
+<field name="animateOnClick"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843356"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="animation"
  type="int"
  transient="false"
@@ -1857,6 +1923,17 @@
  visibility="public"
 >
 </field>
+<field name="bottomOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843351"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="bottomRightRadius"
  type="int"
  transient="false"
@@ -2224,7 +2301,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843336"
+ value="16843330"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2352,6 +2429,17 @@
  visibility="public"
 >
 </field>
+<field name="configure"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843357"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="constantSize"
  type="int"
  transient="false"
@@ -2363,6 +2451,17 @@
  visibility="public"
 >
 </field>
+<field name="content"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843355"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="cropToPadding"
  type="int"
  transient="false"
@@ -3104,7 +3203,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843349"
+ value="16843343"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3441,6 +3540,17 @@
  visibility="public"
 >
 </field>
+<field name="handle"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843354"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="handleProfiling"
  type="int"
  transient="false"
@@ -3522,7 +3632,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843333"
+ value="16843327"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3566,7 +3676,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843343"
+ value="16843337"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3742,7 +3852,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843351"
+ value="16843345"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3863,7 +3973,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843340"
+ value="16843334"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3874,7 +3984,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843342"
+ value="16843336"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3885,7 +3995,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843348"
+ value="16843342"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3896,7 +4006,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843341"
+ value="16843335"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3973,7 +4083,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843339"
+ value="16843333"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3984,7 +4094,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843332"
+ value="16843326"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3995,7 +4105,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843346"
+ value="16843340"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4006,7 +4116,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843345"
+ value="16843339"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4017,7 +4127,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843344"
+ value="16843338"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4083,7 +4193,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843331"
+ value="16843325"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4094,7 +4204,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843347"
+ value="16843341"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5359,7 +5469,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843338"
+ value="16843332"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5370,7 +5480,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843337"
+ value="16843331"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5381,7 +5491,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843329"
+ value="16843323"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5821,7 +5931,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843335"
+ value="16843329"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -6330,7 +6440,7 @@
  value="16843101"
  static="true"
  final="true"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </field>
@@ -6602,7 +6712,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843330"
+ value="16843324"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7511,6 +7621,17 @@
  visibility="public"
 >
 </field>
+<field name="topOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843352"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="topRightRadius"
  type="int"
  transient="false"
@@ -7570,7 +7691,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843350"
+ value="16843344"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7636,7 +7757,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843328"
+ value="16843322"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7658,7 +7779,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843334"
+ value="16843328"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7698,6 +7819,61 @@
  visibility="public"
 >
 </field>
+<field name="voiceLanguage"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843349"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="voiceLanguageModel"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843347"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="voiceMaxResults"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843350"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="voicePromptText"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843348"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="voiceSearchMode"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843346"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="webViewStyle"
  type="int"
  transient="false"
@@ -7863,6 +8039,17 @@
  visibility="public"
 >
 </field>
+<field name="windowNoDisplay"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16843294"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="windowNoTitle"
  type="int"
  transient="false"
@@ -7985,6 +8172,23 @@
 >
 </field>
 </class>
+<class name="R.bool"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="R.bool"
+ type="android.R.bool"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+</class>
 <class name="R.color"
  extends="java.lang.Object"
  abstract="false"
@@ -8475,6 +8679,17 @@
  visibility="public"
 >
 </field>
+<field name="dark_header"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301686"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="dialog_frame"
  type="int"
  transient="false"
@@ -8783,6 +8998,17 @@
  visibility="public"
 >
 </field>
+<field name="ic_btn_speak_now"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301685"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ic_delete"
  type="int"
  transient="false"
@@ -10169,6 +10395,17 @@
  visibility="public"
 >
 </field>
+<field name="title_bar_tall"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17301687"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="toast_frame"
  type="int"
  transient="false"
@@ -10208,6 +10445,17 @@
  visibility="public"
 >
 </constructor>
+<field name="addToDictionary"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16908330"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="background"
  type="int"
  transient="false"
@@ -10439,17 +10687,6 @@
  visibility="public"
 >
 </field>
-<field name="inputMethod"
- type="int"
- transient="false"
- volatile="false"
- value="16908324"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
 <field name="keyboardView"
  type="int"
  transient="false"
@@ -10549,6 +10786,28 @@
  visibility="public"
 >
 </field>
+<field name="startSelectingText"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16908328"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="stopSelectingText"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16908329"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="summary"
  type="int"
  transient="false"
@@ -10560,6 +10819,17 @@
  visibility="public"
 >
 </field>
+<field name="switchInputMethod"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="16908324"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="tabcontent"
  type="int"
  transient="false"
@@ -11035,6 +11305,17 @@
  visibility="public"
 >
 </field>
+<field name="dialog_alert_title"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="17039380"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="emptyPhoneNumber"
  type="int"
  transient="false"
@@ -13234,7 +13515,18 @@
 <parameter name="event" type="android.view.MotionEvent">
 </parameter>
 </method>
-<method name="onUserLeaving"
+<method name="onUserInteraction"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onUserLeaveHint"
  return="void"
  abstract="false"
  native="false"
@@ -13632,6 +13924,19 @@
 <parameter name="textColor" type="int">
 </parameter>
 </method>
+<method name="setVisible"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="visible" type="boolean">
+</parameter>
+</method>
 <method name="setVolumeControlStream"
  return="void"
  abstract="false"
@@ -13946,6 +14251,17 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="getDeviceConfigurationInfo"
+ return="android.content.pm.ConfigurationInfo"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getMemoryInfo"
  return="void"
  abstract="false"
@@ -14028,6 +14344,19 @@
 <exception name="SecurityException" type="java.lang.SecurityException">
 </exception>
 </method>
+<method name="restartPackage"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="packageName" type="java.lang.String">
+</parameter>
+</method>
 <field name="RECENT_WITH_EXCLUDED"
  type="int"
  transient="false"
@@ -14499,6 +14828,81 @@
  visibility="public"
 >
 </field>
+<field name="IMPORTANCE_BACKGROUND"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="400"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="IMPORTANCE_EMPTY"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="500"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="IMPORTANCE_FOREGROUND"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="100"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="IMPORTANCE_SERVICE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="300"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="IMPORTANCE_VISIBLE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="200"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="importance"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="lru"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="pid"
  type="int"
  transient="false"
@@ -18219,7 +18623,7 @@
 </constructor>
 <method name="getTargetIntent"
  return="android.content.Intent"
- abstract="true"
+ abstract="false"
  native="false"
  synchronized="false"
  static="false"
@@ -18228,6 +18632,117 @@
  visibility="protected"
 >
 </method>
+<method name="intentForPosition"
+ return="android.content.Intent"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="position" type="int">
+</parameter>
+</method>
+<method name="makeListItems"
+ return="java.util.List&lt;android.app.LauncherActivity.ListItem&gt;"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
+<class name="LauncherActivity.IconResizer"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="LauncherActivity.IconResizer"
+ type="android.app.LauncherActivity.IconResizer"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="createIconThumbnail"
+ return="android.graphics.drawable.Drawable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="icon" type="android.graphics.drawable.Drawable">
+</parameter>
+</method>
+</class>
+<class name="LauncherActivity.ListItem"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="LauncherActivity.ListItem"
+ type="android.app.LauncherActivity.ListItem"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<field name="className"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="icon"
+ type="android.graphics.drawable.Drawable"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="label"
+ type="java.lang.CharSequence"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="packageName"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <class name="ListActivity"
  extends="android.app.Activity"
@@ -20766,6 +21281,21 @@
 <parameter name="intent" type="android.content.Intent">
 </parameter>
 </method>
+<method name="peekService"
+ return="android.os.IBinder"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="myContext" type="android.content.Context">
+</parameter>
+<parameter name="service" type="android.content.Intent">
+</parameter>
+</method>
 <method name="setDebugUnregister"
  return="void"
  abstract="false"
@@ -26629,6 +27159,17 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_MEDIA_CHECKING"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.MEDIA_CHECKING&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_MEDIA_EJECT"
  type="java.lang.String"
  transient="false"
@@ -26651,6 +27192,17 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_MEDIA_NOFS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.MEDIA_NOFS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_MEDIA_REMOVED"
  type="java.lang.String"
  transient="false"
@@ -26761,6 +27313,17 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_PACKAGE_DATA_CLEARED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.action.PACKAGE_DATA_CLEARED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_PACKAGE_INSTALL"
  type="java.lang.String"
  transient="false"
@@ -27266,6 +27829,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_DATA_REMOVED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.DATA_REMOVED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_DONT_KILL_APP"
  type="java.lang.String"
  transient="false"
@@ -27321,6 +27895,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_REPLACING"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.REPLACING&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_SHORTCUT_ICON"
  type="java.lang.String"
  transient="false"
@@ -27596,6 +28181,17 @@
  visibility="public"
 >
 </field>
+<field name="FLAG_ACTIVITY_REORDER_TO_FRONT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="131072"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="FLAG_ACTIVITY_RESET_TASK_IF_NEEDED"
  type="int"
  transient="false"
@@ -31453,6 +32049,17 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
+<method name="getSystemSharedLibraryNames"
+ return="java.lang.String[]"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getText"
  return="java.lang.CharSequence"
  abstract="true"
@@ -31517,6 +32124,17 @@
 <parameter name="packageURI" type="android.net.Uri">
 </parameter>
 </method>
+<method name="isSafeMode"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="queryBroadcastReceivers"
  return="java.util.List&lt;android.content.pm.ResolveInfo&gt;"
  abstract="true"
@@ -34550,6 +35168,23 @@
 <exception name="Resources.NotFoundException" type="android.content.res.Resources.NotFoundException">
 </exception>
 </method>
+<method name="getFraction"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+<parameter name="base" type="int">
+</parameter>
+<parameter name="pbase" type="int">
+</parameter>
+</method>
 <method name="getIdentifier"
  return="int"
  abstract="false"
@@ -42713,6 +43348,35 @@
 </parameter>
 <parameter name="stride" type="int">
 </parameter>
+<parameter name="x" type="float">
+</parameter>
+<parameter name="y" type="float">
+</parameter>
+<parameter name="width" type="int">
+</parameter>
+<parameter name="height" type="int">
+</parameter>
+<parameter name="hasAlpha" type="boolean">
+</parameter>
+<parameter name="paint" type="android.graphics.Paint">
+</parameter>
+</method>
+<method name="drawBitmap"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="colors" type="int[]">
+</parameter>
+<parameter name="offset" type="int">
+</parameter>
+<parameter name="stride" type="int">
+</parameter>
 <parameter name="x" type="int">
 </parameter>
 <parameter name="y" type="int">
@@ -52106,6 +52770,17 @@
  visibility="public"
 >
 </method>
+<method name="mutate"
+ return="android.graphics.drawable.Drawable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onBoundsChange"
  return="void"
  abstract="false"
@@ -54520,6 +55195,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="java.lang.Cloneable">
+</implements>
 <constructor name="Shape"
  type="android.graphics.drawable.shapes.Shape"
  static="false"
@@ -54528,6 +55205,19 @@
  visibility="public"
 >
 </constructor>
+<method name="clone"
+ return="android.graphics.drawable.shapes.Shape"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="CloneNotSupportedException" type="java.lang.CloneNotSupportedException">
+</exception>
+</method>
 <method name="draw"
  return="void"
  abstract="true"
@@ -55171,6 +55861,108 @@
 >
 </field>
 </class>
+<class name="GeomagneticField"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="GeomagneticField"
+ type="android.hardware.GeomagneticField"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="gdLatitudeDeg" type="float">
+</parameter>
+<parameter name="gdLongitudeDeg" type="float">
+</parameter>
+<parameter name="altitudeMeters" type="float">
+</parameter>
+<parameter name="timeMillis" type="long">
+</parameter>
+</constructor>
+<method name="getDeclination"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getFieldStrength"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getHorizontalStrength"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getInclination"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getX"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getY"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getZ"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</class>
 <class name="Sensor"
  extends="java.lang.Object"
  abstract="false"
@@ -56605,6 +57397,28 @@
 <parameter name="defStyle" type="int">
 </parameter>
 </constructor>
+<method name="finishInternalChanges"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="startInternalChanges"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 </class>
 <class name="InputMethodService"
  extends="android.inputmethodservice.AbstractInputMethodService"
@@ -56635,6 +57449,17 @@
 <parameter name="flags" type="int">
 </parameter>
 </method>
+<method name="getCandidatesHiddenVisibility"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getCurrentInputBinding"
  return="android.view.inputmethod.InputBinding"
  abstract="false"
@@ -56745,6 +57570,17 @@
  visibility="public"
 >
 </method>
+<method name="isShowInputRequested"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onAppPrivateCommand"
  return="void"
  abstract="false"
@@ -56902,6 +57738,58 @@
  visibility="public"
 >
 </method>
+<method name="onExtractTextContextMenuItem"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+</method>
+<method name="onExtractedSelectionChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+</method>
+<method name="onExtractedTextClicked"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onFinishCandidatesView"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="finishingInput" type="boolean">
+</parameter>
+</method>
 <method name="onFinishInput"
  return="void"
  abstract="false"
@@ -56913,6 +57801,30 @@
  visibility="public"
 >
 </method>
+<method name="onFinishInputView"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="finishingInput" type="boolean">
+</parameter>
+</method>
+<method name="onInitializeInterface"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="onKeyDown"
  return="boolean"
  abstract="false"
@@ -56973,6 +57885,21 @@
 <parameter name="flags" type="int">
 </parameter>
 </method>
+<method name="onStartCandidatesView"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="info" type="android.view.inputmethod.EditorInfo">
+</parameter>
+<parameter name="restarting" type="boolean">
+</parameter>
+</method>
 <method name="onStartInput"
  return="void"
  abstract="false"
@@ -57242,6 +58169,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<parameter name="ic" type="android.view.inputmethod.InputConnection">
+</parameter>
 <parameter name="attribute" type="android.view.inputmethod.EditorInfo">
 </parameter>
 </method>
@@ -57268,6 +58197,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<parameter name="ic" type="android.view.inputmethod.InputConnection">
+</parameter>
 <parameter name="attribute" type="android.view.inputmethod.EditorInfo">
 </parameter>
 </method>
@@ -60857,6 +61788,111 @@
 >
 </method>
 </class>
+<class name="AudioFormat"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="AudioFormat"
+ type="android.media.AudioFormat"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<field name="CHANNEL_CONFIGURATION_DEFAULT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CHANNEL_CONFIGURATION_INVALID"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CHANNEL_CONFIGURATION_MONO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CHANNEL_CONFIGURATION_STEREO"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ENCODING_DEFAULT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ENCODING_INVALID"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ENCODING_PCM_16BIT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ENCODING_PCM_8BIT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 <class name="AudioManager"
  extends="java.lang.Object"
  abstract="false"
@@ -61248,6 +62284,17 @@
  visibility="public"
 >
 </method>
+<field name="ACTION_AUDIO_BECOMING_NOISY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.media.AUDIO_BECOMING_NOISY&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ADJUST_LOWER"
  type="int"
  transient="false"
@@ -61755,6 +62802,990 @@
 >
 </field>
 </class>
+<class name="AudioRecord"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="AudioRecord"
+ type="android.media.AudioRecord"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioSource" type="int">
+</parameter>
+<parameter name="sampleRateInHz" type="int">
+</parameter>
+<parameter name="channelConfig" type="int">
+</parameter>
+<parameter name="audioFormat" type="int">
+</parameter>
+<parameter name="bufferSizeInBytes" type="int">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+</constructor>
+<method name="getAudioFormat"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getAudioSource"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getChannelConfiguration"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getChannelCount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getNotificationMarkerPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPositionNotificationPeriod"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getRecordingState"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSampleRate"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getState"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="read"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioData" type="byte[]">
+</parameter>
+<parameter name="offsetInBytes" type="int">
+</parameter>
+<parameter name="sizeInBytes" type="int">
+</parameter>
+</method>
+<method name="read"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioData" type="short[]">
+</parameter>
+<parameter name="offsetInShorts" type="int">
+</parameter>
+<parameter name="sizeInShorts" type="int">
+</parameter>
+</method>
+<method name="read"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioBuffer" type="java.nio.ByteBuffer">
+</parameter>
+<parameter name="sizeInBytes" type="int">
+</parameter>
+</method>
+<method name="release"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setMarkerReachedListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.AudioRecord.OnMarkerReachedListener">
+</parameter>
+</method>
+<method name="setNotificationMarkerPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="markerInFrames" type="int">
+</parameter>
+</method>
+<method name="setPeriodicNotificationListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.AudioRecord.OnPeriodicNotificationListener">
+</parameter>
+</method>
+<method name="setPositionNotificationPeriod"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="periodInFrames" type="int">
+</parameter>
+</method>
+<method name="startRecording"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IllegalStateException" type="java.lang.IllegalStateException">
+</exception>
+</method>
+<method name="stop"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IllegalStateException" type="java.lang.IllegalStateException">
+</exception>
+</method>
+<field name="ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_BAD_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_INVALID_OPERATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RECORDSTATE_RECORDING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RECORDSTATE_STOPPED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="STATE_INITIALIZED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="STATE_UNINITIALIZED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SUCCESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<interface name="AudioRecord.OnMarkerReachedListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onMarkerReached"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="recorder" type="android.media.AudioRecord">
+</parameter>
+</method>
+</interface>
+<interface name="AudioRecord.OnPeriodicNotificationListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onPeriodicNotification"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="recorder" type="android.media.AudioRecord">
+</parameter>
+</method>
+</interface>
+<class name="AudioTrack"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="AudioTrack"
+ type="android.media.AudioTrack"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="streamType" type="int">
+</parameter>
+<parameter name="sampleRateInHz" type="int">
+</parameter>
+<parameter name="channelConfig" type="int">
+</parameter>
+<parameter name="audioFormat" type="int">
+</parameter>
+<parameter name="bufferSizeInBytes" type="int">
+</parameter>
+<parameter name="mode" type="int">
+</parameter>
+<exception name="IllegalArgumentException" type="java.lang.IllegalArgumentException">
+</exception>
+</constructor>
+<method name="flush"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getAudioFormat"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getChannelConfiguration"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getChannelCount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getMaxVolume"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getMinVolume"
+ return="float"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getNativeFrameCount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+</method>
+<method name="getNativeOutputSampleRate"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getNotificationMarkerPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPlayState"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPlaybackHeadPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getPositionNotificationPeriod"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSampleRate"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getState"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getStreamType"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="pause"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IllegalStateException" type="java.lang.IllegalStateException">
+</exception>
+</method>
+<method name="play"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IllegalStateException" type="java.lang.IllegalStateException">
+</exception>
+</method>
+<method name="release"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="reloadStaticData"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setLoopPoints"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="startInFrames" type="int">
+</parameter>
+<parameter name="endInFrames" type="int">
+</parameter>
+<parameter name="loopCount" type="int">
+</parameter>
+</method>
+<method name="setMarkerReachedListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.AudioTrack.OnMarkerReachedListener">
+</parameter>
+</method>
+<method name="setNotificationMarkerPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="markerInFrames" type="int">
+</parameter>
+</method>
+<method name="setPeriodicNotificationListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.AudioTrack.OnPeriodicNotificationListener">
+</parameter>
+</method>
+<method name="setPlaybackHeadPosition"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="positionInFrames" type="int">
+</parameter>
+</method>
+<method name="setPlaybackRate"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="sampleRateInHz" type="int">
+</parameter>
+</method>
+<method name="setPositionNotificationPeriod"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="periodInFrames" type="int">
+</parameter>
+</method>
+<method name="setState"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="state" type="int">
+</parameter>
+</method>
+<method name="setStereoVolume"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="leftVolume" type="float">
+</parameter>
+<parameter name="rightVolume" type="float">
+</parameter>
+</method>
+<method name="stop"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="IllegalStateException" type="java.lang.IllegalStateException">
+</exception>
+</method>
+<method name="write"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioData" type="byte[]">
+</parameter>
+<parameter name="offsetInBytes" type="int">
+</parameter>
+<parameter name="sizeInBytes" type="int">
+</parameter>
+</method>
+<method name="write"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="audioData" type="short[]">
+</parameter>
+<parameter name="offsetInShorts" type="int">
+</parameter>
+<parameter name="sizeInShorts" type="int">
+</parameter>
+</method>
+<field name="ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_BAD_VALUE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ERROR_INVALID_OPERATION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="-3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MODE_STATIC"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="MODE_STREAM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="PLAYSTATE_PAUSED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="PLAYSTATE_PLAYING"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="PLAYSTATE_STOPPED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="STATE_INITIALIZED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="STATE_NO_STATIC_DATA"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="STATE_UNINITIALIZED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SUCCESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<interface name="AudioTrack.OnMarkerReachedListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onMarkerReached"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="track" type="android.media.AudioTrack">
+</parameter>
+</method>
+</interface>
+<interface name="AudioTrack.OnPeriodicNotificationListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onPeriodicNotification"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="track" type="android.media.AudioTrack">
+</parameter>
+</method>
+</interface>
 <class name="FaceDetector"
  extends="java.lang.Object"
  abstract="false"
@@ -61894,6 +63925,349 @@
 >
 </field>
 </class>
+<class name="JetPlayer"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="clearQueue"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="clone"
+ return="java.lang.Object"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<exception name="CloneNotSupportedException" type="java.lang.CloneNotSupportedException">
+</exception>
+</method>
+<method name="closeJetFile"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getJetPlayer"
+ return="android.media.JetPlayer"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getMaxTracks"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="loadJetFile"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="path" type="java.lang.String">
+</parameter>
+</method>
+<method name="loadJetFile"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="afd" type="android.content.res.AssetFileDescriptor">
+</parameter>
+</method>
+<method name="pause"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="play"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="queueJetSegment"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="segmentNum" type="int">
+</parameter>
+<parameter name="libNum" type="int">
+</parameter>
+<parameter name="repeatCount" type="int">
+</parameter>
+<parameter name="transpose" type="int">
+</parameter>
+<parameter name="muteFlags" type="int">
+</parameter>
+<parameter name="userID" type="byte">
+</parameter>
+</method>
+<method name="queueJetSegmentMuteArray"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="segmentNum" type="int">
+</parameter>
+<parameter name="libNum" type="int">
+</parameter>
+<parameter name="repeatCount" type="int">
+</parameter>
+<parameter name="transpose" type="int">
+</parameter>
+<parameter name="muteArray" type="boolean[]">
+</parameter>
+<parameter name="userID" type="byte">
+</parameter>
+</method>
+<method name="release"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setEventListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.JetPlayer.JetEventListener">
+</parameter>
+</method>
+<method name="setMuteArray"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="muteArray" type="boolean[]">
+</parameter>
+<parameter name="sync" type="boolean">
+</parameter>
+</method>
+<method name="setMuteFlag"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="trackId" type="int">
+</parameter>
+<parameter name="muteFlag" type="boolean">
+</parameter>
+<parameter name="sync" type="boolean">
+</parameter>
+</method>
+<method name="setMuteFlags"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="muteFlags" type="int">
+</parameter>
+<parameter name="sync" type="boolean">
+</parameter>
+</method>
+<method name="setStatusUpdateListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="listener" type="android.media.JetPlayer.JetStatusUpdateListener">
+</parameter>
+</method>
+<method name="triggerClip"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="clipId" type="int">
+</parameter>
+</method>
+</class>
+<interface name="JetPlayer.JetEventListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onJetEvent"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="player" type="android.media.JetPlayer">
+</parameter>
+<parameter name="segment" type="short">
+</parameter>
+<parameter name="track" type="byte">
+</parameter>
+<parameter name="channel" type="byte">
+</parameter>
+<parameter name="controller" type="byte">
+</parameter>
+<parameter name="value" type="byte">
+</parameter>
+</method>
+</interface>
+<interface name="JetPlayer.JetStatusUpdateListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onJetNumQueuedSegmentUpdate"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="player" type="android.media.JetPlayer">
+</parameter>
+<parameter name="nbSegments" type="int">
+</parameter>
+</method>
+<method name="onJetPauseUpdate"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="player" type="android.media.JetPlayer">
+</parameter>
+<parameter name="paused" type="int">
+</parameter>
+</method>
+<method name="onJetUserIdUpdate"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="player" type="android.media.JetPlayer">
+</parameter>
+<parameter name="userId" type="int">
+</parameter>
+<parameter name="repeatCount" type="int">
+</parameter>
+</method>
+</interface>
 <class name="MediaPlayer"
  extends="java.lang.Object"
  abstract="false"
@@ -64078,6 +66452,17 @@
  visibility="public"
 >
 </method>
+<method name="getBackgroundDataSetting"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getNetworkInfo"
  return="android.net.NetworkInfo"
  abstract="false"
@@ -64173,6 +66558,17 @@
 <parameter name="feature" type="java.lang.String">
 </parameter>
 </method>
+<field name="ACTION_BACKGROUND_DATA_SETTING_CHANGED"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.net.conn.BACKGROUND_DATA_SETTING_CHANGED&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="CONNECTIVITY_ACTION"
  type="java.lang.String"
  transient="false"
@@ -70693,6 +73089,21 @@
  static="false"
  final="false"
  deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+<parameter name="args" type="java.lang.String[]">
+</parameter>
+</method>
+<method name="dump"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
  visibility="protected"
 >
 <parameter name="fd" type="java.io.FileDescriptor">
@@ -70924,6 +73335,16 @@
  visibility="public"
 >
 </field>
+<field name="DISPLAY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="FINGERPRINT"
  type="java.lang.String"
  transient="false"
@@ -72357,6 +74778,21 @@
 <parameter name="port" type="int">
 </parameter>
 </method>
+<method name="dumpHprofData"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fileName" type="java.lang.String">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
 <method name="enableEmulatorTraceOutput"
  return="void"
  abstract="false"
@@ -73288,6 +75724,17 @@
  visibility="public"
 >
 </field>
+<field name="MEDIA_CHECKING"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;checking&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="MEDIA_MOUNTED"
  type="java.lang.String"
  transient="false"
@@ -73310,6 +75757,17 @@
  visibility="public"
 >
 </field>
+<field name="MEDIA_NOFS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;nofs&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="MEDIA_REMOVED"
  type="java.lang.String"
  transient="false"
@@ -74103,6 +76561,23 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="dump"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fd" type="java.io.FileDescriptor">
+</parameter>
+<parameter name="args" type="java.lang.String[]">
+</parameter>
+<exception name="RemoteException" type="android.os.RemoteException">
+</exception>
+</method>
 <method name="getInterfaceDescriptor"
  return="java.lang.String"
  abstract="true"
@@ -84042,6 +86517,28 @@
  visibility="public"
 >
 </method>
+<field name="ACTION_IMAGE_CAPTURE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.media.action.IMAGE_CAPTURE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_VIDEO_CAPTURE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.media.action.VIDEO_CAPTURE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="AUTHORITY"
  type="java.lang.String"
  transient="false"
@@ -84108,6 +86605,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_OUTPUT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;output&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_SCREEN_ORIENTATION"
  type="java.lang.String"
  transient="false"
@@ -84119,6 +86627,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_VIDEO_QUALITY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.extra.videoQuality&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="INTENT_ACTION_MEDIA_SEARCH"
  type="java.lang.String"
  transient="false"
@@ -85571,7 +88090,7 @@
  type="java.lang.String"
  transient="false"
  volatile="false"
- value="&quot;name ASC&quot;"
+ value="&quot;bucket_display_name&quot;"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -85929,7 +88448,7 @@
  type="java.lang.String"
  transient="false"
  volatile="false"
- value="&quot;name ASC&quot;"
+ value="&quot;_display_name&quot;"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -86042,6 +88561,17 @@
  visibility="public"
 >
 </field>
+<field name="BOOKMARK"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;bookmark&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="BUCKET_DISPLAY_NAME"
  type="java.lang.String"
  transient="false"
@@ -86450,6 +88980,17 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_INPUT_METHOD_SETTINGS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.settings.INPUT_METHOD_SETTINGS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_INTERNAL_STORAGE_SETTINGS"
  type="java.lang.String"
  transient="false"
@@ -86571,6 +89112,17 @@
  visibility="public"
 >
 </field>
+<field name="ACTION_USER_DICTIONARY_SETTINGS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.settings.USER_DICTIONARY_SETTINGS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="ACTION_WIFI_IP_SETTINGS"
  type="java.lang.String"
  transient="false"
@@ -88613,6 +91165,202 @@
 >
 </field>
 </class>
+<class name="UserDictionary"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="UserDictionary"
+ type="android.provider.UserDictionary"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<field name="AUTHORITY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;user_dictionary&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CONTENT_URI"
+ type="android.net.Uri"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<class name="UserDictionary.Words"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.provider.BaseColumns">
+</implements>
+<constructor name="UserDictionary.Words"
+ type="android.provider.UserDictionary.Words"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+<method name="addWord"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="word" type="java.lang.String">
+</parameter>
+<parameter name="frequency" type="int">
+</parameter>
+<parameter name="localeType" type="int">
+</parameter>
+</method>
+<field name="APP_ID"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;appid&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CONTENT_ITEM_TYPE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;vnd.android.cursor.item/vnd.google.userword&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CONTENT_TYPE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;vnd.android.cursor.dir/vnd.google.userword&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="CONTENT_URI"
+ type="android.net.Uri"
+ transient="false"
+ volatile="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="DEFAULT_SORT_ORDER"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;frequency DESC&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="FREQUENCY"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;frequency&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOCALE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;locale&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOCALE_TYPE_ALL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LOCALE_TYPE_CURRENT"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="WORD"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;word&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="_ID"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;_id&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
 </package>
 <package name="android.sax"
 >
@@ -88874,6 +91622,194 @@
 </implements>
 </interface>
 </package>
+<package name="android.speech"
+>
+<class name="RecognizerIntent"
+ extends="java.lang.Object"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<field name="ACTION_RECOGNIZE_SPEECH"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.action.RECOGNIZE_SPEECH&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ACTION_WEB_SEARCH"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.action.WEB_SEARCH&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_LANGUAGE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.LANGUAGE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_LANGUAGE_MODEL"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.LANGUAGE_MODEL&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_MAX_RESULTS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.MAX_RESULTS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_PROMPT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.PROMPT&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_RESULTS"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.RESULTS&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_RESULTS_PENDINGINTENT"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.RESULTS_PENDINGINTENT&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_RESULTS_PENDINGINTENT_BUNDLE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LANGUAGE_MODEL_FREE_FORM"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;free_form&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="LANGUAGE_MODEL_WEB_SEARCH"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;web_search&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RESULT_AUDIO_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="5"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RESULT_CLIENT_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RESULT_NETWORK_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RESULT_NO_MATCH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="RESULT_SERVER_ERROR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+</package>
 <package name="android.speech.srec"
 >
 <class name="MicrophoneInputStream"
@@ -96542,6 +99478,17 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
+<method name="getSystemSharedLibraryNames"
+ return="java.lang.String[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getText"
  return="java.lang.CharSequence"
  abstract="false"
@@ -96593,6 +99540,17 @@
 <parameter name="flags" type="int">
 </parameter>
 </method>
+<method name="isSafeMode"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="queryBroadcastReceivers"
  return="java.util.List&lt;android.content.pm.ResolveInfo&gt;"
  abstract="false"
@@ -97320,6 +100278,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="Annotation"
  type="android.text.Annotation"
  static="false"
@@ -97332,6 +100292,27 @@
 <parameter name="value" type="java.lang.String">
 </parameter>
 </constructor>
+<constructor name="Annotation"
+ type="android.text.Annotation"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getKey"
  return="java.lang.String"
  abstract="false"
@@ -97343,6 +100324,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getValue"
  return="java.lang.String"
  abstract="false"
@@ -97354,6 +100346,21 @@
  visibility="public"
 >
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="AutoText"
  extends="java.lang.Object"
@@ -98721,6 +101728,17 @@
  visibility="public"
 >
 </field>
+<field name="TYPE_TEXT_FLAG_IME_MULTI_LINE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="262144"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="TYPE_TEXT_FLAG_MULTI_LINE"
  type="int"
  transient="false"
@@ -98736,7 +101754,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="262144"
+ value="524288"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -98754,22 +101772,22 @@
  visibility="public"
 >
 </field>
-<field name="TYPE_TEXT_VARIATION_EMAIL_CONTENT"
+<field name="TYPE_TEXT_VARIATION_EMAIL_SUBJECT"
  type="int"
  transient="false"
  volatile="false"
- value="64"
+ value="48"
  static="true"
  final="true"
  deprecated="not deprecated"
  visibility="public"
 >
 </field>
-<field name="TYPE_TEXT_VARIATION_EMAIL_SUBJECT"
+<field name="TYPE_TEXT_VARIATION_LONG_MESSAGE"
  type="int"
  transient="false"
  volatile="false"
- value="48"
+ value="80"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -98791,7 +101809,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="112"
+ value="128"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -98802,7 +101820,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="80"
+ value="96"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -98813,18 +101831,18 @@
  type="int"
  transient="false"
  volatile="false"
- value="96"
+ value="112"
  static="true"
  final="true"
  deprecated="not deprecated"
  visibility="public"
 >
 </field>
-<field name="TYPE_TEXT_VARIATION_SEARCH_STRING"
+<field name="TYPE_TEXT_VARIATION_SHORT_MESSAGE"
  type="int"
  transient="false"
  volatile="false"
- value="128"
+ value="64"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -99762,6 +102780,54 @@
 </parameter>
 </method>
 </class>
+<interface name="NoCopySpan"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</interface>
+<class name="NoCopySpan.Concrete"
+ extends="java.lang.Object"
+ abstract="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.text.NoCopySpan">
+</implements>
+<constructor name="NoCopySpan.Concrete"
+ type="android.text.NoCopySpan.Concrete"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</constructor>
+</class>
+<interface name="ParcelableSpan"
+ abstract="true"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<implements name="android.os.Parcelable">
+</implements>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</interface>
 <class name="Selection"
  extends="java.lang.Object"
  abstract="false"
@@ -100077,6 +103143,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.NoCopySpan">
+</implements>
 <method name="onSpanAdded"
  return="void"
  abstract="true"
@@ -100983,6 +104051,17 @@
  visibility="public"
 >
 </field>
+<field name="SPAN_INTERMEDIATE"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="512"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SPAN_MARK_MARK"
  type="int"
  transient="false"
@@ -102287,6 +105366,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.NoCopySpan">
+</implements>
 <method name="afterTextChanged"
  return="void"
  abstract="true"
@@ -104127,6 +107208,23 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="onKeyOther"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.widget.TextView">
+</parameter>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
 <method name="onKeyUp"
  return="boolean"
  abstract="false"
@@ -104235,6 +107333,23 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="onKeyOther"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.view.View">
+</parameter>
+<parameter name="content" type="android.text.Editable">
+</parameter>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
 </class>
 <class name="CharacterPickerDialog"
  extends="android.app.Dialog"
@@ -104676,6 +107791,23 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="onKeyOther"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.view.View">
+</parameter>
+<parameter name="text" type="android.text.Editable">
+</parameter>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
 <method name="onKeyUp"
  return="boolean"
  abstract="true"
@@ -104784,6 +107916,21 @@
 </parameter>
 </method>
 <method name="clearMetaKeyState"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="content" type="android.text.Editable">
+</parameter>
+<parameter name="states" type="int">
+</parameter>
+</method>
+<method name="clearMetaKeyState"
  return="long"
  abstract="false"
  native="false"
@@ -105099,6 +108246,23 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="onKeyOther"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.widget.TextView">
+</parameter>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
 <method name="onKeyUp"
  return="boolean"
  abstract="true"
@@ -105729,6 +108893,23 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="onKeyOther"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.widget.TextView">
+</parameter>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
 <method name="onKeyUp"
  return="boolean"
  abstract="false"
@@ -106236,6 +109417,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="AbsoluteSizeSpan"
  type="android.text.style.AbsoluteSizeSpan"
  static="false"
@@ -106246,6 +109429,27 @@
 <parameter name="size" type="int">
 </parameter>
 </constructor>
+<constructor name="AbsoluteSizeSpan"
+ type="android.text.style.AbsoluteSizeSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getSize"
  return="int"
  abstract="false"
@@ -106257,6 +109461,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -106283,6 +109498,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <interface name="AlignmentSpan"
  abstract="true"
@@ -106315,6 +109545,8 @@
 >
 <implements name="android.text.style.AlignmentSpan">
 </implements>
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="AlignmentSpan.Standard"
  type="android.text.style.AlignmentSpan.Standard"
  static="false"
@@ -106325,6 +109557,27 @@
 <parameter name="align" type="android.text.Layout.Alignment">
 </parameter>
 </constructor>
+<constructor name="AlignmentSpan.Standard"
+ type="android.text.style.AlignmentSpan.Standard"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getAlignment"
  return="android.text.Layout.Alignment"
  abstract="false"
@@ -106336,6 +109589,32 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="BackgroundColorSpan"
  extends="android.text.style.CharacterStyle"
@@ -106345,6 +109624,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <implements name="android.text.style.UpdateAppearance">
 </implements>
 <constructor name="BackgroundColorSpan"
@@ -106357,6 +109638,27 @@
 <parameter name="color" type="int">
 </parameter>
 </constructor>
+<constructor name="BackgroundColorSpan"
+ type="android.text.style.BackgroundColorSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getBackgroundColor"
  return="int"
  abstract="false"
@@ -106368,6 +109670,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -106381,6 +109694,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="BulletSpan"
  extends="java.lang.Object"
@@ -106392,6 +109720,8 @@
 >
 <implements name="android.text.style.LeadingMarginSpan">
 </implements>
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="BulletSpan"
  type="android.text.style.BulletSpan"
  static="false"
@@ -106422,6 +109752,27 @@
 <parameter name="color" type="int">
 </parameter>
 </constructor>
+<constructor name="BulletSpan"
+ type="android.text.style.BulletSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="drawLeadingMargin"
  return="void"
  abstract="false"
@@ -106470,6 +109821,32 @@
 <parameter name="first" type="boolean">
 </parameter>
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <field name="STANDARD_GAP_WIDTH"
  type="int"
  transient="false"
@@ -106826,6 +110203,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <implements name="android.text.style.UpdateAppearance">
 </implements>
 <constructor name="ForegroundColorSpan"
@@ -106838,6 +110217,27 @@
 <parameter name="color" type="int">
 </parameter>
 </constructor>
+<constructor name="ForegroundColorSpan"
+ type="android.text.style.ForegroundColorSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getForegroundColor"
  return="int"
  abstract="false"
@@ -106849,6 +110249,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -106862,6 +110273,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="IconMarginSpan"
  extends="java.lang.Object"
@@ -107190,6 +110616,8 @@
 >
 <implements name="android.text.style.LeadingMarginSpan">
 </implements>
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="LeadingMarginSpan.Standard"
  type="android.text.style.LeadingMarginSpan.Standard"
  static="false"
@@ -107212,6 +110640,27 @@
 <parameter name="every" type="int">
 </parameter>
 </constructor>
+<constructor name="LeadingMarginSpan.Standard"
+ type="android.text.style.LeadingMarginSpan.Standard"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="drawLeadingMargin"
  return="void"
  abstract="false"
@@ -107260,6 +110709,32 @@
 <parameter name="first" type="boolean">
 </parameter>
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <interface name="LineBackgroundSpan"
  abstract="true"
@@ -107434,6 +110909,8 @@
 >
 <implements name="android.text.style.LeadingMarginSpan">
 </implements>
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="QuoteSpan"
  type="android.text.style.QuoteSpan"
  static="false"
@@ -107452,6 +110929,27 @@
 <parameter name="color" type="int">
 </parameter>
 </constructor>
+<constructor name="QuoteSpan"
+ type="android.text.style.QuoteSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="drawLeadingMargin"
  return="void"
  abstract="false"
@@ -107511,6 +111009,32 @@
 <parameter name="first" type="boolean">
 </parameter>
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="RasterizerSpan"
  extends="android.text.style.CharacterStyle"
@@ -107565,6 +111089,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="RelativeSizeSpan"
  type="android.text.style.RelativeSizeSpan"
  static="false"
@@ -107575,6 +111101,27 @@
 <parameter name="proportion" type="float">
 </parameter>
 </constructor>
+<constructor name="RelativeSizeSpan"
+ type="android.text.style.RelativeSizeSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getSizeChange"
  return="float"
  abstract="false"
@@ -107586,6 +111133,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -107612,6 +111170,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="ReplacementSpan"
  extends="android.text.style.MetricAffectingSpan"
@@ -107714,6 +111287,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="ScaleXSpan"
  type="android.text.style.ScaleXSpan"
  static="false"
@@ -107724,6 +111299,27 @@
 <parameter name="proportion" type="float">
 </parameter>
 </constructor>
+<constructor name="ScaleXSpan"
+ type="android.text.style.ScaleXSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getScaleX"
  return="float"
  abstract="false"
@@ -107735,6 +111331,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -107761,6 +111368,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="StrikethroughSpan"
  extends="android.text.style.CharacterStyle"
@@ -107770,6 +111392,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <implements name="android.text.style.UpdateAppearance">
 </implements>
 <constructor name="StrikethroughSpan"
@@ -107780,6 +111404,38 @@
  visibility="public"
 >
 </constructor>
+<constructor name="StrikethroughSpan"
+ type="android.text.style.StrikethroughSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -107793,6 +111449,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="StyleSpan"
  extends="android.text.style.MetricAffectingSpan"
@@ -107802,6 +111473,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="StyleSpan"
  type="android.text.style.StyleSpan"
  static="false"
@@ -107812,6 +111485,38 @@
 <parameter name="style" type="int">
 </parameter>
 </constructor>
+<constructor name="StyleSpan"
+ type="android.text.style.StyleSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getStyle"
  return="int"
  abstract="false"
@@ -107849,6 +111554,21 @@
 <parameter name="paint" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="SubscriptSpan"
  extends="android.text.style.MetricAffectingSpan"
@@ -107858,6 +111578,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="SubscriptSpan"
  type="android.text.style.SubscriptSpan"
  static="false"
@@ -107866,6 +111588,38 @@
  visibility="public"
 >
 </constructor>
+<constructor name="SubscriptSpan"
+ type="android.text.style.SubscriptSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -107892,6 +111646,21 @@
 <parameter name="tp" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="SuperscriptSpan"
  extends="android.text.style.MetricAffectingSpan"
@@ -107901,6 +111670,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="SuperscriptSpan"
  type="android.text.style.SuperscriptSpan"
  static="false"
@@ -107909,6 +111680,38 @@
  visibility="public"
 >
 </constructor>
+<constructor name="SuperscriptSpan"
+ type="android.text.style.SuperscriptSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -107935,6 +111738,21 @@
 <parameter name="tp" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <interface name="TabStopSpan"
  abstract="true"
@@ -107997,6 +111815,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="TextAppearanceSpan"
  type="android.text.style.TextAppearanceSpan"
  static="false"
@@ -108041,6 +111861,27 @@
 <parameter name="linkColor" type="android.content.res.ColorStateList">
 </parameter>
 </constructor>
+<constructor name="TextAppearanceSpan"
+ type="android.text.style.TextAppearanceSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getFamily"
  return="java.lang.String"
  abstract="false"
@@ -108063,6 +111904,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getTextColor"
  return="android.content.res.ColorStateList"
  abstract="false"
@@ -108122,6 +111974,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="TypefaceSpan"
  extends="android.text.style.MetricAffectingSpan"
@@ -108131,6 +111998,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="TypefaceSpan"
  type="android.text.style.TypefaceSpan"
  static="false"
@@ -108141,6 +112010,27 @@
 <parameter name="family" type="java.lang.String">
 </parameter>
 </constructor>
+<constructor name="TypefaceSpan"
+ type="android.text.style.TypefaceSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getFamily"
  return="java.lang.String"
  abstract="false"
@@ -108152,6 +112042,17 @@
  visibility="public"
 >
 </method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -108178,6 +112079,21 @@
 <parameter name="paint" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="URLSpan"
  extends="android.text.style.ClickableSpan"
@@ -108187,6 +112103,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <constructor name="URLSpan"
  type="android.text.style.URLSpan"
  static="false"
@@ -108197,6 +112115,38 @@
 <parameter name="url" type="java.lang.String">
 </parameter>
 </constructor>
+<constructor name="URLSpan"
+ type="android.text.style.URLSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getURL"
  return="java.lang.String"
  abstract="false"
@@ -108221,6 +112171,21 @@
 <parameter name="widget" type="android.view.View">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <class name="UnderlineSpan"
  extends="android.text.style.CharacterStyle"
@@ -108230,6 +112195,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="android.text.ParcelableSpan">
+</implements>
 <implements name="android.text.style.UpdateAppearance">
 </implements>
 <constructor name="UnderlineSpan"
@@ -108240,6 +112207,38 @@
  visibility="public"
 >
 </constructor>
+<constructor name="UnderlineSpan"
+ type="android.text.style.UnderlineSpan"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="src" type="android.os.Parcel">
+</parameter>
+</constructor>
+<method name="describeContents"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getSpanTypeId"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="updateDrawState"
  return="void"
  abstract="false"
@@ -108253,6 +112252,21 @@
 <parameter name="ds" type="android.text.TextPaint">
 </parameter>
 </method>
+<method name="writeToParcel"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dest" type="android.os.Parcel">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 </class>
 <interface name="UpdateAppearance"
  abstract="true"
@@ -112174,7 +116188,7 @@
  type="android.view.GestureDetector"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 <parameter name="listener" type="android.view.GestureDetector.OnGestureListener">
@@ -112186,12 +116200,38 @@
  type="android.view.GestureDetector"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 <parameter name="listener" type="android.view.GestureDetector.OnGestureListener">
 </parameter>
 </constructor>
+<constructor name="GestureDetector"
+ type="android.view.GestureDetector"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="listener" type="android.view.GestureDetector.OnGestureListener">
+</parameter>
+</constructor>
+<constructor name="GestureDetector"
+ type="android.view.GestureDetector"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="listener" type="android.view.GestureDetector.OnGestureListener">
+</parameter>
+<parameter name="handler" type="android.os.Handler">
+</parameter>
+</constructor>
 <method name="isLongpressEnabled"
  return="boolean"
  abstract="false"
@@ -112853,6 +116893,32 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="deviceHasKey"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="keyCode" type="int">
+</parameter>
+</method>
+<method name="deviceHasKeys"
+ return="boolean[]"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="keyCodes" type="int[]">
+</parameter>
+</method>
 <method name="get"
  return="int"
  abstract="false"
@@ -113271,6 +117337,22 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<parameter name="time" type="long">
+</parameter>
+<parameter name="characters" type="java.lang.String">
+</parameter>
+<parameter name="device" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</constructor>
+<constructor name="KeyEvent"
+ type="android.view.KeyEvent"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
 <parameter name="origEvent" type="android.view.KeyEvent">
 </parameter>
 <parameter name="eventTime" type="long">
@@ -113325,6 +117407,17 @@
  visibility="public"
 >
 </method>
+<method name="getCharacters"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getDeadChar"
  return="int"
  abstract="false"
@@ -121867,10 +125960,23 @@
  type="android.view.ViewConfiguration"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </constructor>
+<method name="get"
+ return="android.view.ViewConfiguration"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</method>
 <method name="getEdgeSlop"
  return="int"
  abstract="false"
@@ -121878,7 +125984,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -121889,7 +125995,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -121933,7 +126039,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -121944,7 +126050,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -121959,6 +126065,83 @@
  visibility="public"
 >
 </method>
+<method name="getScaledEdgeSlop"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledFadingEdgeLength"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledMaximumDrawingCacheSize"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledMinimumFlingVelocity"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledScrollBarSize"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledTouchSlop"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getScaledWindowTouchSlop"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getScrollBarSize"
  return="int"
  abstract="false"
@@ -121966,7 +126149,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -121999,7 +126182,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -122010,7 +126193,7 @@
  synchronized="false"
  static="true"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 </method>
@@ -125315,6 +129498,19 @@
 <parameter name="streamType" type="int">
 </parameter>
 </method>
+<method name="setWindowAnimations"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="resId" type="int">
+</parameter>
+</method>
 <method name="setWindowManager"
  return="void"
  abstract="false"
@@ -126432,6 +130628,17 @@
  visibility="public"
 >
 </field>
+<field name="SCREEN_ORIENTATION_CHANGED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1024"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SOFT_INPUT_ADJUST_PAN"
  type="int"
  transient="false"
@@ -126907,6 +131114,16 @@
  visibility="public"
 >
 </field>
+<field name="screenOrientation"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="softInputMode"
  type="int"
  transient="false"
@@ -127130,6 +131347,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<implements name="java.lang.Cloneable">
+</implements>
 <constructor name="Animation"
  type="android.view.animation.Animation"
  static="false"
@@ -129207,7 +133426,7 @@
 >
 <class name="BaseInputConnection"
  extends="java.lang.Object"
- abstract="true"
+ abstract="false"
  static="false"
  final="false"
  deprecated="not deprecated"
@@ -129224,7 +133443,193 @@
 >
 <parameter name="targetView" type="android.view.View">
 </parameter>
+<parameter name="dummyMode" type="boolean">
+</parameter>
 </constructor>
+<method name="beginBatchEdit"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="clearMetaKeyStates"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="states" type="int">
+</parameter>
+</method>
+<method name="commitCompletion"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="android.view.inputmethod.CompletionInfo">
+</parameter>
+</method>
+<method name="commitText"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="java.lang.CharSequence">
+</parameter>
+<parameter name="newCursorPosition" type="int">
+</parameter>
+</method>
+<method name="deleteSurroundingText"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="leftLength" type="int">
+</parameter>
+<parameter name="rightLength" type="int">
+</parameter>
+</method>
+<method name="endBatchEdit"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="finishComposingText"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getComposingSpanEnd"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+</method>
+<method name="getComposingSpanStart"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+</method>
+<method name="getCursorCapsMode"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="reqModes" type="int">
+</parameter>
+</method>
+<method name="getEditable"
+ return="android.text.Editable"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getExtractedText"
+ return="android.view.inputmethod.ExtractedText"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="request" type="android.view.inputmethod.ExtractedTextRequest">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
+<method name="getTextAfterCursor"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="length" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
+<method name="getTextBeforeCursor"
+ return="java.lang.CharSequence"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="length" type="int">
+</parameter>
+<parameter name="flags" type="int">
+</parameter>
+</method>
 <method name="hideStatusIcon"
  return="boolean"
  abstract="false"
@@ -129236,6 +133641,47 @@
  visibility="public"
 >
 </method>
+<method name="performContextMenuAction"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+</method>
+<method name="performPrivateCommand"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="action" type="java.lang.String">
+</parameter>
+<parameter name="data" type="android.os.Bundle">
+</parameter>
+</method>
+<method name="removeComposingSpans"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+</method>
 <method name="sendKeyEvent"
  return="boolean"
  abstract="false"
@@ -129249,6 +133695,49 @@
 <parameter name="event" type="android.view.KeyEvent">
 </parameter>
 </method>
+<method name="setComposingSpans"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="android.text.Spannable">
+</parameter>
+</method>
+<method name="setComposingText"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="text" type="java.lang.CharSequence">
+</parameter>
+<parameter name="newCursorPosition" type="int">
+</parameter>
+</method>
+<method name="setSelection"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+</method>
 <method name="showStatusIcon"
  return="boolean"
  abstract="false"
@@ -129417,6 +133906,21 @@
  visibility="public"
 >
 </method>
+<method name="dump"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="pw" type="android.util.Printer">
+</parameter>
+<parameter name="prefix" type="java.lang.String">
+</parameter>
+</method>
 <method name="writeToParcel"
  return="void"
  abstract="false"
@@ -129452,6 +133956,26 @@
  visibility="public"
 >
 </field>
+<field name="fieldId"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="fieldName"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="hintText"
  type="java.lang.CharSequence"
  transient="false"
@@ -129512,6 +134036,16 @@
  visibility="public"
 >
 </field>
+<field name="packageName"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="privateContentType"
  type="java.lang.String"
  transient="false"
@@ -129598,6 +134132,26 @@
  visibility="public"
 >
 </field>
+<field name="partialEndOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="partialStartOffset"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="selectionEnd"
  type="int"
  transient="false"
@@ -129693,6 +134247,16 @@
  visibility="public"
 >
 </field>
+<field name="flags"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="hintMaxChars"
  type="int"
  transient="false"
@@ -129979,6 +134543,8 @@
 >
 <parameter name="n" type="int">
 </parameter>
+<parameter name="flags" type="int">
+</parameter>
 </method>
 <method name="getTextBeforeCursor"
  return="java.lang.CharSequence"
@@ -129992,6 +134558,8 @@
 >
 <parameter name="n" type="int">
 </parameter>
+<parameter name="flags" type="int">
+</parameter>
 </method>
 <method name="hideStatusIcon"
  return="boolean"
@@ -130004,6 +134572,19 @@
  visibility="public"
 >
 </method>
+<method name="performContextMenuAction"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+</method>
 <method name="performPrivateCommand"
  return="boolean"
  abstract="true"
@@ -130047,6 +134628,21 @@
 <parameter name="newCursorPosition" type="int">
 </parameter>
 </method>
+<method name="setSelection"
+ return="boolean"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="start" type="int">
+</parameter>
+<parameter name="end" type="int">
+</parameter>
+</method>
 <method name="showStatusIcon"
  return="boolean"
  abstract="true"
@@ -130062,7 +134658,18 @@
 <parameter name="resId" type="int">
 </parameter>
 </method>
-<field name="EXTRACTED_TEXT_MONITOR"
+<field name="GET_EXTRACTED_TEXT_MONITOR"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="GET_TEXT_WITH_STYLES"
  type="int"
  transient="false"
  volatile="false"
@@ -130074,239 +134681,6 @@
 >
 </field>
 </interface>
-<class name="InputConnectionWrapper"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<implements name="android.view.inputmethod.InputConnection">
-</implements>
-<constructor name="InputConnectionWrapper"
- type="android.view.inputmethod.InputConnectionWrapper"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="base" type="android.view.inputmethod.InputConnection">
-</parameter>
-</constructor>
-<method name="beginBatchEdit"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="clearMetaKeyStates"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="states" type="int">
-</parameter>
-</method>
-<method name="commitCompletion"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="text" type="android.view.inputmethod.CompletionInfo">
-</parameter>
-</method>
-<method name="commitText"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="text" type="java.lang.CharSequence">
-</parameter>
-<parameter name="newCursorPosition" type="int">
-</parameter>
-</method>
-<method name="deleteSurroundingText"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="leftLength" type="int">
-</parameter>
-<parameter name="rightLength" type="int">
-</parameter>
-</method>
-<method name="endBatchEdit"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="finishComposingText"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="getCursorCapsMode"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="reqModes" type="int">
-</parameter>
-</method>
-<method name="getExtractedText"
- return="android.view.inputmethod.ExtractedText"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="request" type="android.view.inputmethod.ExtractedTextRequest">
-</parameter>
-<parameter name="flags" type="int">
-</parameter>
-</method>
-<method name="getTextAfterCursor"
- return="java.lang.CharSequence"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="n" type="int">
-</parameter>
-</method>
-<method name="getTextBeforeCursor"
- return="java.lang.CharSequence"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="n" type="int">
-</parameter>
-</method>
-<method name="hideStatusIcon"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</method>
-<method name="performPrivateCommand"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="action" type="java.lang.String">
-</parameter>
-<parameter name="data" type="android.os.Bundle">
-</parameter>
-</method>
-<method name="sendKeyEvent"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="event" type="android.view.KeyEvent">
-</parameter>
-</method>
-<method name="setComposingText"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="text" type="java.lang.CharSequence">
-</parameter>
-<parameter name="newCursorPosition" type="int">
-</parameter>
-</method>
-<method name="showStatusIcon"
- return="boolean"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="resId" type="int">
-</parameter>
-</method>
-</class>
 <interface name="InputMethod"
  abstract="true"
  static="false"
@@ -130374,6 +134748,8 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<parameter name="inputConnection" type="android.view.inputmethod.InputConnection">
+</parameter>
 <parameter name="attribute" type="android.view.inputmethod.EditorInfo">
 </parameter>
 </method>
@@ -130428,7 +134804,9 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="attribute" type="android.view.inputmethod.EditorInfo">
+<parameter name="inputConnection" type="android.view.inputmethod.InputConnection">
+</parameter>
+<parameter name="info" type="android.view.inputmethod.EditorInfo">
 </parameter>
 </method>
 <method name="unbindInput"
@@ -130475,6 +134853,17 @@
  visibility="public"
 >
 </field>
+<field name="SHOW_FORCED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </interface>
 <interface name="InputMethod.SessionCallback"
  abstract="true"
@@ -130830,6 +135219,23 @@
 <parameter name="view" type="android.view.View">
 </parameter>
 </method>
+<method name="sendAppPrivateCommand"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="view" type="android.view.View">
+</parameter>
+<parameter name="action" type="java.lang.String">
+</parameter>
+<parameter name="data" type="android.os.Bundle">
+</parameter>
+</method>
 <method name="setInputMethod"
  return="void"
  abstract="false"
@@ -130956,6 +135362,28 @@
  visibility="public"
 >
 </field>
+<field name="HIDE_NOT_ALWAYS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="SHOW_FORCED"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="SHOW_IMPLICIT"
  type="int"
  transient="false"
@@ -131123,38 +135551,6 @@
 </parameter>
 </method>
 </interface>
-<class name="MutableInputConnectionWrapper"
- extends="android.view.inputmethod.InputConnectionWrapper"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="MutableInputConnectionWrapper"
- type="android.view.inputmethod.MutableInputConnectionWrapper"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="base" type="android.view.inputmethod.InputConnection">
-</parameter>
-</constructor>
-<method name="setBaseInputConnection"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="base" type="android.view.inputmethod.InputConnection">
-</parameter>
-</method>
-</class>
 </package>
 <package name="android.webkit"
 >
@@ -134994,7 +139390,7 @@
  synchronized="false"
  static="false"
  final="false"
- deprecated="not deprecated"
+ deprecated="deprecated"
  visibility="public"
 >
 <parameter name="oldFocus" type="android.view.View">
@@ -138293,6 +142689,17 @@
  visibility="public"
 >
 </method>
+<method name="isPerformingCompletion"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="isPopupShowing"
  return="boolean"
  abstract="false"
@@ -142403,6 +146810,218 @@
 </parameter>
 </method>
 </class>
+<class name="HorizontalScrollView"
+ extends="android.widget.FrameLayout"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="HorizontalScrollView"
+ type="android.widget.HorizontalScrollView"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+</constructor>
+<constructor name="HorizontalScrollView"
+ type="android.widget.HorizontalScrollView"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+</constructor>
+<constructor name="HorizontalScrollView"
+ type="android.widget.HorizontalScrollView"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+<parameter name="defStyle" type="int">
+</parameter>
+</constructor>
+<method name="arrowScroll"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="direction" type="int">
+</parameter>
+</method>
+<method name="computeScrollDeltaToGetChildRectOnScreen"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="rect" type="android.graphics.Rect">
+</parameter>
+</method>
+<method name="executeKeyEvent"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="event" type="android.view.KeyEvent">
+</parameter>
+</method>
+<method name="fling"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="velocityX" type="int">
+</parameter>
+</method>
+<method name="fullScroll"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="direction" type="int">
+</parameter>
+</method>
+<method name="getMaxScrollAmount"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isFillViewport"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isSmoothScrollingEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="pageScroll"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="direction" type="int">
+</parameter>
+</method>
+<method name="setFillViewport"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fillViewport" type="boolean">
+</parameter>
+</method>
+<method name="setSmoothScrollingEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="smoothScrollingEnabled" type="boolean">
+</parameter>
+</method>
+<method name="smoothScrollBy"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="dx" type="int">
+</parameter>
+<parameter name="dy" type="int">
+</parameter>
+</method>
+<method name="smoothScrollTo"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="x" type="int">
+</parameter>
+<parameter name="y" type="int">
+</parameter>
+</method>
+</class>
 <class name="ImageButton"
  extends="android.widget.ImageView"
  abstract="false"
@@ -144318,6 +148937,21 @@
 <parameter name="anchor" type="android.view.View">
 </parameter>
 </method>
+<method name="getMaxAvailableHeight"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="anchor" type="android.view.View">
+</parameter>
+<parameter name="yOffset" type="int">
+</parameter>
+</method>
 <method name="getWidth"
  return="int"
  abstract="false"
@@ -144329,6 +148963,17 @@
  visibility="public"
 >
 </method>
+<method name="isAboveAnchor"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="isClippingEnabled"
  return="boolean"
  abstract="false"
@@ -145967,6 +150612,29 @@
 <parameter name="running" type="boolean">
 </parameter>
 </method>
+<method name="setDrawableParameters"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="viewId" type="int">
+</parameter>
+<parameter name="targetBackground" type="boolean">
+</parameter>
+<parameter name="alpha" type="int">
+</parameter>
+<parameter name="colorFilter" type="int">
+</parameter>
+<parameter name="mode" type="android.graphics.PorterDuff.Mode">
+</parameter>
+<parameter name="level" type="int">
+</parameter>
+</method>
 <method name="setImageViewBitmap"
  return="void"
  abstract="false"
@@ -146046,6 +150714,21 @@
 <parameter name="indeterminate" type="boolean">
 </parameter>
 </method>
+<method name="setTextColor"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="viewId" type="int">
+</parameter>
+<parameter name="color" type="int">
+</parameter>
+</method>
 <method name="setTextViewText"
  return="void"
  abstract="false"
@@ -147733,6 +152416,323 @@
 </parameter>
 </method>
 </class>
+<class name="SlidingDrawer"
+ extends="android.view.ViewGroup"
+ abstract="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<constructor name="SlidingDrawer"
+ type="android.widget.SlidingDrawer"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+</constructor>
+<constructor name="SlidingDrawer"
+ type="android.widget.SlidingDrawer"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="context" type="android.content.Context">
+</parameter>
+<parameter name="attrs" type="android.util.AttributeSet">
+</parameter>
+<parameter name="defStyle" type="int">
+</parameter>
+</constructor>
+<method name="animateClose"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="animateOpen"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="animateToggle"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="close"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getContent"
+ return="android.view.View"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getHandle"
+ return="android.view.View"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isMoving"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="isOpened"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="lock"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onLayout"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="changed" type="boolean">
+</parameter>
+<parameter name="l" type="int">
+</parameter>
+<parameter name="t" type="int">
+</parameter>
+<parameter name="r" type="int">
+</parameter>
+<parameter name="b" type="int">
+</parameter>
+</method>
+<method name="open"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="setOnDrawerCloseListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="onDrawerCloseListener" type="android.widget.SlidingDrawer.OnDrawerCloseListener">
+</parameter>
+</method>
+<method name="setOnDrawerOpenListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="onDrawerOpenListener" type="android.widget.SlidingDrawer.OnDrawerOpenListener">
+</parameter>
+</method>
+<method name="setOnDrawerScrollListener"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="onDrawerScrollListener" type="android.widget.SlidingDrawer.OnDrawerScrollListener">
+</parameter>
+</method>
+<method name="toggle"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="unlock"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<field name="ORIENTATION_HORIZONTAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="ORIENTATION_VERTICAL"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+</class>
+<interface name="SlidingDrawer.OnDrawerCloseListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onDrawerClosed"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</interface>
+<interface name="SlidingDrawer.OnDrawerOpenListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onDrawerOpened"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</interface>
+<interface name="SlidingDrawer.OnDrawerScrollListener"
+ abstract="true"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<method name="onScrollEnded"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="onScrollStarted"
+ return="void"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+</interface>
 <class name="Spinner"
  extends="android.widget.AbsSpinner"
  abstract="false"
@@ -148834,6 +153834,30 @@
 <parameter name="end" type="int">
 </parameter>
 </method>
+<method name="beginBatchEdit"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="bringPointIntoView"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="offset" type="int">
+</parameter>
+</method>
 <method name="debug"
  return="void"
  abstract="false"
@@ -148847,6 +153871,17 @@
 <parameter name="depth" type="int">
 </parameter>
 </method>
+<method name="endBatchEdit"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="extractText"
  return="boolean"
  abstract="false"
@@ -149428,6 +154463,17 @@
  visibility="public"
 >
 </method>
+<method name="isInputMethodTarget"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="length"
  return="int"
  abstract="false"
@@ -149524,6 +154570,21 @@
  visibility="public"
 >
 </method>
+<method name="onSelectionChanged"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="selStart" type="int">
+</parameter>
+<parameter name="selEnd" type="int">
+</parameter>
+</method>
 <method name="onTextChanged"
  return="void"
  abstract="false"
@@ -149543,6 +154604,19 @@
 <parameter name="after" type="int">
 </parameter>
 </method>
+<method name="onTextContextMenuItem"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="id" type="int">
+</parameter>
+</method>
 <method name="removeTextChangedListener"
  return="void"
  abstract="false"
@@ -155136,6 +160210,21 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="dumpHprofData"
+ return="void"
+ abstract="false"
+ native="true"
+ synchronized="false"
+ static="true"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="fileName" type="java.lang.String">
+</parameter>
+<exception name="IOException" type="java.io.IOException">
+</exception>
+</method>
 <method name="getAllocCount"
  return="int"
  abstract="false"
diff --git a/camera/libcameraservice/CameraHardwareStub.cpp b/camera/libcameraservice/CameraHardwareStub.cpp
index 3d6b0b1..9a47705 100644
--- a/camera/libcameraservice/CameraHardwareStub.cpp
+++ b/camera/libcameraservice/CameraHardwareStub.cpp
@@ -187,6 +187,24 @@
     return mPreviewThread != 0;
 }
 
+status_t CameraHardwareStub::startRecording(recording_callback cb, void* user)
+{
+    return UNKNOWN_ERROR;
+}
+
+void CameraHardwareStub::stopRecording()
+{
+}
+
+bool CameraHardwareStub::recordingEnabled()
+{
+    return false;
+}
+
+void CameraHardwareStub::releaseRecordingFrame(const sp<IMemory>& mem)
+{
+}
+
 // ---------------------------------------------------------------------------
 
 int CameraHardwareStub::beginAutoFocusThread(void *cookie)
diff --git a/camera/libcameraservice/CameraHardwareStub.h b/camera/libcameraservice/CameraHardwareStub.h
index 9f5ddf1..cdd6011 100644
--- a/camera/libcameraservice/CameraHardwareStub.h
+++ b/camera/libcameraservice/CameraHardwareStub.h
@@ -34,6 +34,12 @@
     virtual status_t    startPreview(preview_callback cb, void* user);
     virtual void        stopPreview();
     virtual bool        previewEnabled();
+
+    virtual status_t    startRecording(recording_callback cb, void* user);
+    virtual void        stopRecording();
+    virtual bool        recordingEnabled();
+    virtual void        releaseRecordingFrame(const sp<IMemory>& mem);
+
     virtual status_t    autoFocus(autofocus_callback, void *user);
     virtual status_t    takePicture(shutter_callback,
                                     raw_callback,
diff --git a/camera/libcameraservice/CameraService.cpp b/camera/libcameraservice/CameraService.cpp
index 36c5ada..e5d4220 100644
--- a/camera/libcameraservice/CameraService.cpp
+++ b/camera/libcameraservice/CameraService.cpp
@@ -86,18 +86,19 @@
     LOGD("Connect E from ICameraClient %p", cameraClient->asBinder().get());
 
     Mutex::Autolock lock(mLock);
+    sp<Client> client;
     if (mClient != 0) {
         sp<Client> currentClient = mClient.promote();
         if (currentClient != 0) {
             sp<ICameraClient> currentCameraClient(currentClient->getCameraClient());
             if (cameraClient->asBinder() == currentCameraClient->asBinder()) {
                 // this is the same client reconnecting...
-                LOGD("Connect X same client is reconnecting...");
+                LOGD("Connect X same client (%p) is reconnecting...", cameraClient->asBinder().get());
                 return currentClient;
             } else {
-                // it's another client... boot the previous one...
-                LOGD("new client connecting, booting the old one...");
-                mClient.clear();
+                // it's another client... reject it
+                LOGD("new client (%p) attempting to connect - rejected", cameraClient->asBinder().get());
+                return client;
             }
         } else {
             // can't promote, the previous client has died...
@@ -107,7 +108,7 @@
     }
 
     // create a new Client object
-    sp<Client> client = new Client(this, cameraClient, IPCThreadState::self()->getCallingPid());
+    client = new Client(this, cameraClient, IPCThreadState::self()->getCallingPid());
     mClient = client;
 #if DEBUG_CLIENT_REFERENCES
     // Enable tracking for this object, and track increments and decrements of
@@ -158,21 +159,23 @@
     mCameraClient = cameraClient;
     mClientPid = clientPid;
     mHardware = openCameraHardware();
+    mUseOverlay = mHardware->useOverlay();
 
     // Callback is disabled by default
-    mFrameCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
+    mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
     LOGD("Client X constructor");
 }
 
 status_t CameraService::Client::checkPid()
 {
     if (mClientPid == IPCThreadState::self()->getCallingPid()) return NO_ERROR;
-    LOGW("Attempt to use locked camera from different process");
+    LOGW("Attempt to use locked camera (%p) from different process", getCameraClient()->asBinder().get());
     return -EBUSY;
 }
 
 status_t CameraService::Client::lock()
 {
+    Mutex::Autolock _l(mLock);
     // lock camera to this client if the the camera is unlocked
     if (mClientPid == 0) {
         mClientPid = IPCThreadState::self()->getCallingPid();
@@ -184,8 +187,9 @@
 
 status_t CameraService::Client::unlock()
 {
+    Mutex::Autolock _l(mLock);
     // allow anyone to use camera
-    LOGV("unlock");
+    LOGV("unlock (%p)", getCameraClient()->asBinder().get());
     status_t result = checkPid();
     if (result == NO_ERROR) mClientPid = 0;
     return result;
@@ -194,27 +198,40 @@
 status_t CameraService::Client::connect(const sp<ICameraClient>& client)
 {
     // connect a new process to the camera
-    LOGV("connect");
+    LOGV("connect (%p)", client->asBinder().get());
 
-    // hold a reference to the old client or we will deadlock if the client is
-    // in the same process and we hold the lock when we remove the reference
-    sp<ICameraClient> oldClient;
+    // I hate this hack, but things get really ugly when the media recorder
+    // service is handing back the camera to the app. The ICameraClient
+    // destructor will be called during the same IPC, making it look like
+    // the remote client is trying to disconnect. This hack temporarily
+    // sets the mClientPid to an invalid pid to prevent the hardware from
+    //  being torn down.
     {
-        Mutex::Autolock _l(mLock);
-        if (mClientPid != 0) {
-            LOGW("Tried to connect to locked camera");
-            return -EBUSY;
+
+        // hold a reference to the old client or we will deadlock if the client is
+        // in the same process and we hold the lock when we remove the reference
+        sp<ICameraClient> oldClient;
+        {
+            Mutex::Autolock _l(mLock);
+            if (mClientPid != 0) {
+                LOGW("Tried to connect to locked camera");
+                return -EBUSY;
+            }
+            oldClient = mCameraClient;
+
+            // did the client actually change?
+            if (client->asBinder() == mCameraClient->asBinder()) return NO_ERROR;
+
+            mCameraClient = client;
+            mClientPid = -1;
+            mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
+            LOGV("connect new process (%d) to existing camera client", mClientPid);
         }
-        oldClient = mCameraClient;
 
-        // did the client actually change?
-        if (client->asBinder() == mCameraClient->asBinder()) return NO_ERROR;
-
-        LOGV("connect new process to existing camera client");
-        mCameraClient = client;
-        mClientPid = IPCThreadState::self()->getCallingPid();
-        mFrameCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
     }
+    // the old client destructor is called when oldClient goes out of scope
+    // now we set the new PID to lock the interface again
+    mClientPid = IPCThreadState::self()->getCallingPid();
 
     return NO_ERROR;
 }
@@ -232,8 +249,8 @@
 CameraService::Client::~Client()
 {
     // tear down client
-    LOGD("Client E destructor");
-    if (mSurface != 0) {
+    LOGD("Client (%p)  E destructor", getCameraClient()->asBinder().get());
+    if (mSurface != 0 && !mUseOverlay) {
 #if HAVE_ANDROID_OS
         pthread_t thr;
         // We unregister the buffers in a different thread because binder does
@@ -244,7 +261,7 @@
                        mSurface.get());
         pthread_join(thr, NULL);
 #else
-    	mSurface->unregisterBuffers();
+        mSurface->unregisterBuffers();
 #endif
     }
 
@@ -256,16 +273,22 @@
 
 void CameraService::Client::disconnect()
 {
-    LOGD("Client E disconnect");
+    LOGD("Client (%p) E disconnect from (%d)",
+            getCameraClient()->asBinder().get(),
+            IPCThreadState::self()->getCallingPid());
     Mutex::Autolock lock(mLock);
-    if (mClientPid == 0) {
+    if (mClientPid <= 0) {
         LOGV("camera is unlocked, don't tear down hardware");
         return;
     }
-    if (checkPid() != NO_ERROR) return;
+    if (checkPid() != NO_ERROR) {
+        LOGV("Different client - don't disconnect");
+        return;
+    }
 
     mCameraService->removeClient(mCameraClient);
     if (mHardware != 0) {
+        LOGV("hardware teardown");
         // Before destroying mHardware, we must make sure it's in the
         // idle state.
         mHardware->stopPreview();
@@ -288,7 +311,7 @@
     Mutex::Autolock surfaceLock(mSurfaceLock);
     // asBinder() is safe on NULL (returns NULL)
     if (surface->asBinder() != mSurface->asBinder()) {
-        if (mSurface != 0) {
+        if (mSurface != 0 && !mUseOverlay) {
             LOGD("clearing old preview surface %p", mSurface.get());
             mSurface->unregisterBuffers();
         }
@@ -297,19 +320,20 @@
     return NO_ERROR;
 }
 
-// set the frame callback flag to affect how the received frames from
+// set the preview callback flag to affect how the received frames from
 // preview are handled.
-void CameraService::Client::setFrameCallbackFlag(int frame_callback_flag)
+void CameraService::Client::setPreviewCallbackFlag(int callback_flag)
 {
+    LOGV("setPreviewCallbackFlag");
     Mutex::Autolock lock(mLock);
     if (checkPid() != NO_ERROR) return;
-    mFrameCallbackFlag = frame_callback_flag;
+    mPreviewCallbackFlag = callback_flag;
 }
 
 // start preview mode, must call setPreviewDisplay first
-status_t CameraService::Client::startPreview()
+status_t CameraService::Client::startCameraMode(camera_mode mode)
 {
-    LOGD("startPreview()");
+    LOGD("startCameraMode(%d)", mode);
 
     /* we cannot call into mHardware with mLock held because
      * mHardware has callbacks onto us which acquire this lock
@@ -325,37 +349,124 @@
     }
 
     if (mSurface == 0) {
-        LOGE("setPreviewDisplay must be called before startPreview!");
+        LOGE("setPreviewDisplay must be called before startCameraMode!");
         return INVALID_OPERATION;
     }
 
-    // do nothing if preview is already started
-    if (mHardware->previewEnabled()) return NO_ERROR;
+    switch(mode) {
+    case CAMERA_RECORDING_MODE:
+        return startRecordingMode();
 
-    // XXX: This needs to be improved. remove all hardcoded stuff
+    default: // CAMERA_PREVIEW_MODE
+        return startPreviewMode();
+    }
+}
 
+status_t CameraService::Client::startRecordingMode()
+{
+    LOGV("startRecordingMode");
+
+    status_t ret = UNKNOWN_ERROR;
+
+    // if preview has not been started, start preview first
+    if (!mHardware->previewEnabled()) {
+        ret = startPreviewMode();
+        if (ret != NO_ERROR) {
+            return ret;
+        }
+    }
+
+    // if recording has been enabled, nothing needs to be done
+    if (mHardware->recordingEnabled()) {
+        return NO_ERROR;
+    }
+
+    // start recording mode
+    ret = mHardware->startRecording(recordingCallback,
+                                    mCameraService.get());
+    if (ret != NO_ERROR) {
+        LOGE("mHardware->startRecording() failed with status %d", ret);
+    }
+    return ret;
+}
+
+status_t CameraService::Client::startPreviewMode()
+{
+    LOGV("startPreviewMode");
+
+    // if preview has been enabled, nothing needs to be done
+    if (mHardware->previewEnabled()) {
+        return NO_ERROR;
+    }
+
+    // start preview mode
+#if DEBUG_DUMP_PREVIEW_FRAME_TO_FILE
+    debug_frame_cnt = 0;
+#endif
+    status_t ret = UNKNOWN_ERROR;
     int w, h;
     CameraParameters params(mHardware->getParameters());
     params.getPreviewSize(&w, &h);
 
-#if DEBUG_DUMP_PREVIEW_FRAME_TO_FILE
-    debug_frame_cnt = 0;
-#endif
+    if (mUseOverlay) {
+        const char *format = params.getPreviewFormat();
+        int fmt;
+        LOGD("Use Overlays");
+        if (!strcmp(format, "yuv422i"))
+            fmt = OVERLAY_FORMAT_YCbCr_422_I;
+        else if (!strcmp(format, "rgb565"))
+            fmt = OVERLAY_FORMAT_RGB_565;
+        else {
+            LOGE("Invalid preview format for overlays");
+            return -EINVAL;
+        }
+        sp<OverlayRef> ref = mSurface->createOverlay(w, h, fmt);
+        ret = mHardware->setOverlay(new Overlay(ref));
+        if (ret != NO_ERROR) {
+            LOGE("mHardware->setOverlay() failed with status %d\n", ret);
+            return ret;
+        }
+        ret = mHardware->startPreview(NULL, mCameraService.get());
+        if (ret != NO_ERROR)
+            LOGE("mHardware->startPreview() failed with status %d\n", ret);
+ 
+    } else {
+        ret = mHardware->startPreview(previewCallback,
+                                      mCameraService.get());
+        if (ret == NO_ERROR) {
 
-    status_t ret = mHardware->startPreview(previewCallback,
-                                           mCameraService.get());
-    if (ret == NO_ERROR) {
-        mSurface->unregisterBuffers();
-        mSurface->registerBuffers(w,h,w,h,
-                                  PIXEL_FORMAT_YCbCr_420_SP,
-                                  mHardware->getPreviewHeap());
+            mSurface->unregisterBuffers();
+
+            uint32_t transform = 0;
+            if (params.getOrientation() ==
+                CameraParameters::CAMERA_ORIENTATION_PORTRAIT) {
+              LOGV("portrait mode");
+              transform = ISurface::BufferHeap::ROT_90;
+            }
+            ISurface::BufferHeap buffers(w, h, w, h,
+                                         PIXEL_FORMAT_YCbCr_420_SP,
+                                         transform,
+                                         0,
+                                         mHardware->getPreviewHeap());
+
+            mSurface->registerBuffers(buffers);
+        } else {
+          LOGE("mHardware->startPreview() failed with status %d", ret);
+        }
     }
-    else LOGE("mHardware->startPreview() failed with status %d\n",
-              ret);
-
     return ret;
 }
 
+status_t CameraService::Client::startPreview()
+{
+    return startCameraMode(CAMERA_PREVIEW_MODE);
+}
+
+status_t CameraService::Client::startRecording()
+{
+    return startCameraMode(CAMERA_RECORDING_MODE);
+}
+
 // stop preview mode
 void CameraService::Client::stopPreview()
 {
@@ -372,12 +483,46 @@
     mHardware->stopPreview();
     LOGD("stopPreview(), hardware stopped OK");
 
-    if (mSurface != 0) {
+    if (mSurface != 0 && !mUseOverlay) {
         mSurface->unregisterBuffers();
     }
     mPreviewBuffer.clear();
 }
 
+// stop recording mode
+void CameraService::Client::stopRecording()
+{
+    LOGV("stopRecording()");
+
+    Mutex::Autolock lock(mLock);
+    if (checkPid() != NO_ERROR) return;
+
+    if (mHardware == 0) {
+        LOGE("mHardware is NULL, returning.");
+        return;
+    }
+
+    mHardware->stopRecording();
+    LOGV("stopRecording(), hardware stopped OK");
+    mPreviewBuffer.clear();
+}
+
+// release a recording frame
+void CameraService::Client::releaseRecordingFrame(const sp<IMemory>& mem)
+{
+    LOGV("releaseRecordingFrame()");
+
+    Mutex::Autolock lock(mLock);
+    if (checkPid() != NO_ERROR) return;
+
+    if (mHardware == 0) {
+        LOGE("mHardware is NULL, returning.");
+        return;
+    }
+
+    mHardware->releaseRecordingFrame(mem);
+}
+
 bool CameraService::Client::previewEnabled()
 {
     Mutex::Autolock lock(mLock);
@@ -385,6 +530,13 @@
     return mHardware->previewEnabled();
 }
 
+bool CameraService::Client::recordingEnabled()
+{
+    Mutex::Autolock lock(mLock);
+    if (mHardware == 0) return false;
+    return mHardware->recordingEnabled();
+}
+
 // Safely retrieves a strong pointer to the client during a hardware callback.
 sp<CameraService::Client> CameraService::Client::getClientFromCookie(void* user)
 {
@@ -476,7 +628,7 @@
 #endif
 
     // The strong pointer guarantees the client will exist, but no lock is held.
-    client->postFrame(mem);
+    client->postPreviewFrame(mem);
 
 #if DEBUG_CLIENT_REFERENCES
     //**** if the client's refcount is 1, then we are about to destroy it here,
@@ -488,6 +640,18 @@
 #endif
 }
 
+// recording callback
+void CameraService::Client::recordingCallback(const sp<IMemory>& mem, void* user)
+{
+    LOGV("recordingCallback");
+    sp<Client> client = getClientFromCookie(user);
+    if (client == 0) {
+        return;
+    }
+    // The strong pointer guarantees the client will exist, but no lock is held.
+    client->postRecordingFrame(mem);
+}
+
 // take a picture - image is returned in callback
 status_t CameraService::Client::autoFocus()
 {
@@ -520,7 +684,7 @@
         return INVALID_OPERATION;
     }
 
-    if (mSurface != NULL)
+    if (mSurface != NULL && !mUseOverlay)
         mSurface->unregisterBuffers();
 
     return mHardware->takePicture(shutterCallback,
@@ -573,10 +737,18 @@
     params.getPictureSize(&w, &h);
 
 //  Mutex::Autolock clientLock(client->mLock);
-    if (client->mSurface != 0) {
+    if (client->mSurface != 0 && !client->mUseOverlay) {
         client->mSurface->unregisterBuffers();
-        client->mSurface->registerBuffers(w,h,w,h,
-                                          PIXEL_FORMAT_YCbCr_420_SP, heap);
+        
+        uint32_t transform = 0;
+        if (params.getOrientation() == CameraParameters::CAMERA_ORIENTATION_PORTRAIT) {
+            LOGV("portrait mode");
+            transform = ISurface::BufferHeap::ROT_90;
+        }
+        ISurface::BufferHeap buffers(w, h, w, h,
+                PIXEL_FORMAT_YCbCr_420_SP, transform, 0, heap);
+        
+        client->mSurface->registerBuffers(buffers);
         client->mSurface->postBuffer(offset);
     }
 
@@ -730,12 +902,22 @@
         LOGE("failed to allocate space for frame callback");
         return;
     }
-    mCameraClient->frameCallback(frame);
+    mCameraClient->previewCallback(frame);
 }
 
-void CameraService::Client::postFrame(const sp<IMemory>& mem)
+void CameraService::Client::postRecordingFrame(const sp<IMemory>& frame)
 {
-    LOGV("postFrame");
+    LOGV("postRecordingFrame");
+    if (frame == 0) {
+        LOGW("frame is a null pointer");
+        return;
+    }
+    mCameraClient->recordingCallback(frame);
+}
+
+void CameraService::Client::postPreviewFrame(const sp<IMemory>& mem)
+{
+    LOGV("postPreviewFrame");
     if (mem == 0) {
         LOGW("mem is a null pointer");
         return;
@@ -752,31 +934,32 @@
     }
 
     // Is the callback enabled or not?
-    if (!(mFrameCallbackFlag & FRAME_CALLBACK_FLAG_ENABLE_MASK)) {
+    if (!(mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_ENABLE_MASK)) {
         // If the enable bit is off, the copy-out and one-shot bits are ignored
         LOGV("frame callback is diabled");
         return;
     }
 
     // Is the received frame copied out or not?
-    if (mFrameCallbackFlag & FRAME_CALLBACK_FLAG_COPY_OUT_MASK) {
+    if (mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_COPY_OUT_MASK) {
         LOGV("frame is copied out");
         copyFrameAndPostCopiedFrame(heap, offset, size);
     } else {
         LOGV("frame is directly sent out without copying");
-        mCameraClient->frameCallback(mem);
+        mCameraClient->previewCallback(mem);
     }
 
     // Is this is one-shot only?
-    if (mFrameCallbackFlag & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK) {
+    if (mPreviewCallbackFlag & FRAME_CALLBACK_FLAG_ONE_SHOT_MASK) {
         LOGV("One-shot only, thus clear the bits and disable frame callback");
-        mFrameCallbackFlag &= ~(FRAME_CALLBACK_FLAG_ONE_SHOT_MASK |
+        mPreviewCallbackFlag &= ~(FRAME_CALLBACK_FLAG_ONE_SHOT_MASK |
                                 FRAME_CALLBACK_FLAG_COPY_OUT_MASK |
                                 FRAME_CALLBACK_FLAG_ENABLE_MASK);
     }
 }
 
-void CameraService::Client::postError(status_t error) {
+void CameraService::Client::postError(status_t error)
+{
     mCameraClient->errorCallback(error);
 }
 
@@ -796,6 +979,11 @@
         AutoMutex lock(&mLock);
         if (mClient != 0) {
             sp<Client> currentClient = mClient.promote();
+            sprintf(buffer, "Client (%p) PID: %d",
+                    currentClient->getCameraClient()->asBinder().get(),
+                    currentClient->mClientPid);
+            result.append(buffer);
+            write(fd, result.string(), result.size());
             currentClient->mHardware->dump(fd, args);
         } else {
             result.append("No camera client yet.\n");
@@ -880,5 +1068,3 @@
 #endif // DEBUG_HEAP_LEAKS
 
 }; // namespace android
-
-
diff --git a/camera/libcameraservice/CameraService.h b/camera/libcameraservice/CameraService.h
index cd8c1e9..d9b7927 100644
--- a/camera/libcameraservice/CameraService.h
+++ b/camera/libcameraservice/CameraService.h
@@ -82,9 +82,9 @@
         // pass the buffered ISurface to the camera service
         virtual status_t        setPreviewDisplay(const sp<ISurface>& surface);
 
-        // set the frame callback flag to affect how the received frames from
+        // set the preview callback flag to affect how the received frames from
         // preview are handled.
-        virtual void            setFrameCallbackFlag(int frame_callback_flag);
+        virtual void            setPreviewCallbackFlag(int callback_flag);
 
         // start preview mode, must call setPreviewDisplay first
         virtual status_t        startPreview();
@@ -95,6 +95,18 @@
         // get preview state
         virtual bool            previewEnabled();
 
+        // start recording mode
+        virtual status_t        startRecording();
+
+        // stop recording mode
+        virtual void            stopRecording();
+
+        // get recording state
+        virtual bool            recordingEnabled();
+
+        // release a recording frame
+        virtual void            releaseRecordingFrame(const sp<IMemory>& mem);
+
         // auto focus
         virtual status_t        autoFocus();
 
@@ -120,6 +132,7 @@
 
                     status_t    checkPid();
 
+        static      void        recordingCallback(const sp<IMemory>& mem, void* user);
         static      void        previewCallback(const sp<IMemory>& mem, void* user);
         static      void        shutterCallback(void *user);
         static      void        yuvPictureCallback(const sp<IMemory>& mem, void* user);
@@ -130,17 +143,28 @@
                     void        postShutter();
                     void        postRaw(const sp<IMemory>& mem);
                     void        postJpeg(const sp<IMemory>& mem);
-                    void        postFrame(const sp<IMemory>& mem);
+                    void        postPreviewFrame(const sp<IMemory>& mem);
+                    void        postRecordingFrame(const sp<IMemory>& frame);
                     void        copyFrameAndPostCopiedFrame(sp<IMemoryHeap> heap, size_t offset, size_t size);
                     void        postError(status_t error);
                     void        postAutoFocus(bool focused);
 
-                    // Ensures atomicity among the public methods
+        // camera operation mode
+        enum camera_mode {
+            CAMERA_PREVIEW_MODE   = 0,  // frame automatically released
+            CAMERA_RECORDING_MODE = 1,  // frame has to be explicitly released by releaseRecordingFrame()
+        };
+        status_t                startCameraMode(camera_mode mode);
+        status_t                startPreviewMode();
+        status_t                startRecordingMode();
+
+        // Ensures atomicity among the public methods
         mutable     Mutex                       mLock;
+
         // mSurfaceLock synchronizes access to mSurface between
-        // setPreviewSurface() and postFrame().  Note that among
+        // setPreviewSurface() and postPreviewFrame().  Note that among
         // the public methods, all accesses to mSurface are
-        // syncrhonized by mLock.  However, postFrame() is called
+        // syncrhonized by mLock.  However, postPreviewFrame() is called
         // by the CameraHardwareInterface callback, and needs to
         // access mSurface.  It cannot hold mLock, however, because
         // stopPreview() may be holding that lock while attempting
@@ -152,13 +176,14 @@
                     sp<CameraService>           mCameraService;
                     sp<ISurface>                mSurface;
                     sp<MemoryHeapBase>          mPreviewBuffer;
-                    int                         mFrameCallbackFlag;
+                    int                         mPreviewCallbackFlag;
 
                     // these are immutable once the object is created,
                     // they don't need to be protected by a lock
                     sp<ICameraClient>           mCameraClient;
                     sp<CameraHardwareInterface> mHardware;
                     pid_t                       mClientPid;
+                    bool                        mUseOverlay;
     };
 
 // ----------------------------------------------------------------------------
diff --git a/cmds/dumpstate/dumpstate.c b/cmds/dumpstate/dumpstate.c
index dea269dc..4621f57 100644
--- a/cmds/dumpstate/dumpstate.c
+++ b/cmds/dumpstate/dumpstate.c
@@ -224,6 +224,8 @@
         }
         if (compress)
             strcat(path, ".gz");
+        else
+            strcat(path, ".txt");
 
         /* ensure that all directories in the path exist */ 
         create_directories(path);
diff --git a/cmds/installd/commands.c b/cmds/installd/commands.c
index a3651b2..70a1206 100644
--- a/cmds/installd/commands.c
+++ b/cmds/installd/commands.c
@@ -413,7 +413,8 @@
     return 0;
 }
 
-static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name)
+static void run_dexopt(int zip_fd, int odex_fd, const char* input_file_name,
+    const char* dexopt_flags)
 {
     static const char* DEX_OPT_BIN = "/system/bin/dexopt";
     static const int MAX_INT_LEN = 12;      // '-'+10dig+'\0' -OR- 0x+8dig
@@ -424,7 +425,7 @@
     sprintf(odex_num, "%d", odex_fd);
 
     execl(DEX_OPT_BIN, DEX_OPT_BIN, "--zip", zip_num, odex_num, input_file_name,
-        (char*) NULL);
+        dexopt_flags, (char*) NULL);
     LOGE("execl(%s) failed: %s\n", DEX_OPT_BIN, strerror(errno));
 }
 
@@ -465,6 +466,7 @@
     struct utimbuf ut;
     struct stat apk_stat, dex_stat;
     char dex_path[PKG_PATH_MAX];
+    char dexopt_flags[PROPERTY_VALUE_MAX];
     char *end;
     int res, zip_fd=-1, odex_fd=-1;
 
@@ -475,6 +477,9 @@
         return -1;
     }
 
+    /* platform-specific flags affecting optimization and verification */
+    property_get("dalvik.vm.dexopt-flags", dexopt_flags, "");
+
     strcpy(dex_path, apk_path);
     end = strrchr(dex_path, '.');
     if (end != NULL) {
@@ -533,8 +538,8 @@
             exit(66);
         }
 
-        run_dexopt(zip_fd, odex_fd, apk_path);      /* does not return */
-        exit(67);
+        run_dexopt(zip_fd, odex_fd, apk_path, dexopt_flags);
+        exit(67);   /* only get here on exec failure */
     } else {
         res = wait_dexopt(pid, apk_path);
         if (res != 0) {
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 4dc4b6a..8236943 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -53,6 +53,7 @@
 import android.view.MotionEvent;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.ViewManager;
 import android.view.Window;
 import android.view.WindowManager;
 import android.view.ContextMenu.ContextMenuInfo;
@@ -93,11 +94,11 @@
  * {@link android.R.styleable#AndroidManifestActivity &lt;activity&gt;}
  * declaration in their package's <code>AndroidManifest.xml</code>.</p>
  * 
- * <p>The Activity class is an important part of an
- * <a href="{@docRoot}intro/lifecycle.html">application's overall lifecycle</a>,
+ * <p>The Activity class is an important part of an application's overall lifecycle,
  * and the way activities are launched and put together is a fundamental
- * part of the platform's
- * <a href="{@docRoot}intro/appmodel.html">application model</a>.</p>
+ * part of the platform's application model. For a detailed perspective on the structure of
+ * Android applications and lifecycles, please read the <em>Dev Guide</em> document on 
+ * <a href="{@docRoot}guide/topics/fundamentals.html">Application Fundamentals</a>.</p>
  * 
  * <p>Topics covered here:
  * <ol>
@@ -527,7 +528,7 @@
  * {@link android.R.styleable#AndroidManifestUsesPermission &lt;uses-permission&gt;}
  * element in their own manifest to be able to start that activity.
  * 
- * <p>See the <a href="{@docRoot}devel/security.html">Security Model</a>
+ * <p>See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
  * document for more information on permissions and security in general.
  * 
  * <a name="ProcessLifecycle"></a>
@@ -629,6 +630,9 @@
 
     private WindowManager mWindowManager;
     /*package*/ View mDecor = null;
+    /*package*/ boolean mWindowAdded = false;
+    /*package*/ boolean mVisibleFromServer = false;
+    /*package*/ boolean mVisibleFromClient = true;
 
     private CharSequence mTitle;
     private int mTitleColor = 0;
@@ -779,6 +783,8 @@
      * @see #onPostCreate
      */
     protected void onCreate(Bundle savedInstanceState) {
+        mVisibleFromClient = mWindow.getWindowStyle().getBoolean(
+                com.android.internal.R.styleable.Window_windowNoDisplay, true);
         mCalled = true;
     }
 
@@ -1134,12 +1140,19 @@
     /**
      * Called as part of the activity lifecycle when an activity is about to go
      * into the background as the result of user choice.  For example, when the
-     * user presses the Home key, {@link #onUserLeaving} will be called, but
+     * user presses the Home key, {@link #onUserLeaveHint} will be called, but
      * when an incoming phone call causes the in-call Activity to be automatically
-     * brought to the foreground, {@link #onUserLeaving} will not be called on
-     * the activity being interrupted.
+     * brought to the foreground, {@link #onUserLeaveHint} will not be called on
+     * the activity being interrupted.  In cases when it is invoked, this method
+     * is called right before the activity's {@link #onPause} callback.
+     * 
+     * <p>This callback and {@link #onUserInteraction} are intended to help
+     * activities manage status bar notifications intelligently; specifically,
+     * for helping activities determine the proper time to cancel a notfication.
+     * 
+     * @see #onUserInteraction()
      */
-    protected void onUserLeaving() {
+    protected void onUserLeaveHint() {
     }
     
     /**
@@ -1443,7 +1456,6 @@
      * @return The Cursor that was returned by query().
      * 
      * @see ContentResolver#query(android.net.Uri , String[], String, String[], String)
-     * @see #managedCommitUpdates
      * @see #startManagingCursor
      * @hide
      */
@@ -1475,7 +1487,6 @@
      * @return The Cursor that was returned by query().
      * 
      * @see ContentResolver#query(android.net.Uri , String[], String, String[], String)
-     * @see #managedCommitUpdates
      * @see #startManagingCursor
      */
     public final Cursor managedQuery(Uri uri,
@@ -1863,6 +1874,28 @@
         return false;
     }
     
+    /**
+     * Called whenever a key, touch, or trackball event is dispatched to the
+     * activity.  Implement this method if you wish to know that the user has
+     * interacted with the device in some way while your activity is running.
+     * This callback and {@link #onUserLeaveHint} are intended to help
+     * activities manage status bar notifications intelligently; specifically,
+     * for helping activities determine the proper time to cancel a notfication.
+     * 
+     * <p>All calls to your activity's {@link #onUserLeaveHint} callback will
+     * be accompanied by calls to {@link #onUserInteraction}.  This
+     * ensures that your activity will be told of relevant user activity such
+     * as pulling down the notification pane and touching an item there.
+     * 
+     * <p>Note that this callback will be invoked for the touch down action
+     * that begins a touch gesture, but may not be invoked for the touch-moved
+     * and touch-up actions that follow.
+     * 
+     * @see #onUserLeaveHint()
+     */
+    public void onUserInteraction() {
+    }
+    
     public void onWindowAttributesChanged(WindowManager.LayoutParams params) {
         // Update window manager if: we have a view, that view is
         // attached to its parent (which will be a RootView), and
@@ -1935,6 +1968,7 @@
      * @return boolean Return true if this event was consumed.
      */
     public boolean dispatchKeyEvent(KeyEvent event) {
+        onUserInteraction();
         if (getWindow().superDispatchKeyEvent(event)) {
             return true;
         }
@@ -1952,6 +1986,9 @@
      * @return boolean Return true if this event was consumed.
      */
     public boolean dispatchTouchEvent(MotionEvent ev) {
+        if (ev.getAction() == MotionEvent.ACTION_DOWN) {
+            onUserInteraction();
+        }
         if (getWindow().superDispatchTouchEvent(ev)) {
             return true;
         }
@@ -1969,6 +2006,7 @@
      * @return boolean Return true if this event was consumed.
      */
     public boolean dispatchTrackballEvent(MotionEvent ev) {
+        onUserInteraction();
         if (getWindow().superDispatchTrackballEvent(ev)) {
             return true;
         }
@@ -2865,6 +2903,35 @@
     }
 
     /**
+     * Control whether this activity's main window is visible.  This is intended
+     * only for the special case of an activity that is not going to show a
+     * UI itself, but can't just finish prior to onResume() because it needs
+     * to wait for a service binding or such.  Setting this to false allows
+     * you to prevent your UI from being shown during that time.
+     * 
+     * <p>The default value for this is taken from the
+     * {@link android.R.attr#windowNoDisplay} attribute of the activity's theme.
+     */
+    public void setVisible(boolean visible) {
+        if (mVisibleFromClient != visible) {
+            mVisibleFromClient = visible;
+            if (mVisibleFromServer) {
+                if (visible) makeVisible();
+                else mDecor.setVisibility(View.INVISIBLE);
+            }
+        }
+    }
+    
+    void makeVisible() {
+        if (!mWindowAdded) {
+            ViewManager wm = getWindowManager();
+            wm.addView(mDecor, getWindow().getAttributes());
+            mWindowAdded = true;
+        }
+        mDecor.setVisibility(View.VISIBLE);
+    }
+    
+    /**
      * Check to see whether this activity is in the process of finishing,
      * either because you called {@link #finish} on it or someone else
      * has requested that it finished.  This is often used in
@@ -3482,7 +3549,8 @@
     }
     
     final void performUserLeaving() {
-        onUserLeaving();
+        onUserInteraction();
+        onUserLeaveHint();
     }
     
     final void performStop() {
diff --git a/core/java/android/app/ActivityManager.java b/core/java/android/app/ActivityManager.java
index f9b9221..07520c9d 100644
--- a/core/java/android/app/ActivityManager.java
+++ b/core/java/android/app/ActivityManager.java
@@ -19,16 +19,14 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.content.pm.ConfigurationInfo;
 import android.content.pm.IPackageDataObserver;
 import android.graphics.Bitmap;
 import android.os.RemoteException;
 import android.os.Handler;
-import android.os.IBinder;
 import android.os.Parcel;
 import android.os.Parcelable;
-import android.os.Parcelable.Creator;
 import android.text.TextUtils;
-import android.util.Log;
 import java.util.List;
 
 /**
@@ -617,7 +615,59 @@
         
         public String pkgList[];
         
+        /**
+         * Constant for {@link #importance}: this process is running the
+         * foreground UI.
+         */
+        public static final int IMPORTANCE_FOREGROUND = 100;
+        
+        /**
+         * Constant for {@link #importance}: this process is running something
+         * that is considered to be actively visible to the user.
+         */
+        public static final int IMPORTANCE_VISIBLE = 200;
+        
+        /**
+         * Constant for {@link #importance}: this process is contains services
+         * that should remain running.
+         */
+        public static final int IMPORTANCE_SERVICE = 300;
+        
+        /**
+         * Constant for {@link #importance}: this process process contains
+         * background code that is expendable.
+         */
+        public static final int IMPORTANCE_BACKGROUND = 400;
+        
+        /**
+         * Constant for {@link #importance}: this process is empty of any
+         * actively running code.
+         */
+        public static final int IMPORTANCE_EMPTY = 500;
+        
+        /**
+         * The relative importance level that the system places on this
+         * process.  May be one of {@link #IMPORTANCE_FOREGROUND},
+         * {@link #IMPORTANCE_VISIBLE}, {@link #IMPORTANCE_SERVICE},
+         * {@link #IMPORTANCE_BACKGROUND}, or {@link #IMPORTANCE_EMPTY}.  These
+         * constants are numbered so that "more important" values are always
+         * smaller than "less important" values.
+         */
+        public int importance;
+        
+        /**
+         * An additional ordering within a particular {@link #importance}
+         * category, providing finer-grained information about the relative
+         * utility of processes within a category.  This number means nothing
+         * except that a smaller values are more recently used (and thus
+         * more important).  Currently an LRU value is only maintained for
+         * the {@link #IMPORTANCE_BACKGROUND} category, though others may
+         * be maintained in the future.
+         */
+        public int lru;
+        
         public RunningAppProcessInfo() {
+            importance = IMPORTANCE_FOREGROUND;
         }
         
         public RunningAppProcessInfo(String pProcessName, int pPid, String pArr[]) {
@@ -634,12 +684,16 @@
             dest.writeString(processName);
             dest.writeInt(pid);
             dest.writeStringArray(pkgList);
+            dest.writeInt(importance);
+            dest.writeInt(lru);
         }
 
         public void readFromParcel(Parcel source) {
             processName = source.readString();
             pid = source.readInt();
             pkgList = source.readStringArray();
+            importance = source.readInt();
+            lru = source.readInt();
         }
 
         public static final Creator<RunningAppProcessInfo> CREATOR = 
@@ -671,4 +725,37 @@
             return null;
         }
     }
+    
+    /**
+     * Have the system perform a force stop of everything associated with
+     * the given application package.  All processes that share its uid
+     * will be killed, all services it has running stopped, all activities
+     * removed, etc.  In addition, a {@link Intent#ACTION_PACKAGE_RESTARTED}
+     * broadcast will be sent, so that any of its registered alarms can
+     * be stopped, notifications removed, etc.
+     * 
+     * <p>You must hold the permission
+     * {@link android.Manifest.permission#RESTART_PACKAGES} to be able to
+     * call this method.
+     * 
+     * @param packageName The name of the package to be stopped.
+     */
+    public void restartPackage(String packageName) {
+        try {
+            ActivityManagerNative.getDefault().restartPackage(packageName);
+        } catch (RemoteException e) {
+        }
+    }
+    
+    /**
+     * Get the device configuration attributes.
+     */
+    public ConfigurationInfo getDeviceConfigurationInfo() {
+        try {
+            return ActivityManagerNative.getDefault().getDeviceConfigurationInfo();
+        } catch (RemoteException e) {
+        }
+        return null;
+    }
+    
 }
diff --git a/core/java/android/app/ActivityManagerNative.java b/core/java/android/app/ActivityManagerNative.java
index ae9f3bf..f11dbec 100644
--- a/core/java/android/app/ActivityManagerNative.java
+++ b/core/java/android/app/ActivityManagerNative.java
@@ -20,6 +20,7 @@
 import android.content.ContentResolver;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.ConfigurationInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.res.Configuration;
 import android.graphics.Bitmap;
@@ -83,6 +84,17 @@
     }
 
     /**
+     * Convenience for checking whether the system is ready.  For internal use only.
+     */
+    static public boolean isSystemReady() {
+        if (!sSystemReady) {
+            sSystemReady = getDefault().testIsSystemReady();
+        }
+        return sSystemReady;
+    }
+    static boolean sSystemReady = false;
+    
+    /**
      * Convenience for sending a sticky broadcast.  For internal use only.
      * If you don't care about permission, use null.
      */
@@ -959,6 +971,23 @@
             return true;
         }
         
+        case GET_DEVICE_CONFIGURATION_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            ConfigurationInfo config = getDeviceConfigurationInfo();
+            reply.writeNoException();
+            config.writeToParcel(reply, 0);
+            return true;
+        }
+        
+        case PEEK_SERVICE_TRANSACTION: {
+            data.enforceInterface(IActivityManager.descriptor);
+            Intent service = Intent.CREATOR.createFromParcel(data);
+            String resolvedType = data.readString();
+            IBinder binder = peekService(service, resolvedType);
+            reply.writeNoException();
+            reply.writeStrongBinder(binder);
+            return true;
+        }
         }
         
         return super.onTransact(code, data, reply, flags);
@@ -1604,6 +1633,20 @@
         data.recycle();
         reply.recycle();
     }
+    
+    public IBinder peekService(Intent service, String resolvedType) throws RemoteException {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        service.writeToParcel(data, 0);
+        data.writeString(resolvedType);
+        mRemote.transact(PEEK_SERVICE_TRANSACTION, data, reply, 0);
+        reply.readException();
+        IBinder binder = reply.readStrongBinder();
+        reply.recycle();
+        data.recycle();
+        return binder;
+    }
 
     public boolean startInstrumentation(ComponentName className, String profileFile,
             int flags, Bundle arguments, IInstrumentationWatcher watcher)
@@ -2028,6 +2071,11 @@
         data.recycle();
         reply.recycle();
     }
+    public boolean testIsSystemReady()
+    {
+        /* this base class version is never called */
+        return true;
+    }
     public int handleApplicationError(IBinder app, int flags,
             String tag, String shortMsg, String longMsg,
             byte[] crashData) throws RemoteException
@@ -2071,5 +2119,17 @@
         reply.recycle();
     }
     
+    public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException
+    {
+        Parcel data = Parcel.obtain();
+        Parcel reply = Parcel.obtain();
+        data.writeInterfaceToken(IActivityManager.descriptor);
+        mRemote.transact(GET_DEVICE_CONFIGURATION_TRANSACTION, data, reply, 0);
+        reply.readException();
+        ConfigurationInfo res = ConfigurationInfo.CREATOR.createFromParcel(reply);
+        reply.recycle();
+        data.recycle();
+        return res;
+    }
     private IBinder mRemote;
 }
diff --git a/core/java/android/app/ActivityThread.java b/core/java/android/app/ActivityThread.java
index e4c1057..bf5616e 100644
--- a/core/java/android/app/ActivityThread.java
+++ b/core/java/android/app/ActivityThread.java
@@ -144,13 +144,19 @@
         return sPackageManager;
     }
 
-    DisplayMetrics getDisplayMetricsLocked() {
+    DisplayMetrics getDisplayMetricsLocked(boolean forceUpdate) {
+        if (mDisplayMetrics != null && !forceUpdate) {
+            return mDisplayMetrics;
+        }
         if (mDisplay == null) {
             WindowManager wm = WindowManagerImpl.getDefault();
             mDisplay = wm.getDefaultDisplay();
         }
-        DisplayMetrics metrics = new DisplayMetrics();
+        DisplayMetrics metrics = mDisplayMetrics = new DisplayMetrics();
         mDisplay.getMetrics(metrics);
+        //Log.i("foo", "New metrics: w=" + metrics.widthPixels + " h="
+        //        + metrics.heightPixels + " den=" + metrics.density
+        //        + " xdpi=" + metrics.xdpi + " ydpi=" + metrics.ydpi);
         return metrics;
     }
 
@@ -173,7 +179,7 @@
             if (assets.addAssetPath(appDir) == 0) {
                 return null;
             }
-            DisplayMetrics metrics = getDisplayMetricsLocked();
+            DisplayMetrics metrics = getDisplayMetricsLocked(false);
             r = new Resources(assets, metrics, getConfiguration());
             //Log.i(TAG, "Created app resources " + r + ": " + r.getConfiguration());
             // XXX need to remove entries when weak references go away
@@ -235,7 +241,7 @@
                         ApplicationContext.createSystemContext(mainThread);
                     mSystemContext.getResources().updateConfiguration(
                             mainThread.getConfiguration(),
-                            mainThread.getDisplayMetricsLocked());
+                            mainThread.getDisplayMetricsLocked(false));
                     //Log.i(TAG, "Created system resources "
                     //        + mSystemContext.getResources() + ": "
                     //        + mSystemContext.getResources().getConfiguration());
@@ -1205,7 +1211,10 @@
         private static final String HEAP_COLUMN = "%17s %8s %8s %8s %8s";
         private static final String ONE_COUNT_COLUMN = "%17s %8d";
         private static final String TWO_COUNT_COLUMNS = "%17s %8d %17s %8d";
-
+        
+        // Formatting for checkin service - update version if row format changes
+        private static final int ACTIVITY_THREAD_CHECKIN_VERSION = 1;
+       
         public final void schedulePauseActivity(IBinder token, boolean finished,
                 boolean userLeaving, int configChanges) {
             queueOrSendMessage(
@@ -1462,7 +1471,101 @@
             long dalvikMax = runtime.totalMemory() / 1024;
             long dalvikFree = runtime.freeMemory() / 1024;
             long dalvikAllocated = dalvikMax - dalvikFree;
-
+            long viewInstanceCount = ViewDebug.getViewInstanceCount();
+            long viewRootInstanceCount = ViewDebug.getViewRootInstanceCount();
+            long appContextInstanceCount = ApplicationContext.getInstanceCount();
+            long activityInstanceCount = Activity.getInstanceCount();
+            int globalAssetCount = AssetManager.getGlobalAssetCount();
+            int globalAssetManagerCount = AssetManager.getGlobalAssetManagerCount();
+            int binderLocalObjectCount = Debug.getBinderLocalObjectCount();
+            int binderProxyObjectCount = Debug.getBinderProxyObjectCount();
+            int binderDeathObjectCount = Debug.getBinderDeathObjectCount();
+            int openSslSocketCount = OpenSSLSocketImpl.getInstanceCount();
+            long sqliteAllocated = SQLiteDebug.getHeapAllocatedSize() / 1024;
+            SQLiteDebug.PagerStats stats = new SQLiteDebug.PagerStats();
+            SQLiteDebug.getPagerStats(stats);
+            
+            // Check to see if we were called by checkin server. If so, print terse format.
+            boolean doCheckinFormat = false;
+            if (args != null) {
+                for (String arg : args) {
+                    if ("-c".equals(arg)) doCheckinFormat = true;
+                }
+            }
+            
+            // For checkin, we print one long comma-separated list of values
+            if (doCheckinFormat) {
+                // NOTE: if you change anything significant below, also consider changing
+                // ACTIVITY_THREAD_CHECKIN_VERSION.
+                String processName = (mBoundApplication != null) 
+                        ? mBoundApplication.processName : "unknown";
+                
+                // Header
+                pw.print(ACTIVITY_THREAD_CHECKIN_VERSION); pw.print(',');
+                pw.print(Process.myPid()); pw.print(',');
+                pw.print(processName); pw.print(',');
+                
+                // Heap info - max
+                pw.print(nativeMax); pw.print(',');
+                pw.print(dalvikMax); pw.print(',');
+                pw.print("N/A,");
+                pw.print(nativeMax + dalvikMax); pw.print(',');
+                
+                // Heap info - allocated
+                pw.print(nativeAllocated); pw.print(',');
+                pw.print(dalvikAllocated); pw.print(',');
+                pw.print("N/A,");
+                pw.print(nativeAllocated + dalvikAllocated); pw.print(',');
+                
+                // Heap info - free
+                pw.print(nativeFree); pw.print(',');
+                pw.print(dalvikFree); pw.print(',');
+                pw.print("N/A,");
+                pw.print(nativeFree + dalvikFree); pw.print(',');
+                
+                // Heap info - proportional set size
+                pw.print(memInfo.nativePss); pw.print(',');
+                pw.print(memInfo.dalvikPss); pw.print(',');
+                pw.print(memInfo.otherPss); pw.print(',');
+                pw.print(memInfo.nativePss + memInfo.dalvikPss + memInfo.otherPss); pw.print(',');
+                
+                // Heap info - shared
+                pw.print(nativeShared); pw.print(','); 
+                pw.print(dalvikShared); pw.print(','); 
+                pw.print(otherShared); pw.print(','); 
+                pw.print(nativeShared + dalvikShared + otherShared); pw.print(',');
+                
+                // Heap info - private
+                pw.print(nativePrivate); pw.print(','); 
+                pw.print(dalvikPrivate); pw.print(',');
+                pw.print(otherPrivate); pw.print(',');
+                pw.print(nativePrivate + dalvikPrivate + otherPrivate); pw.print(',');
+                
+                // Object counts
+                pw.print(viewInstanceCount); pw.print(',');
+                pw.print(viewRootInstanceCount); pw.print(',');
+                pw.print(appContextInstanceCount); pw.print(',');
+                pw.print(activityInstanceCount); pw.print(',');
+                
+                pw.print(globalAssetCount); pw.print(',');
+                pw.print(globalAssetManagerCount); pw.print(',');
+                pw.print(binderLocalObjectCount); pw.print(',');
+                pw.print(binderProxyObjectCount); pw.print(',');
+                
+                pw.print(binderDeathObjectCount); pw.print(',');
+                pw.print(openSslSocketCount); pw.print(',');
+                
+                // SQL
+                pw.print(sqliteAllocated); pw.print(',');
+                pw.print(stats.databaseBytes / 1024); pw.print(','); 
+                pw.print(stats.numPagers); pw.print(',');
+                pw.print((stats.totalBytes - stats.referencedBytes) / 1024); pw.print(',');
+                pw.print(stats.referencedBytes / 1024); pw.print('\n');
+                
+                return;
+            }
+            
+            // otherwise, show human-readable format
             printRow(pw, HEAP_COLUMN, "", "native", "dalvik", "other", "total");
             printRow(pw, HEAP_COLUMN, "size:", nativeMax, dalvikMax, "N/A", nativeMax + dalvikMax);
             printRow(pw, HEAP_COLUMN, "allocated:", nativeAllocated, dalvikAllocated, "N/A",
@@ -1480,26 +1583,22 @@
 
             pw.println(" ");
             pw.println(" Objects");
-            printRow(pw, TWO_COUNT_COLUMNS, "Views:", ViewDebug.getViewInstanceCount(), "ViewRoots:",
-                    ViewDebug.getViewRootInstanceCount());
+            printRow(pw, TWO_COUNT_COLUMNS, "Views:", viewInstanceCount, "ViewRoots:",
+                    viewRootInstanceCount);
 
-            printRow(pw, TWO_COUNT_COLUMNS, "AppContexts:", ApplicationContext.getInstanceCount(),
-                    "Activities:", Activity.getInstanceCount());
+            printRow(pw, TWO_COUNT_COLUMNS, "AppContexts:", appContextInstanceCount,
+                    "Activities:", activityInstanceCount);
 
-            printRow(pw, TWO_COUNT_COLUMNS, "Assets:", AssetManager.getGlobalAssetCount(),
-                    "AssetManagers:", AssetManager.getGlobalAssetManagerCount());
+            printRow(pw, TWO_COUNT_COLUMNS, "Assets:", globalAssetCount,
+                    "AssetManagers:", globalAssetManagerCount);
 
-            printRow(pw, TWO_COUNT_COLUMNS, "Local Binders:", Debug.getBinderLocalObjectCount(),
-                    "Proxy Binders:", Debug.getBinderProxyObjectCount());
-            printRow(pw, ONE_COUNT_COLUMN, "Death Recipients:", Debug.getBinderDeathObjectCount());
+            printRow(pw, TWO_COUNT_COLUMNS, "Local Binders:", binderLocalObjectCount,
+                    "Proxy Binders:", binderProxyObjectCount);
+            printRow(pw, ONE_COUNT_COLUMN, "Death Recipients:", binderDeathObjectCount);
 
-            printRow(pw, ONE_COUNT_COLUMN, "OpenSSL Sockets:", OpenSSLSocketImpl.getInstanceCount());
-
+            printRow(pw, ONE_COUNT_COLUMN, "OpenSSL Sockets:", openSslSocketCount);
+            
             // SQLite mem info
-            long sqliteAllocated = SQLiteDebug.getHeapAllocatedSize() / 1024;
-            SQLiteDebug.PagerStats stats = new SQLiteDebug.PagerStats();
-            SQLiteDebug.getPagerStats(stats);
-
             pw.println(" ");
             pw.println(" SQL");
             printRow(pw, TWO_COUNT_COLUMNS, "heap:", sqliteAllocated, "dbFiles:",
@@ -1751,6 +1850,7 @@
     final HashMap<String, WeakReference<PackageInfo>> mResourcePackages
         = new HashMap<String, WeakReference<PackageInfo>>();
     Display mDisplay = null;
+    DisplayMetrics mDisplayMetrics = null;
     HashMap<String, WeakReference<Resources> > mActiveResources
         = new HashMap<String, WeakReference<Resources> >();
 
@@ -1918,7 +2018,7 @@
                 PackageInfo info = new PackageInfo(this, "android", context);
                 context.init(info, null, this);
                 context.getResources().updateConfiguration(
-                        getConfiguration(), getDisplayMetricsLocked());
+                        getConfiguration(), getDisplayMetricsLocked(false));
                 mSystemContext = context;
                 //Log.i(TAG, "Created system resources " + context.getResources()
                 //        + ": " + context.getResources().getConfiguration());
@@ -2557,7 +2657,10 @@
                 a.mDecor = decor;
                 l.type = WindowManager.LayoutParams.TYPE_BASE_APPLICATION;
                 l.softInputMode |= forwardBit;
-                wm.addView(decor, l);
+                if (a.mVisibleFromClient) {
+                    a.mWindowAdded = true;
+                    wm.addView(decor, l);
+                }
 
             // If the window has already been added, but during resume
             // we started another activity, then don't yet make the
@@ -2576,7 +2679,8 @@
                     performConfigurationChanged(r.activity, r.newConfig);
                     r.newConfig = null;
                 }
-                Log.v(TAG, "Resuming " + r + " with isForward=" + isForward);
+                if (localLOGV) Log.v(TAG, "Resuming " + r + " with isForward="
+                        + isForward);
                 WindowManager.LayoutParams l = r.window.getAttributes();
                 if ((l.softInputMode
                         & WindowManager.LayoutParams.SOFT_INPUT_IS_FORWARD_NAVIGATION)
@@ -2588,8 +2692,11 @@
                     View decor = r.window.getDecorView();
                     wm.updateViewLayout(decor, l);
                 }
-                r.activity.mDecor.setVisibility(View.VISIBLE);
+                r.activity.mVisibleFromServer = true;
                 mNumVisibleActivities++;
+                if (r.activity.mVisibleFromClient) {
+                    r.activity.makeVisible();
+                }
             }
 
             r.nextIdle = mNewActivities;
@@ -2800,18 +2907,22 @@
         View v = r.activity.mDecor;
         if (v != null) {
             if (show) {
-                if (v.getVisibility() != View.VISIBLE) {
-                    v.setVisibility(View.VISIBLE);
+                if (!r.activity.mVisibleFromServer) {
+                    r.activity.mVisibleFromServer = true;
                     mNumVisibleActivities++;
+                    if (r.activity.mVisibleFromClient) {
+                        r.activity.makeVisible();
+                    }
                 }
                 if (r.newConfig != null) {
                     performConfigurationChanged(r.activity, r.newConfig);
                     r.newConfig = null;
                 }
             } else {
-                if (v.getVisibility() == View.VISIBLE) {
-                    v.setVisibility(View.INVISIBLE);
+                if (r.activity.mVisibleFromServer) {
+                    r.activity.mVisibleFromServer = false;
                     mNumVisibleActivities--;
+                    v.setVisibility(View.INVISIBLE);
                 }
             }
         }
@@ -3037,11 +3148,13 @@
             WindowManager wm = r.activity.getWindowManager();
             View v = r.activity.mDecor;
             if (v != null) {
-                if (v.getVisibility() == View.VISIBLE) {
+                if (r.activity.mVisibleFromServer) {
                     mNumVisibleActivities--;
                 }
                 IBinder wtoken = v.getWindowToken();
-                wm.removeViewImmediate(v);
+                if (r.activity.mWindowAdded) {
+                    wm.removeViewImmediate(v);
+                }
                 if (wtoken != null) {
                     WindowManagerImpl.getDefault().closeAll(wtoken,
                             r.activity.getClass().getName(), "Activity");
@@ -3271,6 +3384,7 @@
                 mConfiguration = new Configuration();
             }
             mConfiguration.updateFrom(config);
+            DisplayMetrics dm = getDisplayMetricsLocked(true);
 
             // set it for java, this also affects newly created Resources
             if (config.locale != null) {
@@ -3290,7 +3404,7 @@
                     WeakReference<Resources> v = it.next();
                     Resources r = v.get();
                     if (r != null) {
-                        r.updateConfiguration(config, null);
+                        r.updateConfiguration(config, dm);
                         //Log.i(TAG, "Updated app resources " + v.getKey()
                         //        + " " + r + ": " + r.getConfiguration());
                     } else {
diff --git a/core/java/android/app/ApplicationContext.java b/core/java/android/app/ApplicationContext.java
index 4236a00..394b8e3 100644
--- a/core/java/android/app/ApplicationContext.java
+++ b/core/java/android/app/ApplicationContext.java
@@ -1630,6 +1630,15 @@
         }
 
         @Override
+        public String[] getSystemSharedLibraryNames() {
+             try {
+                 return mPM.getSystemSharedLibraryNames();
+             } catch (RemoteException e) {
+                 throw new RuntimeException("Package manager has died", e);
+             }
+        }
+
+        @Override
         public int checkPermission(String permName, String pkgName) {
             try {
                 return mPM.checkPermission(permName, pkgName);
@@ -1974,6 +1983,18 @@
                 getApplicationInfo(appPackageName, 0));
         }
 
+        int mCachedSafeMode = -1;
+        @Override public boolean isSafeMode() {
+            try {
+                if (mCachedSafeMode < 0) {
+                    mCachedSafeMode = mPM.isSafeMode() ? 1 : 0;
+                }
+                return mCachedSafeMode != 0;
+            } catch (RemoteException e) {
+                throw new RuntimeException("Package manager has died", e);
+            }
+        }
+
         static void configurationChanged() {
             synchronized (sSync) {
                 sIconCache.clear();
diff --git a/core/java/android/app/Dialog.java b/core/java/android/app/Dialog.java
index 951b48d..b09a57f 100644
--- a/core/java/android/app/Dialog.java
+++ b/core/java/android/app/Dialog.java
@@ -122,7 +122,7 @@
      *                uses the window manager and theme from this context to
      *                present its UI.
      * @param theme A style resource describing the theme to use for the 
-     * window. See <a href="{@docRoot}reference/available-resources.html#stylesandthemes">Style 
+     * window. See <a href="{@docRoot}guide/topics/resources/available-resources.html#stylesandthemes">Style 
      * and Theme Resources</a> for more information about defining and using 
      * styles.  This theme is applied on top of the current theme in 
      * <var>context</var>.  If 0, the default dialog theme will be used.
@@ -518,7 +518,7 @@
     private boolean isOutOfBounds(MotionEvent event) {
         final int x = (int) event.getX();
         final int y = (int) event.getY();
-        final int slop = ViewConfiguration.getWindowTouchSlop();
+        final int slop = ViewConfiguration.get(mContext).getScaledWindowTouchSlop();
         final View decorView = getWindow().getDecorView();
         return (x < -slop) || (y < -slop)
                 || (x > (decorView.getWidth()+slop))
diff --git a/core/java/android/app/IActivityManager.java b/core/java/android/app/IActivityManager.java
index 353500e9..cd3701f 100644
--- a/core/java/android/app/IActivityManager.java
+++ b/core/java/android/app/IActivityManager.java
@@ -22,6 +22,7 @@
 import android.content.IContentProvider;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.ConfigurationInfo;
 import android.content.pm.IPackageDataObserver;
 import android.content.pm.ProviderInfo;
 import android.content.res.Configuration;
@@ -127,7 +128,8 @@
             boolean doRebind) throws RemoteException;
     /* oneway */
     public void serviceDoneExecuting(IBinder token) throws RemoteException;
-
+    public IBinder peekService(Intent service, String resolvedType) throws RemoteException;
+    
     public boolean startInstrumentation(ComponentName className, String profileFile,
             int flags, Bundle arguments, IInstrumentationWatcher watcher)
             throws RemoteException;
@@ -216,6 +218,13 @@
     // Retrieve running application processes in the system
     public List<ActivityManager.RunningAppProcessInfo> getRunningAppProcesses()
             throws RemoteException;
+    // Get device configuration
+    public ConfigurationInfo getDeviceConfigurationInfo() throws RemoteException;
+    
+    /*
+     * Private non-Binder interfaces
+     */
+    /* package */ boolean testIsSystemReady();
     
     /** Information you can retrieve about a particular application. */
     public static class ContentProviderHolder implements Parcelable {
@@ -354,4 +363,6 @@
     int GET_SERVICES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+80;
     int REPORT_PSS_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+81;
     int GET_RUNNING_APP_PROCESSES_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+82;
+    int GET_DEVICE_CONFIGURATION_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+83;
+    int PEEK_SERVICE_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+84;
 }
diff --git a/core/java/android/app/Instrumentation.java b/core/java/android/app/Instrumentation.java
index f96d787..f6a28b2 100644
--- a/core/java/android/app/Instrumentation.java
+++ b/core/java/android/app/Instrumentation.java
@@ -1267,7 +1267,7 @@
     }
     
     /**
-     * Perform calling of an activity's {@link Activity#onUserLeaving} method.
+     * Perform calling of an activity's {@link Activity#onUserLeaveHint} method.
      * The default implementation simply calls through to that method.
      * 
      * @param activity The activity being notified that the user has navigated away
diff --git a/core/java/android/app/LauncherActivity.java b/core/java/android/app/LauncherActivity.java
index 8f0a4f5..c363f04 100644
--- a/core/java/android/app/LauncherActivity.java
+++ b/core/java/android/app/LauncherActivity.java
@@ -21,11 +21,23 @@
 import android.content.pm.ActivityInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.PaintFlagsDrawFilter;
+import android.graphics.PixelFormat;
+import android.graphics.Rect;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.PaintDrawable;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
+import android.view.Window;
 import android.widget.BaseAdapter;
 import android.widget.Filter;
 import android.widget.Filterable;
@@ -43,33 +55,59 @@
  *
  */
 public abstract class LauncherActivity extends ListActivity {
+
+    Intent mIntent;
+    PackageManager mPackageManager;
     
     /**
+     * An item in the list
+     */
+    public static class ListItem {
+        public CharSequence label;
+        //public CharSequence description;
+        public Drawable icon;
+        public String packageName;
+        public String className;
+        
+        ListItem(PackageManager pm, ResolveInfo resolveInfo, IconResizer resizer) {
+            label = resolveInfo.loadLabel(pm);
+            if (label == null && resolveInfo.activityInfo != null) {
+                label = resolveInfo.activityInfo.name;
+            }
+            
+            /*
+            if (resolveInfo.activityInfo != null &&
+                    resolveInfo.activityInfo.applicationInfo != null) {
+                description = resolveInfo.activityInfo.applicationInfo.loadDescription(pm);
+            }
+            */
+            
+            icon = resizer.createIconThumbnail(resolveInfo.loadIcon(pm));
+            packageName = resolveInfo.activityInfo.applicationInfo.packageName;
+            className = resolveInfo.activityInfo.name;
+        }
+
+        public ListItem() {
+        }
+    }
+
+    /**
      * Adapter which shows the set of activities that can be performed for a given intent.
      */
     private class ActivityAdapter extends BaseAdapter implements Filterable {
         private final Object lock = new Object();
-        private ArrayList<ResolveInfo> mOriginalValues;
+        private ArrayList<ListItem> mOriginalValues;
 
-        protected final Context mContext;
-        protected final Intent mIntent;
         protected final LayoutInflater mInflater;
 
-        protected List<ResolveInfo> mActivitiesList;
+        protected List<ListItem> mActivitiesList;
 
         private Filter mFilter;
-
-        public ActivityAdapter(Context context, Intent intent) {
-            mContext = context;
-            mIntent = new Intent(intent);
-            mIntent.setComponent(null);
-            mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
-
-            PackageManager pm = context.getPackageManager();
-            mActivitiesList = pm.queryIntentActivities(intent, 0);
-            if (mActivitiesList != null) {
-                Collections.sort(mActivitiesList, new ResolveInfo.DisplayNameComparator(pm));
-            }
+        
+        public ActivityAdapter() {
+            mInflater = (LayoutInflater) LauncherActivity.this.getSystemService(
+                    Context.LAYOUT_INFLATER_SERVICE);
+            mActivitiesList = makeListItems();
         }
 
         public Intent intentForPosition(int position) {
@@ -78,8 +116,8 @@
             }
 
             Intent intent = new Intent(mIntent);
-            ActivityInfo ai = mActivitiesList.get(position).activityInfo;
-            intent.setClassName(ai.applicationInfo.packageName, ai.name);
+            ListItem item = mActivitiesList.get(position);
+            intent.setClassName(item.packageName, item.className);
             return intent;
         }
 
@@ -99,7 +137,7 @@
             View view;
             if (convertView == null) {
                 view = mInflater.inflate(
-                        com.android.internal.R.layout.simple_list_item_1, parent, false);
+                        com.android.internal.R.layout.activity_list_item_2, parent, false);
             } else {
                 view = convertView;
             }
@@ -108,7 +146,7 @@
         }
 
         private char getCandidateLetter(ResolveInfo info) {
-            PackageManager pm = mContext.getPackageManager();
+            PackageManager pm = LauncherActivity.this.getPackageManager();
             CharSequence label = info.loadLabel(pm);
 
             if (label == null) {
@@ -118,24 +156,22 @@
             return Character.toLowerCase(label.charAt(0));
         }
 
-        private void bindView(View view, ResolveInfo info) {
-            TextView text = (TextView) view.findViewById(com.android.internal.R.id.text1);
-
-            PackageManager pm = mContext.getPackageManager();
-            CharSequence label = info.loadLabel(pm);
-            text.setText(label != null ? label : info.activityInfo.name);
+        private void bindView(View view, ListItem item) {
+            TextView text = (TextView) view;
+            text.setText(item.label);
+            text.setCompoundDrawablesWithIntrinsicBounds(item.icon, null, null, null);
         }
-
+        
         public Filter getFilter() {
             if (mFilter == null) {
                 mFilter = new ArrayFilter();
             }
             return mFilter;
         }
-
+        
         /**
-         * <p>An array filters constrains the content of the array adapter with a prefix. Each item that
-         * does not start with the supplied prefix is removed from the list.</p>
+         * An array filters constrains the content of the array adapter with a prefix. Each
+         * item that does not start with the supplied prefix is removed from the list.
          */
         private class ArrayFilter extends Filter {
             @Override
@@ -144,39 +180,36 @@
 
                 if (mOriginalValues == null) {
                     synchronized (lock) {
-                        mOriginalValues = new ArrayList<ResolveInfo>(mActivitiesList);
+                        mOriginalValues = new ArrayList<ListItem>(mActivitiesList);
                     }
                 }
 
                 if (prefix == null || prefix.length() == 0) {
                     synchronized (lock) {
-                        ArrayList<ResolveInfo> list = new ArrayList<ResolveInfo>(mOriginalValues);
+                        ArrayList<ListItem> list = new ArrayList<ListItem>(mOriginalValues);
                         results.values = list;
                         results.count = list.size();
                     }
                 } else {
-                    final PackageManager pm = mContext.getPackageManager();
+                    final PackageManager pm = LauncherActivity.this.getPackageManager();
                     final String prefixString = prefix.toString().toLowerCase();
 
-                    ArrayList<ResolveInfo> values = mOriginalValues;
+                    ArrayList<ListItem> values = mOriginalValues;
                     int count = values.size();
 
-                    ArrayList<ResolveInfo> newValues = new ArrayList<ResolveInfo>(count);
+                    ArrayList<ListItem> newValues = new ArrayList<ListItem>(count);
 
                     for (int i = 0; i < count; i++) {
-                        ResolveInfo value = values.get(i);
+                        ListItem item = values.get(i);
 
-                        final CharSequence label = value.loadLabel(pm);
-                        final CharSequence name = label != null ? label : value.activityInfo.name;
-
-                        String[] words = name.toString().toLowerCase().split(" ");
+                        String[] words = item.label.toString().toLowerCase().split(" ");
                         int wordCount = words.length;
 
                         for (int k = 0; k < wordCount; k++) {
                             final String word = words[k];
 
                             if (word.startsWith(prefixString)) {
-                                newValues.add(value);
+                                newValues.add(item);
                                 break;
                             }
                         }
@@ -192,7 +225,7 @@
             @Override
             protected void publishResults(CharSequence constraint, FilterResults results) {
                 //noinspection unchecked
-                mActivitiesList = (List<ResolveInfo>) results.values;
+                mActivitiesList = (List<ListItem>) results.values;
                 if (results.count > 0) {
                     notifyDataSetChanged();
                 } else {
@@ -201,19 +234,121 @@
             }
         }
     }
-    
-    
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
         
-        mAdapter = new ActivityAdapter(this, getTargetIntent());
+    /**
+     * Utility class to resize icons to match default icon size.  
+     */
+    public class IconResizer {
+        // Code is borrowed from com.android.launcher.Utilities. 
+        private int mIconWidth = -1;
+        private int mIconHeight = -1;
+
+        private final Paint mPaint = new Paint();
+        private final Rect mBounds = new Rect();
+        private final Rect mOldBounds = new Rect();
+        private Canvas mCanvas = new Canvas();
+        
+        public IconResizer() {
+            mCanvas.setDrawFilter(new PaintFlagsDrawFilter(Paint.DITHER_FLAG,
+                    Paint.FILTER_BITMAP_FLAG));
+            
+            final Resources resources = LauncherActivity.this.getResources();
+            mIconWidth = mIconHeight = (int) resources.getDimension(
+                    android.R.dimen.app_icon_size);
+        }
+
+        /**
+         * Returns a Drawable representing the thumbnail of the specified Drawable.
+         * The size of the thumbnail is defined by the dimension
+         * android.R.dimen.launcher_application_icon_size.
+         *
+         * This method is not thread-safe and should be invoked on the UI thread only.
+         *
+         * @param icon The icon to get a thumbnail of.
+         *
+         * @return A thumbnail for the specified icon or the icon itself if the
+         *         thumbnail could not be created. 
+         */
+        public Drawable createIconThumbnail(Drawable icon) {
+            int width = mIconWidth;
+            int height = mIconHeight;
+
+            final int iconWidth = icon.getIntrinsicWidth();
+            final int iconHeight = icon.getIntrinsicHeight();
+
+            if (icon instanceof PaintDrawable) {
+                PaintDrawable painter = (PaintDrawable) icon;
+                painter.setIntrinsicWidth(width);
+                painter.setIntrinsicHeight(height);
+            }
+
+            if (width > 0 && height > 0) {
+                if (width < iconWidth || height < iconHeight) {
+                    final float ratio = (float) iconWidth / iconHeight;
+
+                    if (iconWidth > iconHeight) {
+                        height = (int) (width / ratio);
+                    } else if (iconHeight > iconWidth) {
+                        width = (int) (height * ratio);
+                    }
+
+                    final Bitmap.Config c = icon.getOpacity() != PixelFormat.OPAQUE ?
+                                Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565;
+                    final Bitmap thumb = Bitmap.createBitmap(mIconWidth, mIconHeight, c);
+                    final Canvas canvas = mCanvas;
+                    canvas.setBitmap(thumb);
+                    // Copy the old bounds to restore them later
+                    // If we were to do oldBounds = icon.getBounds(),
+                    // the call to setBounds() that follows would
+                    // change the same instance and we would lose the
+                    // old bounds
+                    mOldBounds.set(icon.getBounds());
+                    final int x = (mIconWidth - width) / 2;
+                    final int y = (mIconHeight - height) / 2;
+                    icon.setBounds(x, y, x + width, y + height);
+                    icon.draw(canvas);
+                    icon.setBounds(mOldBounds);
+                    icon = new BitmapDrawable(thumb);
+                } else if (iconWidth < width && iconHeight < height) {
+                    final Bitmap.Config c = Bitmap.Config.ARGB_8888;
+                    final Bitmap thumb = Bitmap.createBitmap(mIconWidth, mIconHeight, c);
+                    final Canvas canvas = mCanvas;
+                    canvas.setBitmap(thumb);
+                    mOldBounds.set(icon.getBounds());
+                    final int x = (width - iconWidth) / 2;
+                    final int y = (height - iconHeight) / 2;
+                    icon.setBounds(x, y, x + iconWidth, y + iconHeight);
+                    icon.draw(canvas);
+                    icon.setBounds(mOldBounds);
+                    icon = new BitmapDrawable(thumb);
+                }
+            }
+
+            return icon;
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        
+        mPackageManager = getPackageManager();
+    
+        requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
+        setProgressBarIndeterminateVisibility(true);
+        setContentView(com.android.internal.R.layout.activity_list);
+        
+            
+        mIntent = new Intent(getTargetIntent());
+        mIntent.setComponent(null);
+        mAdapter = new ActivityAdapter();
         
         setListAdapter(mAdapter);
         getListView().setTextFilterEnabled(true);
+        
+        setProgressBarIndeterminateVisibility(false);
     }
 
-
     @Override
     protected void onListItemClick(ListView l, View v, int position, long id) {
         Intent intent = ((ActivityAdapter)mAdapter).intentForPosition(position);
@@ -221,6 +356,42 @@
         startActivity(intent);
     }
     
-    protected abstract Intent getTargetIntent();
-   
+    /**
+     * Return the actual Intent for a specific position in our
+     * {@link android.widget.ListView}.
+     * @param position The item whose Intent to return
+     */
+    protected Intent intentForPosition(int position) {
+        ActivityAdapter adapter = (ActivityAdapter) mAdapter;
+        return adapter.intentForPosition(position);
+    }
+    
+    /**
+     * Get the base intent to use when running
+     * {@link PackageManager#queryIntentActivities(Intent, int)}.
+     */
+    protected Intent getTargetIntent() {
+        return new Intent();
+    }
+
+    /**
+     * Perform the query to determine which results to show and return a list of them.
+     */
+    public List<ListItem> makeListItems() {
+        // Load all matching activities and sort correctly
+        List<ResolveInfo> list = mPackageManager.queryIntentActivities(mIntent,
+                /* no flags */ 0);
+        Collections.sort(list, new ResolveInfo.DisplayNameComparator(mPackageManager));
+        
+        IconResizer resizer = new IconResizer();
+        
+        ArrayList<ListItem> result = new ArrayList<ListItem>(list.size());
+        int listSize = list.size();
+        for (int i = 0; i < listSize; i++) {
+            ResolveInfo resolveInfo = list.get(i);
+            result.add(new ListItem(mPackageManager, resolveInfo, resizer));
+        }
+
+        return result;
+    }
 }
diff --git a/core/java/android/app/Notification.java b/core/java/android/app/Notification.java
index ea67cdb..51fddb1 100644
--- a/core/java/android/app/Notification.java
+++ b/core/java/android/app/Notification.java
@@ -90,8 +90,9 @@
      * The intent to execute when the expanded status entry is clicked.  If
      * this is an activity, it must include the
      * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK} flag, which requires
-     * that you take care of task management as described in the
-     * <a href="{@docRoot}intro/appmodel.html">application model</a> document.
+     * that you take care of task management as described in the <em>Activities and Tasks</em>
+     * section of the <a href="{@docRoot}guide/topics/fundamentals.html#acttask">Application 
+     * Fundamentals</a> document.
      */
     public PendingIntent contentIntent;
 
@@ -420,8 +421,8 @@
      * @param contentIntent The intent to launch when the user clicks the expanded notification.
      * If this is an activity, it must include the
      * {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK} flag, which requires
-     * that you take care of task management as described in the
-     * <a href="{@docRoot}intro/appmodel.html">application model</a> document.
+     * that you take care of task management as described in 
+     * <a href="{@docRoot}guide/topics/fundamentals.html#lcycles">Application Fundamentals: Activities and Tasks</a>.
      */
     public void setLatestEventInfo(Context context,
             CharSequence contentTitle, CharSequence contentText, PendingIntent contentIntent) {
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 2e2a1a1..64f1ba2 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -16,11 +16,14 @@
 
 package android.app;
 
+import android.content.ActivityNotFoundException;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.content.res.Resources.NotFoundException;
@@ -34,6 +37,7 @@
 import android.os.ServiceManager;
 import android.os.SystemClock;
 import android.server.search.SearchableInfo;
+import android.speech.RecognizerIntent;
 import android.text.Editable;
 import android.text.InputType;
 import android.text.TextUtils;
@@ -50,6 +54,7 @@
 import android.widget.AutoCompleteTextView;
 import android.widget.Button;
 import android.widget.CursorAdapter;
+import android.widget.ImageButton;
 import android.widget.ImageView;
 import android.widget.ListView;
 import android.widget.SimpleCursorAdapter;
@@ -59,6 +64,7 @@
 import android.widget.AdapterView.OnItemSelectedListener;
 
 import java.lang.ref.WeakReference;
+import java.util.List;
 import java.util.concurrent.atomic.AtomicLong;
 
 /**
@@ -94,6 +100,7 @@
     private TextView mBadgeLabel;
     private AutoCompleteTextView mSearchTextField;
     private Button mGoButton;
+    private ImageButton mVoiceButton;
 
     // interaction with searchable application
     private ComponentName mLaunchComponent;
@@ -115,6 +122,10 @@
     private Uri mSuggestionData = null;
     private String mSuggestionQuery = null;
     
+    // For voice searching
+    private Intent mVoiceWebSearchIntent;
+    private Intent mVoiceAppSearchIntent;
+
     // support for AutoCompleteTextView suggestions display
     private SuggestionsAdapter mSuggestionsAdapter;
 
@@ -153,12 +164,15 @@
         mSearchTextField = (AutoCompleteTextView) 
                 findViewById(com.android.internal.R.id.search_src_text);
         mGoButton = (Button) findViewById(com.android.internal.R.id.search_go_btn);
+        mVoiceButton = (ImageButton) findViewById(com.android.internal.R.id.search_voice_btn);
         
         // attach listeners
         mSearchTextField.addTextChangedListener(mTextWatcher);
         mSearchTextField.setOnKeyListener(mTextKeyListener);
         mGoButton.setOnClickListener(mGoButtonClickListener);
         mGoButton.setOnKeyListener(mButtonsKeyListener);
+        mVoiceButton.setOnClickListener(mVoiceButtonClickListener);
+        mVoiceButton.setOnKeyListener(mButtonsKeyListener);
 
         // pre-hide all the extraneous elements
         mBadgeLabel.setVisibility(View.GONE);
@@ -169,13 +183,19 @@
         setCanceledOnTouchOutside(true);
         
         // Set up broadcast filters
-        mCloseDialogsFilter = new
-        IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
+        mCloseDialogsFilter = new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
         mPackageFilter = new IntentFilter();
         mPackageFilter.addAction(Intent.ACTION_PACKAGE_ADDED);
         mPackageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED);
         mPackageFilter.addAction(Intent.ACTION_PACKAGE_CHANGED);
         mPackageFilter.addDataScheme("package");
+        
+        // Save voice intent for later queries/launching
+        mVoiceWebSearchIntent = new Intent(RecognizerIntent.ACTION_WEB_SEARCH);
+        mVoiceWebSearchIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+                RecognizerIntent.LANGUAGE_MODEL_WEB_SEARCH);
+        
+        mVoiceAppSearchIntent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
     }
 
     /**
@@ -261,16 +281,15 @@
     }
 
     /**
-     * Dismiss the search dialog.
+     * The search dialog is being dismissed, so handle all of the local shutdown operations.
      * 
-     * This function is designed to be idempotent so it can be safely called at any time
+     * This function is designed to be idempotent so that dismiss() can be safely called at any time
      * (even if already closed) and more likely to really dump any memory.  No leaks!
      */
     @Override
-    public void dismiss() {
-        if (isShowing()) {
-            super.dismiss();
-        }
+    public void onStop() {
+        super.onStop();
+        
         setOnCancelListener(null);
         setOnDismissListener(null);
         
@@ -281,6 +300,11 @@
             // This is OK - it just means we didn't have any registered
         }
         
+        // close any leftover cursor
+        if (mSuggestionsAdapter != null) {
+            mSuggestionsAdapter.changeCursor(null);
+        }
+        
         // dump extra memory we're hanging on to
         mLaunchComponent = null;
         mAppSearchData = null;
@@ -408,6 +432,7 @@
             updateSearchButton();
             updateSearchBadge();
             updateQueryHint();
+            updateVoiceButton();
             
             // In order to properly configure the input method (if one is being used), we
             // need to let it know if we'll be providing suggestions.  Although it would be
@@ -500,6 +525,30 @@
     }
 
     /**
+     * Update the visibility of the voice button.  There are actually two voice search modes, 
+     * either of which will activate the button.
+     */
+    private void updateVoiceButton() {
+        int visibility = View.GONE;
+        if (mSearchable.getVoiceSearchEnabled()) {
+            Intent testIntent = null;
+            if (mSearchable.getVoiceSearchLaunchWebSearch()) {
+                testIntent = mVoiceWebSearchIntent;
+            } else if (mSearchable.getVoiceSearchLaunchRecognizer()) {
+                testIntent = mVoiceAppSearchIntent;
+            }      
+            if (testIntent != null) {
+                List<ResolveInfo> list = getContext().getPackageManager().
+                        queryIntentActivities(testIntent, PackageManager.MATCH_DEFAULT_ONLY);
+                if (list.size() > 0) {
+                    visibility = View.VISIBLE;
+                }
+            }
+        }
+        mVoiceButton.setVisibility(visibility);
+    }
+    
+    /**
      * Listeners of various types
      */
 
@@ -642,11 +691,97 @@
     };
     
     /**
+     * React to a click in the voice search button.
+     */
+    View.OnClickListener mVoiceButtonClickListener = new View.OnClickListener() {
+        public void onClick(View v) {
+            try {
+                if (mSearchable.getVoiceSearchLaunchWebSearch()) {
+                    getContext().startActivity(mVoiceWebSearchIntent);
+                    dismiss();
+                } else if (mSearchable.getVoiceSearchLaunchRecognizer()) {
+                    Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent);
+                    getContext().startActivity(appSearchIntent);
+                    dismiss();
+                }
+            } catch (ActivityNotFoundException e) {
+                // Should not happen, since we check the availability of
+                // voice search before showing the button. But just in case...
+                Log.w(LOG_TAG, "Could not find voice search activity");
+            }
+         }
+    };
+    
+    /**
+     * Create and return an Intent that can launch the voice search activity, perform a specific
+     * voice transcription, and forward the results to the searchable activity.
+     * 
+     * @param baseIntent The voice app search intent to start from
+     * @return A completely-configured intent ready to send to the voice search activity
+     */
+    private Intent createVoiceAppSearchIntent(Intent baseIntent) {
+        // create the necessary intent to set up a search-and-forward operation
+        // in the voice search system.   We have to keep the bundle separate,
+        // because it becomes immutable once it enters the PendingIntent
+        Intent queryIntent = new Intent(Intent.ACTION_SEARCH);
+        queryIntent.setComponent(mSearchable.mSearchActivity);
+        PendingIntent pending = PendingIntent.getActivity(
+                getContext(), 0, queryIntent, PendingIntent.FLAG_ONE_SHOT);
+        
+        // Now set up the bundle that will be inserted into the pending intent
+        // when it's time to do the search.  We always build it here (even if empty)
+        // because the voice search activity will always need to insert "QUERY" into
+        // it anyway.
+        Bundle queryExtras = new Bundle();
+        if (mAppSearchData != null) {
+            queryExtras.putBundle(SearchManager.APP_DATA, mAppSearchData);
+        }
+        
+        // Now build the intent to launch the voice search.  Add all necessary
+        // extras to launch the voice recognizer, and then all the necessary extras
+        // to forward the results to the searchable activity
+        Intent voiceIntent = new Intent(baseIntent);
+        
+        // Add all of the configuration options supplied by the searchable's metadata
+        String languageModel = RecognizerIntent.LANGUAGE_MODEL_FREE_FORM;
+        String prompt = null;
+        String language = null;
+        int maxResults = 1;
+        Resources resources = mActivityContext.getResources();
+        if (mSearchable.getVoiceLanguageModeId() != 0) {
+            languageModel = resources.getString(mSearchable.getVoiceLanguageModeId());
+        }
+        if (mSearchable.getVoicePromptTextId() != 0) {
+            prompt = resources.getString(mSearchable.getVoicePromptTextId());
+        }
+        if (mSearchable.getVoiceLanguageId() != 0) {
+            language = resources.getString(mSearchable.getVoiceLanguageId());
+        }
+        if (mSearchable.getVoiceMaxResults() != 0) {
+            maxResults = mSearchable.getVoiceMaxResults();
+        }
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, languageModel);
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_PROMPT, prompt);
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults);
+        
+        // Add the values that configure forwarding the results
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending);
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT_BUNDLE, queryExtras);
+        
+        return voiceIntent;
+    }
+
+    /**
      * React to the user typing "enter" or other hardwired keys while typing in the search box.
      * This handles these special keys while the edit box has focus.
      */
     View.OnKeyListener mTextKeyListener = new View.OnKeyListener() {
         public boolean onKey(View v, int keyCode, KeyEvent event) {
+            if (keyCode == KeyEvent.KEYCODE_BACK) {
+                cancel();
+                return true;
+            }
             // also guard against possible race conditions (late arrival after dismiss)
             if (mSearchable != null && 
                     TextUtils.getTrimmedLength(mSearchTextField.getText()) > 0) {
@@ -793,24 +928,6 @@
     };
 
     /**
-     * UI-thread handling of dialog dismiss.  Called by mBroadcastReceiver.onReceive().
-     *
-     * TODO: This is a really heavyweight solution for something that should be so simple.
-     * For example, we already have a handler, in our superclass, why aren't we sharing that?
-     * I think we need to investigate simplifying this entire methodology, or perhaps boosting
-     * it up into the Dialog class.
-     */
-    private static final int MESSAGE_DISMISS = 0;
-    private Handler mDismissHandler = new Handler() {
-        @Override
-        public void handleMessage(Message msg) {
-            if (msg.what == MESSAGE_DISMISS) {
-                dismiss();
-            }
-        }
-    };
-    
-    /**
      * Various ways to launch searches
      */
 
diff --git a/core/java/android/app/SearchManager.java b/core/java/android/app/SearchManager.java
index 0a37e81..2cc6de9 100644
--- a/core/java/android/app/SearchManager.java
+++ b/core/java/android/app/SearchManager.java
@@ -168,7 +168,8 @@
  * <p><b>Managing focus and knowing if Search is active.</b>  The search UI is not a separate
  * activity, and when the UI is invoked or dismissed, your activity will not typically be paused,
  * resumed, or otherwise notified by the methods defined in 
- * <a href="android.app.Activity#ActivityLifecycle">Activity Lifecycle</a>.  The search UI is
+ * <a href="{@docRoot}guide/topics/fundamentals.html#actlife">Application Fundamentals: 
+ * Activity Lifecycle</a>.  The search UI is
  * handled in the same way as other system UI elements which may appear from time to time, such as 
  * notifications, screen locks, or other system alerts:  
  * <p>When the search UI appears, your activity will lose input focus.
@@ -212,11 +213,11 @@
  * {@link #QUERY getStringExtra(SearchManager.QUERY)}.</li>
  * <li>To identify and support your searchable activity, you'll need to 
  * provide an XML file providing searchability configuration parameters, a reference to that 
- * in your searchable activity's <a href="../../../devel/bblocks-manifest.html">manifest</a>
+ * in your searchable activity's <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>
  * entry, and an intent-filter declaring that you can 
  * receive ACTION_SEARCH intents.  This is described in more detail in the 
  * <a href="#SearchabilityMetadata">Searchability Metadata</a> section.</li>
- * <li>Your <a href="../../../devel/bblocks-manifest.html">manifest</a> also needs a metadata entry
+ * <li>Your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> also needs a metadata entry
  * providing a global reference to the searchable activity.  This is the "glue" directing the search
  * UI, when invoked from any of your <i>other</i> activities, to use your application as the
  * default search context.  This is also described in more detail in the 
@@ -359,7 +360,7 @@
  * <li>Implement a Content Provider that provides suggestions.  If you already have one, and it 
  * has access to your suggestions data.  If not, you'll have to create one.
  * You'll also provide information about your Content Provider in your 
- * package's <a href="../../../devel/bblocks-manifest.html">manifest</a>.</li>
+ * package's <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>.</li>
  * <li>Update your searchable activity's XML configuration file.  There are two categories of
  * information used for suggestions:
  * <ul><li>The first is (required) data that the search manager will
@@ -634,7 +635,7 @@
  *
  * <p><b>Metadata for searchable activity.</b>  As with your search implementations described 
  * above, you must first identify which of your activities is searchable.  In the 
- * <a href="../../../devel/bblocks-manifest.html">manifest</a> entry for this activity, you must 
+ * <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> entry for this activity, you must 
  * provide two elements:
  * <ul><li>An intent-filter specifying that you can receive and process the 
  * {@link android.content.Intent#ACTION_SEARCH ACTION_SEARCH} {@link android.content.Intent Intent}.
@@ -643,7 +644,7 @@
  * remaining configuration information for how your application implements search.</li></ul>
  * 
  * <p>Here is a snippet showing the necessary elements in the 
- * <a href="../../../devel/bblocks-manifest.html">manifest</a> entry for your searchable activity.
+ * <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> entry for your searchable activity.
  * <pre class="prettyprint">
  *        &lt;!-- Search Activity - searchable --&gt;
  *        &lt;activity android:name="MySearchActivity" 
@@ -765,9 +766,8 @@
  * <li>.../res/values/strings.xml</li></ul>
  * 
  * <p>For more complete documentation on this capability, see
- * <a href="../../../devel/resources-i18n.html#AlternateResources">Resources and 
- * Internationalization: Supporting Alternate Resources for Alternate Languages and Configurations
- * </a>.
+ * <a href="{@docRoot}guide/topics/resources/resources-i18n.html#AlternateResources">Resources and 
+ * Internationalization: Alternate Resources</a>.
  *
  * <p><b>Metadata for non-searchable activities.</b>  Activities which are part of a searchable
  * application, but don't implement search itself, require a bit of "glue" in order to cause
@@ -775,7 +775,7 @@
  * provided, then searches from these activities will use the system default search context.
  * 
  * <p>The simplest way to specify this is to add a <i>search reference</i> element to the
- * application entry in the <a href="../../../devel/bblocks-manifest.html">manifest</a> file.  
+ * application entry in the <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a> file.  
  * The value of this reference can be either of:
  * <ul><li>The name of your searchable activity.  
  * It is typically prefixed by '.' to indicate that it's in the same package.</li>
@@ -803,7 +803,7 @@
  * to generate search suggestions, you'll need to publish it to the system, and you'll need to 
  * provide a bit of additional XML metadata in order to configure communications with it.
  * 
- * <p>First, in your <a href="../../../devel/bblocks-manifest.html">manifest</a>, you'll add the
+ * <p>First, in your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>, you'll add the
  * following lines.
  * <pre class="prettyprint">
  *        &lt;!-- Content provider for search suggestions --&gt;
@@ -832,7 +832,7 @@
  *     <tbody>
  *     <tr><th>android:searchSuggestAuthority</th>
  *         <td>This value must match the authority string provided in the <i>provider</i> section 
- *             of your <a href="../../../devel/bblocks-manifest.html">manifest</a>.</td>
+ *             of your <a href="{@docRoot}guide/topics/manifest/manifest-intro.html">manifest</a>.</td>
  *         <td align="center">Yes</td>
  *     </tr>
  *     
diff --git a/core/java/android/app/Service.java b/core/java/android/app/Service.java
index 6c08e75..72692f4 100644
--- a/core/java/android/app/Service.java
+++ b/core/java/android/app/Service.java
@@ -42,12 +42,12 @@
  * thread of their hosting process.  This means that, if your service is going
  * to do any CPU intensive (such as MP3 playback) or blocking (such as
  * networking) operations, it should spawn its own thread in which to do that
- * work.  More information on this can be found in the
- * <a href="{@docRoot}intro/appmodel.html#Threads">Threading section of the
- * Application Model overview</a>.</p>
+ * work.  More information on this can be found in
+ * <a href="{@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals:
+ * Processes and Threads</a>.</p>
  * 
  * <p>The Service class is an important part of an
- * <a href="{@docRoot}intro/lifecycle.html">application's overall lifecycle</a>.</p>
+ * <a href="{@docRoot}guide/topics/fundamentals.html#lcycles">application's overall lifecycle</a>.</p>
  * 
  * <p>Topics covered here:
  * <ol>
@@ -79,7 +79,7 @@
  * to the service.  The service will remain running as long as the connection
  * is established (whether or not the client retains a reference on the
  * service's IBinder).  Usually the IBinder returned is for a complex
- * interface that has been <a href="{@docRoot}reference/aidl.html">written
+ * interface that has been <a href="{@docRoot}guide/developing/tools/aidl.html">written
  * in aidl</a>.
  * 
  * <p>A service can be both started and have connections bound to it.  In such
@@ -106,7 +106,7 @@
  * {@link #checkCallingPermission}
  * method before executing the implementation of that call.
  * 
- * <p>See the <a href="{@docRoot}devel/security.html">Security Model</a>
+ * <p>See the <a href="{@docRoot}guide/topics/security/security.html">Security and Permissions</a>
  * document for more information on permissions and security in general.
  * 
  * <a name="ProcessLifecycle"></a>
@@ -201,14 +201,14 @@
      * Return the communication channel to the service.  May return null if 
      * clients can not bind to the service.  The returned
      * {@link android.os.IBinder} is usually for a complex interface
-     * that has been <a href="{@docRoot}reference/aidl.html">described using
+     * that has been <a href="{@docRoot}guide/developing/tools/aidl.html">described using
      * aidl</a>.
      * 
      * <p><em>Note that unlike other application components, calls on to the
      * IBinder interface returned here may not happen on the main thread
      * of the process</em>.  More information about this can be found
-     * in the <a href="{@docRoot}intro/appmodel.html#Threads">Threading section
-     * of the Application Model overview</a>.</p>
+     * in <a href="{@docRoot}guide/topics/fundamentals.html#procthread">Application Fundamentals:
+     * Processes and Threads</a>.</p>
      * 
      * @param intent The Intent that was used to bind to this service,
      * as given to {@link android.content.Context#bindService
diff --git a/core/java/android/bluetooth/BluetoothDevice.java b/core/java/android/bluetooth/BluetoothDevice.java
index d613e1c..56b231f 100644
--- a/core/java/android/bluetooth/BluetoothDevice.java
+++ b/core/java/android/bluetooth/BluetoothDevice.java
@@ -31,10 +31,15 @@
  * @hide
  */
 public class BluetoothDevice {
-    public static final int MODE_UNKNOWN = -1;
-    public static final int MODE_OFF = 0;
-    public static final int MODE_CONNECTABLE = 1;
-    public static final int MODE_DISCOVERABLE = 2;
+    /** Inquiry scan and page scan are both off.
+     *  Device is neither discoverable nor connectable */
+    public static final int SCAN_MODE_NONE = 0;
+    /** Page scan is on, inquiry scan is off.
+     *  Device is connectable, but not discoverable */
+    public static final int SCAN_MODE_CONNECTABLE = 1;
+    /** Page scan and inquiry scan are on.
+     *  Device is connectable and discoverable */
+    public static final int SCAN_MODE_CONNECTABLE_DISCOVERABLE = 3;
 
     public static final int RESULT_FAILURE = -1;
     public static final int RESULT_SUCCESS = 0;
@@ -54,10 +59,10 @@
     /** A bond attempt failed because the other side explicilty rejected
      * bonding */
     public static final int UNBOND_REASON_AUTH_REJECTED = 2;
-    /** A bond attempt failed because we cancelled the bonding process */
-    public static final int UNBOND_REASON_CANCELLED = 3;
+    /** A bond attempt failed because we canceled the bonding process */
+    public static final int UNBOND_REASON_AUTH_CANCELED = 3;
     /** A bond attempt failed because we could not contact the remote device */
-    public static final int UNBOND_REASON_AUTH_REMOTE_DEVICE_DOWN = 4;
+    public static final int UNBOND_REASON_REMOTE_DEVICE_DOWN = 4;
     /** An existing bond was explicitly revoked */
     public static final int UNBOND_REASON_REMOVED = 5;
 
@@ -174,18 +179,6 @@
         return false;
     }
 
-    public String getMajorClass() {
-        try {
-            return mService.getMajorClass();
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
-    public String getMinorClass() {
-        try {
-            return mService.getMinorClass();
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
     public String getVersion() {
         try {
             return mService.getVersion();
@@ -211,15 +204,26 @@
         return null;
     }
 
-    public int getMode() {
+    /**
+     * Get the current scan mode.
+     * Used to determine if the local device is connectable and/or discoverable
+     * @return Scan mode, one of SCAN_MODE_* or an error code
+     */
+    public int getScanMode() {
         try {
-            return mService.getMode();
+            return mService.getScanMode();
         } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return MODE_UNKNOWN;
+        return BluetoothError.ERROR_IPC;
     }
-    public void setMode(int mode) {
+
+    /**
+     * Set the current scan mode.
+     * Used to make the local device connectable and/or discoverable
+     * @param scanMode One of SCAN_MODE_*
+     */
+    public void setScanMode(int scanMode) {
         try {
-            mService.setMode(mode);
+            mService.setScanMode(scanMode);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
     }
 
@@ -435,24 +439,6 @@
         return null;
     }
 
-    public String getRemoteAlias(String address) {
-        try {
-            return mService.getRemoteAlias(address);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
-    public boolean setRemoteAlias(String address, String alias) {
-        try {
-            return mService.setRemoteAlias(address, alias);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return false;
-    }
-    public boolean clearRemoteAlias(String address) {
-        try {
-            return mService.clearRemoteAlias(address);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return false;
-    }
     public String getRemoteVersion(String address) {
         try {
             return mService.getRemoteVersion(address);
@@ -477,24 +463,6 @@
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return null;
     }
-    public String getRemoteMajorClass(String address) {
-        try {
-            return mService.getRemoteMajorClass(address);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
-    public String getRemoteMinorClass(String address) {
-        try {
-            return mService.getRemoteMinorClass(address);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
-    public String[] getRemoteServiceClasses(String address) {
-        try {
-            return mService.getRemoteServiceClasses(address);
-        } catch (RemoteException e) {Log.e(TAG, "", e);}
-        return null;
-    }
 
     /**
      * Returns the RFCOMM channel associated with the 16-byte UUID on
@@ -512,12 +480,19 @@
         return false;
     }
 
+    /**
+     * Get the major, minor and servics classes of a remote device.
+     * These classes are encoded as a 32-bit integer. See BluetoothClass.
+     * @param address remote device
+     * @return 32-bit class suitable for use with BluetoothClass.
+     */
     public int getRemoteClass(String address) {
         try {
             return mService.getRemoteClass(address);
         } catch (RemoteException e) {Log.e(TAG, "", e);}
         return BluetoothClass.ERROR;
     }
+
     public byte[] getRemoteFeatures(String address) {
         try {
             return mService.getRemoteFeatures(address);
@@ -576,8 +551,8 @@
     }
     
 
-    /* Sanity check a bluetooth address, such as "00:43:A8:23:10:F0" */
     private static final int ADDRESS_LENGTH = 17;
+    /** Sanity check a bluetooth address, such as "00:43:A8:23:10:F0" */
     public static boolean checkBluetoothAddress(String address) {
         if (address == null || address.length() != ADDRESS_LENGTH) {
             return false;
diff --git a/core/java/android/bluetooth/BluetoothHeadset.java b/core/java/android/bluetooth/BluetoothHeadset.java
index c315271..34196bf 100644
--- a/core/java/android/bluetooth/BluetoothHeadset.java
+++ b/core/java/android/bluetooth/BluetoothHeadset.java
@@ -69,8 +69,8 @@
 
     public static final int RESULT_FAILURE = 0;
     public static final int RESULT_SUCCESS = 1;
-    /** Connection cancelled before completetion. */
-    public static final int RESULT_CANCELLED = 2;
+    /** Connection canceled before completetion. */
+    public static final int RESULT_CANCELED = 2;
 
     /** Default priority for headsets that should be auto-connected */
     public static final int PRIORITY_AUTO = 100;
@@ -318,6 +318,12 @@
      * @return True if this device might support HSP or HFP.
      */
     public static boolean doesClassMatch(int btClass) {
+        // The render service class is required by the spec for HFP, so is a
+        // pretty good signal
+        if (BluetoothClass.Service.hasService(btClass, BluetoothClass.Service.RENDER)) {
+            return true;
+        }
+        // Just in case they forgot the render service class
         switch (BluetoothClass.Device.getDevice(btClass)) {
         case BluetoothClass.Device.AUDIO_VIDEO_HANDSFREE:
         case BluetoothClass.Device.AUDIO_VIDEO_WEARABLE_HEADSET:
diff --git a/core/java/android/bluetooth/BluetoothIntent.java b/core/java/android/bluetooth/BluetoothIntent.java
index 57c46f9..b66b06e 100644
--- a/core/java/android/bluetooth/BluetoothIntent.java
+++ b/core/java/android/bluetooth/BluetoothIntent.java
@@ -29,8 +29,8 @@
  * @hide
  */
 public interface BluetoothIntent {
-    public static final String MODE =
-        "android.bluetooth.intent.MODE";
+    public static final String SCAN_MODE =
+        "android.bluetooth.intent.SCAN_MODE";
     public static final String ADDRESS =
         "android.bluetooth.intent.ADDRESS";
     public static final String NAME =
@@ -62,9 +62,14 @@
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String NAME_CHANGED_ACTION  =
         "android.bluetooth.intent.action.NAME_CHANGED";
+
+    /**
+     * Broadcast when the scan mode changes. Always contains an int extra
+     * named SCAN_MODE that contains the new scan mode.
+     */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String MODE_CHANGED_ACTION         =
-        "android.bluetooth.intent.action.MODE_CHANGED";
+    public static final String SCAN_MODE_CHANGED_ACTION         =
+        "android.bluetooth.intent.action.SCAN_MODE_CHANGED";
 
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String DISCOVERY_STARTED_ACTION          =
@@ -104,12 +109,6 @@
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String REMOTE_NAME_FAILED_ACTION         =
         "android.bluetooth.intent.action.REMOTE_NAME_FAILED";
-    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String REMOTE_ALIAS_CHANGED_ACTION       =
-        "android.bluetooth.intent.action.REMOTE_ALIAS_CHANGED";
-    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
-    public static final String REMOTE_ALIAS_CLEARED_ACTION       =
-        "android.bluetooth.intent.action.REMOTE_ALIAS_CLEARED";
 
     /**
      * Broadcast when the bond state of a remote device changes.
diff --git a/core/java/android/bluetooth/HeadsetBase.java b/core/java/android/bluetooth/HeadsetBase.java
index bce3388..fd2d2ab 100644
--- a/core/java/android/bluetooth/HeadsetBase.java
+++ b/core/java/android/bluetooth/HeadsetBase.java
@@ -21,13 +21,10 @@
 import android.os.PowerManager.WakeLock;
 import android.util.Log;
 
-import java.io.IOException;
-import java.lang.Thread;
-
 /**
  * The Android Bluetooth API is not finalized, and *will* change. Use at your
  * own risk.
- * 
+ *
  * The base RFCOMM (service) connection for a headset or handsfree device.
  *
  * In the future this class will be removed.
@@ -90,7 +87,7 @@
 
     /* Create from an already exisiting rfcomm connection */
     public HeadsetBase(PowerManager pm, BluetoothDevice bluetooth, String address, int socketFd,
-                       int rfcommChannel, Handler handler) {
+            int rfcommChannel, Handler handler) {
         mDirection = DIRECTION_INCOMING;
         mConnectTimestamp = System.currentTimeMillis();
         mBluetooth = bluetooth;
@@ -132,30 +129,8 @@
      */
     protected void initializeAtParser() {
         mAtParser = new AtParser();
-
-        // Microphone Gain
-        mAtParser.register("+VGM", new AtCommandHandler() {
-            @Override
-            public AtCommandResult handleSetCommand(Object[] args) {
-                // AT+VGM=<gain>    in range [0,15]
-                // Headset/Handsfree is reporting its current gain setting
-                //TODO: sync to android UI
-                //TODO: Send unsolicited +VGM when volume changed on AG
-                return new AtCommandResult(AtCommandResult.OK);
-            }
-        });
-
-        // Speaker Gain
-        mAtParser.register("+VGS", new AtCommandHandler() {
-            @Override
-            public AtCommandResult handleSetCommand(Object[] args) {
-                // AT+VGS=<gain>    in range [0,15]
-                // Headset/Handsfree is reporting its current gain to Android
-                //TODO: sync to AG UI
-                //TODO: Send unsolicited +VGS when volume changed on AG
-                return new AtCommandResult(AtCommandResult.OK);
-            }
-        });
+        //TODO(): Get rid of this as there are no parsers registered. But because of dependencies,
+        //it needs to be done as part of refactoring HeadsetBase and BluetoothHandsfree
     }
 
     public AtParser getAtParser() {
diff --git a/core/java/android/bluetooth/IBluetoothDevice.aidl b/core/java/android/bluetooth/IBluetoothDevice.aidl
index 59f679f..4351d2e 100644
--- a/core/java/android/bluetooth/IBluetoothDevice.aidl
+++ b/core/java/android/bluetooth/IBluetoothDevice.aidl
@@ -32,15 +32,13 @@
     String getAddress();
     String getName();
     boolean setName(in String name);
-    String getMajorClass();
-    String getMinorClass();
     String getVersion();
     String getRevision();
     String getManufacturer();
     String getCompany();
 
-    int getMode();
-    boolean setMode(int mode);
+    int getScanMode();
+    boolean setScanMode(int mode);
 
     int getDiscoverableTimeout();
     boolean setDiscoverableTimeout(int timeout);
@@ -64,17 +62,11 @@
     int getBondState(in String address);
 
     String getRemoteName(in String address);
-    String getRemoteAlias(in String address);
-    boolean setRemoteAlias(in String address, in String alias);
-    boolean clearRemoteAlias(in String address);
     String getRemoteVersion(in String address);
     String getRemoteRevision(in String address);
     int getRemoteClass(in String address);
     String getRemoteManufacturer(in String address);
     String getRemoteCompany(in String address);
-    String getRemoteMajorClass(in String address);
-    String getRemoteMinorClass(in String address);
-    String[] getRemoteServiceClasses(in String address);
     boolean getRemoteServiceChannel(in String address, int uuid16, in IBluetoothDeviceCallback callback);
     byte[] getRemoteFeatures(in String adddress);
     String lastSeen(in String address);
diff --git a/core/java/android/content/AsyncQueryHandler.java b/core/java/android/content/AsyncQueryHandler.java
index 2d651a7..ac851cc 100644
--- a/core/java/android/content/AsyncQueryHandler.java
+++ b/core/java/android/content/AsyncQueryHandler.java
@@ -146,6 +146,20 @@
      * @param token A token passed into {@link #onQueryComplete} to identify
      *  the query.
      * @param cookie An object that gets passed into {@link #onQueryComplete}
+     * @param uri The URI, using the content:// scheme, for the content to
+     *         retrieve.
+     * @param projection A list of which columns to return. Passing null will
+     *         return all columns, which is discouraged to prevent reading data
+     *         from storage that isn't going to be used.
+     * @param selection A filter declaring which rows to return, formatted as an
+     *         SQL WHERE clause (excluding the WHERE itself). Passing null will
+     *         return all rows for the given URI.
+     * @param selectionArgs You may include ?s in selection, which will be
+     *         replaced by the values from selectionArgs, in the order that they
+     *         appear in the selection. The values will be bound as Strings.
+     * @param orderBy How to order the rows, formatted as an SQL ORDER BY
+     *         clause (excluding the ORDER BY itself). Passing null will use the
+     *         default sort order, which may be unordered.
      */
     public void startQuery(int token, Object cookie, Uri uri,
             String[] projection, String selection, String[] selectionArgs,
diff --git a/core/java/android/content/BroadcastReceiver.java b/core/java/android/content/BroadcastReceiver.java
index cd92002..ee08eea 100644
--- a/core/java/android/content/BroadcastReceiver.java
+++ b/core/java/android/content/BroadcastReceiver.java
@@ -16,7 +16,11 @@
 
 package android.content;
 
+import android.app.ActivityManagerNative;
+import android.app.IActivityManager;
 import android.os.Bundle;
+import android.os.IBinder;
+import android.os.RemoteException;
 import android.util.Log;
 
 /**
@@ -175,7 +179,9 @@
      * return a result to you asynchronously -- in particular, for interacting
      * with services, you should use
      * {@link Context#startService(Intent)} instead of
-     * {@link Context#bindService(Intent, ServiceConnection, int)}.
+     * {@link Context#bindService(Intent, ServiceConnection, int)}.  If you wish
+     * to interact with a service that is already running, you can use
+     * {@link #peekService}.
      * 
      * @param context The Context in which the receiver is running.
      * @param intent The Intent being received.
@@ -183,6 +189,26 @@
     public abstract void onReceive(Context context, Intent intent);
 
     /**
+     * Provide a binder to an already-running service.  This method is synchronous
+     * and will not start the target service if it is not present, so it is safe
+     * to call from {@link #onReceive}.
+     * 
+     * @param myContext The Context that had been passed to {@link #onReceive(Context, Intent)}
+     * @param service The Intent indicating the service you wish to use.  See {@link
+     * Context#startService(Intent)} for more information.
+     */
+    public IBinder peekService(Context myContext, Intent service) {
+        IActivityManager am = ActivityManagerNative.getDefault();
+        IBinder binder = null;
+        try {
+            binder = am.peekService(service, service.resolveTypeIfNeeded(
+                    myContext.getContentResolver()));
+        } catch (RemoteException e) {
+        }
+        return binder;
+    }
+
+    /**
      * Change the current result code of this broadcast; only works with
      * broadcasts sent through
      * {@link Context#sendOrderedBroadcast(Intent, String)
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 3908aa1..e0fe533 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -127,7 +127,7 @@
      * current process.
      */
     public abstract Context getApplicationContext();
-    
+
     /**
      * Return a localized, styled CharSequence from the application's package's
      * default string table.
@@ -428,7 +428,7 @@
      *     cursor when query is called.
      *
      * @return The contents of a newly created database with the given name.
-     * @throws SQLiteException if the database file could not be opened.
+     * @throws android.database.sqlite.SQLiteException if the database file could not be opened.
      *
      * @see #MODE_PRIVATE
      * @see #MODE_WORLD_READABLE
@@ -1064,7 +1064,7 @@
      * @see #AUDIO_SERVICE
      * @see android.media.AudioManager
      * @see #TELEPHONY_SERVICE
-     * @see android.internal.TelephonyManager
+     * @see android.telephony.TelephonyManager
      * @see #INPUT_METHOD_SERVICE
      * @see android.view.inputmethod.InputMethodManager
      */
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e2d3576..52aae0d 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -504,6 +504,8 @@
  *     <li> {@link #ACTION_PACKAGE_ADDED}
  *     <li> {@link #ACTION_PACKAGE_CHANGED}
  *     <li> {@link #ACTION_PACKAGE_REMOVED}
+ *     <li> {@link #ACTION_PACKAGE_RESTARTED}
+ *     <li> {@link #ACTION_PACKAGE_DATA_CLEARED}
  *     <li> {@link #ACTION_UID_REMOVED}
  *     <li> {@link #ACTION_BATTERY_CHANGED}
  * </ul>
@@ -1107,6 +1109,10 @@
     /**
      * Broadcast Action: A new application package has been installed on the
      * device. The data contains the name of the package.
+     * <p>My include the following extras:
+     * <ul>
+     * <li> {@link #EXTRA_UID} containing the integer uid assigned to the new package.
+     * </ul>
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
@@ -1114,23 +1120,49 @@
      * Broadcast Action: An existing application package has been removed from
      * the device.  The data contains the name of the package.  The package
      * that is being installed does <em>not</em> receive this Intent.
+     * <ul>
+     * <li> {@link #EXTRA_UID} containing the integer uid previously assigned
+     * to the package.
+     * <li> {@link #EXTRA_DATA_REMOVED} is set to true if the entire
+     * application -- data and code -- is being removed.
+     * <li> {@link #EXTRA_REPLACING} is set to true if this will be followed
+     * by an {@link #ACTION_PACKAGE_ADDED} broadcast for the same package.
+     * </ul>
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
     /**
      * Broadcast Action: An existing application package has been changed (e.g. a component has been
      * enabled or disabled.  The data contains the name of the package.
+     * <ul>
+     * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package.
+     * </ul>
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
     /**
-     * Broadcast Action: The user has restarted a package, all runtime state
+     * Broadcast Action: The user has restarted a package, and all of its
+     * processes have been killed.  All runtime state
      * associated with it (processes, alarms, notifications, etc) should
-     * be remove.  The data contains the name of the package.
+     * be removed.  The data contains the name of the package.
+     * <ul>
+     * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package.
+     * </ul>
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
     /**
+     * Broadcast Action: The user has cleared the data of a package.  This should
+     * be preceded by {@link #ACTION_PACKAGE_RESTARTED}, after which all of
+     * its persistent data is erased and this broadcast sent.  The data contains
+     * the name of the package.
+     * <ul>
+     * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package.
+     * </ul>
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
+    /**
      * Broadcast Action: A user ID has been removed from the system.  The user
      * ID number is stored in the extra data under {@link #EXTRA_UID}.
      */
@@ -1227,7 +1259,6 @@
     /**
      * Broadcast Action:  External media is present, and being disk-checked
      * The path to the mount point for the checking media is contained in the Intent.mData field.
-     * @hide
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING";
@@ -1235,7 +1266,6 @@
     /**
      * Broadcast Action:  External media is present, but is using an incompatible fs (or is blank)
      * The path to the mount point for the checking media is contained in the Intent.mData field.
-     * @hide
      */
     @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
     public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS";
@@ -1656,6 +1686,22 @@
     public static final String EXTRA_UID = "android.intent.extra.UID";
 
     /**
+     * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED}
+     * intents to indicate whether this represents a full uninstall (removing
+     * both the code and its data) or a partial uninstall (leaving its data,
+     * implying that this is an update).
+     */
+    public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED";
+    
+    /**
+     * Used as a boolean extra field in {@link android.content.Intent#ACTION_PACKAGE_REMOVED}
+     * intents to indicate that this is a replacement of the package, so this
+     * broadcast will immediately be followed by an add broadcast for a
+     * different version of the same package.
+     */
+    public static final String EXTRA_REPLACING = "android.intent.extra.REPLACING";
+    
+    /**
      * Used as an int extra field in {@link android.app.AlarmManager} intents
      * to tell the application being invoked how many pending alarms are being
      * delievered with the intent.  For one-shot alarms this will always be 1.
@@ -1770,8 +1816,8 @@
      * Intent, resulting in the stack now being: A, B.
      *
      * <p>The currently running instance of task B in the above example will
-     * either receiving the new intent you are starting here in its
-     * onNewIntent() method, or be itself finished and restarting with the
+     * either receive the new intent you are starting here in its
+     * onNewIntent() method, or be itself finished and restarted with the
      * new intent.  If it has declared its launch mode to be "multiple" (the
      * default) it will be finished and re-created; for all other launch modes
      * it will receive the Intent in the current instance.
@@ -1855,7 +1901,7 @@
      */
     public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 0x00080000;
     /**
-     * If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaving}
+     * If set, this flag will prevent the normal {@link android.app.Activity#onUserLeaveHint}
      * callback from occurring on the current frontmost activity before it is
      * paused as the newly-started activity is brought to the front.
      * 
@@ -1871,12 +1917,39 @@
      * activity does not think the user has acknowledged its notification. 
      */
     public static final int FLAG_ACTIVITY_NO_USER_ACTION = 0x00040000;
-
+    /**
+     * If set in an Intent passed to {@link Context#startActivity Context.startActivity()},
+     * this flag will cause the launched activity to be brought to the front of its
+     * task's history stack if it is already running.
+     * 
+     * <p>For example, consider a task consisting of four activities: A, B, C, D.
+     * If D calls startActivity() with an Intent that resolves to the component
+     * of activity B, then B will be brought to the front of the history stack,
+     * with this resulting order:  A, C, D, B.
+     * 
+     * This flag will be ignored if {@link #FLAG_ACTIVITY_CLEAR_TOP} is also
+     * specified. 
+     */
+    public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 0X00020000;
     /**
      * If set, when sending a broadcast only registered receivers will be
      * called -- no BroadcastReceiver components will be launched.
      */
     public static final int FLAG_RECEIVER_REGISTERED_ONLY = 0x40000000;
+    /**
+     * If set, when sending a broadcast <i>before boot has completed</i> only
+     * registered receivers will be called -- no BroadcastReceiver components
+     * will be launched.  Sticky intent state will be recorded properly even
+     * if no receivers wind up being called.  If {@link #FLAG_RECEIVER_REGISTERED_ONLY}
+     * is specified in the broadcast intent, this flag is unnecessary.
+     * 
+     * <p>This flag is only for use by system sevices as a convenience to
+     * avoid having to implement a more complex mechanism around detection
+     * of boot completion.
+     * 
+     * @hide
+     */
+    public static final int FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT = 0x20000000;
 
     // ---------------------------------------------------------------------
 
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index 6bc3774..96470c3 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -123,7 +123,7 @@
 
     private static final String SYNC_WAKE_LOCK = "SyncManagerSyncWakeLock";
     private static final String HANDLE_SYNC_ALARM_WAKE_LOCK = "SyncManagerHandleSyncAlarmWakeLock";
-    
+
     private Context mContext;
     private ContentResolver mContentResolver;
 
@@ -249,7 +249,7 @@
         mSyncQueue = new SyncQueue(mSyncStorageEngine);
 
         mContext = context;
-        
+
         mSyncThread = new HandlerThread("SyncHandlerThread", Process.THREAD_PRIORITY_BACKGROUND);
         mSyncThread.start();
         mSyncHandler = new SyncHandler(mSyncThread.getLooper());
@@ -489,7 +489,7 @@
         // Require the precise value "yes" to discourage accidental activation.
         return "yes".equals(SystemProperties.get("ro.config.sync"));
     }
-    
+
     /**
      * Initiate a sync. This can start a sync for all providers
      * (pass null to url, set onlyTicklable to false), only those
@@ -515,7 +515,7 @@
 *          syncs of a specific provider. Can be null. Is ignored
 *          if the url is null.
      * @param delay how many milliseconds in the future to wait before performing this
-     *   sync. -1 means to make this the next sync to perform. 
+     *   sync. -1 means to make this the next sync to perform.
      */
     public void scheduleSync(Uri url, Bundle extras, long delay) {
         boolean isLoggable = Log.isLoggable(TAG, Log.VERBOSE);
@@ -694,7 +694,7 @@
     class SyncHandlerMessagePayload {
         public final ActiveSyncContext activeSyncContext;
         public final SyncResult syncResult;
-        
+
         SyncHandlerMessagePayload(ActiveSyncContext syncContext, SyncResult syncResult) {
             this.activeSyncContext = syncContext;
             this.syncResult = syncResult;
@@ -740,7 +740,7 @@
         if (newDelayInMs > maxSyncRetryTimeInSeconds * 1000) {
             newDelayInMs = maxSyncRetryTimeInSeconds * 1000;
         }
-        
+
         SyncOperation rescheduledSyncOperation = new SyncOperation(syncOperation);
         rescheduledSyncOperation.setDelay(newDelayInMs);
         scheduleSyncOperation(rescheduledSyncOperation);
@@ -786,7 +786,7 @@
             // key than the one we are scheduling.
             if (!activeIsExpedited && !hasSameKey) {
                 rescheduleImmediately(activeSyncContext.mSyncOperation);
-                sendSyncFinishedOrCanceledMessage(activeSyncContext, 
+                sendSyncFinishedOrCanceledMessage(activeSyncContext,
                         null /* no result since this is a cancel */);
             }
         }
@@ -1323,7 +1323,7 @@
         public SyncHandler(Looper looper) {
             super(looper);
         }
-        
+
         public void handleMessage(Message msg) {
             handleSyncHandlerMessage(msg);
         }
@@ -1462,6 +1462,9 @@
             // start it, otherwise just get out.
             SyncOperation syncOperation;
             final Sync.Settings.QueryMap syncSettings = getSyncSettings();
+            final ConnectivityManager connManager = (ConnectivityManager)
+                    mContext.getSystemService(Context.CONNECTIVITY_SERVICE);
+            final boolean backgroundDataSetting = connManager.getBackgroundDataSetting();
             synchronized (mSyncQueue) {
                 while (true) {
                     syncOperation = mSyncQueue.head();
@@ -1484,10 +1487,10 @@
                     // skip the sync if it isn't a force and the settings are off for this provider
                     final boolean force = syncOperation.extras.getBoolean(
                             ContentResolver.SYNC_EXTRAS_FORCE, false);
-                    if (!force && (!syncSettings.getBackgroundData()
+                    if (!force && (!backgroundDataSetting
                             || !syncSettings.getListenForNetworkTickles()
                             || !syncSettings.getSyncProviderAutomatically(
-                            syncOperation.authority))) {
+                                    syncOperation.authority))) {
                         if (isLoggable) {
                             Log.v(TAG, "runStateIdle: sync off, dropping " + syncOperation);
                         }
@@ -1669,7 +1672,7 @@
          * @param syncResult the SyncResult from which to read
          * @return the most "serious" error set in the SyncResult
          * @throws IllegalStateException if the SyncResult does not indicate any errors.
-         *   If SyncResult.error() is true then it is safe to call this.   
+         *   If SyncResult.error() is true then it is safe to call this.
          */
         private int syncResultToErrorNumber(SyncResult syncResult) {
             if (syncResult.syncAlreadyInProgress) return History.ERROR_SYNC_ALREADY_IN_PROGRESS;
@@ -1679,7 +1682,8 @@
             if (syncResult.stats.numConflictDetectedExceptions > 0) return History.ERROR_CONFLICT;
             if (syncResult.tooManyDeletions) return History.ERROR_TOO_MANY_DELETIONS;
             if (syncResult.tooManyRetries) return History.ERROR_TOO_MANY_RETRIES;
-            throw new IllegalStateException("we are not in an error state, " + toString());
+            if (syncResult.databaseError) return History.ERROR_INTERNAL;
+            throw new IllegalStateException("we are not in an error state, " + syncResult);
         }
 
         private void manageSyncNotification() {
@@ -1717,7 +1721,7 @@
                 if (mSyncNotificationInfo.isActive) {
                     shouldInstall = shouldCancel;
                 } else {
-                    final boolean timeToShowNotification = 
+                    final boolean timeToShowNotification =
                             now > mSyncNotificationInfo.startTime + SYNC_NOTIFICATION_DELAY;
                     final boolean syncIsForced = syncOperation.extras
                             .getBoolean(ContentResolver.SYNC_EXTRAS_FORCE, false);
@@ -1769,7 +1773,7 @@
             if (!mDataConnectionIsConnected) return;
             if (mAccounts == null) return;
             if (mStorageIsLow) return;
-            
+
             // Compute the alarm fire time:
             // - not syncing: time of the next sync operation
             // - syncing, no notification: time from sync start to notification create time
@@ -1850,12 +1854,12 @@
             clickIntent.putExtra("account", account);
             clickIntent.putExtra("provider", authority);
             clickIntent.putExtra("numDeletes", numDeletes);
-            
+
             if (!isActivityAvailable(clickIntent)) {
                 Log.w(TAG, "No activity found to handle too many deletes.");
                 return;
             }
-            
+
             final PendingIntent pendingIntent = PendingIntent
                     .getActivity(mContext, 0, clickIntent, PendingIntent.FLAG_CANCEL_CURRENT);
 
@@ -1877,7 +1881,7 @@
 
         /**
          * Checks whether an activity exists on the system image for the given intent.
-         * 
+         *
          * @param intent The intent for an activity.
          * @return Whether or not an activity exists.
          */
@@ -1892,10 +1896,10 @@
                     return true;
                 }
             }
-            
+
             return false;
         }
-        
+
         public long insertStartSyncEvent(SyncOperation syncOperation) {
             final int source = syncOperation.syncSource;
             final long now = System.currentTimeMillis();
diff --git a/core/java/android/content/TempProviderSyncAdapter.java b/core/java/android/content/TempProviderSyncAdapter.java
index 78510aa..eb3a5da 100644
--- a/core/java/android/content/TempProviderSyncAdapter.java
+++ b/core/java/android/content/TempProviderSyncAdapter.java
@@ -1,11 +1,11 @@
 package android.content;
 
-import com.google.android.net.NetStats;
-
 import android.database.SQLException;
 import android.os.Bundle;
 import android.os.Debug;
+import android.os.NetStat;
 import android.os.Parcelable;
+import android.os.Process;
 import android.os.SystemProperties;
 import android.text.TextUtils;
 import android.util.Config;
@@ -177,7 +177,8 @@
         private final Bundle mExtras;
         private final SyncContext mSyncContext;
         private volatile boolean mIsCanceled = false;
-        private long[] mNetStats;
+        private long mInitialTxBytes;
+        private long mInitialRxBytes;
         private final SyncResult mResult;
 
         SyncThread(SyncContext syncContext, String account, Bundle extras) {
@@ -193,15 +194,18 @@
             if (mAdapterSyncStarted) onSyncCanceled();
             if (mProviderSyncStarted) mProvider.onSyncCanceled();
             // We may lose the last few sync events when canceling.  Oh well.
-            long[] newNetStats = NetStats.getStats();
-            logSyncDetails(newNetStats[0] - mNetStats[0], newNetStats[1] - mNetStats[1], mResult);
+            int uid = Process.myUid();
+            logSyncDetails(NetStat.getUidTxBytes(uid) - mInitialTxBytes,
+                    NetStat.getUidRxBytes(uid) - mInitialRxBytes, mResult);
         }
         
         @Override
         public void run() {
-            android.os.Process.setThreadPriority(android.os.Process.myTid(),
-                    android.os.Process.THREAD_PRIORITY_BACKGROUND);
-            mNetStats = NetStats.getStats();
+            Process.setThreadPriority(Process.myTid(),
+                    Process.THREAD_PRIORITY_BACKGROUND);
+            int uid = Process.myUid();
+            mInitialTxBytes = NetStat.getUidTxBytes(uid);
+            mInitialRxBytes = NetStat.getUidRxBytes(uid);
             try {
                 sync(mSyncContext, mAccount, mExtras);
             } catch (SQLException e) {
@@ -210,8 +214,8 @@
             } finally {
                 mSyncThread = null;
                 if (!mIsCanceled) {
-                    long[] newNetStats = NetStats.getStats();
-                    logSyncDetails(newNetStats[0] - mNetStats[0], newNetStats[1] - mNetStats[1], mResult);
+                    logSyncDetails(NetStat.getUidTxBytes(uid) - mInitialTxBytes,
+                    NetStat.getUidRxBytes(uid) - mInitialRxBytes, mResult);
                     mSyncContext.onFinished(mResult);
                 }
             }
diff --git a/core/java/android/content/pm/ConfigurationInfo.java b/core/java/android/content/pm/ConfigurationInfo.java
index 9115225..dcc7463 100755
--- a/core/java/android/content/pm/ConfigurationInfo.java
+++ b/core/java/android/content/pm/ConfigurationInfo.java
@@ -16,7 +16,6 @@
 
 package android.content.pm;
 
-import android.content.res.Configuration;
 import android.os.Parcel;
 import android.os.Parcelable;
 
@@ -60,12 +59,12 @@
     
     /**
      * Value for {@link #reqInputFeatures}: if set, indicates that the application
-     * requires a hard keyboard
+     * requires a five way navigation device
      */
     public static final int INPUT_FEATURE_FIVE_WAY_NAV = 0x00000002;
     
     /**
-     * Flags associated with the application.  Any combination of
+     * Flags associated with the input features.  Any combination of
      * {@link #INPUT_FEATURE_HARD_KEYBOARD},
      * {@link #INPUT_FEATURE_FIVE_WAY_NAV}
      */
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index ea86188..d3f6f3c 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -255,8 +255,15 @@
      * retrieval of information is complete.
      */
     void getPackageSizeInfo(in String packageName, IPackageStatsObserver observer);
+    
+    /**
+     * Get a list of shared libraries that are available on the
+     * system.
+     */
+    String[] getSystemSharedLibraryNames();
 
     void enterSafeMode();
+    boolean isSafeMode();
     void systemReady();
     boolean hasSystemUidErrors();
 }
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 4b902e9..698f27f 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -851,6 +851,16 @@
      * @see #GET_UNINSTALLED_PACKAGES
      */
     public abstract List<ApplicationInfo> getInstalledApplications(int flags);
+    
+    /**
+     * Get a list of shared libraries that are available on the
+     * system.
+     * 
+     * @return An array of shared library names that are
+     * available on the system, or null if none are installed.
+     * 
+     */
+    public abstract String[] getSystemSharedLibraryNames();
 
     /**
      * Determine the best action to perform for a given Intent.  This is how
@@ -1608,4 +1618,9 @@
      * the manifest as found in {@link ComponentInfo}.
      */
     public abstract int getApplicationEnabledSetting(String packageName);
+
+    /**
+     * Return whether the device has been booted into safe mode.
+     */
+    public abstract boolean isSafeMode();
 }
diff --git a/core/java/android/content/res/ColorStateList.java b/core/java/android/content/res/ColorStateList.java
index 4b1e678..17cb687 100644
--- a/core/java/android/content/res/ColorStateList.java
+++ b/core/java/android/content/res/ColorStateList.java
@@ -304,6 +304,11 @@
     }
 
     public void writeToParcel(Parcel dest, int flags) {
+        final int N = mStateSpecs.length;
+        dest.writeInt(N);
+        for (int i=0; i<N; i++) {
+            dest.writeIntArray(mStateSpecs[i]);
+        }
         dest.writeArray(mStateSpecs);
         dest.writeIntArray(mColors);
     }
@@ -315,14 +320,11 @@
         }
 
         public ColorStateList createFromParcel(Parcel source) {
-            Object[] o = source.readArray(
-                                    ColorStateList.class.getClassLoader());
-            int[][] stateSpecs = new int[o.length][];
-
-            for (int i = 0; i < o.length; i++) {
-                stateSpecs[i] = (int[]) o[i];
+            final int N = source.readInt();
+            int[][] stateSpecs = new int[N][];
+            for (int i=0; i<N; i++) {
+                stateSpecs[i] = source.createIntArray();
             }
-
             int[] colors = source.createIntArray();
             return new ColorStateList(stateSpecs, colors);
         }
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index 10eced6..5a0daea 100644
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -22,7 +22,6 @@
 import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 
-import android.content.Intent;
 import android.graphics.Movie;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.ColorDrawable;
@@ -399,7 +398,6 @@
      * 
      * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
      *
-     * @return CharSequence The string data associated with the resource, plus
      * @see #getDimensionPixelOffset
      * @see #getDimensionPixelSize
      */
@@ -432,7 +430,6 @@
      * 
      * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
      *
-     * @return CharSequence The string data associated with the resource, plus
      * @see #getDimension
      * @see #getDimensionPixelSize
      */
@@ -467,7 +464,6 @@
      *  
      * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
      *
-     * @return CharSequence The string data associated with the resource, plus
      * @see #getDimension
      * @see #getDimensionPixelOffset
      */
@@ -486,6 +482,36 @@
     }
 
     /**
+     * Retrieve a fractional unit for a particular resource ID.
+     * 
+     * @param id The desired resource identifier, as generated by the aapt
+     *           tool. This integer encodes the package, type, and resource
+     *           entry. The value 0 is an invalid identifier.
+     * @param base The base value of this fraction.  In other words, a 
+     *             standard fraction is multiplied by this value.
+     * @param pbase The parent base value of this fraction.  In other 
+     *             words, a parent fraction (nn%p) is multiplied by this
+     *             value.
+     * 
+     * @return Attribute fractional value multiplied by the appropriate 
+     * base value.
+     *  
+     * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
+     */
+    public float getFraction(int id, int base, int pbase) {
+        synchronized (mTmpValue) {
+            TypedValue value = mTmpValue;
+            getValue(id, value, true);
+            if (value.type == TypedValue.TYPE_FRACTION) {
+                return TypedValue.complexToFraction(value.data, base, pbase);
+            }
+            throw new NotFoundException(
+                    "Resource ID #0x" + Integer.toHexString(id) + " type #0x"
+                    + Integer.toHexString(value.type) + " is not valid");
+        }
+    }
+    
+    /**
      * Return a drawable object associated with a particular resource ID.
      * Various types of objects will be returned depending on the underlying
      * resource -- for example, a solid color, PNG image, scalable image, etc.
@@ -721,22 +747,36 @@
      */
     public InputStream openRawResource(int id) throws NotFoundException {
         synchronized (mTmpValue) {
-            TypedValue value = mTmpValue;
-            getValue(id, value, true);
+            return openRawResource(id, mTmpValue);
+        }
+    }
 
-            try {
-                return mAssets.openNonAsset(
-                    value.assetCookie, value.string.toString(),
+    /**
+     * Open a data stream for reading a raw resource.  This can only be used
+     * with resources whose value is the name of an asset files -- that is, it can be
+     * used to open drawable, sound, and raw resources; it will fail on string
+     * and color resources.
+     *
+     * @param id The resource identifier to open, as generated by the appt tool.
+     * @param value The TypedValue object to hold the resource information.
+     *
+     * @return InputStream Access to the resource data.
+     *
+     * @throws NotFoundException Throws NotFoundException if the given ID does not exist.
+     *
+     * @hide Pending API council approval
+     */
+    public InputStream openRawResource(int id, TypedValue value) throws NotFoundException {
+        getValue(id, value, true);
+
+        try {
+            return mAssets.openNonAsset(value.assetCookie, value.string.toString(),
                     AssetManager.ACCESS_STREAMING);
-            } catch (Exception e) {
-                NotFoundException rnf = new NotFoundException(
-                    "File " + value.string.toString()
-                    + " from drawable resource ID #0x"
-                    + Integer.toHexString(id));
-                rnf.initCause(e);
-                throw rnf;
-            }
-
+        } catch (Exception e) {
+            NotFoundException rnf = new NotFoundException("File " + value.string.toString() +
+                    " from drawable resource ID #0x" + Integer.toHexString(id));
+            rnf.initCause(e);
+            throw rnf;
         }
     }
 
@@ -1588,7 +1628,7 @@
                     InputStream is = mAssets.openNonAsset(
                             value.assetCookie, file, AssetManager.ACCESS_BUFFER);
     //                System.out.println("Opened file " + file + ": " + is);
-                    dr = Drawable.createFromStream(is, file);
+                    dr = Drawable.createFromResourceStream(this, value, is, file);
                     is.close();
     //                System.out.println("Created stream: " + dr);
                 } catch (Exception e) {
diff --git a/core/java/android/database/sqlite/SQLiteDatabase.java b/core/java/android/database/sqlite/SQLiteDatabase.java
index fa062c8..87bb277 100644
--- a/core/java/android/database/sqlite/SQLiteDatabase.java
+++ b/core/java/android/database/sqlite/SQLiteDatabase.java
@@ -25,6 +25,7 @@
 import android.text.TextUtils;
 import android.util.Config;
 import android.util.Log;
+import android.util.EventLog;
 
 import java.io.File;
 import java.util.HashMap;
@@ -51,7 +52,8 @@
  * is the Unicode Collation Algorithm and not tailored to the current locale.
  */
 public class SQLiteDatabase extends SQLiteClosable {
-    private final static String TAG = "Database";
+    private static final String TAG = "Database";
+    private static final int DB_OPERATION_EVENT = 52000;
 
     /**
      * Algorithms used in ON CONFLICT clause
@@ -207,6 +209,11 @@
     private WeakHashMap<SQLiteClosable, Object> mPrograms;
  
     private final RuntimeException mLeakedException;
+
+    // package visible, since callers will access directly to minimize overhead in the case
+    // that logging is not enabled.
+    /* package */ final boolean mLogStats;
+    
     /**
      * @param closable
      */
@@ -436,7 +443,14 @@
             if (mTransactionIsSuccessful) {
                 execSQL("COMMIT;");
             } else {
-                execSQL("ROLLBACK;");
+                try {
+                    execSQL("ROLLBACK;");
+                } catch (SQLException e) {
+                    if (Config.LOGD) {
+                        Log.d(TAG, "exception during rollback, maybe the DB previously "
+                                + "performed an auto-rollback");
+                    }
+                }
             }
         } finally {
             unlockForced();
@@ -1472,10 +1486,8 @@
      * @throws SQLException If the SQL string is invalid for some reason
      */
     public void execSQL(String sql) throws SQLException {
-        long timeStart = 0;
-        if (Config.LOGV) {
-            timeStart = System.currentTimeMillis();
-        }
+        boolean logStats = mLogStats;
+        long timeStart = logStats ? SystemClock.elapsedRealtime() : 0;
         lock();
         try {
             native_execSQL(sql);
@@ -1485,9 +1497,8 @@
         } finally {
             unlock();
         }
-        if (Config.LOGV) {
-            long timeEnd = System.currentTimeMillis();
-            Log.v(TAG, "Executed (" + (timeEnd - timeStart) + " ms):" + sql);
+        if (logStats) {
+            logTimeStat(false /* not a read */, timeStart, SystemClock.elapsedRealtime());
         }
     }
 
@@ -1504,10 +1515,9 @@
         if (bindArgs == null) {
             throw new IllegalArgumentException("Empty bindArgs");
         }
-        long timeStart = 0;
-        if (Config.LOGV) {
-            timeStart = System.currentTimeMillis();
-        }
+
+        boolean logStats = mLogStats;
+        long timeStart = logStats ? SystemClock.elapsedRealtime() : 0;
         lock();
         SQLiteStatement statement = null;
         try {
@@ -1528,9 +1538,8 @@
             }
             unlock();
         }
-        if (Config.LOGV) {
-            long timeEnd = System.currentTimeMillis();
-            Log.v(TAG, "Executed (" + (timeEnd - timeStart) + " ms):" + sql);
+        if (logStats) {
+            logTimeStat(false /* not a read */, timeStart, SystemClock.elapsedRealtime());
         }
     }
 
@@ -1550,7 +1559,7 @@
     }
 
     /**
-     * Private constructor. See {@link createDatabase} and {@link openDatabase}.
+     * Private constructor. See {@link #create} and {@link #openDatabase}.
      *
      * @param path The full path to the database
      * @param factory The factory to use when creating cursors, may be NULL.
@@ -1563,6 +1572,8 @@
         }
         mFlags = flags;
         mPath = path;
+        mLogStats = "1".equals(android.os.SystemProperties.get("db.logstats"));
+        
         mLeakedException = new IllegalStateException(path +
             " SQLiteDatabase created and never closed");
         mFactory = factory;
@@ -1605,6 +1616,10 @@
         return mPath;
     }
 
+    /* package */ void logTimeStat(boolean read, long begin, long end) {
+        EventLog.writeEvent(DB_OPERATION_EVENT, mPath, read ? 0 : 1, end - begin);
+    }
+
     /**
      * Sets the locale for this database.  Does nothing if this database has
      * the NO_LOCALIZED_COLLATORS flag set or was opened read only.
@@ -1629,7 +1644,7 @@
     private native void dbopen(String path, int flags);
 
     /**
-     * Native call to execute a raw SQL statement. {@link mLock} must be held
+     * Native call to execute a raw SQL statement. {@link #lock} must be held
      * when calling this method.
      *
      * @param sql The raw SQL string
@@ -1638,7 +1653,7 @@
     /* package */ native void native_execSQL(String sql) throws SQLException;
 
     /**
-     * Native call to set the locale.  {@link mLock} must be held when calling
+     * Native call to set the locale.  {@link #lock} must be held when calling
      * this method.
      * @throws SQLException
      */
diff --git a/core/java/android/database/sqlite/SQLiteOpenHelper.java b/core/java/android/database/sqlite/SQLiteOpenHelper.java
index 35bf645..52aac3a 100644
--- a/core/java/android/database/sqlite/SQLiteOpenHelper.java
+++ b/core/java/android/database/sqlite/SQLiteOpenHelper.java
@@ -26,6 +26,8 @@
  * optionally {@link #onOpen}, and this class takes care of opening the database
  * if it exists, creating it if it does not, and upgrading it as necessary.
  * Transactions are used to make sure the database is always in a sensible state.
+ * <p>For an example, see the NotePadProvider class in the NotePad sample application,
+ * in the <em>samples/</em> directory of the SDK.</p>
  */
 public abstract class SQLiteOpenHelper {
     private static final String TAG = SQLiteOpenHelper.class.getSimpleName();
diff --git a/core/java/android/database/sqlite/SQLiteQuery.java b/core/java/android/database/sqlite/SQLiteQuery.java
index 22c53ab..5bfa0e8 100644
--- a/core/java/android/database/sqlite/SQLiteQuery.java
+++ b/core/java/android/database/sqlite/SQLiteQuery.java
@@ -17,6 +17,7 @@
 package android.database.sqlite;
 
 import android.database.CursorWindow;
+import android.os.SystemClock;
 
 /**
  * A SQLite program that represents a query that reads the resulting rows into a CursorWindow.
@@ -55,12 +56,14 @@
      * Reads rows into a buffer. This method acquires the database lock.
      * 
      * @param window The window to fill into
-     * @param startPos The position to start reading rows from
      * @return number of total rows in the query
      */
     /* package */ int fillWindow(CursorWindow window,  
             int maxRead, int lastPos) {
         mDatabase.lock();
+
+        boolean logStats = mDatabase.mLogStats;
+        long startTime = logStats ? SystemClock.elapsedRealtime() : 0;
         try {
             acquireReference();
             try {
@@ -68,8 +71,13 @@
                 // if the start pos is not equal to 0, then most likely window is 
                 // too small for the data set, loading by another thread
                 // is not safe in this situation. the native code will ignore maxRead
-                return native_fill_window(window, window.getStartPosition(), mOffsetIndex, 
+                int numRows = native_fill_window(window, window.getStartPosition(), mOffsetIndex,
                         maxRead, lastPos);
+                if (logStats) {
+                    mDatabase.logTimeStat(true /* read */, startTime,
+                            SystemClock.elapsedRealtime());
+                }
+                return numRows;
             } catch (IllegalStateException e){
                 // simply ignore it
                 return 0;
diff --git a/core/java/android/database/sqlite/SQLiteStatement.java b/core/java/android/database/sqlite/SQLiteStatement.java
index bf9361d..d169259 100644
--- a/core/java/android/database/sqlite/SQLiteStatement.java
+++ b/core/java/android/database/sqlite/SQLiteStatement.java
@@ -16,6 +16,8 @@
 
 package android.database.sqlite;
 
+import android.os.SystemClock;
+
 /**
  * A pre-compiled statement against a {@link SQLiteDatabase} that can be reused.
  * The statement cannot return multiple rows, but 1x1 result sets are allowed.
@@ -43,10 +45,16 @@
      */
     public void execute() {
         mDatabase.lock();
+        boolean logStats = mDatabase.mLogStats;
+        long startTime = logStats ? SystemClock.elapsedRealtime() : 0;
+
         acquireReference();
         try {
             native_execute();
-        } finally {
+            if (logStats) {
+                mDatabase.logTimeStat(false /* write */, startTime, SystemClock.elapsedRealtime());
+            }
+        } finally {                    
             releaseReference();
             mDatabase.unlock();
         }
@@ -64,9 +72,15 @@
      */
     public long executeInsert() {
         mDatabase.lock();
+        boolean logStats = mDatabase.mLogStats;
+        long startTime = logStats ? SystemClock.elapsedRealtime() : 0;
+
         acquireReference();
         try {
             native_execute();
+            if (logStats) {
+                mDatabase.logTimeStat(false /* write */, startTime, SystemClock.elapsedRealtime());
+            }
             return mDatabase.lastInsertRow();
         } finally {
             releaseReference();
@@ -84,9 +98,16 @@
      */
     public long simpleQueryForLong() {
         mDatabase.lock();
+        boolean logStats = mDatabase.mLogStats;
+        long startTime = logStats ? SystemClock.elapsedRealtime() : 0;
+
         acquireReference();
         try {
-            return native_1x1_long();
+            long retValue = native_1x1_long();
+            if (logStats) {
+                mDatabase.logTimeStat(false /* write */, startTime, SystemClock.elapsedRealtime());
+            }
+            return retValue;
         } finally {
             releaseReference();
             mDatabase.unlock();
@@ -103,9 +124,16 @@
      */
     public String simpleQueryForString() {
         mDatabase.lock();
+        boolean logStats = mDatabase.mLogStats;
+        long startTime = logStats ? SystemClock.elapsedRealtime() : 0;
+
         acquireReference();
         try {
-            return native_1x1_string();
+            String retValue = native_1x1_string();
+            if (logStats) {
+                mDatabase.logTimeStat(false /* write */, startTime, SystemClock.elapsedRealtime());
+            }
+            return retValue;
         } finally {
             releaseReference();
             mDatabase.unlock();
diff --git a/core/java/android/database/sqlite/package.html b/core/java/android/database/sqlite/package.html
index c03a8dc..ff0f9f5 100644
--- a/core/java/android/database/sqlite/package.html
+++ b/core/java/android/database/sqlite/package.html
@@ -6,7 +6,7 @@
 Applications use these classes to maange private databases. If creating a
 content provider, you will probably have to use these classes to create and
 manage your own database to store content. See <a
-href="{@docRoot}devel/data.html">Storing, Retrieving and Exposing Data</a> to learn
+href="{@docRoot}guide/topics/providers/content-providers.html">Content Providers</a> to learn
 the conventions for implementing a content provider. See the
 NotePadProvider class in the NotePad sample application in the SDK for an
 example of a content provider. Android ships with SQLite version 3.4.0
diff --git a/core/java/android/gadget/GadgetHost.java b/core/java/android/gadget/GadgetHost.java
index 418f2aa..9176d18 100644
--- a/core/java/android/gadget/GadgetHost.java
+++ b/core/java/android/gadget/GadgetHost.java
@@ -17,14 +17,67 @@
 package android.gadget;
 
 import android.content.Context;
+import android.os.Handler;
+import android.os.IBinder;
+import android.os.Message;
+import android.os.RemoteException;
+import android.os.ServiceManager;
 import android.widget.RemoteViews;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import com.android.internal.gadget.IGadgetHost;
+import com.android.internal.gadget.IGadgetService;
+
 /**
  * GadgetHost provides the interaction with the Gadget Service for apps,
  * like the home screen, that want to embed gadgets in their UI.
  */
 public class GadgetHost {
+
+    static final int HANDLE_UPDATE = 1;
+
+    static Object sServiceLock = new Object();
+    static IGadgetService sService;
+
+    Context mContext;
+    String mPackageName;
+
+    class Callbacks extends IGadgetHost.Stub {
+        public void updateGadget(int gadgetId, RemoteViews views) {
+            Message msg = mHandler.obtainMessage(HANDLE_UPDATE);
+            msg.arg1 = gadgetId;
+            msg.obj = views;
+            msg.sendToTarget();
+        }
+    }
+
+    Handler mHandler = new Handler() {
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case HANDLE_UPDATE: {
+                    updateGadgetView(msg.arg1, (RemoteViews)msg.obj);
+                    break;
+                }
+            }
+        }
+    };
+
+    int mHostId;
+    Callbacks mCallbacks = new Callbacks();
+    HashMap<Integer,GadgetHostView> mViews = new HashMap();
+
     public GadgetHost(Context context, int hostId) {
+        mContext = context;
+        mHostId = hostId;
+        synchronized (sServiceLock) {
+            if (sService == null) {
+                IBinder b = ServiceManager.getService(Context.GADGET_SERVICE);
+                sService = IGadgetService.Stub.asInterface(b);
+            }
+        }
     }
 
     /**
@@ -32,6 +85,23 @@
      * becomes visible, i.e. from onStart() in your Activity.
      */
     public void startListening() {
+        int[] updatedIds = null;
+        ArrayList<RemoteViews> updatedViews = new ArrayList();
+        
+        try {
+            if (mPackageName == null) {
+                mPackageName = mContext.getPackageName();
+            }
+            updatedIds = sService.startListening(mCallbacks, mPackageName, mHostId, updatedViews);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
+
+        final int N = updatedIds.length;
+        for (int i=0; i<N; i++) {
+            updateGadgetView(updatedIds[i], updatedViews.get(i));
+        }
     }
 
     /**
@@ -39,25 +109,93 @@
      * no longer visible, i.e. from onStop() in your Activity.
      */
     public void stopListening() {
+        try {
+            sService.stopListening(mHostId);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
     }
 
     /**
-     * Stop listening to changes for this gadget.
+     * Get a gadgetId for a host in the calling process.
+     *
+     * @return a gadgetId
      */
-    public void gadgetRemoved(int gadgetId) {
+    public int allocateGadgetId() {
+        try {
+            if (mPackageName == null) {
+                mPackageName = mContext.getPackageName();
+            }
+            return sService.allocateGadgetId(mPackageName, mHostId);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
     }
 
     /**
-     * Remove all records about gadget instances from the gadget manager.  Call this when
-     * initializing your database, as it might be because of a data wipe.
+     * Stop listening to changes for this gadget.  
      */
-    public void clearGadgets() {
+    public void deleteGadgetId(int gadgetId) {
+        synchronized (mViews) {
+            mViews.remove(gadgetId);
+            try {
+                sService.deleteGadgetId(gadgetId);
+            }
+            catch (RemoteException e) {
+                throw new RuntimeException("system server dead?", e);
+            }
+        }
+    }
+
+    /**
+     * Remove all records about this host from the gadget manager.
+     * <ul>
+     *   <li>Call this when initializing your database, as it might be because of a data wipe.</li>
+     *   <li>Call this to have the gadget manager release all resources associated with your
+     *   host.  Any future calls about this host will cause the records to be re-allocated.</li>
+     * </ul>
+     */
+    public void deleteHost() {
+        try {
+            sService.deleteHost(mHostId);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
+    }
+
+    /**
+     * Remove all records about all hosts for your package.
+     * <ul>
+     *   <li>Call this when initializing your database, as it might be because of a data wipe.</li>
+     *   <li>Call this to have the gadget manager release all resources associated with your
+     *   host.  Any future calls about this host will cause the records to be re-allocated.</li>
+     * </ul>
+     */
+    public static void deleteAllHosts() {
+        try {
+            sService.deleteAllHosts();
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
     }
 
     public final GadgetHostView createView(Context context, int gadgetId, GadgetInfo gadget) {
         GadgetHostView view = onCreateView(context, gadgetId, gadget);
         view.setGadget(gadgetId, gadget);
-        view.updateGadget(null);
+        synchronized (mViews) {
+            mViews.put(gadgetId, view);
+        }
+        RemoteViews views = null;
+        try {
+            views = sService.getGadgetViews(gadgetId);
+        } catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
+        view.updateGadget(views);
         return view;
     }
 
@@ -68,5 +206,16 @@
     protected GadgetHostView onCreateView(Context context, int gadgetId, GadgetInfo gadget) {
         return new GadgetHostView(context);
     }
+
+    void updateGadgetView(int gadgetId, RemoteViews views) {
+        GadgetHostView v;
+        synchronized (mViews) {
+            v = mViews.get(gadgetId);
+        }
+        if (v != null) {
+            v.updateGadget(views);
+        }
+    }
 }
 
+
diff --git a/core/java/android/gadget/GadgetHostView.java b/core/java/android/gadget/GadgetHostView.java
index e2bef8c..d92c123 100644
--- a/core/java/android/gadget/GadgetHostView.java
+++ b/core/java/android/gadget/GadgetHostView.java
@@ -19,16 +19,21 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.gadget.GadgetInfo;
-import android.util.AttributeSet;
+import android.graphics.Color;
+import android.util.Config;
 import android.util.Log;
+import android.view.Gravity;
 import android.view.LayoutInflater;
 import android.view.View;
+import android.view.ViewGroup;
 import android.widget.FrameLayout;
 import android.widget.RemoteViews;
 import android.widget.TextView;
+import android.widget.ViewAnimator;
 
-public class GadgetHostView extends FrameLayout {
+public class GadgetHostView extends ViewAnimator {
     static final String TAG = "GadgetHostView";
+    static final boolean LOGD = Config.LOGD || true;
 
     // When we're inflating the initialLayout for a gadget, we only allow
     // views that are allowed in RemoteViews.
@@ -40,63 +45,139 @@
 
     int mGadgetId;
     GadgetInfo mInfo;
-    View mContentView;
+    View mActiveView;
+    View mStaleView;
+    
+    protected int mDefaultGravity = Gravity.CENTER;
 
     public GadgetHostView(Context context) {
         super(context);
     }
 
     public void setGadget(int gadgetId, GadgetInfo info) {
+        if (LOGD) Log.d(TAG, "setGadget is incoming with info=" + info);
         if (mInfo != null) {
             // TODO: remove the old view, or whatever
         }
         mGadgetId = gadgetId;
         mInfo = info;
+        
+        View defaultView = getDefaultView();
+        flipUpdate(defaultView);
+    }
+    
+    /**
+     * Trigger actual animation between current and new content in the
+     * {@link ViewAnimator}.
+     */
+    protected void flipUpdate(View newContent) {
+        if (LOGD) Log.d(TAG, "pushing an update to surface");
+        
+        // Take requested dimensions from parent, but apply default gravity.
+        ViewGroup.LayoutParams requested = newContent.getLayoutParams();
+        if (requested == null) {
+            requested = new FrameLayout.LayoutParams(LayoutParams.FILL_PARENT,
+                    LayoutParams.FILL_PARENT);
+        }
+        
+        FrameLayout.LayoutParams params =
+            new FrameLayout.LayoutParams(requested.width, requested.height);
+        params.gravity = mDefaultGravity;
+        newContent.setLayoutParams(params);
+        
+        // Add new content and animate to it
+        addView(newContent);
+        showNext();
+        
+        // Dispose old stale view
+        removeView(mStaleView);
+        mStaleView = mActiveView;
+        mActiveView = newContent;
     }
 
+    /**
+     * Process a set of {@link RemoteViews} coming in as an update from the
+     * gadget provider. Will animate into these new views as needed.
+     */
     public void updateGadget(RemoteViews remoteViews) {
-        Context context = getContext();
-
-        View contentView = null;
+        if (LOGD) Log.d(TAG, "updateGadget() with remoteViews = " + remoteViews);
+        
+        View newContent = null;
         Exception exception = null;
+        
         try {
             if (remoteViews == null) {
                 // there is no remoteViews (yet), so use the initial layout
-                Context theirContext = context.createPackageContext(mInfo.provider.getPackageName(),
-                        0);
-                LayoutInflater inflater = (LayoutInflater)theirContext.getSystemService(
-                        Context.LAYOUT_INFLATER_SERVICE);
-                inflater = inflater.cloneInContext(theirContext);
-                inflater.setFilter(sInflaterFilter);
-                contentView = inflater.inflate(mInfo.initialLayout, this, false);
+                newContent = getDefaultView();
             } else {
                 // use the RemoteViews
-                contentView = remoteViews.apply(mContext, this);
+                // TODO: try applying RemoteViews to existing staleView if available 
+                newContent = remoteViews.apply(mContext, this);
             }
-        }
-        catch (PackageManager.NameNotFoundException e) {
+        } catch (RuntimeException e) {
             exception = e;
         }
-        catch (RuntimeException e) {
-            exception = e;
-        }
-        if (contentView == null) {
+        
+        if (exception != null && LOGD) {
             Log.w(TAG, "Error inflating gadget " + mInfo, exception);
+        }
+        
+        if (newContent == null) {
             // TODO: Should we throw an exception here for the host activity to catch?
             // Maybe we should show a generic error widget.
-            TextView tv = new TextView(context);
-            tv.setText("Error inflating gadget");
-            contentView = tv;
+            if (LOGD) Log.d(TAG, "updateGadget couldn't find any view, so inflating error");
+            newContent = getErrorView();
         }
 
-        FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
-                FrameLayout.LayoutParams.WRAP_CONTENT,
-                FrameLayout.LayoutParams.WRAP_CONTENT);
-
-        mContentView = contentView;
-        this.addView(contentView, lp);
-
-        // TODO: do an animation (maybe even one provided by the gadget).
+        flipUpdate(newContent);
+    }
+    
+    /**
+     * Inflate and return the default layout requested by gadget provider.
+     */
+    protected View getDefaultView() {
+        View defaultView = null;
+        Exception exception = null;
+        
+        try {
+            if (mInfo != null) {
+                Context theirContext = mContext.createPackageContext(
+                        mInfo.provider.getPackageName(), 0 /* no flags */);
+                LayoutInflater inflater = (LayoutInflater)
+                        theirContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+                inflater = inflater.cloneInContext(theirContext);
+                inflater.setFilter(sInflaterFilter);
+                defaultView = inflater.inflate(mInfo.initialLayout, this, false);
+            } else {
+                Log.w(TAG, "can't inflate defaultView because mInfo is missing");
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+            exception = e;
+        } catch (RuntimeException e) {
+            exception = e;
+        }
+        
+        if (exception != null && LOGD) {
+            Log.w(TAG, "Error inflating gadget " + mInfo, exception);
+        }
+        
+        if (defaultView == null) {
+            if (LOGD) Log.d(TAG, "getDefaultView couldn't find any view, so inflating error");
+            defaultView = getErrorView();
+        }
+        
+        return defaultView;
+    }
+    
+    /**
+     * Inflate and return a view that represents an error state.
+     */
+    protected View getErrorView() {
+        TextView tv = new TextView(mContext);
+        // TODO: move this error string and background color into resources
+        tv.setText("Error inflating gadget");
+        tv.setBackgroundColor(Color.argb(127, 0, 0, 0));
+        return tv;
     }
 }
 
diff --git a/core/java/android/gadget/GadgetInfo.java b/core/java/android/gadget/GadgetInfo.java
index 1a7a9a0..5ac3da9 100644
--- a/core/java/android/gadget/GadgetInfo.java
+++ b/core/java/android/gadget/GadgetInfo.java
@@ -58,6 +58,16 @@
      */
     public ComponentName configure;
 
+    /**
+     * The label to display to the user.
+     */
+    public String label;
+
+    /**
+     * The icon to display for this gadget in the picker list.
+     */
+    public int icon;
+
     public GadgetInfo() {
     }
 
@@ -75,6 +85,8 @@
         if (0 != in.readInt()) {
             this.configure = new ComponentName(in);
         }
+        this.label = in.readString();
+        this.icon = in.readInt();
     }
 
 
@@ -95,6 +107,8 @@
         } else {
             out.writeInt(0);
         }
+        out.writeString(this.label);
+        out.writeInt(this.icon);
     }
 
     public int describeContents() {
diff --git a/core/java/android/gadget/GadgetManager.java b/core/java/android/gadget/GadgetManager.java
index 088dc86..20f4014 100644
--- a/core/java/android/gadget/GadgetManager.java
+++ b/core/java/android/gadget/GadgetManager.java
@@ -30,6 +30,10 @@
 import java.util.List;
 import java.util.WeakHashMap;
 
+/**
+ * Updates gadget state; gets information about installed gadget providers and other
+ * gadget related state.
+ */
 public class GadgetManager {
     static final String TAG = "GadgetManager";
 
@@ -40,9 +44,8 @@
      * The system will respond with an onActivityResult call with the following extras in
      * the intent:
      * <ul>
-     *   <li><b>gadgetId</b></li>
-     *   <li><b>gadgetId</b></li>
-     *   <li><b>gadgetId</b></li>
+     *   <li><b>gadgetIds</b></li>
+     *   <li><b>hostId</b></li>
      * </ul>
      * TODO: Add constants for these.
      * TODO: Where does this go?
@@ -50,21 +53,42 @@
     public static final String GADGET_PICK_ACTION = "android.gadget.action.PICK_GADGET";
 
     public static final String EXTRA_GADGET_ID = "gadgetId";
+    public static final String EXTRA_GADGET_IDS = "gadgetIds";
+    public static final String EXTRA_HOST_ID = "hostId";
 
     /**
      * Sent when it is time to update your gadget.
+     *
+     * <p>This may be sent in response to a new instance for this gadget provider having
+     * been instantiated, the requested {@link GadgetInfo#updatePeriodMillis update interval}
+     * having lapsed, or the system booting.
      */
     public static final String GADGET_UPDATE_ACTION = "android.gadget.action.GADGET_UPDATE";
 
     /**
-     * Sent when the gadget is added to a host for the first time. TODO: Maybe we don't want this.
+     * Sent when it is time to configure your gadget.  This action is not sent as a broadcast
+     * to the gadget provider, but as a startActivity to the activity specified in the
+     * {@link GadgetInfo GadgetInfo meta-data}.
+     *
+     * <p>The {@link #EXTRA_GADGET_ID} extra contains the gadget ID.
      */
-    public static final String GADGET_ENABLE_ACTION = "android.gadget.action.GADGET_ENABLE";
+    public static final String GADGET_CONFIGURE_ACTION = "android.gadget.action.GADGET_CONFIGURE";
 
     /**
-     * Sent when the gadget is removed from the last host. TODO: Maybe we don't want this.
+     * Sent when the gadget is added to a host for the first time.  This broadcast is sent at
+     * boot time if there is a gadget host installed with an instance for this provider.
      */
-    public static final String GADGET_DISABLE_ACTION = "android.gadget.action.GADGET_DISABLE";
+    public static final String GADGET_ENABLED_ACTION = "android.gadget.action.GADGET_ENABLED";
+
+    /**
+     * Sent when an instances of a gadget is deleted from the host.
+     */
+    public static final String GADGET_DELETED_ACTION = "android.gadget.action.GADGET_DELETED";
+
+    /**
+     * Sent when the gadget is removed from the last host.
+     */
+    public static final String GADGET_DISABLED_ACTION = "android.gadget.action.GADGET_DISABLED";
 
     /**
      * Field for the manifest meta-data tag.
@@ -106,10 +130,36 @@
      * <p>
      * This method will only work when called from the uid that owns the gadget provider.
      *
-     * @param gadgetId      The gadget instance for which to set the RemoteViews.
+     * @param gadgetIds     The gadget instances for which to set the RemoteViews.
      * @param views         The RemoteViews object to show.
      */
-    public void updateGadget(int gadgetId, RemoteViews views) {
+    public void updateGadget(int[] gadgetIds, RemoteViews views) {
+        try {
+            sService.updateGadgetIds(gadgetIds, views);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
+    }
+
+    /**
+     * Call this with the new RemoteViews for your gadget whenever you need to.
+     *
+     * <p>
+     * This method will only work when called from the uid that owns the gadget provider.
+     *
+     * @param provider      The {@link ComponentName} for the {@link
+     * android.content.BroadcastReceiver BroadcastReceiver} provider
+     *                      for your gadget.
+     * @param views         The RemoteViews object to show.
+     */
+    public void updateGadget(ComponentName provider, RemoteViews views) {
+        try {
+            sService.updateGadgetProvider(provider, views);
+        }
+        catch (RemoteException e) {
+            throw new RuntimeException("system server dead?", e);
+        }
     }
 
     /**
@@ -140,32 +190,6 @@
     }
 
     /**
-     * Get a gadgetId for a host in the calling process.
-     *
-     * @return a gadgetId
-     */
-    public int allocateGadgetId(String hostPackage) {
-        try {
-            return sService.allocateGadgetId(hostPackage);
-        }
-        catch (RemoteException e) {
-            throw new RuntimeException("system server dead?", e);
-        }
-    }
-
-    /**
-     * Delete the gadgetId.  Same as removeGadget on GadgetHost.
-     */
-    public void deleteGadgetId(int gadgetId) {
-        try {
-            sService.deleteGadgetId(gadgetId);
-        }
-        catch (RemoteException e) {
-            throw new RuntimeException("system server dead?", e);
-        }
-    }
-
-    /**
      * Set the component for a given gadgetId.  You need the GADGET_LIST permission.
      */
     public void bindGadgetId(int gadgetId, ComponentName provider) {
diff --git a/core/java/android/gadget/GadgetProvider.java b/core/java/android/gadget/GadgetProvider.java
new file mode 100755
index 0000000..1ddfe3f
--- /dev/null
+++ b/core/java/android/gadget/GadgetProvider.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (C) 2006 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 android.gadget;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+
+/**
+ * A conveience class to aid in implementing a gadget provider.
+ * Everything you can do with GadgetProvider, you can do with a regular {@link BroadcastReceiver}.
+ * GadgetProvider merely parses the relevant fields out of the Intent that is received in
+ * {@link #onReceive(Context,Intent) onReceive(Context,Intent)}, and calls hook methods
+ * with the received extras.
+ *
+ * <p>Extend this class and override one or more of the {@link #onUpdate}, {@link #onDeleted},
+ * {@link #onEnabled} or {@link #onDisabled} methods to implement your own gadget functionality.
+ *
+ * <h3>Sample Code</h3>
+ * For an example of how to write a gadget provider, see the
+ * <a href="{@toroot}reference/android/gadget/package-descr.html#providers">android.gadget
+ * package overview</a>.
+ */
+public class GadgetProvider extends BroadcastReceiver {
+    /**
+     * Constructor to initialize GadgetProvider.
+     */
+    public GadgetProvider() {
+    }
+
+    /**
+     * Implements {@link BroadcastReceiver#onReceive} to dispatch calls to the various
+     * other methods on GadgetProvider.  
+     *
+     * @param context The Context in which the receiver is running.
+     * @param intent The Intent being received.
+     */
+    // BEGIN_INCLUDE(onReceive)
+    public void onReceive(Context context, Intent intent) {
+        // Protect against rogue update broadcasts (not really a security issue,
+        // just filter bad broacasts out so subclasses are less likely to crash).
+        String action = intent.getAction();
+        if (GadgetManager.GADGET_UPDATE_ACTION.equals(action)) {
+            Bundle extras = intent.getExtras();
+            if (extras != null) {
+                int[] gadgetIds = extras.getIntArray(GadgetManager.EXTRA_GADGET_IDS);
+                if (gadgetIds != null && gadgetIds.length > 0) {
+                    this.onUpdate(context, GadgetManager.getInstance(context), gadgetIds);
+                }
+            }
+        }
+        else if (GadgetManager.GADGET_DELETED_ACTION.equals(action)) {
+            Bundle extras = intent.getExtras();
+            if (extras != null) {
+                int[] gadgetIds = extras.getIntArray(GadgetManager.EXTRA_GADGET_IDS);
+                if (gadgetIds != null && gadgetIds.length > 0) {
+                    this.onDeleted(context, gadgetIds);
+                }
+            }
+        }
+        else if (GadgetManager.GADGET_ENABLED_ACTION.equals(action)) {
+            this.onEnabled(context);
+        }
+        else if (GadgetManager.GADGET_DISABLED_ACTION.equals(action)) {
+            this.onDisabled(context);
+        }
+    }
+    // END_INCLUDE(onReceive)
+    
+    /**
+     * Called in response to the {@link GadgetManager#GADGET_UPDATE_ACTION} broadcast when
+     * this gadget provider is being asked to provide {@link android.widget.RemoteViews RemoteViews}
+     * for a set of gadgets.  Override this method to implement your own gadget functionality.
+     *
+     * {@more}
+     * <p class="note">If you want this method called, you must declare in an intent-filter in
+     * your AndroidManifest.xml file that you accept the GADGET_UPDATE_ACTION intent action.
+     * For example:
+     * <font color=red>TODO: SAMPLE CODE GOES HERE</font>
+     * </p>
+     * 
+     * @param context   The {@link android.content.Context Context} in which this receiver is
+     *                  running.
+     * @param gadgetManager A {@link GadgetManager} object you can call {@link
+     *                  GadgetManager#updateGadgets} on.
+     * @param gadgetIds The gadgetsIds for which an update is needed.  Note that this
+     *                  may be all of the gadget instances for this provider, or just
+     *                  a subset of them.
+     *
+     * @see GadgetManager#GADGET_UPDATE_ACTION
+     */
+    public void onUpdate(Context context, GadgetManager gadgetManager, int[] gadgetIds) {
+    }
+    
+    /**
+     * Called in response to the {@link GadgetManager#GADGET_DELETED_ACTION} broadcast when
+     * one or more gadget instances have been deleted.  Override this method to implement
+     * your own gadget functionality.
+     *
+     * {@more}
+     * <p class="note">If you want this method called, you must declare in an intent-filter in
+     * your AndroidManifest.xml file that you accept the GADGET_DELETED_ACTION intent action.
+     * For example:
+     * <font color=red>TODO: SAMPLE CODE GOES HERE</font>
+     * </p>
+     * 
+     * @param context   The {@link android.content.Context Context} in which this receiver is
+     *                  running.
+     * @param gadgetIds The gadgetsIds that have been deleted from their host.
+     *
+     * @see GadgetManager#GADGET_DELETED_ACTION
+     */
+    public void onDeleted(Context context, int[] gadgetIds) {
+    }
+
+    /**
+     * Called in response to the {@link GadgetManager#GADGET_ENABLED_ACTION} broadcast when
+     * the a gadget for this provider is instantiated.  Override this method to implement your
+     * own gadget functionality.
+     *
+     * {@more}
+     * When the last gadget for this provider is deleted,
+     * {@link GadgetManager#GADGET_DISABLED_ACTION} is sent and {@link #onDisabled}
+     * is called.  If after that, a gadget for this provider is created again, onEnabled() will
+     * be called again.
+     *
+     * <p class="note">If you want this method called, you must declare in an intent-filter in
+     * your AndroidManifest.xml file that you accept the GADGET_ENABLED_ACTION intent action.
+     * For example:
+     * <font color=red>TODO: SAMPLE CODE GOES HERE</font>
+     * </p>
+     * 
+     * @param context   The {@link android.content.Context Context} in which this receiver is
+     *                  running.
+     *
+     * @see GadgetManager#GADGET_ENABLED_ACTION
+     */
+    public void onEnabled(Context context) {
+    }
+
+    /**
+     * Called in response to the {@link GadgetManager#GADGET_DISABLED_ACTION} broadcast, which
+     * is sent when the last gadget instance for this provider is deleted.  Override this method
+     * to implement your own gadget functionality.
+     *
+     * {@more}
+     * <p class="note">If you want this method called, you must declare in an intent-filter in
+     * your AndroidManifest.xml file that you accept the GADGET_DISABLED_ACTION intent action.
+     * For example:
+     * <font color=red>TODO: SAMPLE CODE GOES HERE</font>
+     * </p>
+     * 
+     * @param context   The {@link android.content.Context Context} in which this receiver is
+     *                  running.
+     *
+     * @see GadgetManager#GADGET_DISABLED_ACTION
+     */
+    public void onDisabled(Context context) {
+    }
+}
diff --git a/core/java/android/gadget/package.html b/core/java/android/gadget/package.html
index 280ccfb..4b8b9d9 100644
--- a/core/java/android/gadget/package.html
+++ b/core/java/android/gadget/package.html
@@ -1,4 +1,51 @@
 <body>
-@hide
+{@hide}
+<p>Android allows applications to publish views to be embedded in other applications.  These
+views are called gadgets, and are published by "gadget providers."  The component that can
+contain gadgets is called a "gadget host."  See the links below for more information.
+</p>
+<h3><a href="{@toroot}reference/android/gadget/package-descr.html#providers">Gadget Providers</a></h3>
+<ul>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#provider_manifest">Declaring a gadget in the AndroidManifest</a></li>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#provider_meta_data">Adding the {@link android.gadget.GadgetInfo GadgetInfo} meta-data</a></li>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#provider_GadgetProvider">Using the {@link android.gadget.GadgetProvider GadgetProvider} class</a></li>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#provider_configuration">Gadget Configuration UI</a></li>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#provider_broadcasts">Gadget Broadcast Intents</a></li>
+</ul>
+<h3><a href="{@toroot}reference/android/gadget/package-descr.html#">Gadget Hosts</a></h3>
+<ul>
+  <li><a href="{@toroot}reference/android/gadget/package-descr.html#">asdf</a></li>
+</ul>
+{@more}
+<h2><a name="providers"></a>Gadget Providers</h2>
+<p>Any application can publish gadgets.  All an application needs to do to publish a gadget is
+to have a {@link android.content.BroadcastReceiver} that receives the {@link
+android.gadget.GadgetManager#GADGET_UPDATE_ACTION GadgetManager.GADGET_UPDATE_ACTION} intent,
+and provide some meta-data about the gadget.
+
+<h3><a name="provider_manifest"></a>Declaring a gadget in the AndroidManifest</h3>
+
+<h3><a name="provider_meta_data"></a>Adding the {@link android.gadget.GadgetInfo GadgetInfo} meta-data</h3>
+
+<h3><a name="provider_GadgetProvider"></a>Using the {@link android.gadget.GadgetProvider GadgetProvider} class</h3>
+
+<h3><a name="provider_configuration"></a>Gadget Configuration UI</h3>
+
+<h3><a name="providers_broadcasts"></a>Gadget Broadcast Intents</h3>
+
+<p>{@link GadgetProvider} is just a convenience class.  If you would like to receive the
+gadget broadcasts directly, you can.  By way of example, the implementation of
+{@link GadgetProvider.onReceive} is quite simple:</p>
+
+{@sample frameworks/base/core/java/android/gadget/GadgetProvider.java onReceive}
+
+
+<h2>Gadget Hosts</h3>
+<p>Gadget hosts are the containers in which gadgets can be placed.  Most of the look and feel
+details are left up to the gadget hosts.  For example, the home screen has one way of viewing
+gadgets, but the lock screen could also contain gadgets, and it would have a different way of
+adding, removing and otherwise managing gadgets.</p>
+<p>For more information on implementing your own gadget host, see the
+{@link android.gadget.GadgetHost GadgetHost} class.</p>
 </body>
 
diff --git a/core/java/android/hardware/GeomagneticField.java b/core/java/android/hardware/GeomagneticField.java
new file mode 100644
index 0000000..b4c04b1
--- /dev/null
+++ b/core/java/android/hardware/GeomagneticField.java
@@ -0,0 +1,409 @@
+/*
+ * Copyright (C) 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.
+ */
+
+package android.hardware;
+
+import java.util.GregorianCalendar;
+
+/**
+ * This class is used to estimated estimate magnetic field at a given point on
+ * Earth, and in particular, to compute the magnetic declination from true
+ * north.
+ *
+ * <p>This uses the World Magnetic Model produced by the United States National
+ * Geospatial-Intelligence Agency.  More details about the model can be found at
+ * <a href="http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml">http://www.ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml</a>.
+ * This class currently uses WMM-2005 which is valid until 2010, but should
+ * produce acceptable results for several years after that.
+ */
+public class GeomagneticField {
+    // The magnetic field at a given point, in nonoteslas in geodetic
+    // coordinates.
+    private float mX;
+    private float mY;
+    private float mZ;
+
+    // Geocentric coordinates -- set by computeGeocentricCoordinates.
+    private float mGcLatitudeRad;
+    private float mGcLongitudeRad;
+    private float mGcRadiusKm;
+
+    // Constants from WGS84 (the coordinate system used by GPS)
+    static private final float EARTH_SEMI_MAJOR_AXIS_KM = 6378.137f;
+    static private final float EARTH_SEMI_MINOR_AXIS_KM = 6356.7523f;
+    static private final float EARTH_REFERENCE_RADIUS_KM = 6371.2f;
+
+    // These coefficients and the formulae used below are from:
+    // NOAA Technical Report: The US/UK World Magnetic Model for 2005-2010
+    static private final float[][] G_COEFF = new float[][] {
+        { 0f },
+        { -29556.8f, -1671.7f },
+        { -2340.6f, 3046.9f, 1657.0f },
+        { 1335.4f, -2305.1f, 1246.7f, 674.0f },
+        { 919.8f, 798.1f, 211.3f, -379.4f, 100.0f },
+        { -227.4f, 354.6f, 208.7f, -136.5f, -168.3f, -14.1f },
+        { 73.2f, 69.7f, 76.7f, -151.2f, -14.9f, 14.6f, -86.3f },
+        { 80.1f, -74.5f, -1.4f, 38.5f, 12.4f, 9.5f, 5.7f, 1.8f },
+        { 24.9f, 7.7f, -11.6f, -6.9f, -18.2f, 10.0f, 9.2f, -11.6f, -5.2f },
+        { 5.6f, 9.9f, 3.5f, -7.0f, 5.1f, -10.8f, -1.3f, 8.8f, -6.7f, -9.1f },
+        { -2.3f, -6.3f, 1.6f, -2.6f, 0.0f, 3.1f, 0.4f, 2.1f, 3.9f, -0.1f, -2.3f },
+        { 2.8f, -1.6f, -1.7f, 1.7f, -0.1f, 0.1f, -0.7f, 0.7f, 1.8f, 0.0f, 1.1f, 4.1f },
+        { -2.4f, -0.4f, 0.2f, 0.8f, -0.3f, 1.1f, -0.5f, 0.4f, -0.3f, -0.3f, -0.1f,
+          -0.3f, -0.1f } };
+
+    static private final float[][] H_COEFF = new float[][] {
+        { 0f },
+        { 0.0f, 5079.8f },
+        { 0.0f, -2594.7f, -516.7f },
+        { 0.0f, -199.9f, 269.3f, -524.2f },
+        { 0.0f, 281.5f, -226.0f, 145.8f, -304.7f },
+        { 0.0f, 42.4f, 179.8f, -123.0f, -19.5f, 103.6f },
+        { 0.0f, -20.3f, 54.7f, 63.6f, -63.4f, -0.1f, 50.4f },
+        { 0.0f, -61.5f, -22.4f, 7.2f, 25.4f, 11.0f, -26.4f, -5.1f },
+        { 0.0f, 11.2f, -21.0f, 9.6f, -19.8f, 16.1f, 7.7f, -12.9f, -0.2f },
+        { 0.0f, -20.1f, 12.9f, 12.6f, -6.7f, -8.1f, 8.0f, 2.9f, -7.9f, 6.0f },
+        { 0.0f, 2.4f, 0.2f, 4.4f, 4.8f, -6.5f, -1.1f, -3.4f, -0.8f, -2.3f, -7.9f },
+        { 0.0f, 0.3f, 1.2f, -0.8f, -2.5f, 0.9f, -0.6f, -2.7f, -0.9f, -1.3f, -2.0f, -1.2f },
+        { 0.0f, -0.4f, 0.3f, 2.4f, -2.6f, 0.6f, 0.3f, 0.0f, 0.0f, 0.3f, -0.9f, -0.4f,
+          0.8f } };
+
+    static private final float[][] DELTA_G = new float[][] {
+        { 0f },
+        { 8.0f, 10.6f },
+        { -15.1f, -7.8f, -0.8f },
+        { 0.4f, -2.6f, -1.2f, -6.5f },
+        { -2.5f, 2.8f, -7.0f, 6.2f, -3.8f },
+        { -2.8f, 0.7f, -3.2f, -1.1f, 0.1f, -0.8f },
+        { -0.7f, 0.4f, -0.3f, 2.3f, -2.1f, -0.6f, 1.4f },
+        { 0.2f, -0.1f, -0.3f, 1.1f, 0.6f, 0.5f, -0.4f, 0.6f },
+        { 0.1f, 0.3f, -0.4f, 0.3f, -0.3f, 0.2f, 0.4f, -0.7f, 0.4f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } };
+
+    static private final float[][] DELTA_H = new float[][] {
+        { 0f },
+        { 0.0f, -20.9f },
+        { 0.0f, -23.2f, -14.6f },
+        { 0.0f, 5.0f, -7.0f, -0.6f },
+        { 0.0f, 2.2f, 1.6f, 5.8f, 0.1f },
+        { 0.0f, 0.0f, 1.7f, 2.1f, 4.8f, -1.1f },
+        { 0.0f, -0.6f, -1.9f, -0.4f, -0.5f, -0.3f, 0.7f },
+        { 0.0f, 0.6f, 0.4f, 0.2f, 0.3f, -0.8f, -0.2f, 0.1f },
+        { 0.0f, -0.2f, 0.1f, 0.3f, 0.4f, 0.1f, -0.2f, 0.4f, 0.4f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
+        { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f } };
+
+    static private final long BASE_TIME =
+        new GregorianCalendar(2005, 1, 1).getTimeInMillis();
+
+    // The ratio between the Gauss-normalized associated Legendre functions and
+    // the Schmid quasi-normalized ones. Compute these once staticly since they
+    // don't depend on input variables at all.
+    static private final float[][] SCHMIDT_QUASI_NORM_FACTORS =
+        computeSchmidtQuasiNormFactors(G_COEFF.length);
+
+    /**
+     * Estimate the magnetic field at a given point and time.
+     *
+     * @param gdLatitudeDeg
+     *            Latitude in WGS84 geodetic coordinates -- positive is east.
+     * @param gdLongitudeDeg
+     *            Longitude in WGS84 geodetic coordinates -- positive is north.
+     * @param altitudeMeters
+     *            Altitude in WGS84 geodetic coordinates, in meters.
+     * @param timeMillis
+     *            Time at which to evaluate the declination, in milliseconds
+     *            since January 1, 1970. (approximate is fine -- the declination
+     *            changes very slowly).
+     */
+    public GeomagneticField(float gdLatitudeDeg,
+                            float gdLongitudeDeg,
+                            float altitudeMeters,
+                            long timeMillis) {
+        final int MAX_N = G_COEFF.length; // Maximum degree of the coefficients.
+
+        // We don't handle the north and south poles correctly -- pretend that
+        // we're not quite at them to avoid crashing.
+        gdLatitudeDeg = Math.min(90.0f - 1e-5f,
+                                 Math.max(-90.0f + 1e-5f, gdLatitudeDeg));
+        computeGeocentricCoordinates(gdLatitudeDeg,
+                                     gdLongitudeDeg,
+                                     altitudeMeters);
+
+        assert G_COEFF.length == H_COEFF.length;
+
+        // Note: LegendreTable computes associated Legendre functions for
+        // cos(theta).  We want the associated Legendre functions for
+        // sin(latitude), which is the same as cos(PI/2 - latitude), except the
+        // derivate will be negated.
+        LegendreTable legendre =
+            new LegendreTable(MAX_N - 1,
+                              (float) (Math.PI / 2.0 - mGcLatitudeRad));
+
+        // Compute a table of (EARTH_REFERENCE_RADIUS_KM / radius)^n for i in
+        // 0..MAX_N-2 (this is much faster than calling Math.pow MAX_N+1 times).
+        float[] relativeRadiusPower = new float[MAX_N + 2];
+        relativeRadiusPower[0] = 1.0f;
+        relativeRadiusPower[1] = EARTH_REFERENCE_RADIUS_KM / mGcRadiusKm;
+        for (int i = 2; i < relativeRadiusPower.length; ++i) {
+            relativeRadiusPower[i] = relativeRadiusPower[i - 1] *
+                relativeRadiusPower[1];
+        }
+
+        // Compute tables of sin(lon * m) and cos(lon * m) for m = 0..MAX_N --
+        // this is much faster than calling Math.sin and Math.com MAX_N+1 times.
+        float[] sinMLon = new float[MAX_N];
+        float[] cosMLon = new float[MAX_N];
+        sinMLon[0] = 0.0f;
+        cosMLon[0] = 1.0f;
+        sinMLon[1] = (float) Math.sin(mGcLongitudeRad);
+        cosMLon[1] = (float) Math.cos(mGcLongitudeRad);
+
+        for (int m = 2; m < MAX_N; ++m) {
+            // Standard expansions for sin((m-x)*theta + x*theta) and
+            // cos((m-x)*theta + x*theta).
+            int x = m >> 1;
+            sinMLon[m] = sinMLon[m-x] * cosMLon[x] + cosMLon[m-x] * sinMLon[x];
+            cosMLon[m] = cosMLon[m-x] * cosMLon[x] - sinMLon[m-x] * sinMLon[x];
+        }
+
+        float inverseCosLatitude = 1.0f / (float) Math.cos(mGcLatitudeRad);
+        float yearsSinceBase =
+            (timeMillis - BASE_TIME) / (365f * 24f * 60f * 60f * 1000f);
+
+        // We now compute the magnetic field strength given the geocentric
+        // location. The magnetic field is the derivative of the potential
+        // function defined by the model. See NOAA Technical Report: The US/UK
+        // World Magnetic Model for 2005-2010 for the derivation.
+        float gcX = 0.0f;  // Geocentric northwards component.
+        float gcY = 0.0f;  // Geocentric eastwards component.
+        float gcZ = 0.0f;  // Geocentric downwards component.
+
+        for (int n = 1; n < MAX_N; n++) {
+            for (int m = 0; m <= n; m++) {
+                // Adjust the coefficients for the current date.
+                float g = G_COEFF[n][m] + yearsSinceBase * DELTA_G[n][m];
+                float h = H_COEFF[n][m] + yearsSinceBase * DELTA_H[n][m];
+
+                // Negative derivative with respect to latitude, divided by
+                // radius.  This looks like the negation of the version in the
+                // NOAA Techincal report because that report used
+                // P_n^m(sin(theta)) and we use P_n^m(cos(90 - theta)), so the
+                // derivative with respect to theta is negated.
+                gcX += relativeRadiusPower[n+2]
+                    * (g * cosMLon[m] + h * sinMLon[m])
+                    * legendre.mPDeriv[n][m]
+                    * SCHMIDT_QUASI_NORM_FACTORS[n][m];
+
+                // Negative derivative with respect to longitude, divided by
+                // radius.
+                gcY += relativeRadiusPower[n+2] * m
+                    * (g * sinMLon[m] - h * cosMLon[m])
+                    * legendre.mP[n][m]
+                    * SCHMIDT_QUASI_NORM_FACTORS[n][m]
+                    * inverseCosLatitude;
+
+                // Negative derivative with respect to radius.
+                gcZ -= (n + 1) * relativeRadiusPower[n+2]
+                    * (g * cosMLon[m] + h * sinMLon[m])
+                    * legendre.mP[n][m]
+                    * SCHMIDT_QUASI_NORM_FACTORS[n][m];
+            }
+        }
+
+        // Convert back to geodetic coordinates.  This is basically just a
+        // rotation around the Y-axis by the difference in latitudes between the
+        // geocentric frame and the geodetic frame.
+        double latDiffRad = Math.toRadians(gdLatitudeDeg) - mGcLatitudeRad;
+        mX = (float) (gcX * Math.cos(latDiffRad)
+                      + gcZ * Math.sin(latDiffRad));
+        mY = gcY;
+        mZ = (float) (- gcX * Math.sin(latDiffRad)
+                      + gcZ * Math.cos(latDiffRad));
+    }
+
+    /**
+     * @return The X (northward) component of the magnetic field in nanoteslas.
+     */
+    public float getX() {
+        return mX;
+    }
+
+    /**
+     * @return The Y (eastward) component of the magnetic field in nanoteslas.
+     */
+    public float getY() {
+        return mY;
+    }
+
+    /**
+     * @return The Z (downward) component of the magnetic field in nanoteslas.
+     */
+    public float getZ() {
+        return mZ;
+    }
+
+    /**
+     * @return The declination of the horizontal component of the magnetic
+     *         field from true north, in degrees (i.e. positive means the
+     *         magnetic field is rotated east that much from true north).
+     */
+    public float getDeclination() {
+        return (float) Math.toDegrees(Math.atan2(mY, mX));
+    }
+
+    /**
+     * @return The inclination of the magnetic field in degrees -- positive
+     *         means the magnetic field is rotated downwards.
+     */
+    public float getInclination() {
+        return (float) Math.toDegrees(Math.atan2(mZ,
+                                                 getHorizontalStrength()));
+    }
+
+    /**
+     * @return  Horizontal component of the field strength in nonoteslas.
+     */
+    public float getHorizontalStrength() {
+        return (float) Math.sqrt(mX * mX + mY * mY);
+    }
+
+    /**
+     * @return  Total field strength in nanoteslas.
+     */
+    public float getFieldStrength() {
+        return (float) Math.sqrt(mX * mX + mY * mY + mZ * mZ);
+    }
+
+    /**
+     * @param gdLatitudeDeg
+     *            Latitude in WGS84 geodetic coordinates.
+     * @param gdLongitudeDeg
+     *            Longitude in WGS84 geodetic coordinates.
+     * @param altitudeMeters
+     *            Altitude above sea level in WGS84 geodetic coordinates.
+     * @return Geocentric latitude (i.e. angle between closest point on the
+     *         equator and this point, at the center of the earth.
+     */
+    private void computeGeocentricCoordinates(float gdLatitudeDeg,
+                                              float gdLongitudeDeg,
+                                              float altitudeMeters) {
+        float altitudeKm = altitudeMeters / 1000.0f;
+        float a2 = EARTH_SEMI_MAJOR_AXIS_KM * EARTH_SEMI_MAJOR_AXIS_KM;
+        float b2 = EARTH_SEMI_MINOR_AXIS_KM * EARTH_SEMI_MINOR_AXIS_KM;
+        double gdLatRad = Math.toRadians(gdLatitudeDeg);
+        float clat = (float) Math.cos(gdLatRad);
+        float slat = (float) Math.sin(gdLatRad);
+        float tlat = slat / clat;
+        float latRad =
+            (float) Math.sqrt(a2 * clat * clat + b2 * slat * slat);
+
+        mGcLatitudeRad = (float) Math.atan(tlat * (latRad * altitudeKm + b2)
+                                           / (latRad * altitudeKm + a2));
+
+        mGcLongitudeRad = (float) Math.toRadians(gdLongitudeDeg);
+
+        float radSq = altitudeKm * altitudeKm
+            + 2 * altitudeKm * (float) Math.sqrt(a2 * clat * clat +
+                                                 b2 * slat * slat)
+            + (a2 * a2 * clat * clat + b2 * b2 * slat * slat)
+            / (a2 * clat * clat + b2 * slat * slat);
+        mGcRadiusKm = (float) Math.sqrt(radSq);
+    }
+
+
+    /**
+     * Utility class to compute a table of Gauss-normalized associated Legendre
+     * functions P_n^m(cos(theta))
+     */
+    static private class LegendreTable {
+        // These are the Gauss-normalized associated Legendre functions -- that
+        // is, they are normal Legendre functions multiplied by
+        // (n-m)!/(2n-1)!! (where (2n-1)!! = 1*3*5*...*2n-1)
+        public final float[][] mP;
+
+        // Derivative of mP, with respect to theta.
+        public final float[][] mPDeriv;
+
+        /**
+         * @param maxN
+         *            The maximum n- and m-values to support
+         * @param thetaRad
+         *            Returned functions will be Gauss-normalized
+         *            P_n^m(cos(thetaRad)), with thetaRad in radians.
+         */
+        public LegendreTable(int maxN, float thetaRad) {
+            // Compute the table of Gauss-normalized associated Legendre
+            // functions using standard recursion relations. Also compute the
+            // table of derivatives using the derivative of the recursion
+            // relations.
+            float cos = (float) Math.cos(thetaRad);
+            float sin = (float) Math.sin(thetaRad);
+
+            mP = new float[maxN + 1][];
+            mPDeriv = new float[maxN + 1][];
+            mP[0] = new float[] { 1.0f };
+            mPDeriv[0] = new float[] { 0.0f };
+            for (int n = 1; n <= maxN; n++) {
+            	mP[n] = new float[n + 1];
+                mPDeriv[n] = new float[n + 1];
+                for (int m = 0; m <= n; m++) {
+                    if (n == m) {
+                        mP[n][m] = sin * mP[n - 1][m - 1];
+                        mPDeriv[n][m] = cos * mP[n - 1][m - 1]
+                            + sin * mPDeriv[n - 1][m - 1];
+                    } else if (n == 1 || m == n - 1) {
+                        mP[n][m] = cos * mP[n - 1][m];
+                        mPDeriv[n][m] = -sin * mP[n - 1][m]
+                            + cos * mPDeriv[n - 1][m];
+                    } else {
+                        assert n > 1 && m < n - 1;
+                        float k = ((n - 1) * (n - 1) - m * m)
+                            / (float) ((2 * n - 1) * (2 * n - 3));
+                        mP[n][m] = cos * mP[n - 1][m] - k * mP[n - 2][m];
+                        mPDeriv[n][m] = -sin * mP[n - 1][m]
+                            + cos * mPDeriv[n - 1][m] - k * mPDeriv[n - 2][m];
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Compute the ration between the Gauss-normalized associated Legendre
+     * functions and the Schmidt quasi-normalized version. This is equivalent to
+     * sqrt((m==0?1:2)*(n-m)!/(n+m!))*(2n-1)!!/(n-m)!
+     */
+    private static float[][] computeSchmidtQuasiNormFactors(int maxN) {
+        float[][] schmidtQuasiNorm = new float[maxN + 1][];
+        schmidtQuasiNorm[0] = new float[] { 1.0f };
+        for (int n = 1; n <= maxN; n++) {
+            schmidtQuasiNorm[n] = new float[n + 1];
+            schmidtQuasiNorm[n][0] =
+                schmidtQuasiNorm[n - 1][0] * (2 * n - 1) / (float) n;
+            for (int m = 1; m <= n; m++) {
+                schmidtQuasiNorm[n][m] = schmidtQuasiNorm[n][m - 1]
+                    * (float) Math.sqrt((n - m + 1) * (m == 1 ? 2 : 1)
+                                / (float) (n + m));
+            }
+        }
+        return schmidtQuasiNorm;
+    }
+}
\ No newline at end of file
diff --git a/core/java/android/hardware/ISensorService.aidl b/core/java/android/hardware/ISensorService.aidl
index 8aad9b4..04af2ae 100644
--- a/core/java/android/hardware/ISensorService.aidl
+++ b/core/java/android/hardware/ISensorService.aidl
@@ -25,5 +25,5 @@
 interface ISensorService
 {
     ParcelFileDescriptor getDataChanel();
-    boolean enableSensor(IBinder listener, int sensor, int enable);
+    boolean enableSensor(IBinder listener, String name, int sensor, int enable);
 }
diff --git a/core/java/android/hardware/SensorManager.java b/core/java/android/hardware/SensorManager.java
index f02094e..3981f27 100644
--- a/core/java/android/hardware/SensorManager.java
+++ b/core/java/android/hardware/SensorManager.java
@@ -741,7 +741,7 @@
      */
     @Deprecated
     public void unregisterListener(SensorListener listener) {
-        unregisterListener(listener, SENSOR_ALL);
+        unregisterListener(listener, SENSOR_ALL | SENSOR_ORIENTATION_RAW);
     }
 
     /**
@@ -829,9 +829,11 @@
                     }
                 }
 
+                String name = sensor.getName();
+                int handle = sensor.getHandle();
                 if (l == null) {
                     l = new ListenerDelegate(listener, sensor, handler);
-                    result = mSensorService.enableSensor(l, sensor.getHandle(), delay);
+                    result = mSensorService.enableSensor(l, name, handle, delay);
                     if (result) {
                         sListeners.add(l);
                         sListeners.notify();
@@ -840,7 +842,7 @@
                         sSensorThread.startLocked(mSensorService);
                     }
                 } else {
-                    result = mSensorService.enableSensor(l, sensor.getHandle(), delay);
+                    result = mSensorService.enableSensor(l, name, handle, delay);
                     if (result) {
                         l.addSensor(sensor);
                     }
@@ -861,8 +863,9 @@
                     ListenerDelegate l = sListeners.get(i);
                     if (l.getListener() == listener) {
                         // disable these sensors
+                        String name = sensor.getName();
                         int handle = sensor.getHandle();
-                        mSensorService.enableSensor(l, handle, SENSOR_DISABLE);
+                        mSensorService.enableSensor(l, name, handle, SENSOR_DISABLE);
                         // if we have no more sensors enabled on this listener,
                         // take it off the list.
                         if (l.removeSensor(sensor) == 0) {
@@ -886,7 +889,9 @@
                     if (l.getListener() == listener) {
                         // disable all sensors for this listener
                         for (Sensor sensor : l.getSensors()) {
-                            mSensorService.enableSensor(l, sensor.getHandle(), SENSOR_DISABLE);
+                            String name = sensor.getName();
+                            int handle = sensor.getHandle();
+                            mSensorService.enableSensor(l, name, handle, SENSOR_DISABLE);
                         }
                         sListeners.remove(i);
                         break;
diff --git a/core/java/android/inputmethodservice/AbstractInputMethodService.java b/core/java/android/inputmethodservice/AbstractInputMethodService.java
index 7d02f65..eedcc35 100644
--- a/core/java/android/inputmethodservice/AbstractInputMethodService.java
+++ b/core/java/android/inputmethodservice/AbstractInputMethodService.java
@@ -24,6 +24,9 @@
 import android.view.inputmethod.InputMethod;
 import android.view.inputmethod.InputMethodSession;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
 /**
  * AbstractInputMethodService provides a abstract base class for input methods.
  * Normal input method implementations will not derive from this directly,
@@ -156,6 +159,13 @@
      */
     public abstract AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
     
+    /**
+     * Implement this to handle {@link android.os.Binder#dump Binder.dump()}
+     * calls on your input method.
+     */
+    protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+    }
+
     @Override
     final public IBinder onBind(Intent intent) {
         if (mInputMethod == null) {
diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java
index e59f38b..d9f10a9 100644
--- a/core/java/android/inputmethodservice/ExtractEditText.java
+++ b/core/java/android/inputmethodservice/ExtractEditText.java
@@ -2,6 +2,7 @@
 
 import android.content.Context;
 import android.util.AttributeSet;
+import android.view.inputmethod.ExtractedText;
 import android.widget.EditText;
 
 /***
@@ -9,6 +10,9 @@
  * extracted text in a full-screen input method.
  */
 public class ExtractEditText extends EditText {
+    private InputMethodService mIME;
+    private int mSettingExtractedText;
+    
     public ExtractEditText(Context context) {
         super(context, null);
     }
@@ -20,4 +24,101 @@
     public ExtractEditText(Context context, AttributeSet attrs, int defStyle) {
         super(context, attrs, defStyle);
     }
+    
+    void setIME(InputMethodService ime) {
+        mIME = ime;
+    }
+    
+    /**
+     * Start making changes that will not be reported to the client.  That
+     * is, {@link #onSelectionChanged(int, int)} will not result in sending
+     * the new selection to the client
+     */
+    public void startInternalChanges() {
+        mSettingExtractedText += 1;
+    }
+    
+    /**
+     * Finish making changes that will not be reported to the client.  That
+     * is, {@link #onSelectionChanged(int, int)} will not result in sending
+     * the new selection to the client
+     */
+    public void finishInternalChanges() {
+        mSettingExtractedText -= 1;
+    }
+    
+    /**
+     * Implement just to keep track of when we are setting text from the
+     * client (vs. seeing changes in ourself from the user).
+     */
+    @Override public void setExtractedText(ExtractedText text) {
+        try {
+            mSettingExtractedText++;
+            super.setExtractedText(text);
+        } finally {
+            mSettingExtractedText--;
+        }
+    }
+    
+    /**
+     * Report to the underlying text editor about selection changes.
+     */
+    @Override protected void onSelectionChanged(int selStart, int selEnd) {
+        if (mSettingExtractedText == 0 && mIME != null && selStart >= 0 && selEnd >= 0) {
+            mIME.onExtractedSelectionChanged(selStart, selEnd);
+        }
+    }
+    
+    /**
+     * Redirect clicks to the IME for handling there.  First allows any
+     * on click handler to run, though.
+     */
+    @Override public boolean performClick() {
+        if (!super.performClick() && mIME != null) {
+            mIME.onExtractedTextClicked();
+            return true;
+        }
+        return false;
+    }
+    
+    @Override public boolean onTextContextMenuItem(int id) {
+        if (mIME != null) {
+            if (mIME.onExtractTextContextMenuItem(id)) {
+                return true;
+            }
+        }
+        return super.onTextContextMenuItem(id);
+    }
+    
+    /**
+     * We are always considered to be an input method target.
+     */
+    public boolean isInputMethodTarget() {
+        return true;
+    }
+    
+    /**
+     * Pretend like the window this view is in always has focus, so its
+     * highlight and cursor will be displayed.
+     */
+    @Override public boolean hasWindowFocus() {
+        return true;
+    }
+
+    /**
+     * Pretend like this view always has focus, so its
+     * highlight and cursor will be displayed.
+     */
+    @Override public boolean isFocused() {
+        return true;
+    }
+
+    /**
+     * Pretend like this view always has focus, so its
+     * highlight and cursor will be displayed.
+     */
+    @Override public boolean hasFocus() {
+        return true;
+    }
+    
 }
diff --git a/core/java/android/inputmethodservice/IInputMethodWrapper.java b/core/java/android/inputmethodservice/IInputMethodWrapper.java
index 9abc23b..a2c75b5 100644
--- a/core/java/android/inputmethodservice/IInputMethodWrapper.java
+++ b/core/java/android/inputmethodservice/IInputMethodWrapper.java
@@ -8,6 +8,8 @@
 import com.android.internal.view.InputConnectionWrapper;
 
 import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Binder;
 import android.os.IBinder;
 import android.os.Message;
 import android.os.RemoteException;
@@ -18,6 +20,11 @@
 import android.view.inputmethod.InputMethod;
 import android.view.inputmethod.InputMethodSession;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
 /**
  * Implements the internal IInputMethod interface to convert incoming calls
  * on to it back to calls on the public InputMethod interface, scheduling
@@ -28,6 +35,7 @@
     private static final String TAG = "InputMethodWrapper";
     private static final boolean DEBUG = false;
     
+    private static final int DO_DUMP = 1;
     private static final int DO_ATTACH_TOKEN = 10;
     private static final int DO_SET_INPUT_CONTEXT = 20;
     private static final int DO_UNSET_INPUT_CONTEXT = 30;
@@ -39,9 +47,14 @@
     private static final int DO_SHOW_SOFT_INPUT = 60;
     private static final int DO_HIDE_SOFT_INPUT = 70;
    
+    final AbstractInputMethodService mTarget;
     final HandlerCaller mCaller;
     final InputMethod mInputMethod;
     
+    static class Notifier {
+        boolean notified;
+    }
+    
     // NOTE: we should have a cache of these.
     static class InputMethodSessionCallbackWrapper implements InputMethod.SessionCallback {
         final Context mContext;
@@ -64,7 +77,9 @@
         }
     }
     
-    public IInputMethodWrapper(Context context, InputMethod inputMethod) {
+    public IInputMethodWrapper(AbstractInputMethodService context,
+            InputMethod inputMethod) {
+        mTarget = context;
         mCaller = new HandlerCaller(context, this);
         mInputMethod = inputMethod;
     }
@@ -75,6 +90,20 @@
 
     public void executeMessage(Message msg) {
         switch (msg.what) {
+            case DO_DUMP: {
+                HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+                try {
+                    mTarget.dump((FileDescriptor)args.arg1,
+                            (PrintWriter)args.arg2, (String[])args.arg3);
+                } catch (RuntimeException e) {
+                    ((PrintWriter)args.arg2).println("Exception: " + e);
+                }
+                synchronized (args.arg4) {
+                    ((CountDownLatch)args.arg4).countDown();
+                }
+                return;
+            }
+            
             case DO_ATTACH_TOKEN: {
                 mInputMethod.attachToken((IBinder)msg.obj);
                 return;
@@ -86,12 +115,22 @@
             case DO_UNSET_INPUT_CONTEXT:
                 mInputMethod.unbindInput();
                 return;
-            case DO_START_INPUT:
-                mInputMethod.startInput((EditorInfo)msg.obj);
+            case DO_START_INPUT: {
+                HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+                IInputContext inputContext = (IInputContext)args.arg1;
+                InputConnection ic = inputContext != null
+                        ? new InputConnectionWrapper(inputContext) : null;
+                mInputMethod.startInput(ic, (EditorInfo)args.arg2);
                 return;
-            case DO_RESTART_INPUT:
-                mInputMethod.restartInput((EditorInfo)msg.obj);
+            }
+            case DO_RESTART_INPUT: {
+                HandlerCaller.SomeArgs args = (HandlerCaller.SomeArgs)msg.obj;
+                IInputContext inputContext = (IInputContext)args.arg1;
+                InputConnection ic = inputContext != null
+                        ? new InputConnectionWrapper(inputContext) : null;
+                mInputMethod.restartInput(ic, (EditorInfo)args.arg2);
                 return;
+            }
             case DO_CREATE_SESSION: {
                 mInputMethod.createSession(new InputMethodSessionCallbackWrapper(
                         mCaller.mContext, (IInputMethodCallback)msg.obj));
@@ -105,8 +144,7 @@
                 mInputMethod.revokeSession((InputMethodSession)msg.obj);
                 return;
             case DO_SHOW_SOFT_INPUT:
-                mInputMethod.showSoftInput(
-                        msg.arg1 != 0 ? InputMethod.SHOW_EXPLICIT : 0);
+                mInputMethod.showSoftInput(msg.arg1);
                 return;
             case DO_HIDE_SOFT_INPUT:
                 mInputMethod.hideSoftInput();
@@ -115,6 +153,28 @@
         Log.w(TAG, "Unhandled message code: " + msg.what);
     }
     
+    @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+        if (mTarget.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
+                != PackageManager.PERMISSION_GRANTED) {
+            
+            fout.println("Permission Denial: can't dump InputMethodManager from from pid="
+                    + Binder.getCallingPid()
+                    + ", uid=" + Binder.getCallingUid());
+            return;
+        }
+
+        CountDownLatch latch = new CountDownLatch(1);
+        mCaller.executeOrSendMessage(mCaller.obtainMessageOOOO(DO_DUMP,
+                fd, fout, args, latch));
+        try {
+            if (!latch.await(5, TimeUnit.SECONDS)) {
+                fout.println("Timeout waiting for dump");
+            }
+        } catch (InterruptedException e) {
+            fout.println("Interrupted waiting for dump");
+        }
+    }
+
     public void attachToken(IBinder token) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_ATTACH_TOKEN, token));
     }
@@ -130,12 +190,14 @@
         mCaller.executeOrSendMessage(mCaller.obtainMessage(DO_UNSET_INPUT_CONTEXT));
     }
 
-    public void startInput(EditorInfo attribute) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_START_INPUT, attribute));
+    public void startInput(IInputContext inputContext, EditorInfo attribute) {
+        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_START_INPUT,
+                inputContext, attribute));
     }
 
-    public void restartInput(EditorInfo attribute) {
-        mCaller.executeOrSendMessage(mCaller.obtainMessageO(DO_RESTART_INPUT, attribute));
+    public void restartInput(IInputContext inputContext, EditorInfo attribute) {
+        mCaller.executeOrSendMessage(mCaller.obtainMessageOO(DO_RESTART_INPUT,
+                inputContext, attribute));
     }
 
     public void createSession(IInputMethodCallback callback) {
@@ -163,9 +225,9 @@
         }
     }
     
-    public void showSoftInput(boolean explicit) {
+    public void showSoftInput(int flags) {
         mCaller.executeOrSendMessage(mCaller.obtainMessageI(DO_SHOW_SOFT_INPUT,
-                explicit ? 1 : 0));
+                flags));
     }
     
     public void hideSoftInput() {
diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java
index 3a9b26a..ea5f741 100644
--- a/core/java/android/inputmethodservice/InputMethodService.java
+++ b/core/java/android/inputmethodservice/InputMethodService.java
@@ -26,7 +26,13 @@
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.os.IBinder;
+import android.provider.Settings;
+import android.text.Layout;
+import android.text.Spannable;
+import android.text.method.MovementMethod;
 import android.util.Log;
+import android.util.PrintWriterPrinter;
+import android.util.Printer;
 import android.view.KeyEvent;
 import android.view.LayoutInflater;
 import android.view.MotionEvent;
@@ -45,12 +51,31 @@
 import android.view.inputmethod.EditorInfo;
 import android.widget.FrameLayout;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
 /**
  * InputMethodService provides a standard implementation of an InputMethod,
  * which final implementations can derive from and customize.  See the
  * base class {@link AbstractInputMethodService} and the {@link InputMethod}
  * interface for more information on the basics of writing input methods.
  * 
+ * <p>In addition to the normal Service lifecycle methods, this class
+ * introduces some new specific callbacks that most subclasses will want
+ * to make use of:</p>
+ * <ul>
+ * <li> {@link #onInitializeInterface()} for user-interface initialization,
+ * in particular to deal with configuration changes while the service is
+ * running.
+ * <li> {@link #onBindInput} to find out about switching to a new client.
+ * <li> {@link #onStartInput} to deal with an input session starting with
+ * the client.
+ * <li> {@link #onCreateInputView()}, {@link #onCreateCandidatesView()},
+ * and {@link #onCreateExtractTextView()} for non-demand generation of the UI.
+ * <li> {@link #onStartInputView(EditorInfo, boolean)} to deal with input
+ * starting within the input area of the IME.
+ * </ul>
+ * 
  * <p>An input method has significant discretion in how it goes about its
  * work: the {@link android.inputmethodservice.InputMethodService} provides
  * a basic framework for standard UI elements (input view, candidates view,
@@ -184,6 +209,7 @@
     LayoutInflater mInflater;
     View mRootView;
     SoftInputWindow mWindow;
+    boolean mInitialized;
     boolean mWindowCreated;
     boolean mWindowAdded;
     boolean mWindowVisible;
@@ -196,11 +222,16 @@
     InputBinding mInputBinding;
     InputConnection mInputConnection;
     boolean mInputStarted;
+    boolean mInputViewStarted;
+    boolean mCandidatesViewStarted;
+    InputConnection mStartedInputConnection;
     EditorInfo mInputEditorInfo;
     
     boolean mShowInputRequested;
     boolean mLastShowInputRequested;
-    boolean mShowCandidatesRequested;
+    int mCandidatesVisibility;
+    
+    boolean mShowInputForced;
     
     boolean mFullscreenApplied;
     boolean mIsFullscreen;
@@ -262,6 +293,7 @@
             mInputConnection = binding.getConnection();
             if (DEBUG) Log.v(TAG, "bindInput(): binding=" + binding
                     + " ic=" + mInputConnection);
+            initialize();
             onBindInput();
         }
 
@@ -277,14 +309,14 @@
             mInputConnection = null;
         }
 
-        public void startInput(EditorInfo attribute) {
+        public void startInput(InputConnection ic, EditorInfo attribute) {
             if (DEBUG) Log.v(TAG, "startInput(): editor=" + attribute);
-            doStartInput(attribute, false);
+            doStartInput(ic, attribute, false);
         }
 
-        public void restartInput(EditorInfo attribute) {
+        public void restartInput(InputConnection ic, EditorInfo attribute) {
             if (DEBUG) Log.v(TAG, "restartInput(): editor=" + attribute);
-            doStartInput(attribute, true);
+            doStartInput(ic, attribute, true);
         }
 
         /**
@@ -293,6 +325,7 @@
         public void hideSoftInput() {
             if (DEBUG) Log.v(TAG, "hideSoftInput()");
             mShowInputRequested = false;
+            mShowInputForced = false;
             hideWindow();
         }
 
@@ -316,8 +349,7 @@
                 return;
             }
             if (DEBUG) Log.v(TAG, "finishInput() in " + this);
-            onFinishInput();
-            mInputStarted = false;
+            doFinishInput();
         }
 
         /**
@@ -444,17 +476,37 @@
         mWindow.getWindow().setLayout(FILL_PARENT, WRAP_CONTENT);
     }
     
+    /**
+     * This is a hook that subclasses can use to perform initialization of
+     * their interface.  It is called for you prior to any of your UI objects
+     * being created, both after the service is first created and after a
+     * configuration change happens.
+     */
+    public void onInitializeInterface() {
+    }
+    
+    void initialize() {
+        if (!mInitialized) {
+            mInitialized = true;
+            onInitializeInterface();
+        }
+    }
+    
     void initViews() {
-        mWindowVisible = false;
+        mInitialized = false;
         mWindowCreated = false;
         mShowInputRequested = false;
-        mShowCandidatesRequested = false;
+        mShowInputForced = false;
         
         mRootView = mInflater.inflate(
                 com.android.internal.R.layout.input_method, null);
         mWindow.setContentView(mRootView);
         mRootView.getViewTreeObserver().addOnComputeInternalInsetsListener(mInsetsComputer);
-        
+        if (Settings.System.getInt(getContentResolver(),
+                Settings.System.FANCY_IME_ANIMATIONS, 0) != 0) {
+            mWindow.getWindow().setWindowAnimations(
+                    com.android.internal.R.style.Animation_InputMethodFancy);
+        }
         mExtractFrame = (FrameLayout)mRootView.findViewById(android.R.id.extractArea);
         mExtractView = null;
         mExtractEditText = null;
@@ -466,7 +518,8 @@
         mIsInputViewShown = false;
         
         mExtractFrame.setVisibility(View.GONE);
-        mCandidatesFrame.setVisibility(View.INVISIBLE);
+        mCandidatesVisibility = getCandidatesHiddenVisibility();
+        mCandidatesFrame.setVisibility(mCandidatesVisibility);
         mInputFrame.setVisibility(View.GONE);
     }
     
@@ -486,19 +539,36 @@
      * regenerating the input method UI as a result of the configuration
      * change, so you can rely on your {@link #onCreateInputView} and
      * other methods being called as appropriate due to a configuration change.
+     * 
+     * <p>When a configuration change does happen,
+     * {@link #onInitializeInterface()} is guaranteed to be called the next
+     * time prior to any of the other input or UI creation callbacks.  The
+     * following will be called immediately depending if appropriate for current 
+     * state: {@link #onStartInput} if input is active, and
+     * {@link #onCreateInputView} and {@link #onStartInputView} and related
+     * appropriate functions if the UI is displayed.
      */
     @Override public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
         
         boolean visible = mWindowVisible;
         boolean showingInput = mShowInputRequested;
-        boolean showingCandidates = mShowCandidatesRequested;
+        boolean showingForced = mShowInputForced;
+        boolean showingCandidates = mCandidatesVisibility == View.VISIBLE;
         initViews();
+        mInputViewStarted = false;
+        mCandidatesViewStarted = false;
+        if (mInputStarted) {
+            doStartInput(getCurrentInputConnection(),
+                    getCurrentInputEditorInfo(), true);
+        }
         if (visible) {
-            if (showingCandidates) {
-                setCandidatesViewShown(true);
-            }
-            if (showingInput) {
+            if (showingForced) {
+                // If we are showing the full soft keyboard, then go through
+                // this path to take care of current decisions about fullscreen
+                // etc.
+                onShowRequested(InputMethod.SHOW_FORCED|InputMethod.SHOW_EXPLICIT);
+            } else if (showingInput) {
                 // If we are showing the full soft keyboard, then go through
                 // this path to take care of current decisions about fullscreen
                 // etc.
@@ -507,6 +577,9 @@
                 // Otherwise just put it back for its candidates.
                 showWindow(false);
             }
+            if (showingCandidates) {
+                setCandidatesViewShown(true);
+            }
         }
     }
 
@@ -568,6 +641,10 @@
      * the input method, or null if there is none.
      */
     public InputConnection getCurrentInputConnection() {
+        InputConnection ic = mStartedInputConnection;
+        if (ic != null) {
+            return ic;
+        }
         return mInputConnection;
     }
     
@@ -594,6 +671,7 @@
             changed = true;
             mIsFullscreen = isFullscreen;
             mFullscreenApplied = true;
+            initialize();
             Drawable bg = onCreateBackgroundDrawable();
             if (bg == null) {
                 // We need to give the window a real drawable, so that it
@@ -708,6 +786,7 @@
             mIsInputViewShown = isShown;
             mInputFrame.setVisibility(isShown ? View.VISIBLE : View.GONE);
             if (mInputView == null) {
+                initialize();
                 View v = onCreateInputView();
                 if (v != null) {
                     setInputView(v);
@@ -717,12 +796,19 @@
     }
     
     /**
+     * Returns true if we have been asked to show our input view.
+     */
+    public boolean isShowInputRequested() {
+        return mShowInputRequested;
+    }
+    
+    /**
      * Return whether the soft input view is <em>currently</em> shown to the
      * user.  This is the state that was last determined and
      * applied by {@link #updateInputViewShown()}.
      */
     public boolean isInputViewShown() {
-        return mIsInputViewShown;
+        return mIsInputViewShown && mWindowVisible;
     }
     
     /**
@@ -744,9 +830,10 @@
      * it is hidden.
      */
     public void setCandidatesViewShown(boolean shown) {
-        if (mShowCandidatesRequested != shown) {
-            mCandidatesFrame.setVisibility(shown ? View.VISIBLE : View.INVISIBLE);
-            mShowCandidatesRequested = shown;
+        int vis = shown ? View.VISIBLE : getCandidatesHiddenVisibility();
+        if (mCandidatesVisibility != vis) {
+            mCandidatesFrame.setVisibility(vis);
+            mCandidatesVisibility = vis;
         }
         if (!mShowInputRequested && mWindowVisible != shown) {
             // If we are being asked to show the candidates view while the app
@@ -760,10 +847,24 @@
         }
     }
     
+    /**
+     * Returns the visibility mode (either {@link View#INVISIBLE View.INVISIBLE}
+     * or {@link View#GONE View.GONE}) of the candidates view when it is not
+     * shown.  The default implementation returns GONE when in fullscreen mode,
+     * otherwise VISIBLE.  Be careful if you change this to return GONE in
+     * other situations -- if showing or hiding the candidates view causes
+     * your window to resize, this can cause temporary drawing artifacts as
+     * the resize takes place.
+     */
+    public int getCandidatesHiddenVisibility() {
+        return isFullscreenMode() ? View.GONE : View.INVISIBLE;
+    }
+    
     public void setStatusIcon(int iconResId) {
         mStatusIcon = iconResId;
-        if (mInputConnection != null && mWindowVisible) {
-            mInputConnection.showStatusIcon(getPackageName(), iconResId);
+        InputConnection ic = getCurrentInputConnection();
+        if (ic != null && mWindowVisible) {
+            ic.showStatusIcon(getPackageName(), iconResId);
         }
     }
     
@@ -783,11 +884,12 @@
         mExtractFrame.removeAllViews();
         mExtractFrame.addView(view, new FrameLayout.LayoutParams(
                 ViewGroup.LayoutParams.FILL_PARENT,
-                ViewGroup.LayoutParams.WRAP_CONTENT));
+                ViewGroup.LayoutParams.FILL_PARENT));
         mExtractView = view;
         if (view != null) {
             mExtractEditText = (ExtractEditText)view.findViewById(
                     com.android.internal.R.id.inputExtractEditText);
+            mExtractEditText.setIME(this);
             startExtractingText();
         } else {
             mExtractEditText = null;
@@ -890,6 +992,72 @@
     }
     
     /**
+     * Called when the input view is being hidden from the user.  This will
+     * be called either prior to hiding the window, or prior to switching to
+     * another target for editing.
+     * 
+     * <p>The default
+     * implementation uses the InputConnection to clear any active composing
+     * text; you can override this (not calling the base class implementation)
+     * to perform whatever behavior you would like.
+     * 
+     * @boolean finishingInput If true, {@link #onFinishInput} will be
+     * called immediately after.
+     */
+    public void onFinishInputView(boolean finishingInput) {
+        if (!finishingInput) {
+            InputConnection ic = getCurrentInputConnection();
+            if (ic != null) {
+                ic.finishComposingText();
+            }
+        }
+    }
+    
+    /**
+     * Called when only the candidates view has been shown for showing
+     * processing as the user enters text through a hard keyboard.
+     * This will always be called after {@link #onStartInput},
+     * allowing you to do your general setup there and just view-specific
+     * setup here.  You are guaranteed that {@link #onCreateCandidatesView()}
+     * will have been called some time before this function is called.
+     * 
+     * <p>Note that this will <em>not</em> be called when the input method
+     * is running in full editing mode, and thus receiving
+     * {@link #onStartInputView} to initiate that operation.  This is only
+     * for the case when candidates are being shown while the input method
+     * editor is hidden but wants to show its candidates UI as text is
+     * entered through some other mechanism.
+     * 
+     * @param info Description of the type of text being edited.
+     * @param restarting Set to true if we are restarting input on the
+     * same text field as before.
+     */
+    public void onStartCandidatesView(EditorInfo info, boolean restarting) {
+    }
+    
+    /**
+     * Called when the candidates view is being hidden from the user.  This will
+     * be called either prior to hiding the window, or prior to switching to
+     * another target for editing.
+     * 
+     * <p>The default
+     * implementation uses the InputConnection to clear any active composing
+     * text; you can override this (not calling the base class implementation)
+     * to perform whatever behavior you would like.
+     * 
+     * @boolean finishingInput If true, {@link #onFinishInput} will be
+     * called immediately after.
+     */
+    public void onFinishCandidatesView(boolean finishingInput) {
+        if (!finishingInput) {
+            InputConnection ic = getCurrentInputConnection();
+            if (ic != null) {
+                ic.finishComposingText();
+            }
+        }
+    }
+    
+    /**
      * The system has decided that it may be time to show your input method.
      * This is called due to a corresponding call to your
      * {@link InputMethod#showSoftInput(int) InputMethod.showSoftInput(int)}
@@ -905,10 +1073,22 @@
         if (!onEvaluateInputViewShown()) {
             return;
         }
-        if ((flags&InputMethod.SHOW_EXPLICIT) == 0 && onEvaluateFullscreenMode()) {
-            // Don't show if this is not explicit requested by the user and
-            // the input method is fullscreen.  That would be too disruptive.
-            return;
+        if ((flags&InputMethod.SHOW_EXPLICIT) == 0) {
+            if (onEvaluateFullscreenMode()) {
+                // Don't show if this is not explicitly requested by the user and
+                // the input method is fullscreen.  That would be too disruptive.
+                return;
+            }
+            Configuration config = getResources().getConfiguration();
+            if (config.keyboard != Configuration.KEYBOARD_NOKEYS) {
+                // And if the device has a hard keyboard, even if it is
+                // currently hidden, don't show the input method implicitly.
+                // These kinds of devices don't need it that much.
+                return;
+            }
+        }
+        if ((flags&InputMethod.SHOW_FORCED) != 0) {
+            mShowInputForced = true;
         }
         showWindow(true);
     }
@@ -922,6 +1102,7 @@
                 + " mInputStarted=" + mInputStarted);
         boolean doShowInput = false;
         boolean wasVisible = mWindowVisible;
+        boolean wasCreated = mWindowCreated;
         mWindowVisible = true;
         if (!mShowInputRequested) {
             if (mInputStarted) {
@@ -935,41 +1116,66 @@
         }
         
         if (DEBUG) Log.v(TAG, "showWindow: updating UI");
+        initialize();
         updateFullscreenMode();
         updateInputViewShown();
         
         if (!mWindowAdded || !mWindowCreated) {
             mWindowAdded = true;
             mWindowCreated = true;
+            initialize();
+            if (DEBUG) Log.v(TAG, "CALL: onCreateCandidatesView");
             View v = onCreateCandidatesView();
             if (DEBUG) Log.v(TAG, "showWindow: candidates=" + v);
             if (v != null) {
                 setCandidatesView(v);
             }
         }
-        if (doShowInput) {
-            if (mInputStarted) {
-                if (DEBUG) Log.v(TAG, "showWindow: starting input view");
+        if (mShowInputRequested) {
+            if (!mInputViewStarted) {
+                if (DEBUG) Log.v(TAG, "CALL: onStartInputView");
+                mInputViewStarted = true;
                 onStartInputView(mInputEditorInfo, false);
             }
+        } else if (!mCandidatesViewStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onStartCandidatesView");
+            mCandidatesViewStarted = true;
+            onStartCandidatesView(mInputEditorInfo, false);
+        }
+        
+        if (doShowInput) {
             startExtractingText();
         }
         
         if (!wasVisible) {
             if (DEBUG) Log.v(TAG, "showWindow: showing!");
             mWindow.show();
-            if (mInputConnection != null) {
-                mInputConnection.showStatusIcon(getPackageName(), mStatusIcon);
+        }
+        
+        if (!wasVisible || !wasCreated) {
+            InputConnection ic = getCurrentInputConnection();
+            if (ic != null) {
+                ic.showStatusIcon(getPackageName(), mStatusIcon);
             }
         }
     }
     
     public void hideWindow() {
+        if (mInputViewStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onFinishInputView");
+            onFinishInputView(false);
+        } else if (mCandidatesViewStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onFinishCandidatesView");
+            onFinishCandidatesView(false);
+        }
+        mInputViewStarted = false;
+        mCandidatesViewStarted = false;
         if (mWindowVisible) {
             mWindow.hide();
             mWindowVisible = false;
-            if (mInputConnection != null) {
-                mInputConnection.hideStatusIcon();
+            InputConnection ic = getCurrentInputConnection();
+            if (ic != null) {
+                ic.hideStatusIcon();
             }
         }
     }
@@ -1008,18 +1214,45 @@
     public void onStartInput(EditorInfo attribute, boolean restarting) {
     }
     
-    void doStartInput(EditorInfo attribute, boolean restarting) {
-        if (mInputStarted && !restarting) {
+    void doFinishInput() {
+        if (mInputViewStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onFinishInputView");
+            onFinishInputView(true);
+        } else if (mCandidatesViewStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onFinishCandidatesView");
+            onFinishCandidatesView(true);
+        }
+        mInputViewStarted = false;
+        mCandidatesViewStarted = false;
+        if (mInputStarted) {
+            if (DEBUG) Log.v(TAG, "CALL: onFinishInput");
             onFinishInput();
         }
+        mInputStarted = false;
+        mStartedInputConnection = null;
+    }
+    
+    void doStartInput(InputConnection ic, EditorInfo attribute, boolean restarting) {
+        if (!restarting) {
+            doFinishInput();
+        }
         mInputStarted = true;
+        mStartedInputConnection = ic;
         mInputEditorInfo = attribute;
+        initialize();
+        if (DEBUG) Log.v(TAG, "CALL: onStartInput");
         onStartInput(attribute, restarting);
         if (mWindowVisible) {
             if (mShowInputRequested) {
+                if (DEBUG) Log.v(TAG, "CALL: onStartInputView");
+                mInputViewStarted = true;
                 onStartInputView(mInputEditorInfo, restarting);
+                startExtractingText();
+            } else if (mCandidatesVisibility == View.VISIBLE) {
+                if (DEBUG) Log.v(TAG, "CALL: onStartCandidatesView");
+                mCandidatesViewStarted = true;
+                onStartCandidatesView(mInputEditorInfo, restarting);
             }
-            startExtractingText();
         }
     }
     
@@ -1029,8 +1262,17 @@
      * {@link #onStartInput(EditorInfo, boolean)} to perform input in a
      * new editor, or the input method may be left idle.  This method is
      * <em>not</em> called when input restarts in the same editor.
+     * 
+     * <p>The default
+     * implementation uses the InputConnection to clear any active composing
+     * text; you can override this (not calling the base class implementation)
+     * to perform whatever behavior you would like.
      */
     public void onFinishInput() {
+        InputConnection ic = getCurrentInputConnection();
+        if (ic != null) {
+            ic.finishComposingText();
+        }
     }
     
     /**
@@ -1073,9 +1315,12 @@
     public void onUpdateSelection(int oldSelStart, int oldSelEnd,
             int newSelStart, int newSelEnd,
             int candidatesStart, int candidatesEnd) {
-        if (mExtractEditText != null && mExtractedText != null) {
+        final ExtractEditText eet = mExtractEditText;
+        if (eet != null && mExtractedText != null) {
             final int off = mExtractedText.startOffset;
-            mExtractEditText.setSelection(newSelStart-off, newSelEnd-off);
+            eet.startInternalChanges();
+            eet.setSelection(newSelStart-off, newSelEnd-off);
+            eet.finishInternalChanges();
         }
     }
 
@@ -1100,6 +1345,18 @@
                 .hideSoftInputFromInputMethod(mToken, flags);
     }
     
+    /**
+     * Override this to intercept key down events before they are processed by the
+     * application.  If you return true, the application will not itself
+     * process the event.  If you return true, the normal application processing
+     * will occur as if the IME had not seen the event at all.
+     * 
+     * <p>The default implementation intercepts {@link KeyEvent#KEYCODE_BACK
+     * KeyEvent.KEYCODE_BACK} to hide the current IME UI if it is shown.  In
+     * additional, in fullscreen mode only, it will consume DPAD movement
+     * events to move the cursor in the extracted text view, not allowing
+     * them to perform navigation in the underlying application.
+     */
     public boolean onKeyDown(int keyCode, KeyEvent event) {
         if (event.getKeyCode() == KeyEvent.KEYCODE_BACK
                 && event.getRepeatCount() == 0) {
@@ -1108,25 +1365,54 @@
                 // consume the back key.
                 dismissSoftInput(0);
                 return true;
-            }
-            if (mShowCandidatesRequested) {
-                // If the candidates are shown, we just want to make sure
-                // they are now hidden but otherwise let the app execute
-                // the back.
-                // XXX this needs better interaction with the soft input
-                // implementation.
-                //setCandidatesViewShown(false);
+            } else if (mWindowVisible) {
+                if (mCandidatesVisibility == View.VISIBLE) {
+                    // If we are showing candidates even if no input area, then
+                    // hide them.
+                    setCandidatesViewShown(false);
+                    return true;
+                } else {
+                    // If we have the window visible for some other reason --
+                    // most likely to show candidates -- then just get rid
+                    // of it.  This really shouldn't happen, but just in case...
+                    hideWindow();
+                    return true;
+                }
             }
         }
-        return false;
+        
+        return doMovementKey(keyCode, event, MOVEMENT_DOWN);
     }
 
+    /**
+     * Override this to intercept special key multiple events before they are
+     * processed by the
+     * application.  If you return true, the application will not itself
+     * process the event.  If you return true, the normal application processing
+     * will occur as if the IME had not seen the event at all.
+     * 
+     * <p>The default implementation always returns false, except when
+     * in fullscreen mode, where it will consume DPAD movement
+     * events to move the cursor in the extracted text view, not allowing
+     * them to perform navigation in the underlying application.
+     */
     public boolean onKeyMultiple(int keyCode, int count, KeyEvent event) {
-        return false;
+        return doMovementKey(keyCode, event, count);
     }
 
+    /**
+     * Override this to intercept key up events before they are processed by the
+     * application.  If you return true, the application will not itself
+     * process the event.  If you return true, the normal application processing
+     * will occur as if the IME had not seen the event at all.
+     * 
+     * <p>The default implementation always returns false, except when
+     * in fullscreen mode, where it will consume DPAD movement
+     * events to move the cursor in the extracted text view, not allowing
+     * them to perform navigation in the underlying application.
+     */
     public boolean onKeyUp(int keyCode, KeyEvent event) {
-        return false;
+        return doMovementKey(keyCode, event, MOVEMENT_UP);
     }
 
     public boolean onTrackballEvent(MotionEvent event) {
@@ -1136,21 +1422,176 @@
     public void onAppPrivateCommand(String action, Bundle data) {
     }
     
+    static final int MOVEMENT_DOWN = -1;
+    static final int MOVEMENT_UP = -2;
+    
+    boolean doMovementKey(int keyCode, KeyEvent event, int count) {
+        final ExtractEditText eet = mExtractEditText;
+        if (isFullscreenMode() && isInputViewShown() && eet != null) {
+            // If we are in fullscreen mode, the cursor will move around
+            // the extract edit text, but should NOT cause focus to move
+            // to other fields.
+            MovementMethod movement = eet.getMovementMethod();
+            Layout layout = eet.getLayout();
+            if (movement != null && layout != null) {
+                // We want our own movement method to handle the key, so the
+                // cursor will properly move in our own word wrapping.
+                if (count == MOVEMENT_DOWN) {
+                    if (movement.onKeyDown(eet,
+                            (Spannable)eet.getText(), keyCode, event)) {
+                        return true;
+                    }
+                } else if (count == MOVEMENT_UP) {
+                    if (movement.onKeyUp(eet,
+                            (Spannable)eet.getText(), keyCode, event)) {
+                        return true;
+                    }
+                } else {
+                    KeyEvent down = new KeyEvent(event, KeyEvent.ACTION_DOWN);
+                    if (movement.onKeyDown(eet,
+                            (Spannable)eet.getText(), keyCode, down)) {
+                        KeyEvent up = new KeyEvent(event, KeyEvent.ACTION_UP);
+                        movement.onKeyUp(eet,
+                                (Spannable)eet.getText(), keyCode, up);
+                        while (--count > 0) {
+                            movement.onKeyDown(eet,
+                                    (Spannable)eet.getText(), keyCode, down);
+                            movement.onKeyUp(eet,
+                                    (Spannable)eet.getText(), keyCode, up);
+                        }
+                    }
+                }
+            }
+            // Regardless of whether the movement method handled the key,
+            // we never allow DPAD navigation to the application.
+            switch (keyCode) {
+                case KeyEvent.KEYCODE_DPAD_LEFT:
+                case KeyEvent.KEYCODE_DPAD_RIGHT:
+                case KeyEvent.KEYCODE_DPAD_UP:
+                case KeyEvent.KEYCODE_DPAD_DOWN:
+                    return true;
+            }
+        }
+        
+        return false;
+    }
+    
+    /**
+     * This is called when the user has moved the cursor in the extracted
+     * text view, when running in fullsreen mode.  The default implementation
+     * performs the corresponding selection change on the underlying text
+     * editor.
+     */
+    public void onExtractedSelectionChanged(int start, int end) {
+        InputConnection conn = getCurrentInputConnection();
+        if (conn != null) {
+            conn.setSelection(start, end);
+        }
+    }
+    
+    /**
+     * This is called when the user has clicked on the extracted text view,
+     * when running in fullscreen mode.  The default implementation hides
+     * the candidates view when this happens.  Re-implement this to provide
+     * whatever behavior you want.
+     */
+    public void onExtractedTextClicked() {
+        setCandidatesViewShown(false);
+    }
+    
+    /**
+     * This is called when the user has selected a context menu item from the
+     * extracted text view, when running in fullscreen mode.  The default
+     * implementation sends this action to the current InputConnection's
+     * {@link InputConnection#performContextMenuAction(int)}, for it
+     * to be processed in underlying "real" editor.  Re-implement this to
+     * provide whatever behavior you want.
+     */
+    public boolean onExtractTextContextMenuItem(int id) {
+        InputConnection ic = getCurrentInputConnection();
+        if (ic != null) {
+            ic.performContextMenuAction(id);
+        }
+        return true;
+    }
+    
     void startExtractingText() {
-        if (mExtractEditText != null && getCurrentInputStarted()
+        final ExtractEditText eet = mExtractEditText;
+        if (eet != null && getCurrentInputStarted()
                 && isFullscreenMode()) {
             mExtractedToken++;
             ExtractedTextRequest req = new ExtractedTextRequest();
             req.token = mExtractedToken;
+            req.flags = InputConnection.GET_TEXT_WITH_STYLES;
             req.hintMaxLines = 10;
             req.hintMaxChars = 10000;
-            mExtractedText = mInputConnection.getExtractedText(req,
-                    InputConnection.EXTRACTED_TEXT_MONITOR);
-            if (mExtractedText != null) {
-                mExtractEditText.setExtractedText(mExtractedText);
+            mExtractedText = getCurrentInputConnection().getExtractedText(req,
+                    InputConnection.GET_EXTRACTED_TEXT_MONITOR);
+            try {
+                eet.startInternalChanges();
+                int inputType = getCurrentInputEditorInfo().inputType;
+                if ((inputType&EditorInfo.TYPE_MASK_CLASS)
+                        == EditorInfo.TYPE_CLASS_TEXT) {
+                    if ((inputType&EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
+                        inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
+                    }
+                }
+                eet.setInputType(inputType);
+                eet.setHint(mInputEditorInfo.hintText);
+                if (mExtractedText != null) {
+                    eet.setExtractedText(mExtractedText);
+                }
+            } finally {
+                eet.finishInternalChanges();
             }
-            mExtractEditText.setInputType(getCurrentInputEditorInfo().inputType);
-            mExtractEditText.setHint(mInputEditorInfo.hintText);
         }
     }
+    
+    /**
+     * Performs a dump of the InputMethodService's internal state.  Override
+     * to add your own information to the dump.
+     */
+    @Override protected void dump(FileDescriptor fd, PrintWriter fout, String[] args) {
+        final Printer p = new PrintWriterPrinter(fout);
+        p.println("Input method service state for " + this + ":");
+        p.println("  mWindowCreated=" + mWindowCreated
+                + " mWindowAdded=" + mWindowAdded
+                + " mWindowVisible=" + mWindowVisible);
+        p.println("  Configuration=" + getResources().getConfiguration());
+        p.println("  mToken=" + mToken);
+        p.println("  mInputBinding=" + mInputBinding);
+        p.println("  mInputConnection=" + mInputConnection);
+        p.println("  mStartedInputConnection=" + mStartedInputConnection);
+        p.println("  mInputStarted=" + mInputStarted
+                + " mInputViewStarted=" + mInputViewStarted
+                + " mCandidatesViewStarted=" + mCandidatesViewStarted);
+        
+        if (mInputEditorInfo != null) {
+            p.println("  mInputEditorInfo:");
+            mInputEditorInfo.dump(p, "    ");
+        } else {
+            p.println("  mInputEditorInfo: null");
+        }
+        
+        p.println("  mShowInputRequested=" + mShowInputRequested
+                + " mLastShowInputRequested=" + mLastShowInputRequested
+                + " mShowInputForced=" + mShowInputForced);
+        p.println("  mCandidatesVisibility=" + mCandidatesVisibility
+                + " mFullscreenApplied=" + mFullscreenApplied
+                + " mIsFullscreen=" + mIsFullscreen);
+        
+        if (mExtractedText != null) {
+            p.println("  mExtractedText:");
+            p.println("    text=" + mExtractedText.text.length() + " chars"
+                    + " startOffset=" + mExtractedText.startOffset);
+            p.println("    selectionStart=" + mExtractedText.selectionStart
+                    + " selectionEnd=" + mExtractedText.selectionEnd
+                    + " flags=0x" + Integer.toHexString(mExtractedText.flags));
+        } else {
+            p.println("  mExtractedText: null");
+        }
+        p.println("  mExtractedToken=" + mExtractedToken);
+        p.println("  mIsInputViewShown=" + mIsInputViewShown
+                + " mStatusIcon=" + mStatusIcon);
+    }
 }
diff --git a/core/java/android/inputmethodservice/Keyboard.java b/core/java/android/inputmethodservice/Keyboard.java
index cfd3188..228acbe 100755
--- a/core/java/android/inputmethodservice/Keyboard.java
+++ b/core/java/android/inputmethodservice/Keyboard.java
@@ -177,13 +177,13 @@
                     parent.mDisplayWidth, parent.mDefaultWidth);
             defaultHeight = getDimensionOrFraction(a, 
                     com.android.internal.R.styleable.Keyboard_keyHeight, 
-                    parent.mDisplayWidth, parent.mDefaultHeight);
-            defaultHorizontalGap = getDimensionOrFraction(a, 
+                    parent.mDisplayHeight, parent.mDefaultHeight);
+            defaultHorizontalGap = getDimensionOrFraction(a,
                     com.android.internal.R.styleable.Keyboard_horizontalGap, 
                     parent.mDisplayWidth, parent.mDefaultHorizontalGap);
             verticalGap = getDimensionOrFraction(a, 
                     com.android.internal.R.styleable.Keyboard_verticalGap, 
-                    parent.mDisplayWidth, parent.mDefaultVerticalGap);
+                    parent.mDisplayHeight, parent.mDefaultVerticalGap);
             a.recycle();
             a = res.obtainAttributes(Xml.asAttributeSet(parser),
                     com.android.internal.R.styleable.Keyboard_Row);
@@ -540,7 +540,6 @@
         row.defaultHorizontalGap = mDefaultHorizontalGap;
         row.verticalGap = mDefaultVerticalGap;
         row.rowEdgeFlags = EDGE_TOP | EDGE_BOTTOM;
-        
         final int maxColumns = columns == -1 ? Integer.MAX_VALUE : columns;
         for (int i = 0; i < characters.length(); i++) {
             char c = characters.charAt(i);
diff --git a/core/java/android/inputmethodservice/KeyboardView.java b/core/java/android/inputmethodservice/KeyboardView.java
index 2f3b54b..b2c74f2 100755
--- a/core/java/android/inputmethodservice/KeyboardView.java
+++ b/core/java/android/inputmethodservice/KeyboardView.java
@@ -149,6 +149,7 @@
     private int mMiniKeyboardOffsetY;
     private Map<Key,View> mMiniKeyboardCache;
     private int[] mWindowOffset;
+    private Key[] mKeys;
 
     /** Listener for {@link OnKeyboardActionListener}. */
     private OnKeyboardActionListener mKeyboardActionListener;
@@ -163,7 +164,7 @@
 
     private boolean mPreviewCentered = false;
     private boolean mShowPreview = true;
-    private boolean mShowTouchPoints = false;
+    private boolean mShowTouchPoints = true;
     private int mPopupPreviewX;
     private int mPopupPreviewY;
 
@@ -334,7 +335,7 @@
     }
 
     private void initGestureDetector() {
-        mGestureDetector = new GestureDetector(new GestureDetector.SimpleOnGestureListener() {
+        mGestureDetector = new GestureDetector(getContext(), new GestureDetector.SimpleOnGestureListener() {
             @Override
             public boolean onFling(MotionEvent me1, MotionEvent me2, 
                     float velocityX, float velocityY) {
@@ -386,6 +387,8 @@
             showPreview(NOT_A_KEY);
         }
         mKeyboard = keyboard;
+        List<Key> keys = mKeyboard.getKeys();
+        mKeys = keys.toArray(new Key[keys.size()]);
         requestLayout();
         invalidate();
         computeProximityThreshold(keyboard);
@@ -521,16 +524,16 @@
      */
     private void computeProximityThreshold(Keyboard keyboard) {
         if (keyboard == null) return;
-        List<Key> keys = keyboard.getKeys();
+        final Key[] keys = mKeys;
         if (keys == null) return;
-        int length = keys.size();
+        int length = keys.length;
         int dimensionSum = 0;
         for (int i = 0; i < length; i++) {
-            Key key = keys.get(i);
-            dimensionSum += key.width + key.gap + key.height; 
+            Key key = keys[i];
+            dimensionSum += Math.min(key.width, key.height) + key.gap;
         }
         if (dimensionSum < 0 || length == 0) return;
-        mProximityThreshold = dimensionSum / (length * 2);
+        mProximityThreshold = (int) (dimensionSum * 1.5f / length);
         mProximityThreshold *= mProximityThreshold; // Square it
     }
     
@@ -545,7 +548,7 @@
         final Rect padding = mPadding;
         final int kbdPaddingLeft = mPaddingLeft;
         final int kbdPaddingTop = mPaddingTop;
-        final List<Key> keys = mKeyboard.getKeys();
+        final Key[] keys = mKeys;
         final Key invalidKey = mInvalidatedKey;
         //canvas.translate(0, mKeyboardPaddingTop);
         paint.setAlpha(255);
@@ -565,9 +568,9 @@
                 drawSingleKey = true;
             }
         }
-        final int keyCount = keys.size();
+        final int keyCount = keys.length;
         for (int i = 0; i < keyCount; i++) {
-            final Key key = keys.get(i);
+            final Key key = keys[i];
             if (drawSingleKey && invalidKey != key) {
                 continue;
             }
@@ -638,15 +641,15 @@
     }
 
     private int getKeyIndices(int x, int y, int[] allKeys) {
-        final List<Key> keys = mKeyboard.getKeys();
+        final Key[] keys = mKeys;
         final boolean shifted = mKeyboard.isShifted();
         int primaryIndex = NOT_A_KEY;
         int closestKey = NOT_A_KEY;
         int closestKeyDist = mProximityThreshold + 1;
         java.util.Arrays.fill(mDistances, Integer.MAX_VALUE);
-        final int keyCount = keys.size();
+        final int keyCount = keys.length;
         for (int i = 0; i < keyCount; i++) {
-            final Key key = keys.get(i);
+            final Key key = keys[i];
             int dist = 0;
             boolean isInside = key.isInside(x,y);
             if (((mProximityCorrectOn 
@@ -694,7 +697,7 @@
     private void detectAndSendKey(int x, int y, long eventTime) {
         int index = mCurrentKey;
         if (index != NOT_A_KEY) {
-            final Key key = mKeyboard.getKeys().get(index);
+            final Key key = mKeys[index];
             if (key.text != null) {
                 for (int i = 0; i < key.text.length(); i++) {
                     mKeyboardActionListener.onKey(key.text.charAt(i), key.codes);
@@ -743,14 +746,14 @@
         
         mCurrentKeyIndex = keyIndex;
         // Release the old key and press the new key
-        final List<Key> keys = mKeyboard.getKeys();
+        final Key[] keys = mKeys;
         if (oldKeyIndex != mCurrentKeyIndex) {
-            if (oldKeyIndex != NOT_A_KEY && keys.size() > oldKeyIndex) {
-                keys.get(oldKeyIndex).onReleased(mCurrentKeyIndex == NOT_A_KEY);
+            if (oldKeyIndex != NOT_A_KEY && keys.length > oldKeyIndex) {
+                keys[oldKeyIndex].onReleased(mCurrentKeyIndex == NOT_A_KEY);
                 invalidateKey(oldKeyIndex);
             }
-            if (mCurrentKeyIndex != NOT_A_KEY && keys.size() > mCurrentKeyIndex) {
-                keys.get(mCurrentKeyIndex).onPressed();
+            if (mCurrentKeyIndex != NOT_A_KEY && keys.length > mCurrentKeyIndex) {
+                keys[mCurrentKeyIndex].onPressed();
                 invalidateKey(mCurrentKeyIndex);
             }
         }
@@ -764,7 +767,7 @@
                 }
             }
             if (keyIndex != NOT_A_KEY) {
-                Key key = keys.get(keyIndex);
+                Key key = keys[keyIndex];
                 if (key.icon != null) {
                     mPreviewText.setCompoundDrawables(null, null, null, 
                             key.iconPreview != null ? key.iconPreview : key.icon);
@@ -774,8 +777,10 @@
                     mPreviewText.setText(getPreviewText(key));
                     if (key.label.length() > 1 && key.codes.length < 2) {
                         mPreviewText.setTextSize(mLabelTextSize);
+                        mPreviewText.setTypeface(Typeface.DEFAULT_BOLD);
                     } else {
                         mPreviewText.setTextSize(mPreviewTextSizeLarge);
+                        mPreviewText.setTypeface(Typeface.DEFAULT);
                     }
                 }
                 mPreviewText.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
@@ -788,8 +793,6 @@
                     lp.width = popupWidth;
                     lp.height = popupHeight;
                 }
-                previewPopup.setWidth(popupWidth);
-                previewPopup.setHeight(popupHeight);
                 if (!mPreviewCentered) {
                     mPopupPreviewX = key.x - mPreviewText.getPaddingLeft() + mPaddingLeft;
                     mPopupPreviewY = key.y - popupHeight + mPreviewOffset;
@@ -809,25 +812,27 @@
                 mPreviewText.getBackground().setState(
                         key.popupResId != 0 ? LONG_PRESSABLE_STATE_SET : EMPTY_STATE_SET);
                 if (previewPopup.isShowing()) {
-                    previewPopup.update(mPopupParent, mPopupPreviewX + mOffsetInWindow[0],
+                    previewPopup.update(mPopupPreviewX + mOffsetInWindow[0],
                             mPopupPreviewY + mOffsetInWindow[1], 
                             popupWidth, popupHeight);
                 } else {
+                    previewPopup.setWidth(popupWidth);
+                    previewPopup.setHeight(popupHeight);
                     previewPopup.showAtLocation(mPopupParent, Gravity.NO_GRAVITY, 
                             mPopupPreviewX + mOffsetInWindow[0], 
                             mPopupPreviewY + mOffsetInWindow[1]);
                 }
-                mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, 0), 
+                mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_SHOW_PREVIEW, keyIndex, 0),
                         ViewConfiguration.getTapTimeout());
             }
         }
     }
 
     private void invalidateKey(int keyIndex) {
-        if (keyIndex < 0 || keyIndex >= mKeyboard.getKeys().size()) {
+        if (keyIndex < 0 || keyIndex >= mKeys.length) {
             return;
         }
-        final Key key = mKeyboard.getKeys().get(keyIndex);
+        final Key key = mKeys[keyIndex];
         mInvalidatedKey = key;
         invalidate(key.x + mPaddingLeft, key.y + mPaddingTop, 
                 key.x + key.width + mPaddingLeft, key.y + key.height + mPaddingTop);
@@ -838,11 +843,11 @@
         if (mPopupLayout == 0) {
             return false;
         }
-        if (mCurrentKey < 0 || mCurrentKey >= mKeyboard.getKeys().size()) {
+        if (mCurrentKey < 0 || mCurrentKey >= mKeys.length) {
             return false;
         }
 
-        Key popupKey = mKeyboard.getKeys().get(mCurrentKey);        
+        Key popupKey = mKeys[mCurrentKey];        
         boolean result = onLongPress(popupKey);
         if (result) {
             mAbortKey = true;
@@ -968,8 +973,8 @@
                 mLastMoveTime = mDownTime;
                 checkMultiTap(eventTime, keyIndex);
                 mKeyboardActionListener.onPress(keyIndex != NOT_A_KEY ? 
-                        mKeyboard.getKeys().get(keyIndex).codes[0] : 0);
-                if (mCurrentKey >= 0 && mKeyboard.getKeys().get(mCurrentKey).repeatable) {
+                        mKeys[keyIndex].codes[0] : 0);
+                if (mCurrentKey >= 0 && mKeys[mCurrentKey].repeatable) {
                     mRepeatKeyIndex = mCurrentKey;
                     repeatKey();
                     Message msg = mHandler.obtainMessage(MSG_REPEAT);
@@ -1054,7 +1059,7 @@
     }
 
     private boolean repeatKey() {
-        Key key = mKeyboard.getKeys().get(mRepeatKeyIndex);
+        Key key = mKeys[mRepeatKeyIndex];
         detectAndSendKey(key.x, key.y, mLastTapTime);
         return true;
     }
@@ -1113,7 +1118,7 @@
     
     private void checkMultiTap(long eventTime, int keyIndex) {
         if (keyIndex == NOT_A_KEY) return;
-        Key key = mKeyboard.getKeys().get(keyIndex);
+        Key key = mKeys[keyIndex];
         if (key.codes.length > 1) {
             mInMultiTap = true;
             if (eventTime < mLastTapTime + MULTITAP_INTERVAL
diff --git a/core/java/android/inputmethodservice/SoftInputWindow.java b/core/java/android/inputmethodservice/SoftInputWindow.java
index 9ff1665..da67c6d 100644
--- a/core/java/android/inputmethodservice/SoftInputWindow.java
+++ b/core/java/android/inputmethodservice/SoftInputWindow.java
@@ -18,6 +18,7 @@
 
 import android.app.Dialog;
 import android.content.Context;
+import android.content.pm.ActivityInfo;
 import android.os.IBinder;
 import android.view.Gravity;
 import android.view.WindowManager;
@@ -139,6 +140,8 @@
 
         lp.gravity = Gravity.BOTTOM;
         lp.width = -1;
+        // Let the input method window's orientation follow sensor based rotation
+        lp.screenOrientation = ActivityInfo.SCREEN_ORIENTATION_USER;
 
         getWindow().setAttributes(lp);
         getWindow().setFlags(
diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java
index 213813a..1429bc1 100644
--- a/core/java/android/net/ConnectivityManager.java
+++ b/core/java/android/net/ConnectivityManager.java
@@ -16,6 +16,8 @@
 
 package android.net;
 
+import android.annotation.SdkConstant;
+import android.annotation.SdkConstant.SdkConstantType;
 import android.os.RemoteException;
 
 /**
@@ -100,6 +102,18 @@
      */
     public static final String EXTRA_EXTRA_INFO = "extraInfo";
 
+    /**
+     * Broadcast Action: The setting for background data usage has changed
+     * values. Use {@link #getBackgroundDataSetting()} to get the current value.
+     * <p>
+     * If an application uses the network in the background, it should listen
+     * for this broadcast and stop using the background data if the value is
+     * false.
+     */
+    @SdkConstant(SdkConstantType.BROADCAST_INTENT_ACTION)
+    public static final String ACTION_BACKGROUND_DATA_SETTING_CHANGED =
+            "android.net.conn.BACKGROUND_DATA_SETTING_CHANGED";
+
     public static final int TYPE_MOBILE = 0;
     public static final int TYPE_WIFI   = 1;
 
@@ -224,6 +238,43 @@
     }
 
     /**
+     * Returns the value of the setting for background data usage. If false,
+     * applications should not use the network if the application is not in the
+     * foreground. Developers should respect this setting, and check the value
+     * of this before performing any background data operations.
+     * <p>
+     * All applications that have background services that use the network
+     * should listen to {@link #ACTION_BACKGROUND_DATA_SETTING_CHANGED}.
+     * 
+     * @return Whether background data usage is allowed.
+     */
+    public boolean getBackgroundDataSetting() {
+        try {
+            return mService.getBackgroundDataSetting();
+        } catch (RemoteException e) {
+            // Err on the side of safety 
+            return false;
+        }
+    }
+
+    /**
+     * Sets the value of the setting for background data usage.
+     * 
+     * @param allowBackgroundData Whether an application should use data while
+     *            it is in the background.
+     *            
+     * @attr ref android.Manifest.permission#CHANGE_BACKGROUND_DATA_SETTING
+     * @see #getBackgroundDataSetting()
+     * @hide
+     */
+    public void setBackgroundDataSetting(boolean allowBackgroundData) {
+        try {
+            mService.setBackgroundDataSetting(allowBackgroundData);
+        } catch (RemoteException e) {
+        }
+    }
+    
+    /**
      * Don't allow use of default constructor.
      */
     @SuppressWarnings({"UnusedDeclaration"})
diff --git a/core/java/android/net/IConnectivityManager.aidl b/core/java/android/net/IConnectivityManager.aidl
index e1d921f..de68598 100644
--- a/core/java/android/net/IConnectivityManager.aidl
+++ b/core/java/android/net/IConnectivityManager.aidl
@@ -44,4 +44,8 @@
     int stopUsingNetworkFeature(int networkType, in String feature);
 
     boolean requestRouteToHost(int networkType, int hostAddress);
+
+    boolean getBackgroundDataSetting();
+
+    void setBackgroundDataSetting(boolean allowBackgroundData);
 }
diff --git a/core/java/android/net/Uri.java b/core/java/android/net/Uri.java
index 32a26e4..c23df21 100644
--- a/core/java/android/net/Uri.java
+++ b/core/java/android/net/Uri.java
@@ -2235,12 +2235,13 @@
     }
 
     /**
-     * Creates a new Uri by encoding and appending a path segment to a base Uri.
+     * Creates a new Uri by appending an already-encoded path segment to a
+     * base Uri.
      *
      * @param baseUri Uri to append path segment to
-     * @param pathSegment to encode and append
-     * @return a new Uri based on baseUri with the given segment encoded and
-     * appended to the path
+     * @param pathSegment encoded path segment to append
+     * @return a new Uri based on baseUri with the given segment appended to 
+     *  the path
      * @throws NullPointerException if baseUri is null
      */
     public static Uri withAppendedPath(Uri baseUri, String pathSegment) {
diff --git a/core/java/android/net/http/AndroidHttpClient.java b/core/java/android/net/http/AndroidHttpClient.java
index 01442ae..4fb1499 100644
--- a/core/java/android/net/http/AndroidHttpClient.java
+++ b/core/java/android/net/http/AndroidHttpClient.java
@@ -26,7 +26,6 @@
 import org.apache.http.HttpResponse;
 import org.apache.http.entity.AbstractHttpEntity;
 import org.apache.http.entity.ByteArrayEntity;
-import org.apache.http.client.CookieStore;
 import org.apache.http.client.HttpClient;
 import org.apache.http.client.ResponseHandler;
 import org.apache.http.client.ClientProtocolException;
@@ -56,7 +55,6 @@
 import java.util.zip.GZIPInputStream;
 import java.util.zip.GZIPOutputStream;
 import java.net.URI;
-import java.util.concurrent.atomic.AtomicInteger;
 
 import android.util.Log;
 import android.content.ContentResolver;
@@ -347,6 +345,13 @@
         }
 
         /**
+         * Returns true if auth logging is turned on for this configuration.
+         */
+        private boolean isAuthLoggable() {
+            return Log.isLoggable(tag + "-auth", level);
+        }
+
+        /**
          * Prints a message using this configuration.
          */
         private void println(String message) {
@@ -392,7 +397,8 @@
             if (configuration != null
                     && configuration.isLoggable()
                     && request instanceof HttpUriRequest) {
-                configuration.println(toCurl((HttpUriRequest) request));
+                configuration.println(toCurl((HttpUriRequest) request,
+                        configuration.isAuthLoggable()));
             }
         }
     }
@@ -400,12 +406,17 @@
     /**
      * Generates a cURL command equivalent to the given request.
      */
-    private static String toCurl(HttpUriRequest request) throws IOException {
+    private static String toCurl(HttpUriRequest request, boolean logAuthToken) throws IOException {
         StringBuilder builder = new StringBuilder();
 
         builder.append("curl ");
 
         for (Header header: request.getAllHeaders()) {
+            if (!logAuthToken
+                    && (header.getName().equals("Authorization") ||
+                        header.getName().equals("Cookie"))) {
+                continue;
+            }
             builder.append("--header \"");
             builder.append(header.toString().trim());
             builder.append("\" ");
diff --git a/core/java/android/net/http/RequestHandle.java b/core/java/android/net/http/RequestHandle.java
index 65e6117..c4ee5b0 100644
--- a/core/java/android/net/http/RequestHandle.java
+++ b/core/java/android/net/http/RequestHandle.java
@@ -55,7 +55,7 @@
     private final static String AUTHORIZATION_HEADER = "Authorization";
     private final static String PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization";
 
-    private final static int MAX_REDIRECT_COUNT = 16;
+    public final static int MAX_REDIRECT_COUNT = 16;
 
     /**
      * Creates a new request session.
@@ -106,6 +106,14 @@
         return mRedirectCount >= MAX_REDIRECT_COUNT;
     }
 
+    public int getRedirectCount() {
+        return mRedirectCount;
+    }
+
+    public void setRedirectCount(int count) {
+        mRedirectCount = count;
+    }
+
     /**
      * Create and queue a redirect request.
      *
diff --git a/core/java/android/os/BatteryStats.java b/core/java/android/os/BatteryStats.java
index ed7c366..017b14d 100644
--- a/core/java/android/os/BatteryStats.java
+++ b/core/java/android/os/BatteryStats.java
@@ -15,19 +15,26 @@
 public abstract class BatteryStats {
 
     /**
-     * A constant indicating a partial wake lock.
+     * A constant indicating a partial wake lock timer.
      */
     public static final int WAKE_TYPE_PARTIAL = 0;
 
     /**
-     * A constant indicating a full wake lock.
+     * A constant indicating a full wake lock timer.
      */
     public static final int WAKE_TYPE_FULL = 1;
 
     /**
-     * A constant indicating a window wake lock.
+     * A constant indicating a window wake lock timer.
      */
     public static final int WAKE_TYPE_WINDOW = 2;
+    
+    /**
+     * A constant indicating a sensor timer.
+     * 
+     * {@hide}
+     */
+    public static final int SENSOR = 3;
 
     /**
      * Include all of the data in the stats, including previously saved data.
@@ -48,6 +55,21 @@
      * Include only the run since the last time the device was unplugged in the stats.
      */
     public static final int STATS_UNPLUGGED = 3;
+    
+    /**
+     * Bump the version on this if the checkin format changes.
+     */
+    private static final int BATTERY_STATS_CHECKIN_VERSION = 1;
+    
+    // TODO: Update this list if you add/change any stats above.
+    private static final String[] STAT_NAMES = { "total", "last", "current", "unplugged" };
+
+    private static final String APK_DATA = "apk";
+    private static final String PROCESS_DATA = "process";
+    private static final String SENSOR_DATA = "sensor";
+    private static final String WAKELOCK_DATA = "wakelock";
+    private static final String NETWORK_DATA = "network";
+    private static final String BATTERY_DATA = "battery";
 
     private final StringBuilder mFormatBuilder = new StringBuilder(8);
     private final Formatter mFormatter = new Formatter(mFormatBuilder);
@@ -115,8 +137,28 @@
          * @return a Map from Strings to Uid.Pkg objects.
          */
         public abstract Map<String, ? extends Pkg> getPackageStats();
+        
+        /**
+         * {@hide}
+         */
+        public abstract int getUid();
+        
+        /**
+         * {@hide}
+         */
+        public abstract long getTcpBytesReceived(int which);
+        
+        /**
+         * {@hide}
+         */
+        public abstract long getTcpBytesSent(int which);
 
         public static abstract class Sensor {
+            /**
+             * {@hide}
+             */
+            public abstract String getName();
+            
             public abstract Timer getSensorTime();
         }
 
@@ -200,6 +242,22 @@
      * Returns the number of times the device has been started.
      */
     public abstract int getStartCount();
+    
+    /**
+     * Returns the time in milliseconds that the screen has been on while the device was
+     * running on battery.
+     * 
+     * {@hide}
+     */
+    public abstract long getBatteryScreenOnTime();
+    
+    /**
+     * Returns the time in milliseconds that the screen has been on while the device was
+     * plugged in.
+     * 
+     * {@hide}
+     */
+    public abstract long getPluggedScreenOnTime();
 
     /**
      * Returns a SparseArray containing the statistics for each uid.
@@ -318,11 +376,14 @@
      * @param linePrefix a String to be prepended to each line of output.
      * @return the line prefix
      */
-    private final String printWakeLock(StringBuilder sb, Timer timer, long now,
+    private static final String printWakeLock(StringBuilder sb, Timer timer, long now,
         String name, int which, String linePrefix) {
+        
         if (timer != null) {
             // Convert from microseconds to milliseconds with rounding
-            long totalTimeMillis = (timer.getTotalTime(now, which) + 500) / 1000;
+            long totalTimeMicros = timer.getTotalTime(now, which);
+            long totalTimeMillis = (totalTimeMicros + 500) / 1000;
+            
             int count = timer.getCount(which);
             if (totalTimeMillis != 0) {
                 sb.append(linePrefix);
@@ -337,6 +398,184 @@
         }
         return linePrefix;
     }
+    
+    /**
+     * Checkin version of wakelock printer. Prints simple comma-separated list.
+     * 
+     * @param sb a StringBuilder object.
+     * @param timer a Timer object contining the wakelock times.
+     * @param now the current time in microseconds.
+     * @param name the name of the wakelock.
+     * @param which which one of STATS_TOTAL, STATS_LAST, or STATS_CURRENT.
+     * @param linePrefix a String to be prepended to each line of output.
+     * @return the line prefix
+     */
+    private static final String printWakeLockCheckin(StringBuilder sb, Timer timer, long now,
+        String name, int which, String linePrefix) {
+        long totalTimeMicros = 0;
+        int count = 0;
+        if (timer != null) {
+            totalTimeMicros = timer.getTotalTime(now, which);
+            count = timer.getCount(which); 
+        }
+        sb.append(linePrefix);
+        sb.append((totalTimeMicros + 500) / 1000); // microseconds to milliseconds with rounding
+        sb.append(',');
+        sb.append(name);
+        sb.append(',');
+        sb.append(count);
+        return ",";
+    }
+    
+    /**
+     * Dump a comma-separated line of values for terse checkin mode.
+     * 
+     * @param pw the PageWriter to dump log to
+     * @param category category of data (e.g. "total", "last", "unplugged", "current" )
+     * @param type type of data (e.g. "wakelock", "sensor", "process", "apk" ,  "process", "network")
+     * @param args type-dependent data arguments
+     */
+    private static final void dumpLine(PrintWriter pw, int uid, String category, String type, 
+           Object... args ) {
+        pw.print(BATTERY_STATS_CHECKIN_VERSION); pw.print(',');
+        pw.print(uid); pw.print(',');
+        pw.print(category); pw.print(',');
+        pw.print(type); 
+        
+        for (Object arg : args) {  
+            pw.print(','); 
+            pw.print(arg); 
+        }
+        pw.print('\n');
+    }
+    
+    /**
+     * Checkin server version of dump to produce more compact, computer-readable log.
+     * 
+     * NOTE: all times are expressed in 'ms'.
+     * @param fd
+     * @param pw
+     * @param which
+     */
+    private final void dumpCheckinLocked(FileDescriptor fd, PrintWriter pw, int which) {
+        long uSecTime = SystemClock.elapsedRealtime() * 1000;
+        final long uSecNow = getBatteryUptime(uSecTime);
+       
+        StringBuilder sb = new StringBuilder(128);
+        long batteryUptime = computeBatteryUptime(uSecNow, which);
+        long batteryRealtime = computeBatteryRealtime(getBatteryRealtime(uSecTime), which);
+        long elapsedRealtime = computeRealtime(uSecTime, which);
+        long uptime = computeUptime(SystemClock.uptimeMillis() * 1000, which);
+        
+        String category = STAT_NAMES[which];
+        
+        // Dump "battery" stat
+        dumpLine(pw, 0 /* uid */, category, BATTERY_DATA, 
+                which == STATS_TOTAL ? getStartCount() : "N/A",
+                batteryUptime / 1000, 
+                formatRatioLocked(batteryUptime, elapsedRealtime),
+                batteryRealtime / 1000, 
+                formatRatioLocked(batteryRealtime, elapsedRealtime),
+                uptime / 1000,
+                elapsedRealtime / 1000); 
+        
+        SparseArray<? extends Uid> uidStats = getUidStats();
+        final int NU = uidStats.size();
+        for (int iu = 0; iu < NU; iu++) {
+            final int uid = uidStats.keyAt(iu);
+            Uid u = uidStats.valueAt(iu);
+            // Dump Network stats per uid, if any
+            long rx = u.getTcpBytesReceived(which);
+            long tx = u.getTcpBytesSent(which);
+            if (rx > 0 || tx > 0) dumpLine(pw, uid, category, NETWORK_DATA, rx, tx);
+
+            Map<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats();
+            if (wakelocks.size() > 0) {
+                for (Map.Entry<String, ? extends BatteryStats.Uid.Wakelock> ent
+                        : wakelocks.entrySet()) {
+                    Uid.Wakelock wl = ent.getValue();
+                    String linePrefix = "";
+                    sb.setLength(0);
+                    linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_FULL), uSecNow,
+                            "full", which, linePrefix);
+                    linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_PARTIAL), uSecNow,
+                            "partial", which, linePrefix);
+                    linePrefix = printWakeLockCheckin(sb, wl.getWakeTime(WAKE_TYPE_WINDOW), uSecNow,
+                            "window", which, linePrefix);
+                    
+                    // Only log if we had at lease one wakelock...
+                    if (sb.length() > 0) {
+                       dumpLine(pw, uid, category, WAKELOCK_DATA, ent.getKey(), sb.toString());
+                    }
+                }
+            }
+                
+            Map<Integer, ? extends BatteryStats.Uid.Sensor> sensors = u.getSensorStats();
+            if (sensors.size() > 0)  {
+                for (Map.Entry<Integer, ? extends BatteryStats.Uid.Sensor> ent
+                        : sensors.entrySet()) {
+                    Uid.Sensor se = ent.getValue();
+                    int sensorNumber = ent.getKey();
+                    Timer timer = se.getSensorTime();
+                    if (timer != null) {
+                        // Convert from microseconds to milliseconds with rounding
+                        long totalTime = (timer.getTotalTime(uSecNow, which) + 500) / 1000;
+                        int count = timer.getCount(which);
+                        if (totalTime != 0) {
+                            dumpLine(pw, uid, category, SENSOR_DATA, sensorNumber, totalTime, count);
+                        }
+                    } 
+                }
+            }
+
+            Map<String, ? extends BatteryStats.Uid.Proc> processStats = u.getProcessStats();
+            if (processStats.size() > 0) {
+                for (Map.Entry<String, ? extends BatteryStats.Uid.Proc> ent
+                        : processStats.entrySet()) {
+                    Uid.Proc ps = ent.getValue();
+    
+                    long userTime = ps.getUserTime(which);
+                    long systemTime = ps.getSystemTime(which);
+                    int starts = ps.getStarts(which);
+    
+                    if (userTime != 0 || systemTime != 0 || starts != 0) {
+                        dumpLine(pw, uid, category, PROCESS_DATA, 
+                                ent.getKey(), // proc
+                                userTime * 10, // cpu time in ms
+                                systemTime * 10, // user time in ms
+                                starts); // process starts
+                    }
+                }
+            }
+
+            Map<String, ? extends BatteryStats.Uid.Pkg> packageStats = u.getPackageStats();
+            if (packageStats.size() > 0) {
+                for (Map.Entry<String, ? extends BatteryStats.Uid.Pkg> ent
+                        : packageStats.entrySet()) {
+              
+                    Uid.Pkg ps = ent.getValue();
+                    int wakeups = ps.getWakeups(which);
+                    Map<String, ? extends  Uid.Pkg.Serv> serviceStats = ps.getServiceStats();
+                    for (Map.Entry<String, ? extends BatteryStats.Uid.Pkg.Serv> sent
+                            : serviceStats.entrySet()) {
+                        BatteryStats.Uid.Pkg.Serv ss = sent.getValue();
+                        long startTime = ss.getStartTime(uSecNow, which);
+                        int starts = ss.getStarts(which);
+                        int launches = ss.getLaunches(which);
+                        if (startTime != 0 || starts != 0 || launches != 0) {
+                            dumpLine(pw, uid, category, APK_DATA, 
+                                    wakeups, // wakeup alarms
+                                    ent.getKey(), // Apk
+                                    sent.getKey(), // service
+                                    startTime / 1000, // time spent started, in ms
+                                    starts,
+                                    launches);
+                        }
+                    }
+                }
+            }
+        }
+    }
 
     @SuppressWarnings("unused")
     private final void dumpLocked(FileDescriptor fd, PrintWriter pw, String prefix, int which) {
@@ -344,13 +583,22 @@
         final long uSecNow = getBatteryUptime(uSecTime);
 
         StringBuilder sb = new StringBuilder(128);
-        if (which == STATS_TOTAL) {
-            pw.println(prefix + "Current and Historic Battery Usage Statistics:");
-            pw.println(prefix + "  System starts: " + getStartCount());
-        } else if (which == STATS_LAST) {
-            pw.println(prefix + "Last Battery Usage Statistics:");
-        } else {
-            pw.println(prefix + "Current Battery Usage Statistics:");
+        switch (which) {
+            case STATS_TOTAL:
+                pw.println(prefix + "Current and Historic Battery Usage Statistics:");
+                pw.println(prefix + "  System starts: " + getStartCount());
+                break;
+            case STATS_LAST:
+                pw.println(prefix + "Last Battery Usage Statistics:");
+                break;
+            case STATS_UNPLUGGED:
+                pw.println(prefix + "Last Unplugged Battery Usage Statistics:");
+                break;
+            case STATS_CURRENT:
+                pw.println(prefix + "Current Battery Usage Statistics:");
+                break;
+            default:
+                throw new IllegalArgumentException("which = " + which);
         }
         long batteryUptime = computeBatteryUptime(uSecNow, which);
         long batteryRealtime = computeBatteryRealtime(getBatteryRealtime(uSecTime), which);
@@ -359,7 +607,7 @@
 
         pw.println(prefix
                 + "  On battery: " + formatTimeMs(batteryUptime / 1000) + "("
-                + formatRatioLocked(batteryUptime, batteryRealtime)
+                + formatRatioLocked(batteryUptime, elapsedRealtime)
                 + ") uptime, "
                 + formatTimeMs(batteryRealtime / 1000) + "("
                 + formatRatioLocked(batteryRealtime, elapsedRealtime)
@@ -380,6 +628,9 @@
             Uid u = uidStats.valueAt(iu);
             pw.println(prefix + "  #" + uid + ":");
             boolean uidActivity = false;
+            
+            pw.println(prefix + "    Network: " + u.getTcpBytesReceived(which) + " bytes received, "
+                    + u.getTcpBytesSent(which) + " bytes sent");
 
             Map<String, ? extends BatteryStats.Uid.Wakelock> wakelocks = u.getWakelockStats();
             if (wakelocks.size() > 0) {
@@ -512,12 +763,30 @@
      */
     @SuppressWarnings("unused")
     public void dumpLocked(FileDescriptor fd, PrintWriter pw, String[] args) {
+        boolean isCheckin = false;
+        if (args != null) {
+            for (String arg : args) {
+                if ("-c".equals(arg)) {
+                    isCheckin = true;
+                    break;
+                }
+            }
+        }
         synchronized (this) {
-            dumpLocked(fd, pw, "", STATS_TOTAL);
-            pw.println("");
-            dumpLocked(fd, pw, "", STATS_LAST);
-            pw.println("");
-            dumpLocked(fd, pw, "", STATS_CURRENT);
+            if (isCheckin) {
+                dumpCheckinLocked(fd, pw, STATS_TOTAL);
+                dumpCheckinLocked(fd, pw, STATS_LAST);
+                dumpCheckinLocked(fd, pw, STATS_UNPLUGGED);
+                dumpCheckinLocked(fd, pw, STATS_CURRENT);
+            } else {
+                dumpLocked(fd, pw, "", STATS_TOTAL);
+                pw.println("");
+                dumpLocked(fd, pw, "", STATS_LAST);
+                pw.println("");
+                dumpLocked(fd, pw, "", STATS_UNPLUGGED);
+                pw.println("");
+                dumpLocked(fd, pw, "", STATS_CURRENT);
+            }
         }
     }
 }
diff --git a/core/java/android/os/Binder.java b/core/java/android/os/Binder.java
index 528e6bd..df10c6a 100644
--- a/core/java/android/os/Binder.java
+++ b/core/java/android/os/Binder.java
@@ -33,7 +33,7 @@
  * the standard support creating a local implementation of such an object.
  * 
  * <p>Most developers will not implement this class directly, instead using the
- * <a href="{@docRoot}reference/aidl.html">aidl</a> tool to describe the desired
+ * <a href="{@docRoot}guide/developing/tools/aidl.html">aidl</a> tool to describe the desired
  * interface, having it generate the appropriate Binder subclass.  You can,
  * however, derive directly from Binder to implement your own custom RPC
  * protocol or simply instantiate a raw Binder object directly to use as a
@@ -194,18 +194,15 @@
             return true;
         } else if (code == DUMP_TRANSACTION) {
             ParcelFileDescriptor fd = data.readFileDescriptor();
-            FileOutputStream fout = fd != null
-                    ? new FileOutputStream(fd.getFileDescriptor()) : null;
-            PrintWriter pw = fout != null ? new PrintWriter(fout) : null;
-            if (pw != null) {
-                String[] args = data.readStringArray();
-                dump(fd.getFileDescriptor(), pw, args);
-                pw.flush();
-            }
+            String[] args = data.readStringArray();
             if (fd != null) {
                 try {
-                    fd.close();
-                } catch (IOException e) {
+                    dump(fd.getFileDescriptor(), args);
+                } finally {
+                    try {
+                        fd.close();
+                    } catch (IOException e) {
+                    }
                 }
             }
             return true;
@@ -214,6 +211,20 @@
     }
 
     /**
+     * Implemented to call the more convenient version
+     * {@link #dump(FileDescriptor, PrintWriter, String[])}.
+     */
+    public void dump(FileDescriptor fd, String[] args) {
+        FileOutputStream fout = new FileOutputStream(fd);
+        PrintWriter pw = new PrintWriter(fout);
+        try {
+            dump(fd, pw, args);
+        } finally {
+            pw.flush();
+        }
+    }
+    
+    /**
      * Print the object's state into the given stream.
      * 
      * @param fd The raw file descriptor that the dump is being sent to.
@@ -302,6 +313,17 @@
             throws RemoteException;
     public native boolean unlinkToDeath(DeathRecipient recipient, int flags);
 
+    public void dump(FileDescriptor fd, String[] args) throws RemoteException {
+        Parcel data = Parcel.obtain();
+        data.writeFileDescriptor(fd);
+        data.writeStringArray(args);
+        try {
+            transact(DUMP_TRANSACTION, data, null, 0);
+        } finally {
+            data.recycle();
+        }
+    }
+    
     BinderProxy() {
         mSelf = new WeakReference(this);
     }