Merge "Clean up simple integer operations." into honeycomb
diff --git a/NOTICE b/NOTICE
index 8d6f583..d857ba3 100644
--- a/NOTICE
+++ b/NOTICE
@@ -72,6 +72,17 @@
 OF ANY KIND, either express or implied; not even the implied warranty
 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
+  =========================================================================
+  ==  NOTICE file corresponding to the section 4 d of                    ==
+  ==  the Apache License, Version 2.0,                                   ==
+  ==  in this case for the Audio Effects code.                           ==
+  =========================================================================
+
+Audio Effects
+These files are Copyright (C) 2004-2010 NXP Software and
+Copyright (C) 2010 The Android Open Source Project, but released under
+the Apache2 License.
+
 
                                Apache License
                            Version 2.0, January 2004
diff --git a/api/10.xml b/api/10.xml
index 3b9ab1a..15fcffe 100644
--- a/api/10.xml
+++ b/api/10.xml
@@ -157967,21 +157967,6 @@
 <parameter name="flags" type="int">
 </parameter>
 </method>
-<method name="setPackageObbPath"
- 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>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
 </class>
 <class name="MockResources"
  extends="android.content.res.Resources"
diff --git a/api/11.xml b/api/11.xml
index 5b6765b..6d12990 100644
--- a/api/11.xml
+++ b/api/11.xml
@@ -30672,6 +30672,17 @@
 <parameter name="listener" type="android.app.FragmentManager.OnBackStackChangedListener">
 </parameter>
 </method>
+<method name="beginTransaction"
+ return="android.app.FragmentTransaction"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="countBackStackEntries"
  return="int"
  abstract="true"
@@ -30782,7 +30793,7 @@
 </method>
 <method name="openTransaction"
  return="android.app.FragmentTransaction"
- abstract="true"
+ abstract="false"
  native="false"
  synchronized="false"
  static="false"
@@ -37816,7 +37827,7 @@
 </parameter>
 </method>
 <method name="getStorageEncryption"
- return="int"
+ return="boolean"
  abstract="false"
  native="false"
  synchronized="false"
@@ -37828,6 +37839,17 @@
 <parameter name="admin" type="android.content.ComponentName">
 </parameter>
 </method>
+<method name="getStorageEncryptionStatus"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="hasGrantedPolicy"
  return="boolean"
  abstract="false"
@@ -38168,7 +38190,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="3"
+ value="2"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -38179,7 +38201,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="4"
+ value="3"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -38197,17 +38219,6 @@
  visibility="public"
 >
 </field>
-<field name="ENCRYPTION_STATUS_REQUESTED"
- type="int"
- transient="false"
- volatile="false"
- value="2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
 <field name="ENCRYPTION_STATUS_UNSUPPORTED"
  type="int"
  transient="false"
@@ -60287,19 +60298,6 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
 <method name="getPackagesForUid"
  return="java.lang.String[]"
  abstract="true"
@@ -60786,21 +60784,6 @@
 <parameter name="installerPackageName" type="java.lang.String">
 </parameter>
 </method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
 <field name="COMPONENT_ENABLED_STATE_DEFAULT"
  type="int"
  transient="false"
@@ -61562,6 +61545,46 @@
  visibility="public"
 >
 </field>
+<field name="externalCacheSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalDataSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalMediaSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="externalObbSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="packageName"
  type="java.lang.String"
  transient="false"
@@ -77084,6 +77107,16 @@
  visibility="public"
 >
 </field>
+<field name="inMutable"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="inPreferQualityOverSpeed"
  type="boolean"
  transient="false"
@@ -86319,7 +86352,7 @@
 <method name="updateTexImage"
  return="void"
  abstract="false"
- native="true"
+ native="false"
  synchronized="false"
  static="false"
  final="false"
@@ -95577,6 +95610,17 @@
  visibility="public"
 >
 </field>
+<field name="TOUCHABLE_INSETS_REGION"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="3"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="TOUCHABLE_INSETS_VISIBLE"
  type="int"
  transient="false"
@@ -95608,6 +95652,16 @@
  visibility="public"
 >
 </field>
+<field name="touchableRegion"
+ type="android.graphics.Region"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="visibleTopInsets"
  type="int"
  transient="false"
@@ -147371,53 +147425,6 @@
 >
 </field>
 </class>
-<class name="StorageEventListener"
- extends="java.lang.Object"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageEventListener"
- type="android.os.storage.StorageEventListener"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="onStorageStateChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="path" type="java.lang.String">
-</parameter>
-<parameter name="oldState" type="java.lang.String">
-</parameter>
-<parameter name="newState" type="java.lang.String">
-</parameter>
-</method>
-<method name="onUsbMassStorageConnectionChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="connected" type="boolean">
-</parameter>
-</method>
-</class>
 <class name="StorageManager"
  extends="java.lang.Object"
  abstract="false"
@@ -147487,111 +147494,6 @@
 </parameter>
 </method>
 </class>
-<class name="StorageResultCode"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageResultCode"
- type="android.os.storage.StorageResultCode"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<field name="OperationFailedInternalError"
- type="int"
- transient="false"
- volatile="false"
- value="-1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaBlank"
- type="int"
- transient="false"
- volatile="false"
- value="-3"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaCorrupt"
- type="int"
- transient="false"
- volatile="false"
- value="-4"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedNoMedia"
- type="int"
- transient="false"
- volatile="false"
- value="-2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageBusy"
- type="int"
- transient="false"
- volatile="false"
- value="-7"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-6"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageNotMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationSucceeded"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
 </package>
 <package name="android.preference"
 >
@@ -167286,6 +167188,38 @@
 <parameter name="dimX" type="int">
 </parameter>
 </method>
+<method name="setFromFieldPacker"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="xoff" type="int">
+</parameter>
+<parameter name="fp" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
+<method name="setFromFieldPacker"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="xoff" type="int">
+</parameter>
+<parameter name="component_number" type="int">
+</parameter>
+<parameter name="fp" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
 <method name="syncAll"
  return="void"
  abstract="false"
@@ -173046,6 +172980,49 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<method name="bindAllocation"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="va" type="android.renderscript.Allocation">
+</parameter>
+<parameter name="slot" type="int">
+</parameter>
+</method>
+<method name="invoke"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="slot" type="int">
+</parameter>
+</method>
+<method name="invoke"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="slot" type="int">
+</parameter>
+<parameter name="v" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
 <method name="setTimeZone"
  return="void"
  abstract="false"
@@ -173059,6 +173036,111 @@
 <parameter name="timeZone" type="java.lang.String">
 </parameter>
 </method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="float">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="double">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="int">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="long">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="boolean">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="o" type="android.renderscript.BaseObj">
+</parameter>
+</method>
+<method name="setVar"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="index" type="int">
+</parameter>
+<parameter name="v" type="android.renderscript.FieldPacker">
+</parameter>
+</method>
 </class>
 <class name="Script.Builder"
  extends="java.lang.Object"
@@ -173190,6 +173272,32 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<constructor name="ScriptC"
+ type="android.renderscript.ScriptC"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="id" type="int">
+</parameter>
+<parameter name="rs" type="android.renderscript.RenderScript">
+</parameter>
+</constructor>
+<constructor name="ScriptC"
+ type="android.renderscript.ScriptC"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="rs" type="android.renderscript.RenderScript">
+</parameter>
+<parameter name="resources" type="android.content.res.Resources">
+</parameter>
+<parameter name="resourceID" type="int">
+</parameter>
+</constructor>
 </class>
 <class name="Short2"
  extends="java.lang.Object"
@@ -183646,6 +183754,17 @@
  visibility="public"
 >
 </method>
+<method name="getObbDir"
+ return="java.io.File"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getPackageCodePath"
  return="java.lang.String"
  abstract="false"
@@ -185234,19 +185353,6 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
 <method name="getPackagesForUid"
  return="java.lang.String[]"
  abstract="false"
@@ -185731,36 +185837,6 @@
 <parameter name="installerPackageName" type="java.lang.String">
 </parameter>
 </method>
-<method name="setPackageObbPath"
- 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>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
-<method name="setPackageObbPaths"
- 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>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
 </class>
 <class name="MockResources"
  extends="android.content.res.Resources"
diff --git a/api/9.xml b/api/9.xml
index 3b9ab1a..15fcffe 100644
--- a/api/9.xml
+++ b/api/9.xml
@@ -157967,21 +157967,6 @@
 <parameter name="flags" type="int">
 </parameter>
 </method>
-<method name="setPackageObbPath"
- 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>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
 </class>
 <class name="MockResources"
  extends="android.content.res.Resources"
diff --git a/api/current.xml b/api/current.xml
index ef23af2..6d12990 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -30672,6 +30672,17 @@
 <parameter name="listener" type="android.app.FragmentManager.OnBackStackChangedListener">
 </parameter>
 </method>
+<method name="beginTransaction"
+ return="android.app.FragmentTransaction"
+ abstract="true"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="countBackStackEntries"
  return="int"
  abstract="true"
@@ -30782,7 +30793,7 @@
 </method>
 <method name="openTransaction"
  return="android.app.FragmentTransaction"
- abstract="true"
+ abstract="false"
  native="false"
  synchronized="false"
  static="false"
@@ -37816,7 +37827,7 @@
 </parameter>
 </method>
 <method name="getStorageEncryption"
- return="int"
+ return="boolean"
  abstract="false"
  native="false"
  synchronized="false"
@@ -37828,6 +37839,17 @@
 <parameter name="admin" type="android.content.ComponentName">
 </parameter>
 </method>
+<method name="getStorageEncryptionStatus"
+ return="int"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="hasGrantedPolicy"
  return="boolean"
  abstract="false"
@@ -38168,7 +38190,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="3"
+ value="2"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -38179,7 +38201,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="4"
+ value="3"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -38197,17 +38219,6 @@
  visibility="public"
 >
 </field>
-<field name="ENCRYPTION_STATUS_REQUESTED"
- type="int"
- transient="false"
- volatile="false"
- value="2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
 <field name="ENCRYPTION_STATUS_UNSUPPORTED"
  type="int"
  transient="false"
@@ -60287,19 +60298,6 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
 <method name="getPackagesForUid"
  return="java.lang.String[]"
  abstract="true"
@@ -60786,21 +60784,6 @@
 <parameter name="installerPackageName" type="java.lang.String">
 </parameter>
 </method>
-<method name="setPackageObbPaths"
- return="void"
- abstract="true"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
 <field name="COMPONENT_ENABLED_STATE_DEFAULT"
  type="int"
  transient="false"
@@ -61592,6 +61575,16 @@
  visibility="public"
 >
 </field>
+<field name="externalObbSize"
+ type="long"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="packageName"
  type="java.lang.String"
  transient="false"
@@ -77114,6 +77107,16 @@
  visibility="public"
 >
 </field>
+<field name="inMutable"
+ type="boolean"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="inPreferQualityOverSpeed"
  type="boolean"
  transient="false"
@@ -86349,7 +86352,7 @@
 <method name="updateTexImage"
  return="void"
  abstract="false"
- native="true"
+ native="false"
  synchronized="false"
  static="false"
  final="false"
@@ -147422,53 +147425,6 @@
 >
 </field>
 </class>
-<class name="StorageEventListener"
- extends="java.lang.Object"
- abstract="true"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageEventListener"
- type="android.os.storage.StorageEventListener"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<method name="onStorageStateChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="path" type="java.lang.String">
-</parameter>
-<parameter name="oldState" type="java.lang.String">
-</parameter>
-<parameter name="newState" type="java.lang.String">
-</parameter>
-</method>
-<method name="onUsbMassStorageConnectionChanged"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="connected" type="boolean">
-</parameter>
-</method>
-</class>
 <class name="StorageManager"
  extends="java.lang.Object"
  abstract="false"
@@ -147538,111 +147494,6 @@
 </parameter>
 </method>
 </class>
-<class name="StorageResultCode"
- extends="java.lang.Object"
- abstract="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<constructor name="StorageResultCode"
- type="android.os.storage.StorageResultCode"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-</constructor>
-<field name="OperationFailedInternalError"
- type="int"
- transient="false"
- volatile="false"
- value="-1"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaBlank"
- type="int"
- transient="false"
- volatile="false"
- value="-3"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedMediaCorrupt"
- type="int"
- transient="false"
- volatile="false"
- value="-4"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedNoMedia"
- type="int"
- transient="false"
- volatile="false"
- value="-2"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageBusy"
- type="int"
- transient="false"
- volatile="false"
- value="-7"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-6"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationFailedStorageNotMounted"
- type="int"
- transient="false"
- volatile="false"
- value="-5"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="OperationSucceeded"
- type="int"
- transient="false"
- volatile="false"
- value="0"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
 </package>
 <package name="android.preference"
 >
@@ -183903,6 +183754,17 @@
  visibility="public"
 >
 </method>
+<method name="getObbDir"
+ return="java.io.File"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getPackageCodePath"
  return="java.lang.String"
  abstract="false"
@@ -185491,19 +185353,6 @@
 <exception name="PackageManager.NameNotFoundException" type="android.content.pm.PackageManager.NameNotFoundException">
 </exception>
 </method>
-<method name="getPackageObbPaths"
- return="java.lang.String[]"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="packageName" type="java.lang.String">
-</parameter>
-</method>
 <method name="getPackagesForUid"
  return="java.lang.String[]"
  abstract="false"
@@ -185988,36 +185837,6 @@
 <parameter name="installerPackageName" type="java.lang.String">
 </parameter>
 </method>
-<method name="setPackageObbPath"
- 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>
-<parameter name="path" type="java.lang.String">
-</parameter>
-</method>
-<method name="setPackageObbPaths"
- 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>
-<parameter name="paths" type="java.lang.String[]">
-</parameter>
-</method>
 </class>
 <class name="MockResources"
  extends="android.content.res.Resources"
diff --git a/core/java/android/app/ApplicationPackageManager.java b/core/java/android/app/ApplicationPackageManager.java
index b64069d..079d4cf 100644
--- a/core/java/android/app/ApplicationPackageManager.java
+++ b/core/java/android/app/ApplicationPackageManager.java
@@ -1103,25 +1103,6 @@
         return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
     }
 
-    @Override
-    public void setPackageObbPaths(String packageName, String[] paths) {
-        try {
-            mPM.setPackageObbPaths(packageName, paths);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
-    }
-
-    @Override
-    public String[] getPackageObbPaths(String packageName) {
-        try {
-            return mPM.getPackageObbPaths(packageName);
-        } catch (RemoteException e) {
-            // Should never happen!
-        }
-        return null;
-    }
-
     private final ContextImpl mContext;
     private final IPackageManager mPM;
 
diff --git a/core/java/android/app/DialogFragment.java b/core/java/android/app/DialogFragment.java
index 6194240..6f25293 100644
--- a/core/java/android/app/DialogFragment.java
+++ b/core/java/android/app/DialogFragment.java
@@ -218,7 +218,7 @@
      * {@link FragmentTransaction#add(Fragment, String) FragmentTransaction.add}.
      */
     public void show(FragmentManager manager, String tag) {
-        FragmentTransaction ft = manager.openTransaction();
+        FragmentTransaction ft = manager.beginTransaction();
         ft.add(this, tag);
         ft.commit();
     }
@@ -260,7 +260,7 @@
                     FragmentManager.POP_BACK_STACK_INCLUSIVE);
             mBackStackId = -1;
         } else {
-            FragmentTransaction ft = getFragmentManager().openTransaction();
+            FragmentTransaction ft = getFragmentManager().beginTransaction();
             ft.remove(this);
             if (allowStateLoss) {
                 ft.commitAllowingStateLoss();
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java
index eb9b8a3..e35ef87 100644
--- a/core/java/android/app/FragmentManager.java
+++ b/core/java/android/app/FragmentManager.java
@@ -100,8 +100,13 @@
      * in the state, and if changes are made after the state is saved then they
      * will be lost.</p>
      */
-    public abstract FragmentTransaction openTransaction();
+    public abstract FragmentTransaction beginTransaction();
 
+    /** Old API */
+    public FragmentTransaction openTransaction() {
+        return beginTransaction();
+    }
+    
     /**
      * After a {@link FragmentTransaction} is committed with
      * {@link FragmentTransaction#commit FragmentTransaction.commit()}, it
@@ -347,7 +352,7 @@
     };
 
     @Override
-    public FragmentTransaction openTransaction() {
+    public FragmentTransaction beginTransaction() {
         return new BackStackRecord(this);
     }
 
diff --git a/core/java/android/app/LoaderManager.java b/core/java/android/app/LoaderManager.java
index 1ef011c..cd5e3bb 100644
--- a/core/java/android/app/LoaderManager.java
+++ b/core/java/android/app/LoaderManager.java
@@ -60,7 +60,7 @@
          * Called when a previously created loader has finished its load.  Note
          * that normally an application is <em>not</em> allowed to commit fragment
          * transactions while in this call, since it can happen after an
-         * activity's state is saved.  See {@link FragmentManager#openTransaction()
+         * activity's state is saved.  See {@link FragmentManager#beginTransaction()
          * FragmentManager.openTransaction()} for further discussion on this.
          * 
          * <p>This function is guaranteed to be called prior to the release of
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 4186fec..3f3aa74 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1093,38 +1093,32 @@
     }
 
     /**
-     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
      * indicating that encryption is not supported.
      */
     public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0;
 
     /**
-     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
      * indicating that encryption is supported, but is not currently active.
      */
     public static final int ENCRYPTION_STATUS_INACTIVE = 1;
 
     /**
-     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
-     * indicating that encryption is not currently active, but has been requested.
-     */
-    public static final int ENCRYPTION_STATUS_REQUESTED = 2;
-
-    /**
-     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
      * indicating that encryption is not currently active, but is currently
      * being activated.  This is only reported by devices that support
      * encryption of data and only when the storage is currently
      * undergoing a process of becoming encrypted.  A device that must reboot and/or wipe data
      * to become encrypted will never return this value.
      */
-    public static final int ENCRYPTION_STATUS_ACTIVATING = 3;
+    public static final int ENCRYPTION_STATUS_ACTIVATING = 2;
 
     /**
-     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryption}:
+     * Result code for {@link #setStorageEncryption} and {@link #getStorageEncryptionStatus}:
      * indicating that encryption is active.
      */
-    public static final int ENCRYPTION_STATUS_ACTIVE = 4;
+    public static final int ENCRYPTION_STATUS_ACTIVE = 3;
 
     /**
      * Activity action: begin the process of encrypting data on the device.  This activity should
@@ -1139,14 +1133,7 @@
 
     /**
      * Called by an application that is administering the device to
-     * request that the storage system be encrypted.  Depending
-     * on the returned status code, the caller may proceed in different
-     * ways.  If the result is {@link #ENCRYPTION_STATUS_UNSUPPORTED}, the
-     * storage system does not support encryption.  If the
-     * result is {@link #ENCRYPTION_STATUS_REQUESTED}, use {@link
-     * #ACTION_START_ENCRYPTION} to begin the process of encrypting or decrypting the
-     * storage.  If the result is {@link #ENCRYPTION_STATUS_ACTIVATING} or
-     * {@link #ENCRYPTION_STATUS_ACTIVE}, no further action is required.
+     * request that the storage system be encrypted.
      *
      * <p>When multiple device administrators attempt to control device
      * encryption, the most secure, supported setting will always be
@@ -1167,7 +1154,10 @@
      *
      * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
      * @param encrypt true to request encryption, false to release any previous request
-     * @return current status of encryption
+     * @return the new request status (for all active admins) - will be one of
+     * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE}, or
+     * {@link #ENCRYPTION_STATUS_ACTIVE}.  This is the value of the requests;  Use
+     * {@link #getStorageEncryptionStatus()} to query the actual device state.
      */
     public int setStorageEncryption(ComponentName admin, boolean encrypt) {
         if (mService != null) {
@@ -1182,12 +1172,14 @@
 
     /**
      * Called by an application that is administering the device to
-     * determine the encryption status of a specific storage system.
+     * determine the requested setting for secure storage.
      *
-     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.
-     * @return current status of encryption
+     * @param admin Which {@link DeviceAdminReceiver} this request is associated with.  If null,
+     * this will return the requested encryption setting as an aggregate of all active
+     * administrators.
+     * @return true if the admin(s) are requesting encryption, false if not.
      */
-    public int getStorageEncryption(ComponentName admin) {
+    public boolean getStorageEncryption(ComponentName admin) {
         if (mService != null) {
             try {
                 return mService.getStorageEncryption(admin);
@@ -1195,6 +1187,33 @@
                 Log.w(TAG, "Failed talking with device policy service", e);
             }
         }
+        return false;
+    }
+
+    /**
+     * Called by an application that is administering the device to
+     * determine the current encryption status of the device.
+     *
+     * Depending on the returned status code, the caller may proceed in different
+     * ways.  If the result is {@link #ENCRYPTION_STATUS_UNSUPPORTED}, the
+     * storage system does not support encryption.  If the
+     * result is {@link #ENCRYPTION_STATUS_INACTIVE}, use {@link
+     * #ACTION_START_ENCRYPTION} to begin the process of encrypting or decrypting the
+     * storage.  If the result is {@link #ENCRYPTION_STATUS_ACTIVATING} or
+     * {@link #ENCRYPTION_STATUS_ACTIVE}, no further action is required.
+     *
+     * @return current status of encryption.  The value will be one of
+     * {@link #ENCRYPTION_STATUS_UNSUPPORTED}, {@link #ENCRYPTION_STATUS_INACTIVE},
+     * {@link #ENCRYPTION_STATUS_ACTIVATING}, or{@link #ENCRYPTION_STATUS_ACTIVE}.
+     */
+    public int getStorageEncryptionStatus() {
+        if (mService != null) {
+            try {
+                return mService.getStorageEncryptionStatus();
+            } catch (RemoteException e) {
+                Log.w(TAG, "Failed talking with device policy service", e);
+            }
+        }
         return ENCRYPTION_STATUS_UNSUPPORTED;
     }
 
diff --git a/core/java/android/app/admin/IDevicePolicyManager.aidl b/core/java/android/app/admin/IDevicePolicyManager.aidl
index d3b5cf3..e8caca1 100644
--- a/core/java/android/app/admin/IDevicePolicyManager.aidl
+++ b/core/java/android/app/admin/IDevicePolicyManager.aidl
@@ -76,7 +76,8 @@
     ComponentName getGlobalProxyAdmin();
 
     int setStorageEncryption(in ComponentName who, boolean encrypt);
-    int getStorageEncryption(in ComponentName who);
+    boolean getStorageEncryption(in ComponentName who);
+    int getStorageEncryptionStatus();
 
     void setActiveAdmin(in ComponentName policyReceiver, boolean refreshing);
     boolean isAdminActive(in ComponentName policyReceiver);
diff --git a/core/java/android/content/pm/IPackageManager.aidl b/core/java/android/content/pm/IPackageManager.aidl
index 28e1a63..034525e 100644
--- a/core/java/android/content/pm/IPackageManager.aidl
+++ b/core/java/android/content/pm/IPackageManager.aidl
@@ -323,7 +323,4 @@
 
     boolean setInstallLocation(int loc);
     int getInstallLocation();
-
-    void setPackageObbPaths(in String packageName, in String[] paths);
-    String[] getPackageObbPaths(in String packageName);
 }
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 47418aa..6e9cdbe 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -2289,32 +2289,4 @@
      */
     public abstract void movePackage(
             String packageName, IPackageMoveObserver observer, int flags);
-
-    /**
-     * Sets the Opaque Binary Blob (OBB) file path associated with a package
-     * name. The caller must have the
-     * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
-     * <p>
-     * NOTE: The existence or format of this file is not currently checked, but
-     * it may be in the future.
-     * 
-     * @param packageName Name of the package with which to associate the .obb
-     *            file.
-     * @param paths Arrays of paths on the filesystem to the .obb files
-     *            associated with the package.
-     * @see #getPackageObbPaths(String)
-     */
-    public abstract void setPackageObbPaths(String packageName, String[] paths);
-
-    /**
-     * Gets the Opaque Binary Blob (OBB) file path associated with the package.
-     * The caller must be the owner of the package queried or have the
-     * {@link android.Manifest.permission#INSTALL_PACKAGES} permission.
-     * 
-     * @param packageName Name of the package with which to associate the .obb
-     *            file.
-     * @return array of paths to .obb files associated with the package
-     * @see #setPackageObbPaths(String, String[])
-     */
-    public abstract String[] getPackageObbPaths(String packageName);
 }
diff --git a/core/java/android/content/pm/PackageStats.java b/core/java/android/content/pm/PackageStats.java
index 28a2886..11068e5 100755
--- a/core/java/android/content/pm/PackageStats.java
+++ b/core/java/android/content/pm/PackageStats.java
@@ -55,6 +55,9 @@
     /** Size of the external media size used by the application. */
     public long externalMediaSize;
 
+    /** Size of the package's OBBs placed on external media. */
+    public long externalObbSize;
+
     public static final Parcelable.Creator<PackageStats> CREATOR
             = new Parcelable.Creator<PackageStats>() {
         public PackageStats createFromParcel(Parcel in) {
@@ -83,6 +86,8 @@
         sb.append(externalCacheSize);
         sb.append(",externalMediaSize=");
         sb.append(externalMediaSize);
+        sb.append(",externalObbSize=");
+        sb.append(externalObbSize);
         return sb.toString();
     }
 
@@ -98,6 +103,7 @@
         externalDataSize = source.readLong();
         externalCacheSize = source.readLong();
         externalMediaSize = source.readLong();
+        externalObbSize = source.readLong();
     }
 
     public PackageStats(PackageStats pStats) {
@@ -108,6 +114,7 @@
         externalDataSize = pStats.externalDataSize;
         externalCacheSize = pStats.externalCacheSize;
         externalMediaSize = pStats.externalMediaSize;
+        externalObbSize = pStats.externalObbSize;
     }
 
     public int describeContents() {
@@ -122,5 +129,6 @@
         dest.writeLong(externalDataSize);
         dest.writeLong(externalCacheSize);
         dest.writeLong(externalMediaSize);
+        dest.writeLong(externalObbSize);
     }
 }
diff --git a/core/java/android/os/storage/StorageEventListener.java b/core/java/android/os/storage/StorageEventListener.java
index d3d39d6..6c73d04 100644
--- a/core/java/android/os/storage/StorageEventListener.java
+++ b/core/java/android/os/storage/StorageEventListener.java
@@ -18,6 +18,8 @@
 
 /**
  * Used for receiving notifications from the StorageManager
+ * 
+ * @hide
  */
 public abstract class StorageEventListener {
     /**
diff --git a/core/java/android/os/storage/StorageResultCode.java b/core/java/android/os/storage/StorageResultCode.java
index 07d95df..8e7db31 100644
--- a/core/java/android/os/storage/StorageResultCode.java
+++ b/core/java/android/os/storage/StorageResultCode.java
@@ -19,6 +19,8 @@
 /**
  * Class that provides access to constants returned from StorageManager
  * and lower level MountService APIs.
+ * 
+ * @hide
  */
 public class StorageResultCode
 {
diff --git a/core/java/android/preference/Preference.java b/core/java/android/preference/Preference.java
index e869f3f..7d37e5b 100644
--- a/core/java/android/preference/Preference.java
+++ b/core/java/android/preference/Preference.java
@@ -285,7 +285,7 @@
      * @see #Preference(Context, AttributeSet, int)
      */
     public Preference(Context context, AttributeSet attrs) {
-        this(context, attrs, 0);
+        this(context, attrs, com.android.internal.R.attr.preferenceStyle);
     }
 
     /**
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index 7a186f3..ee3bdab 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -1044,7 +1044,7 @@
         getFragmentManager().popBackStack(BACK_STACK_PREFS,
                 FragmentManager.POP_BACK_STACK_INCLUSIVE);
         Fragment f = Fragment.instantiate(this, fragmentName, args);
-        FragmentTransaction transaction = getFragmentManager().openTransaction();
+        FragmentTransaction transaction = getFragmentManager().beginTransaction();
         transaction.setTransition(direction == 0 ? FragmentTransaction.TRANSIT_NONE
                 : direction > 0 ? FragmentTransaction.TRANSIT_FRAGMENT_NEXT
                         : FragmentTransaction.TRANSIT_FRAGMENT_PREV);
@@ -1136,7 +1136,7 @@
      * the current fragment will be replaced.
      */
     public void startPreferenceFragment(Fragment fragment, boolean push) {
-        FragmentTransaction transaction = getFragmentManager().openTransaction();
+        FragmentTransaction transaction = getFragmentManager().beginTransaction();
         transaction.replace(com.android.internal.R.id.prefs, fragment);
         if (push) {
             transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
@@ -1175,7 +1175,7 @@
             if (resultTo != null) {
                 f.setTargetFragment(resultTo, resultRequestCode);
             }
-            FragmentTransaction transaction = getFragmentManager().openTransaction();
+            FragmentTransaction transaction = getFragmentManager().beginTransaction();
             transaction.replace(com.android.internal.R.id.prefs, f);
             if (titleRes != 0) {
                 transaction.setBreadCrumbTitle(titleRes);
diff --git a/core/java/android/widget/DatePicker.java b/core/java/android/widget/DatePicker.java
index dbcf1e9..4d63cf4 100644
--- a/core/java/android/widget/DatePicker.java
+++ b/core/java/android/widget/DatePicker.java
@@ -471,6 +471,8 @@
      */
     public void init(int year, int monthOfYear, int dayOfMonth,
             OnDateChangedListener onDateChangedListener) {
+        // make sure there is no callback
+        mOnDateChangedListener = null;
         updateDate(year, monthOfYear, dayOfMonth);
         // register the callback after updating the date
         mOnDateChangedListener = onDateChangedListener;
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index 472a335..8279ee5 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -211,7 +211,7 @@
                 .getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorLeft, 0);
         mIndicatorRight = a
                 .getDimensionPixelSize(com.android.internal.R.styleable.ExpandableListView_indicatorRight, 0);
-        if (mIndicatorRight == 0) {
+        if (mIndicatorRight == 0 && mGroupIndicator != null) {
             mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
         }
         mChildIndicatorLeft = a.getDimensionPixelSize(
@@ -1022,8 +1022,11 @@
      */
     public void setGroupIndicator(Drawable groupIndicator) {
         mGroupIndicator = groupIndicator;
+        if (mIndicatorRight == 0 && mGroupIndicator != null) {
+            mIndicatorRight = mIndicatorLeft + mGroupIndicator.getIntrinsicWidth();
+        }
     }
-    
+
     /**
      * Sets the drawing bounds for the indicators (at minimum, the group indicator
      * is affected by this; the child indicator is affected by this if the
diff --git a/core/java/android/widget/NumberPicker.java b/core/java/android/widget/NumberPicker.java
index ba46a3f..63dbfbf 100644
--- a/core/java/android/widget/NumberPicker.java
+++ b/core/java/android/widget/NumberPicker.java
@@ -754,7 +754,7 @@
             return;
         }
         mCurrentScrollOffset += y;
-        while (mCurrentScrollOffset - mInitialScrollOffset > mSelectorElementHeight) {
+        while (mCurrentScrollOffset - mInitialScrollOffset >= mSelectorElementHeight) {
             mCurrentScrollOffset -= mSelectorElementHeight;
             decrementSelectorIndices(selectorIndices);
             changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -762,7 +762,7 @@
                 mCurrentScrollOffset = mInitialScrollOffset;
             }
         }
-        while (mCurrentScrollOffset - mInitialScrollOffset < -mSelectorElementHeight) {
+        while (mCurrentScrollOffset - mInitialScrollOffset <= -mSelectorElementHeight) {
             mCurrentScrollOffset += mSelectorElementHeight;
             incrementScrollSelectorIndices(selectorIndices);
             changeCurrent(selectorIndices[SELECTOR_MIDDLE_ITEM_INDEX]);
@@ -1147,8 +1147,8 @@
             postAdjustScrollerCommand(0);
             tryNotifyScrollListener(OnScrollListener.SCROLL_STATE_IDLE);
         } else {
-            showInputControls();
             updateInputTextView();
+            showInputControls();
         }
     }
 
@@ -1537,8 +1537,8 @@
         public void run() {
             mPreviousScrollerY = 0;
             if (mInitialScrollOffset == mCurrentScrollOffset) {
-                showInputControls();
                 updateInputTextView();
+                showInputControls();
                 return;
             }
             // adjust to the closest value
diff --git a/core/java/android/widget/RemoteViewsAdapter.java b/core/java/android/widget/RemoteViewsAdapter.java
index df1f4bf..ab69725 100644
--- a/core/java/android/widget/RemoteViewsAdapter.java
+++ b/core/java/android/widget/RemoteViewsAdapter.java
@@ -33,8 +33,8 @@
 import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
-import android.view.View.MeasureSpec;
 import android.view.ViewGroup;
+import android.view.View.MeasureSpec;
 
 import com.android.internal.widget.IRemoteViewsFactory;
 
@@ -760,11 +760,12 @@
             synchronized (mCache) {
                 // Queue up other indices to be preloaded based on this position
                 mCache.queuePositionsToBePreloadedFromRequestedPosition(position);
-
-                RemoteViewsFrameLayout layout = (RemoteViewsFrameLayout) convertView;
                 View convertViewChild = null;
                 int convertViewTypeId = 0;
-                if (convertView != null) {
+                RemoteViewsFrameLayout layout = null;
+
+                if (convertView instanceof RemoteViewsFrameLayout) {
+                    layout = (RemoteViewsFrameLayout) convertView;
                     convertViewChild = layout.getChildAt(0);
                     convertViewTypeId = getConvertViewTypeId(convertViewChild);
                 }
@@ -777,17 +778,17 @@
                     int typeId = mCache.getMetaDataAt(position).typeId;
 
                     // Reuse the convert view where possible
-                    if (convertView != null) {
+                    if (layout != null) {
                         if (convertViewTypeId == typeId) {
                             rv.reapply(context, convertViewChild);
-                            return convertView;
+                            return layout;
                         }
                     }
 
                     // Otherwise, create a new view to be returned
                     View newView = rv.apply(context, parent);
                     newView.setTagInternal(com.android.internal.R.id.rowTypeId, new Integer(typeId));
-                    if (convertView != null) {
+                    if (layout != null) {
                         layout.removeAllViews();
                     } else {
                         layout = new RemoteViewsFrameLayout(context);
diff --git a/core/java/android/widget/Spinner.java b/core/java/android/widget/Spinner.java
index 0102628..0baddcb 100644
--- a/core/java/android/widget/Spinner.java
+++ b/core/java/android/widget/Spinner.java
@@ -23,6 +23,8 @@
 import android.content.DialogInterface.OnClickListener;
 import android.content.res.TypedArray;
 import android.database.DataSetObserver;
+import android.graphics.drawable.Drawable;
+import android.graphics.Rect;
 import android.util.AttributeSet;
 import android.util.DisplayMetrics;
 import android.view.Gravity;
@@ -632,7 +634,8 @@
     private class DropdownPopup extends ListPopupWindow implements SpinnerPopup {
         private CharSequence mHintText;
         private int mPopupMaxWidth;
-        
+        private Rect mTempRect = new Rect();
+
         public DropdownPopup(Context context, AttributeSet attrs, int defStyleRes) {
             super(context, attrs, 0, defStyleRes);
             
@@ -699,6 +702,14 @@
                 itemView.measure(widthMeasureSpec, heightMeasureSpec);
                 width = Math.max(width, itemView.getMeasuredWidth());
             }
+
+            // Add background padding to measured width
+            Drawable popupBackground = getBackground();
+            if (popupBackground != null) {
+                popupBackground.getPadding(mTempRect);
+                width += mTempRect.left + mTempRect.right;
+            }
+
             return width;
         }
 
diff --git a/core/java/com/android/internal/app/ActionBarImpl.java b/core/java/com/android/internal/app/ActionBarImpl.java
index 4ee3083..0e31fef 100644
--- a/core/java/com/android/internal/app/ActionBarImpl.java
+++ b/core/java/com/android/internal/app/ActionBarImpl.java
@@ -492,7 +492,7 @@
             return;
         }
 
-        final FragmentTransaction trans = mActivity.getFragmentManager().openTransaction()
+        final FragmentTransaction trans = mActivity.getFragmentManager().beginTransaction()
                 .disallowAddToBackStack();
 
         if (mSelectedTab == tab) {
diff --git a/core/java/com/android/internal/view/menu/MenuBuilder.java b/core/java/com/android/internal/view/menu/MenuBuilder.java
index 588b10c..ff59950 100644
--- a/core/java/com/android/internal/view/menu/MenuBuilder.java
+++ b/core/java/com/android/internal/view/menu/MenuBuilder.java
@@ -1050,7 +1050,7 @@
      */
     private ViewGroup getMeasureActionButtonParent() {
         if (mMeasureActionButtonParent == null) {
-            mMeasureActionButtonParent = (ViewGroup) mMenuTypes[TYPE_ACTION_BUTTON].getInflater()
+            mMeasureActionButtonParent = (ViewGroup) getMenuType(TYPE_ACTION_BUTTON).getInflater()
                     .inflate(LAYOUT_RES_FOR_TYPE[TYPE_ACTION_BUTTON], null, false);
         }
         return mMeasureActionButtonParent;
diff --git a/core/java/com/android/internal/widget/ActionBarContextView.java b/core/java/com/android/internal/widget/ActionBarContextView.java
index 23f89f1..31e7bab 100644
--- a/core/java/com/android/internal/widget/ActionBarContextView.java
+++ b/core/java/com/android/internal/widget/ActionBarContextView.java
@@ -26,7 +26,6 @@
 import android.content.Context;
 import android.content.res.TypedArray;
 import android.util.AttributeSet;
-import android.util.Log;
 import android.view.ActionMode;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -39,6 +38,8 @@
  * @hide
  */
 public class ActionBarContextView extends ViewGroup implements AnimatorListener {
+    private static final String TAG = "ActionBarContextView";
+
     private int mContentHeight;
     
     private CharSequence mTitle;
@@ -447,7 +448,7 @@
 
     @Override
     public void onAnimationEnd(Animator animation) {
-        if (mAnimationMode == ANIMATE_OUT) {
+        if (mAnimationMode != ANIMATE_IN) {
             killMode();
         }
         mAnimationMode = ANIMATE_IDLE;
diff --git a/core/jni/android/graphics/BitmapFactory.cpp b/core/jni/android/graphics/BitmapFactory.cpp
index dac748d..e47d91c 100644
--- a/core/jni/android/graphics/BitmapFactory.cpp
+++ b/core/jni/android/graphics/BitmapFactory.cpp
@@ -23,6 +23,7 @@
 jfieldID gOptions_justBoundsFieldID;
 jfieldID gOptions_sampleSizeFieldID;
 jfieldID gOptions_configFieldID;
+jfieldID gOptions_mutableFieldID;
 jfieldID gOptions_ditherFieldID;
 jfieldID gOptions_purgeableFieldID;
 jfieldID gOptions_shareableFieldID;
@@ -179,6 +180,7 @@
     SkImageDecoder::Mode mode = SkImageDecoder::kDecodePixels_Mode;
     SkBitmap::Config prefConfig = SkBitmap::kNo_Config;
     bool doDither = true;
+    bool isMutable = false;
     bool isPurgeable = forcePurgeable ||
                         (allowPurgeable && optionsPurgeable(env, options));
     bool preferQualityOverSpeed = false;
@@ -196,6 +198,7 @@
         
         jobject jconfig = env->GetObjectField(options, gOptions_configFieldID);
         prefConfig = GraphicsJNI::getNativeBitmapConfig(env, jconfig);
+        isMutable = env->GetBooleanField(options, gOptions_mutableFieldID);
         doDither = env->GetBooleanField(options, gOptions_ditherFieldID);
         preferQualityOverSpeed = env->GetBooleanField(options,
                 gOptions_preferQualityOverSpeedFieldID);
@@ -306,15 +309,19 @@
         // already have a pixelref installed.
         pr = bitmap->pixelRef();
     }
-    // promise we will never change our pixels (great for sharing and pictures)
-    pr->setImmutable();
+
+    if (!isMutable) {
+        // promise we will never change our pixels (great for sharing and pictures)
+        pr->setImmutable();
+    }
 
     if (javaBitmap != NULL) {
         // If a java bitmap was passed in for reuse, pass it back
         return javaBitmap;
     }
     // now create the java bitmap
-    return GraphicsJNI::createBitmap(env, bitmap, javaAllocator.getStorageObj(), false, ninePatchChunk);
+    return GraphicsJNI::createBitmap(env, bitmap, javaAllocator.getStorageObj(),
+            isMutable, ninePatchChunk);
 }
 
 static jobject nativeDecodeStream(JNIEnv* env, jobject clazz,
@@ -572,6 +579,7 @@
     gOptions_sampleSizeFieldID = getFieldIDCheck(env, gOptions_class, "inSampleSize", "I");
     gOptions_configFieldID = getFieldIDCheck(env, gOptions_class, "inPreferredConfig",
             "Landroid/graphics/Bitmap$Config;");
+    gOptions_mutableFieldID = getFieldIDCheck(env, gOptions_class, "inMutable", "Z");
     gOptions_ditherFieldID = getFieldIDCheck(env, gOptions_class, "inDither", "Z");
     gOptions_purgeableFieldID = getFieldIDCheck(env, gOptions_class, "inPurgeable", "Z");
     gOptions_shareableFieldID = getFieldIDCheck(env, gOptions_class, "inInputShareable", "Z");
diff --git a/core/res/res/layout/preference.xml b/core/res/res/layout/preference.xml
index 6bd5efa..1f92252 100644
--- a/core/res/res/layout/preference.xml
+++ b/core/res/res/layout/preference.xml
@@ -24,36 +24,30 @@
     android:gravity="center_vertical"
     android:paddingRight="?android:attr/scrollbarSize">
 
-    <LinearLayout
+    <ImageView
+        android:id="@+android:id/icon"
         android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:minWidth="@dimen/preference_widget_width"
-        android:gravity="center"
-        android:orientation="horizontal">
-        <ImageView
-            android:id="@+android:id/icon"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="center"
-            />
-    </LinearLayout>
+        android:layout_height="wrap_content"
+        android:layout_gravity="center"
+        />
 
     <RelativeLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginLeft="15dip"
         android:layout_marginRight="6dip"
         android:layout_marginTop="6dip"
         android:layout_marginBottom="6dip"
         android:layout_weight="1">
-    
+
         <TextView android:id="@+android:id/title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:singleLine="true"
-            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textAppearance="?android:attr/textAppearanceLarge"
             android:ellipsize="marquee"
             android:fadingEdge="horizontal" />
-            
+
         <TextView android:id="@+android:id/summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -69,8 +63,7 @@
     <LinearLayout android:id="@+android:id/widget_frame"
         android:layout_width="wrap_content"
         android:layout_height="match_parent"
-        android:minWidth="@dimen/preference_widget_width"
-        android:gravity="center"
+        android:gravity="center_vertical"
         android:orientation="vertical" />
 
 </LinearLayout>
diff --git a/core/res/res/layout/preference_category.xml b/core/res/res/layout/preference_category.xml
index 7ffdc9a..280d952 100644
--- a/core/res/res/layout/preference_category.xml
+++ b/core/res/res/layout/preference_category.xml
@@ -18,5 +18,4 @@
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     style="?android:attr/listSeparatorTextViewStyle"
     android:id="@+android:id/title"
-    android:paddingLeft="32dp"
 />
diff --git a/core/res/res/layout/preference_category_holo.xml b/core/res/res/layout/preference_category_holo.xml
new file mode 100644
index 0000000..5fe8b28
--- /dev/null
+++ b/core/res/res/layout/preference_category_holo.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Layout used for PreferenceCategory in a PreferenceActivity. -->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+    style="?android:attr/listSeparatorTextViewStyle"
+    android:id="@+android:id/title"
+    android:paddingLeft="32dp"
+/>
diff --git a/core/res/res/layout/preference_child_holo.xml b/core/res/res/layout/preference_child_holo.xml
new file mode 100644
index 0000000..2e70d77
--- /dev/null
+++ b/core/res/res/layout/preference_child_holo.xml
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Layout for a visually child-like Preference in a PreferenceActivity. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:gravity="center_vertical"
+    android:paddingLeft="16dip"
+    android:paddingRight="?android:attr/scrollbarSize">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:minWidth="@dimen/preference_widget_width"
+        android:gravity="center"
+        android:orientation="horizontal">
+        <ImageView
+            android:id="@+android:id/icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            />
+    </LinearLayout>
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="6dip"
+        android:layout_marginTop="6dip"
+        android:layout_marginBottom="6dip"
+        android:layout_weight="1">
+
+        <TextView android:id="@+android:id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal" />
+            
+        <TextView android:id="@+android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@android:id/title"
+            android:layout_alignLeft="@android:id/title"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="4" />
+
+    </RelativeLayout>
+
+    <!-- Preference should place its actual preference widget here. -->
+    <LinearLayout android:id="@+android:id/widget_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:minWidth="@dimen/preference_widget_width"
+        android:gravity="center"
+        android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/layout/preference_holo.xml b/core/res/res/layout/preference_holo.xml
new file mode 100644
index 0000000..c448f64
--- /dev/null
+++ b/core/res/res/layout/preference_holo.xml
@@ -0,0 +1,76 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Layout for a Preference in a PreferenceActivity. The
+     Preference is able to place a specific widget for its particular
+     type in the "widget_frame" layout. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:gravity="center_vertical"
+    android:paddingRight="?android:attr/scrollbarSize">
+
+    <LinearLayout
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:minWidth="@dimen/preference_widget_width"
+        android:gravity="center"
+        android:orientation="horizontal">
+        <ImageView
+            android:id="@+android:id/icon"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_gravity="center"
+            />
+    </LinearLayout>
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="6dip"
+        android:layout_marginTop="6dip"
+        android:layout_marginBottom="6dip"
+        android:layout_weight="1">
+    
+        <TextView android:id="@+android:id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:ellipsize="marquee"
+            android:fadingEdge="horizontal" />
+            
+        <TextView android:id="@+android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@android:id/title"
+            android:layout_alignLeft="@android:id/title"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="4" />
+
+    </RelativeLayout>
+
+    <!-- Preference should place its actual preference widget here. -->
+    <LinearLayout android:id="@+android:id/widget_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:minWidth="@dimen/preference_widget_width"
+        android:gravity="center"
+        android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/layout/preference_information.xml b/core/res/res/layout/preference_information.xml
index 9c9b83e..32cbb90 100644
--- a/core/res/res/layout/preference_information.xml
+++ b/core/res/res/layout/preference_information.xml
@@ -24,13 +24,10 @@
     android:gravity="center_vertical"
     android:paddingRight="?android:attr/scrollbarSize">
 
-    <View
-        android:layout_width="@dimen/preference_widget_width"
-        android:layout_height="match_parent" />
-
     <RelativeLayout
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
+        android:layout_marginLeft="16sp"
         android:layout_marginRight="6sp"
         android:layout_marginTop="6sp"
         android:layout_marginBottom="6sp"
@@ -40,9 +37,9 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:singleLine="true"
-            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textAppearance="?android:attr/textAppearanceLarge"
             android:textColor="?android:attr/textColorSecondary" />
-            
+
         <TextView android:id="@+android:id/summary"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
@@ -53,7 +50,7 @@
             android:maxLines="2" />
 
     </RelativeLayout>
-    
+
     <!-- Preference should place its actual preference widget here. -->
     <LinearLayout android:id="@+android:id/widget_frame"
         android:layout_width="wrap_content"
diff --git a/core/res/res/layout/preference_information_holo.xml b/core/res/res/layout/preference_information_holo.xml
new file mode 100644
index 0000000..d6cc063
--- /dev/null
+++ b/core/res/res/layout/preference_information_holo.xml
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Layout for a Preference in a PreferenceActivity. The
+     Preference is able to place a specific widget for its particular
+     type in the "widget_frame" layout. -->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
+    android:gravity="center_vertical"
+    android:paddingRight="?android:attr/scrollbarSize">
+
+    <View
+        android:layout_width="@dimen/preference_widget_width"
+        android:layout_height="match_parent" />
+
+    <RelativeLayout
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginRight="6sp"
+        android:layout_marginTop="6sp"
+        android:layout_marginBottom="6sp"
+        android:layout_weight="1">
+
+        <TextView android:id="@+android:id/title"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:singleLine="true"
+            android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="?android:attr/textColorSecondary" />
+            
+        <TextView android:id="@+android:id/summary"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_below="@android:id/title"
+            android:layout_alignLeft="@android:id/title"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textColor="?android:attr/textColorSecondary"
+            android:maxLines="2" />
+
+    </RelativeLayout>
+    
+    <!-- Preference should place its actual preference widget here. -->
+    <LinearLayout android:id="@+android:id/widget_frame"
+        android:layout_width="wrap_content"
+        android:layout_height="match_parent"
+        android:gravity="center_vertical"
+        android:orientation="vertical" />
+
+</LinearLayout>
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index c4e815e..a366047 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -889,22 +889,66 @@
         <item name="android:positiveButtonText">@android:string/ok</item>
         <item name="android:negativeButtonText">@android:string/cancel</item>
     </style>
-    
+
     <style name="Preference.DialogPreference.YesNoPreference">
         <item name="android:positiveButtonText">@android:string/yes</item>
         <item name="android:negativeButtonText">@android:string/no</item>
     </style>
-    
+
     <style name="Preference.DialogPreference.EditTextPreference">
         <item name="android:dialogLayout">@android:layout/preference_dialog_edittext</item>
     </style>
-    
+
     <style name="Preference.RingtonePreference">
         <item name="android:ringtoneType">ringtone</item>
         <item name="android:showSilent">true</item>
         <item name="android:showDefault">true</item>
     </style>
 
+    <style name="Preference.Holo">
+        <item name="android:layout">@android:layout/preference_holo</item>
+    </style>
+
+    <style name="Preference.Holo.Information">
+        <item name="android:layout">@android:layout/preference_information_holo</item>
+        <item name="android:enabled">false</item>
+        <item name="android:shouldDisableView">false</item>
+    </style>
+
+    <style name="Preference.Holo.Category">
+        <item name="android:layout">@android:layout/preference_category_holo</item>
+        <!-- The title should not dim if the category is disabled, instead only the preference children should dim. -->
+        <item name="android:shouldDisableView">false</item>
+        <item name="android:selectable">false</item>
+    </style>
+
+    <style name="Preference.Holo.CheckBoxPreference">
+        <item name="android:widgetLayout">@android:layout/preference_widget_checkbox</item>
+    </style>
+
+    <style name="Preference.Holo.PreferenceScreen">
+    </style>
+
+    <style name="Preference.Holo.DialogPreference">
+        <item name="android:positiveButtonText">@android:string/ok</item>
+        <item name="android:negativeButtonText">@android:string/cancel</item>
+    </style>
+
+    <style name="Preference.Holo.DialogPreference.YesNoPreference">
+        <item name="android:positiveButtonText">@android:string/yes</item>
+        <item name="android:negativeButtonText">@android:string/no</item>
+    </style>
+
+    <style name="Preference.Holo.DialogPreference.EditTextPreference">
+        <item name="android:dialogLayout">@android:layout/preference_dialog_edittext</item>
+    </style>
+
+    <style name="Preference.Holo.RingtonePreference">
+        <item name="android:ringtoneType">ringtone</item>
+        <item name="android:showSilent">true</item>
+        <item name="android:showDefault">true</item>
+    </style>
+
     <!-- No margins or background by default. Could be different for x-large screens -->
     <style name="PreferencePanel">
     </style>
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index 744d0d8..506dd07 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -924,18 +924,18 @@
         <item name="quickContactBadgeStyleSmallWindowLarge">@android:style/Widget.Holo.QuickContactBadgeSmall.WindowLarge</item>
         <item name="listPopupWindowStyle">@android:style/Widget.Holo.ListPopupWindow</item>
         <item name="popupMenuStyle">@android:style/Widget.Holo.PopupMenu</item>
-        
+
         <!-- Preference styles -->
-        <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
-        <item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
-        <item name="preferenceStyle">@android:style/Preference</item>
-        <item name="preferenceInformationStyle">@android:style/Preference.Information</item>
-        <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item>
-        <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item>
-        <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item>
-        <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
-        <item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
-        <item name="preferenceLayoutChild">@android:layout/preference_child</item>
+        <item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
+        <item name="preferenceCategoryStyle">@android:style/Preference.Holo.Category</item>
+        <item name="preferenceStyle">@android:style/Preference.Holo</item>
+        <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item>
+        <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item>
+        <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item>
+        <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item>
+        <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item>
+        <item name="ringtonePreferenceStyle">@android:style/Preference.Holo.RingtonePreference</item>
+        <item name="preferenceLayoutChild">@android:layout/preference_child_holo</item>
         <item name="detailsElementBackground">@android:drawable/panel_bg_holo_dark</item>
 
         <!-- Search widget styles -->
@@ -1187,16 +1187,16 @@
         <item name="popupMenuStyle">@android:style/Widget.Holo.Light.PopupMenu</item>
         
         <!-- Preference styles -->
-        <item name="preferenceScreenStyle">@android:style/Preference.PreferenceScreen</item>
-        <item name="preferenceCategoryStyle">@android:style/Preference.Category</item>
-        <item name="preferenceStyle">@android:style/Preference</item>
-        <item name="preferenceInformationStyle">@android:style/Preference.Information</item>
-        <item name="checkBoxPreferenceStyle">@android:style/Preference.CheckBoxPreference</item>
-        <item name="yesNoPreferenceStyle">@android:style/Preference.DialogPreference.YesNoPreference</item>
-        <item name="dialogPreferenceStyle">@android:style/Preference.DialogPreference</item>
-        <item name="editTextPreferenceStyle">@android:style/Preference.DialogPreference.EditTextPreference</item>
-        <item name="ringtonePreferenceStyle">@android:style/Preference.RingtonePreference</item>
-        <item name="preferenceLayoutChild">@android:layout/preference_child</item>
+        <item name="preferenceScreenStyle">@android:style/Preference.Holo.PreferenceScreen</item>
+        <item name="preferenceCategoryStyle">@android:style/Preference.Holo.Category</item>
+        <item name="preferenceStyle">@android:style/Preference.Holo</item>
+        <item name="preferenceInformationStyle">@android:style/Preference.Holo.Information</item>
+        <item name="checkBoxPreferenceStyle">@android:style/Preference.Holo.CheckBoxPreference</item>
+        <item name="yesNoPreferenceStyle">@android:style/Preference.Holo.DialogPreference.YesNoPreference</item>
+        <item name="dialogPreferenceStyle">@android:style/Preference.Holo.DialogPreference</item>
+        <item name="editTextPreferenceStyle">@android:style/Preference.Holo.DialogPreference.EditTextPreference</item>
+        <item name="ringtonePreferenceStyle">@android:style/Preference.Holo.RingtonePreference</item>
+        <item name="preferenceLayoutChild">@android:layout/preference_child_holo</item>
         <item name="detailsElementBackground">@android:drawable/panel_bg_holo_light</item>
 
         <!-- Search widget styles -->
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 2126529..0e65df5 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -48,7 +48,6 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Arrays;
 
 public class PackageManagerTests extends AndroidTestCase {
     private static final boolean localLOGV = true;
@@ -3106,164 +3105,6 @@
                 PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
 
-    @LargeTest
-    public void testPackageObbPaths_Nonexistent() {
-        try {
-            final PackageManager pm = getPm();
-
-            // Invalid Java package name.
-            pm.getPackageObbPaths("=non-existent");
-
-            fail("Should not be able to get package OBB paths for non-existent package");
-        } catch (IllegalArgumentException e) {
-            // pass
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Initial() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            assertEquals("Initial obb paths should be null",
-                    null, pm.getPackageObbPaths(ip.pkg.packageName));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Null() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            pm.setPackageObbPaths(ip.pkg.packageName, null);
-
-            assertEquals("Returned paths should be null",
-                    null, pm.getPackageObbPaths(ip.pkg.packageName));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Empty() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            final String[] paths = new String[0];
-
-            pm.setPackageObbPaths(ip.pkg.packageName, paths);
-
-            assertEquals("Empty list should be interpreted as null",
-                    null, pm.getPackageObbPaths(ip.pkg.packageName));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Single() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            final String[] paths = new String[] {
-                "/example/test",
-            };
-
-            pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
-            assertTrue("Previously set paths should be the same as the returned paths.",
-                    Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Multiple() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            final String[] paths = new String[] {
-                    "/example/test1",
-                    "/example/test2",
-            };
-
-            pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
-            assertTrue("Previously set paths should be the same as the returned paths.",
-                    Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_Twice() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            final String[] paths = new String[] {
-                    "/example/test1",
-                    "/example/test2",
-            };
-
-            pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
-            assertTrue("Previously set paths should be the same as the returned paths.",
-                    Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-
-            paths[0] = "/example/test3";
-            pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
-            assertTrue("Previously set paths should be the same as the returned paths.",
-                    Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
-    @LargeTest
-    public void testPackageObbPaths_ReplacePackage() {
-        InstallParams ip = sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, false);
-
-        try {
-            final PackageManager pm = getPm();
-
-            final String[] paths = new String[] {
-                    "/example/test1",
-                    "/example/test2",
-            };
-
-            pm.setPackageObbPaths(ip.pkg.packageName, paths.clone());
-
-            Log.i(TAG, "Creating replaceReceiver");
-            final GenericReceiver receiver = new ReplaceReceiver(ip.pkg.packageName);
-
-            final int flags = PackageManager.INSTALL_REPLACE_EXISTING;
-            invokeInstallPackage(ip.packageURI, flags, receiver);
-            assertInstall(ip.pkg, flags, ip.pkg.installLocation);
-
-            assertTrue("Previously set paths should be the same as the returned paths.",
-                    Arrays.equals(paths, pm.getPackageObbPaths(ip.pkg.packageName)));
-        } finally {
-            cleanUpInstall(ip);
-        }
-    }
-
     /*---------- Recommended install location tests ----*/
     /*
      * TODO's
diff --git a/docs/html/guide/topics/fragments/index.jd b/docs/html/guide/topics/fragments/index.jd
index d07daf4..045a1e8 100644
--- a/docs/html/guide/topics/fragments/index.jd
+++ b/docs/html/guide/topics/fragments/index.jd
@@ -6,7 +6,7 @@
 
   <h2>Quickview</h2>
   <ul>
-    <li>Decompose application functionality and UI into reusable modules</li>
+    <li>Fragments decompose application functionality and UI into reusable modules</li>
     <li>Add multiple fragments to a screen to avoid switching activities</li>
     <li>Fragments have their own lifecycle, state, and back stack</li>
     <li>Fragments require API Level HONEYCOMB or greater</li>
@@ -14,12 +14,27 @@
 
   <h2>In this document</h2>
   <ol>
-    <li><a href="#Creating">Creating fragments</a></li>
-    <li><a href="#Adding">Adding a fragment to an activity</a></li>
-    <li><a href="#Managing">Managing fragments</a></li>
-    <li><a href="#Lifecycle">Handling the lifecycle</a></li>
-    <li><a href="#Integrating">Integrating with the activity</a></li>
-    <li><a href="#Menus">Adding menus</a></li>
+    <li><a href="#Design">Design Philosophy</a></li>
+    <li><a href="#Creating">Creating a Fragment</a>
+      <ol>
+        <li><a href="#UI">Adding a user interface</a></li>
+        <li><a href="#Adding">Adding a fragment to an activity</a></li>
+      </ol>
+    </li>
+    <li><a href="#Managing">Managing Fragments</a></li>
+    <li><a href="#Transactions">Performing Fragment Transactions</a></li>
+    <li><a href="#CommunicatingWithActivity">Communicating with the Activity</a>
+      <ol>
+        <li><a href="#EventCallbacks">Creating event callbacks to the activity</a></li>
+        <li><a href="#ActionBar">Adding items to the Action Bar</a></li>
+      </ol>
+    </li>
+    <li><a href="#Lifecycle">Handling the Fragment Lifecycle</a>
+      <ol>
+        <li><a href="#CoordinadingWithActivity">Coordinating with the activity lifecycle</a></li>
+      </ol>
+    </li>
+    <li><a href="#Example">Example</a></li>
   </ol>
 
   <h2>Key classes</h2>
@@ -29,100 +44,108 @@
     <li>{@link android.app.FragmentTransaction}</li>
   </ol>
 
-  <!--
   <h2>Related samples</h2>
   <ol>
     <li><a
-href="{@docRoot}resources/samples/NotePad/index.html">NotePad</a></li>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">ApiDemos</a></li>
   </ol>
-  -->
 </div>
 </div>
 
+<p>A {@link android.app.Fragment} represents a behavior or a portion of user interface in an
+{@link android.app.Activity}. You can combine multiple fragments in a single activity to build a
+multi-pane UI and reuse a fragment in multiple activities. You can think of a fragment as a
+modular section of an activity, which has its own lifecycle, receives its own input events, and
+which you can add or remove while the activity is running.</p>
 
-<p>An {@link android.app.Activity} is always the window in which users interact with your
-application, but a {@link android.app.Fragment} can be responsible for distinct operations and UI
-that's embedded in an activity. So, when using fragments, your activity becomes more like a
-container for fragments that define the activity's behavior and UI.</p>
+<p>A fragment must always be embedded in an activity and the fragment's lifecycle is directly
+affected by the activity's lifecycle. For example, when the activity is paused, so are all
+fragments in it, and when the activity is destroyed, so are all fragments. However, while an
+activity is running (it is in the <em>resumed</em> <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">lifecycle state</a>), you can
+manipulate each fragment independently, such as add or remove them. When you perform such a
+fragment transaction, you can it to a back stack managed by the
+activity&mdash;each back stack entry in the activity is a record of the fragment transaction that
+occurred. The back stack allows the user to reverse a fragment transaction (navigate backwards),
+by pressing the BACK key.</p>
 
-<p>Fragments have their own
-set of lifecylce callback methods and recieve their own user input events. A fragment must always be
-embedded in an activity and the fragment's lifecycle is directly affected by the activity's
-lifecycle. For example, when the activity is stopped, so are all fragments in it, and when
-the activity is destroyed, so are all fragments. However, while an activity
-is active (in the "resumed" lifecycle stage), you can manipulate the lifecycle of each fragment
-independently. For example, you can add and remove fragments while the activity is active and you
-can add each fragment to a back stack within the activity&mdash;each back stack entry in the
-activity is actually a record of a "transaction" that occurred with the activity's fragments, so
-that the user can reverse the transaction with the BACK key (this is discussed more later).</p>
+<p>When you add a fragment as a part of your activity layout, it lives in a {@link
+android.view.ViewGroup} inside the activity's view hierarchy and defines its own layout of views.
+You can insert a fragment into your activity layout by declaring the fragment in the activity's
+layout file, as a {@code &lt;fragment&gt;} element, or from your application code by adding it to an
+existing {@link android.view.ViewGroup}. However, a fragment is not required to be a part of the
+activity layout; you may also use a fragment as an invisible worker for the activity.</p>
 
-<div class="figure" style="width:314px">
-<img src="{@docRoot}images/fragment_lifecycle.png" alt="" />
-<p class="img-caption"><strong>Figure 1.</strong> The lifecycle of a fragment (while its
-activity is running).</p>
-</div>
+<p>This document describes how to build your application to use fragments, including
+how fragments can maintain their state when added to the activity's back stack, share
+events with the activity and other fragments in the activity, contribute to the activity's action
+bar, and more.</p>
 
-<p>Android introduced fragments in Android X.X (API Level HONEYCOMB), with the primary intention to
-support more dynamic and flexible UI designs on large screen devices, such as tablets. Because a
-tablet has a much larger screen than a mobile phone, there's more room to interchange UI
-elements. Fragments allow that without the need for you to start a new activity or manage complex
-changes to the view hierarchy. By dividing the layout of an activity into fragments, the code
-that defines your activity becomes more modular and interchangable, allowing you to modify the
-activity's appearance at runtime and for different types of screens.</p>
+
+<h2 id="Design">Design Philosophy</h2>
+
+<p>Android introduced fragments in Android 3.0 (API Level "Honeycomb"), primarily to support more
+dynamic and flexible UI designs on large screens, such as tablets. Because a
+tablet's screen is much larger than that of a mobile phone, there's more room to combine and
+interchange UI components. Fragments allow such designs without the need for you to manage complex
+changes to the view hierarchy. By dividing the layout of an activity into fragments, you become able
+to modify the activity's appearance at runtime and preserve those changes in a back stack
+that's managed by the activity.</p>
 
 <p>For example, a news application can use one fragment to show a list of articles on the
 left and another fragment to display an article on the right&mdash;both fragments appear in one
 activity, side by side, and each fragment has its own set of lifecycle callback methods and handle
-their own user input events. Thus, instead using one activity to select an article and another
+their own user input events. Thus, instead of using one activity to select an article and another
 activity to read the article, the user can select an article and read it all within the same
-activity.</p>
+activity, as illustrated in figure 1.</p>
 
-<!-- ** TODO: Save this for later or move it down in the doc so the intro isn't overwhelming **
-     
-<p>A fragment can be a modular and reusable component in your application. That is, because
-the fragment defines its own behavior using its own set of lifecycle callbacks, you can
-include one fragment in multiple activities. This also enables you to create one version of your
-application for multiple screen sizes. For instance, on an extra large screen (<em>xlarge</em>
-screen configuration), you can embed two or more fragments in one activity, but on a normal-sized
-screen (<em>normal</em> screen configuration), you can embed just one fragment in an activity and
-then start other activities in order to display the other fragments.</p>
--->
+<img src="{@docRoot}images/fundamentals/fragments.png" alt="" />
+<p class="img-caption"><strong>Figure 1.</strong> An example of how two UI modules that are
+typically separated into two activities can be combined into one activity, using fragments.</p>
 
-<p>When you use a fragment as a part of your layout, it technically lives within a {@link
-android.view.View} of the activity's layout and defines its own layout of views. You can insert a
-fragment into your activity layout by declaring the fragment in the activity's XML layout file, as
-a {@code &lt;fragment&gt;} element, or from your application code by adding it to an existing {@link
-android.view.View}. However, a fragment is not required to be a part of the activity
-layout&mdash;you might use a fragment as an invisible worker for the activity (more about that
-later).</p>
 
-<p>The rest of this document describes how to build your application to use fragments, including
-how fragments can contribute to the activity options menu and action bar, create context menus,
-maintain their state when added to the activity's back stack, and more.</p>
+<p>A fragment should be a modular and reusable component in your application. That is, because the
+fragment defines its own layout and its own behavior using its own lifecycle callbacks, you
+can include one fragment in multiple activities. This is especially important because it allows you
+to adapt your user experience to different screen sizes. For instance, you might include multiple
+fragments in an activity only when the screen size is sufficiently large, and, when it is not,
+launch separate activities that use different fragments.</p>
+
+<p>For example&mdash;to continue with the news application example&mdash;the application can embed
+two
+fragments in <em>Activity A</em>, when running on an extra large screen (a tablet, for example).
+However, on a normal-sized screen (a phone, for example),
+there's not be enough room for both fragments, so <em>Activity A</em> includes only the fragment for
+the list of articles, and when the user selects an article, it starts <em>Activity B</em>, which
+includes the fragment to read the article. Thus, the application supports both design patterns
+suggested in figure 1.</p>
 
 
 
 <h2 id="Creating">Creating a Fragment</h2>
 
-<p>An implementation of the {@link android.app.Fragment} class contains code that looks a lot like
-the code in an {@link android.app.Activity}. In fact, if you're
-converting an existing Android application to use fragments, you'll move code
-from your {@link android.app.Activity} implementation into your {@link android.app.Fragment} class
-implementation, and into some of the same callback methods. A fragment contains callback methods
-similar to an activity, such as {@link android.app.Fragment#onCreate onCreate()}, {@link
-android.app.Fragment#onStart onStart()}, {@link android.app.Fragment#onPause onPause()}, and {@link
-android.app.Fragment#onStop onStop()}.</p>
+<div class="figure" style="width:314px">
+<img src="{@docRoot}images/fragment_lifecycle.png" alt="" />
+<p class="img-caption"><strong>Figure 2.</strong> The lifecycle of a fragment (while its
+activity is running).</p>
+</div>
 
-<p>If you're creating a fragment to be a modular piece of an activity UI, then your
-implementation of {@link android.app.Fragment} should include most of the same lifecycle
-callback methods traditionally implemented by the activity to initialize elements of the UI and
-save and restore state information. Usually, you'll want to implement the following methods:</p>
+<p>To create a fragment, you must create a subclass of {@link android.app.Fragment} (or an existing
+subclass of it). The {@link android.app.Fragment} class has code that looks a lot like
+an {@link android.app.Activity}. It contains callback methods similar to an activity, such
+as {@link android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onStart onStart()},
+{@link android.app.Fragment#onPause onPause()}, and {@link android.app.Fragment#onStop onStop()}. In
+fact, if you're converting an existing Android application to use fragments, you might simply move
+code from your activity's callback methods into the respective callback methods of your
+fragment.</p>
+
+<p>Usually, you should implement at least the following lifecycle methods:</p>
 
 <dl>
   <dt>{@link android.app.Fragment#onCreate onCreate()}</dt>
   <dd>The system calls this when creating the fragment. Within your implementation, you should
-initialize the essential components of the fragment that should be retained when the fragment is
-paused or stopped.</dd>
+initialize essential components of the fragment that you want to retain when the fragment is
+paused or stopped, then resumed.</dd>
   <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
   <dd>The system calls this when it's time for the fragment to draw its user interface for the
 first time. To draw a UI for your fragment, you must return a {@link android.view.View} from this
@@ -135,101 +158,117 @@
 the user might not come back).</dd>
 </dl>
 
-<p>Most applications should implement at least these three methods for each fragment, but there are
-several other lifecycle callback methods that you should also use in order to provide the best
-user experience when switching fragments and when the activity is paused or stopped. All of the
-lifecycle callback methods are discussed more later, in
-the section about <a href="#Lifecycle">Handling the Lifecycle</a>.</p>
+<p>Most applications should implement at least these three methods for every fragment, but there are
+several other callback methods you should also use to handle various stages of the
+fragment lifecycle. All the lifecycle callback methods are discussed more later, in the section
+about <a href="#Lifecycle">Handling the Fragment Lifecycle</a>.</p>
 
 
-<p>There are also a few different subclasses of {@link android.app.Fragment} that you might want 
-to use:</p>
+<p>There are also a few subclasses that you might want to extend, instead of the base {@link
+android.app.Fragment} class:</p>
 
 <dl>
   <dt>{@link android.app.DialogFragment}</dt>
   <dd>Displays a floating dialog. Using this class to create a dialog is a good alternative to using
-the dialog helper methods in the {@link android.app.Activity} class, because the dialog can be
-incorporated into the fragment back stack managed by the activity.</dd>
+the dialog helper methods in the {@link android.app.Activity} class, because you can
+incorporate a fragment dialog into the back stack of fragments managed by the activity,
+allowing the user to return to a dismissed fragment.</dd>
 
   <dt>{@link android.app.ListFragment}</dt>
   <dd>Displays a list of items that are managed by an adapter (such as a {@link
-android.widget.SimpleCursorAdapter}), similar to {@link android.app.ListActivity}. Provides methods
-for managing a list, such as the {@link
+android.widget.SimpleCursorAdapter}), similar to {@link android.app.ListActivity}. It provides
+several methods for managing a list view, such as the {@link
 android.app.ListFragment#onListItemClick(ListView,View,int,long) onListItemClick()} callback to
-handle click events on list items.</dd>
+handle click events.</dd>
 
   <dt>{@link android.preference.PreferenceFragment}</dt>
   <dd>Displays a hierarchy of {@link android.preference.Preference} objects as a list, similar to
-{@link android.preference.PreferenceActivity}. </dd>
+{@link android.preference.PreferenceActivity}. This is useful when creating a "settings"
+activity for your application.</dd>
 </dl>
 
-<p>However, subclassing the standard {@link android.app.Fragment} class is most common, if
-you're not creating a dialog, a list, or displaying preferences.</p>
 
+<h3 id="UI">Adding a user interface</h3>
 
-<h3 id="UI">Providing a user interface</h3>
+<p>A fragment is usually used as part of an activity's user interface and contributes its own
+layout to the activity.</p>
 
-<p>To provide a UI layout for a fragment, you must implement
-the {@link android.app.Fragment#onCreateView onCreateView()}
-callback method in your {@link android.app.Fragment} (unless your fragment is a subclass of
-{@link android.app.ListFragment}, which returns a {@link android.widget.ListView} from this method
-by default). The Android system calls {@link android.app.Fragment#onCreateView onCreateView()} when
-it's time for the fragment to draw its layout. Your implementation of this method must return a
+<p>To provide a layout for a fragment, you must implement the {@link
+android.app.Fragment#onCreateView onCreateView()} callback method, which the Android system calls
+when it's time for the fragment to draw its layout. Your implementation of this method must return a
 {@link android.view.View} that is the root of your fragment's layout.</p>
 
-<p>The easiest way to provide your layout is to inflate it from a <a
-href="{@docRoot}guide/topics/resources/layout-resource.html">layout resource</a>. To help you
-inflate a layout, the {@link android.app.Fragment#onCreateView onCreateView()} method passes a
-{@link android.view.LayoutInflater} that you can use to get your layout. For example, here's a
-simple subclass of {@link android.app.Fragment} that contains an implementation of {@link
-android.app.Fragment#onCreateView onCreateView()} that loads the fragment's layout from a
-resource:</p>
+<p class="note"><strong>Note:</strong> If your fragment is a subclass of {@link
+android.app.ListFragment}, the default implementation returns a {@link android.widget.ListView} from
+{@link android.app.Fragment#onCreateView onCreateView()}, so you don't need to implement it.</p>
+
+<p>To return a layout from {@link
+android.app.Fragment#onCreateView onCreateView()}, you can inflate it from a <a
+href="{@docRoot}guide/topics/resources/layout-resource.html">layout resource</a> defined in XML. To
+help you do so, {@link android.app.Fragment#onCreateView onCreateView()} provides a
+{@link android.view.LayoutInflater} object.</p>
+
+<p>For example, here's a subclass of {@link android.app.Fragment} that loads a layout from the
+{@code example_fragment.xml} file:</p>
 
 <pre>
-public static class SimpleFragment extends Fragment {
+public static class ExampleFragment extends Fragment {
     &#64;Override
     public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
         // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.simple_fragment, container, false);
+        return inflater.inflate(R.layout.example_fragment, container, false);
     }
 }
 </pre>
 
+<div class="sidebox-wrapper">
+<div class="sidebox">
+  <h3>Creating a layout</h3>
+  <p>In the sample above, {@code R.layout.example_fragment} is a reference to a layout resource
+named {@code example_fragment.xml} saved in the application resources. For information about how to
+create a layout in XML, see the <a href="{@docRoot}guide/topics/ui/index.html">User Interface</a>
+documentation.</p>
+</div>
+</div>
+
+<p>The {@code container} parameter passed to {@link android.app.Fragment#onCreateView
+onCreateView()} is the parent {@link android.view.ViewGroup} (from the activity's layout) in which
+your fragment layout
+will be inserted. The {@code savedInstanceState} parameter is a {@link android.os.Bundle} that
+provides data about the previous instance of the fragment, if the fragment is being resumed
+(restoring state is discussed more in the section about <a href="#Lifecycle">Handling the
+Fragment Lifecycle</a>).</p>
+
 <p>The {@link android.view.LayoutInflater#inflate(int,ViewGroup,boolean) inflate()} method takes
 three arguments:</p>
 <ul>
-  <li>The resource ID of the layout you want to inflate</li>
-  <li>The {@link android.view.ViewGroup} to be the parent of the
-inflated layout (supplying this is important in order to apply layout parameters from the parent
-view)</li>
-  <li>And a boolean indicating whether the inflated layout should be attached to the {@link
-android.view.ViewGroup} (from the second parameter) during inflation (in this case, this
-is false because the system is already going to insert the layout into the appropriate parent
-view&mdash;doing otherwise would create a redundant view group in the final layout)</li>
+  <li>The resource ID of the layout you want to inflate.</li>
+  <li>The {@link android.view.ViewGroup} to be the parent of the inflated layout. Passing the {@code
+container} is important in order for the system to apply layout parameters to the root view of the
+inflated layout, specified by the parent view in which it's going.</li>
+  <li>A boolean indicating whether the inflated layout should be attached to the {@link
+android.view.ViewGroup} (the second parameter) during inflation. (In this case, this
+is false because the system is already inserting the inflated layout into the {@code
+container}&mdash;passing true would create a redundant view group in the final layout.)</li>
 </ul>
 
-<p>The {@code container} parameter passed to {@link android.app.Fragment#onCreateView
-onCreateView()} provides the parent {@link android.view.ViewGroup} in which your fragment layout
-will be inserted, which you can use to generate layout parameters for your
-fragment layout. The {@code savedInstanceState} parameter is a {@link android.os.Bundle} that
-provides data about the previous instance of the fragment, if the fragment is being resumed
-(restoring state is discussed more in the section about <a href="#Lifecycle">Handling the
-Lifecycle</a>.</p>
+<p>Now you've seen how to create a fragment that provides a layout. Next, you need to add
+the fragment to your activity.</p>
 
 
-<h3 id="Adding">Adding a Fragment to an Activity</h3>
 
-<p>Each fragment is embedded into the layout of its container activity as a part of the overall view
-hierarchy, whether or not it actually provides a UI. If a fragment is not embedded into the activity
-layout, then it is never created (it does not receive any lifecycle callbacks). There are two ways
-you can add a fragment to the activity layout:</p>
+<h3 id="Adding">Adding a fragment to an activity</h3>
+
+<p>Usually, a fragment contributes a portion of UI to the host activity, which is embedded as a part
+of the activity's overall view hierarchy. There are two ways you can add a fragment to the activity
+layout:</p>
 
 <ul>
-  <li><b>Declare the fragment inside the activity's layout XML file.</b>
+  <li><b>Declare the fragment inside the activity's layout file.</b>
 <p>In this case, you can
-specify layout properties for the fragment as if it were a view itself and the fragment's layout
-fills that space. For example:</p>
+specify layout properties for the fragment as if it were a view. For example, here's the layout
+file for an activity with two fragments:</p>
 <pre>
 &lt;?xml version="1.0" encoding="utf-8"?&gt;
 &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
@@ -248,338 +287,286 @@
             android:layout_height="match_parent" /&gt;
 &lt;/LinearLayout&gt;
 </pre>
-  <p>The {@code &lt;fragment&gt;} element uses the {@code android:name} attribute to specify the
-{@link android.app.Fragment} class to instantiate and insert into the layout. When the activity
-layout is created, the system instantiates each fragment in the layout and calls its {@link
-android.app.Fragment#onCreateView onCreateView()} method in order to retrieve the fragment's
-layout. The {@link android.view.View} object returned by {@link
-android.app.Fragment#onCreateView onCreateView()} is then
-placed directly in the activity layout in place of the {@code &lt;fragment&gt;} element.</p>
+  <p>The {@code android:name} attribute in the {@code &lt;fragment&gt;} specifies the {@link
+android.app.Fragment} class to instantiate in the layout.</p>
+
+<p>When the system creates this activity layout, it instantiates each fragment specified in the
+layout and calls the {@link android.app.Fragment#onCreateView onCreateView()} method for each one,
+to retrieve each fragment's layout. The system inserts the {@link android.view.View} returned by the
+fragment directly in place of the {@code &lt;fragment&gt;} element.</p>
 
 <div class="note">
   <p><strong>Note:</strong> Each fragment requires a unique identifier that
 the system can use to restore the fragment if the activity is restarted (and which you can use to
-perform fragment transactions). There are three ways to identify a fragment:</p>
+capture the fragment to perform transactions, such as remove it). There are three ways to provide an
+ID for a fragment:</p>
   <ul>
-    <li>Supply the {@code android:id} attribute with a unique ID, in the {@code
-&lt;fragment&gt;}</li>
-    <li>Supply the {@code android:tag} attribute with a unique string ID, in the {@code
-  &lt;fragment&gt;}</li>
-    <li>If neither of the previous two are provided, the system uses the ID of the container
-  view.</li>
+    <li>Supply the {@code android:id} attribute with a unique ID.</li>
+    <li>Supply the {@code android:tag} attribute with a unique string.</li>
+    <li>If you provide neither of the previous two, the system uses the ID of the container 
+view.</li>
   </ul>
 </div>
   </li>
 
   <li><b>Or, programmatically add the fragment to an existing {@link android.view.ViewGroup}.</b>
-<p>At any time while your activity is running (in the "resumed" state), you can add (and remove)
-fragments to your activity layout. You simply need to specify a {@link android.view.ViewGroup} in
-which to place the fragment.</p>
-  <p>To make any fragment transactions in your activity (such as add, remove, or replace a
+<p>At any time while your activity is running, you can add fragments to your activity layout. You
+simply need to specify a {@link
+android.view.ViewGroup} in which to place the fragment.</p>
+  <p>To make fragment transactions in your activity (such as add, remove, or replace a
 fragment), you must use APIs from {@link android.app.FragmentTransaction}. You can get an instance
-of {@link android.app.FragmentTransaction} from your {@link android.app.FragmentManager} using {@link
-android.app.FragmentManager#openTransaction()}. You can then add a fragment using the {@link
-android.app.FragmentTransaction#add add()} method, specifying the fragment to add and the view in
-which to insert it. For example:</p>
+of {@link android.app.FragmentTransaction} from your {@link android.app.Activity} like this:</p>
+
 <pre>
-MyFragment fragment = new MyFragment();
-getFragmentManager().openTransaction().add(R.id.fragment_container, fragment).commit();
+FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()}
+FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#openTransaction()};
 </pre>
-  <p>The first argument passed to {@link android.app.FragmentTransaction#add add()}
+
+<p>You can then add a fragment using the {@link
+android.app.FragmentTransaction#add(int,Fragment) add()} method, specifying the fragment to add and
+the view in which to insert it. For example:</p>
+
+<pre>
+ExampleFragment fragment = new ExampleFragment();
+fragmentTransaction.add(R.id.fragment_container, fragment);
+fragmentTransaction.commit();
+</pre>
+
+  <p>The first argument passed to {@link android.app.FragmentTransaction#add(int,Fragment) add()}
 is the {@link android.view.ViewGroup} in which the fragment should be placed, specified by
-resource ID, and the second parameter is the fragment object.</p>
-  <p>Once you've made your changes using
+resource ID, and the second parameter is the fragment to add.</p>
+  <p>Once you've made your changes with
 {@link android.app.FragmentTransaction}, you must
-call {@link android.app.FragmentTransaction#commit} in order for the changes to take effect.</p>
+call {@link android.app.FragmentTransaction#commit} for the changes to take effect.</p>
   </li>
 </ul>
 
 
-<h3 id="Example1">Example: simple fragments</h3>
+<h4 id="AddingWithoutUI">Adding a fragment without a UI</h4>
 
-<p>In the last couple sections, you saw how to declare layout for a fragment and add it to an
-activity. What follows is some code that brings it all together, like a "Hello World" for
-fragments.</p>
+<p>The examples above show how to add a fragment to your activity in order to provide a UI. However,
+you can also use a fragment to provide a background behavior for the activity without presenting
+additional UI.</p>
 
-<p>First, here's a layout file for a fragment:</p>
-<pre>
-&lt;?xml version="1.0" encoding="utf-8"?&gt;
-&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent" &gt;
-&lt;TextView  
-    android:layout_width="match_parent" 
-    android:layout_height="wrap_content"
-    android:text="@string/hello" /&gt;
-&lt;TextView  
-    android:layout_width="match_parent" 
-    android:layout_height="wrap_content"
-    android:text="@string/hello" /&gt;
-&lt;/LinearLayout&gt;
-</pre>
+<p>To add a fragment without a UI, add the fragment from the activity using {@link
+android.app.FragmentTransaction#add(Fragment,String)} (supplying a unique string "tag" for the
+fragment, rather than a view ID). This adds the fragment, but, because it's not associated with a
+view in the activity layout, it does not receive a call to {@link
+android.app.Fragment#onCreateView onCreateView()}. So you don't need to implement that method.</p>
 
-<p>With that file saved at {@code res/layout/simple_fragment.xml}, the following {@link
-android.app.Fragment} uses it for its layout:</p>
+<p>Supplying a string tag for the fragment isn't strictly for non-UI fragments&mdash;you can also
+supply string tags to fragments that do have a UI&mdash;but if the fragment does not have a
+UI, then the string tag is the only way to identify it. If you want to get the fragment from the
+activity later, you need to use {@link android.app.FragmentManager#findFragmentByTag
+findFragmentByTag()}.</p>
 
-<pre>
-public static class SimpleFragment extends Fragment {
-    &#64;Override
-    public View onCreateView(LayoutInflater inflater, ViewGroup container,
-                             Bundle savedInstanceState) {
-        // Inflate the layout for this fragment
-        return inflater.inflate(R.layout.simple_fragment, null);
-    }
-}
-</pre>
-
-<p>And the following layout for an activity applies the fragment twice, side by side:</p>
-
-<pre>
-&lt;?xml version="1.0" encoding="utf-8"?&gt;
-&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="horizontal"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"&gt;
-    &lt;fragment android:name="com.example.SimpleFragment"
-            android:id="@+id/list"
-            android:layout_weight="1"
-            android:layout_width="0dp"
-            android:layout_height="match_parent" /&gt;
-    &lt;fragment android:name="com.example.SimpleFragment"
-            android:id="@+id/viewer"
-            android:layout_weight="1"
-            android:layout_width="0dp"
-            android:layout_height="match_parent" /&gt;
-&lt;/LinearLayout&gt;
-</pre>
-
-<p>That's it. When an activity applies the previous layout as its content, the {@code
-SimpleFragment} class is instantiated for each occurence in the layout, applying the fragment
-layout when it receives the call to  {@link android.app.Fragment#onCreateView onCreateView()}.</p>
-
-<p>Although the fragment in this example implements only the {@link
-android.app.Fragment#onCreateView onCreateView()} callback, there are several other lifecycle
-callback methods that you should implement in your application. For example, {@link
-android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onPause onPause()}, {@link
-android.app.Fragment#onStop onStop()} and others that coincide with the fragment's lifecycle.</p>
+<p>For an example activity that uses a fragment as a background worker, without a UI, see the <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentRetainInstance.html">{@code
+FragmentRetainInstance.java}</a> sample.</p>
 
 
 
 <h2 id="Managing">Managing Fragments</h2>
 
-<p>A useful feature of fragments is the ability to add, remove, replace, and perform other
-operations on a fragment as the user interacts with the activity, alowing for more rich user
-experiences without changing activities. In order to perform these operations, you must use {@link
-android.app.FragmentTransaction} to perform fragment "transactions." You can acquire {@link
-android.app.FragmentTransaction} from your FragmentManager with {@link
-android.app.FragmentManager#openTransaction}.</p>
+<p>To manage the fragments in your activity, you need to use {@link android.app.FragmentManager}. To
+get it, call {@link android.app.Activity#getFragmentManager()} from your activity.</p>
 
-<p>Common transactions you can perform with fragments include:</p>
+<p>Some things that you can do with {@link android.app.FragmentManager} include:</p>
 
-<dl>
-  <dt>{@link android.app.FragmentTransaction#add add()}</dt>
-    <dd>Add a {@link android.app.Fragment} to the {@link android.app.Activity} layout.</dd>
-  <dt>{@link android.app.FragmentTransaction#remove remove()}</dt>
-    <dd>Remove a {@link android.app.Fragment} from the {@link android.app.Activity} layout.</dd>
-  <dt>{@link android.app.FragmentTransaction#replace replace()}</dt>
-    <dd>Replace an existing {@link android.app.Fragment} with another one.</dd>
-</dl>
+<ul>
+  <li>Get fragments that exist in the activity, with {@link
+android.app.FragmentManager#findFragmentById findFragmentById()} (for fragments that provide a UI in
+the activity layout) or {@link android.app.FragmentManager#findFragmentByTag
+findFragmentByTag()} (for fragments that do or don't provide a UI).</li> 
+  <li>Pop fragments off the back stack, with {@link
+android.app.FragmentManager#popBackStack()} (simulating a BACK command by the user).</li>
+  <li>Register a listener for changes to the back stack, with {@link
+android.app.FragmentManager#addOnBackStackChangedListener addOnBackStackChangedListener()}.</li>
+</ul>
 
-<p>For every transaction (or set of transactions) you perform, you must call {@link
-android.app.FragmentTransaction#commit} in order for the transactions made with {@link
-android.app.FragmentTransaction} to be applied. Before you do, however, you can call {@link
-android.app.FragmentTransaction#addToBackStack} to add the current fragment state to the
-activity's back stack, so that the user can return to the previous fragment state with the BACK key.
-For example, here's how a new fragment can replace another one, but keep the previous fragment
-in the back stack:</p>
+<p>For more information about these methods and others, refer to the {@link
+android.app.FragmentManager} class documentation.</p>
+
+<p>As demonstrated in the previous section, you can also use {@link android.app.FragmentManager}
+to open a {@link android.app.FragmentTransaction}, which allows you to perform transactions, such as
+add and remove fragments.</p>
+
+
+<h2 id="Transactions">Performing Fragment Transactions</h2>
+
+<p>A great feature about using fragments in your activity is the ability to add, remove, replace,
+and perform other actions with them, in response to user interaction. Each set of changes that you
+commit to the activity is called a transaction and you can perform one using APIs in {@link
+android.app.FragmentTransaction}. You can also save each transaction to a back stack managed by the
+activity, allowing the user to navigate backward through the fragment changes (similar to navigating
+backward through activities).</p>
+
+<p>You can acquire an instance of {@link android.app.FragmentTransaction} from the {@link
+android.app.FragmentManager} like this:</p>
 
 <pre>
-// Create new fragment
-Fragment newFragment = new MyFragment();
-FragmentTransaction ft = getFragmentManager().openTransaction();
-// Replace and add to back stack
-ft.replace(R.id.myfragment, newFragment);
-ft.addToBackStack(null);
-// Apply changes
-ft.commit();
+FragmentManager fragmentManager = {@link android.app.Activity#getFragmentManager()};
+FragmentTransaction fragmentTransaction = fragmentManager.{@link android.app.FragmentManager#openTransaction()};
 </pre>
 
-<p>In this example, {@code newFragment} replaces whatever fragment is currently in the
-layout container identified by the {@code R.id.myfragment} ID. By calling {@link
-android.app.FragmentTransaction#addToBackStack addToBackStack()}, this transaction (the replace) is
-saved to the activity's back stack so that the user can reverse this change and bring back the
+<p>Each transaction is a set of changes that you want to perform at the same time. You can set
+up all the changes you want to perform for a given transaction using methods such as {@link
+android.app.FragmentTransaction#add add()}, {@link android.app.FragmentTransaction#remove remove()},
+and {@link android.app.FragmentTransaction#replace replace()}. Then, to apply the transaction
+to the activity, you must call {@link android.app.FragmentTransaction#commit()}.</p>
+</dl>
+
+<p>Before you call {@link
+android.app.FragmentTransaction#commit()}, however, you might want to call {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, in order to add the transaction
+to a back stack of fragment transactions. This back stack is managed by the activity and allows
+the user to return to the previous fragment state, by pressing the BACK key.</p>
+
+<p>For example, here's how you can replace one fragment with another, and preserve the previous
+state in the back stack:</p>
+
+<pre>
+// Create new fragment and transaction
+Fragment newFragment = new ExampleFragment();
+FragmentTransaction transaction = getFragmentManager().openTransaction();
+
+// Replace whatever is in the fragment_container view with this fragment,
+// and add the transaction to the back stack
+transaction.replace(R.id.fragment_container, newFragment);
+transaction.addToBackStack(null);
+
+// Commit the transaction
+transaction.commit();
+</pre>
+
+<p>In this example, {@code newFragment} replaces whatever fragment (if any) is currently in the
+layout container identified by the {@code R.id.fragment_container} ID. By calling {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, the replace transaction is
+saved to the back stack so the user can reverse the transaction and bring back the
 previous fragment by pressing the BACK key.</p>
 
-<p>If you perform multiple transactions and call {@link
-android.app.FragmentTransaction#addToBackStack addToBackStack()}, then all transactions performed
-before {@link android.app.FragmentTransaction#commit} are added to the activity's back stack as a
-single event and the BACK key will reverse them all together.</p>
+<p>If you add multiple changes to the transaction (such as another {@link
+android.app.FragmentTransaction#add add()} or {@link android.app.FragmentTransaction#remove
+remove()}) and call {@link
+android.app.FragmentTransaction#addToBackStack addToBackStack()}, then all changes applied
+before you call {@link android.app.FragmentTransaction#commit commit()} are added to the
+back stack as a single transaction and the BACK key will reverse them all together.</p>
 
-
-
-<h2 id="Lifecycle">Handling the Lifecycle</h2>
-
-<p>A fragment has a lifecycle that corresponds to the lifecycle of the activity in which it
-resides. For example, a fragment has callback methods {@link
-android.app.Fragment#onCreate onCreate()}, {@link android.app.Fragment#onStart onStart()}, {@link
-android.app.Fragment#onPause onPause()}, {@link android.app.Fragment#onStop onStop()}, and more.</p>
-
-<p>The lifecycle of the activity directly affects the lifecycle of the fragment, such that each
-lifecycle callback for the activity results in a similar callback for each fragment (for
-example, when the activity receives {@link android.app.Activity#onPause}, each fragment receives
-{@link android.app.Fragment#onPause}). However, the
-fragment's lifecycle can also change independently&mdash;but only while the activity is
-resumed (while it is in the foreground)&mdash;because you can dynamically
-add, remove, and replace fragments without any change to the lifecycle of the activity.</p>
-
-<p>To accomodate backward navigation with the
-BACK key, you can optionally maintain a back stack of fragment transactions, as described in the
-previous section. So, if you
-replace one fragment with another, the user can press the BACK key and view the previous
-fragment. Additionally, each fragment can maintain its own state, such that
-when the user navigates back to a previous fragment, the state of that fragment can be restored in
-the same manner as the state of an activity is restored when it is stopped and restarted.</p>
-
-<p>Managing the lifecycle of a fragment is a lot like managing the lifecycle of an activity. A
-fragment and an activity both have an "resumed," "paused," and "stopped" state, and they can both
-retain their state using a {@link android.os.Bundle}. The only significant difference is that an
-activity is placed into a the task's back stack by default (so that the user can navigate to
-the previous activity with the BACK key), but a fragment is placed into the activity's back stack
-only when you explicitly call {@link android.app.FragmentTransaction#addToBackStack(String)
-addToBackStack()} before you {@link android.app.FragmentTransaction#commit()} a fragment
-transaction.</p>
-
-<p>The order in which you perform transactions with {@link android.app.FragmentTransaction} doesn't
-matter, except:</p>
+<p>The order in which you add changes to a {@link android.app.FragmentTransaction} doesn't matter,
+except:</p>
 <ul>
   <li>You must call {@link android.app.FragmentTransaction#commit()} last</li>
   <li>If you're adding multiple fragments to the same container, then the order in which
-you add them determines the order they appear</li>
+you add them determines the order they appear in the view hierarchy</li>
 </ul>
+
 <p>If you do not call {@link android.app.FragmentTransaction#addToBackStack(String)
 addToBackStack()} when you perform a transaction that removes a fragment, then that fragment is
-destroyed when the transaction is committed.</p>
+destroyed when the transaction is committed and the user cannot navigate back to it. Whereas, if you
+do call {@link android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} when
+removing a fragment, then the fragment is <em>stopped</em> and will be resumed if the user navigates
+back.</p>
+
+<p class="note"><strong>Tip:</strong> For each fragment transaction, you can apply a transition
+animation, by calling {@link android.app.FragmentTransaction#setTransition setTransition()} before
+you commit.</p>
+
+<p>Calling {@link android.app.FragmentTransaction#commit()} does not perform the transaction
+immediately. Rather, it schedules it to run on the activity's UI thread (the "main" thread) as soon
+as the thread is able to do so. If necessary, however, you may call {@link
+android.app.FragmentManager#executePendingTransactions()} from your UI thread to immediately execute
+transactions submitted by {@link android.app.FragmentTransaction#commit()}. Doing so is
+usually not necessary unless the transaction is a dependency for jobs in other threads.</p>
+
+<p class="caution"><strong>Caution:</strong> You can commit a transaction using {@link
+android.app.FragmentTransaction#commit commit()} only prior to the activity <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#SavingActivityState">saving its
+state</a> (when the user leaves the activity). If you attempt to commit after that point, an
+exception will be thrown. This is because the state after the commit can be lost if the activity
+needs to be restored. For situations in which its okay that you lose the commit, use {@link
+android.app.FragmentTransaction#commitAllowingStateLoss()}.</p>
 
 
-<h3 id="CoordinatingWithTheActivity">Coordinating with the activity lifecycle</h3>
-
-<p>The lifecycle of an activity directly affects the lifecycle of a {@link android.app.Fragment}
-embedded in that activity. The {@link android.app.Fragment} class has lifecycle callback
-methods that match those in the {@link android.app.Activity} class.</p>
-
-<p>Fragments have a few extra lifecycle callbacks, however, that handle unique interaction with the
-activity in order to perform actions such as build and destroy the fragment's UI. These additional
-callback methods are:</p>
-
-<dl>
-  <dt>{@link android.app.Fragment#onAttach onAttach()}</dt>
-    <dd>Called when the fragment has been associated with the activity (the {@link
-android.app.Activity} is passed in here).</dd>
-  <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
-    <dd>Called to create the view hierarchy associated with the fragment.</dd>
-  <dt>{@link android.app.Fragment#onActivityCreated onActivityCreated()}</dt>
-    <dd>Called when the activity's own {@link android.app.Activity#onCreate
-onCreate()} has finished.</dd>
-  <dt>{@link android.app.Fragment#onDestroyView onDestroyView()}</dt>
-    <dd>Called when the view hierarchy associated with the fragment is being removed.</dd>
-  <dt>{@link android.app.Fragment#onDetach onDetach()}</dt>
-    <dd>Called when the fragment is being disassociated from the activity.</dd>
-</dl>
-
-<p>The flow of a fragment's lifecycle, as it is affected by its container activity, is illustrated
-by figure 3. In this figure, you can see how each successive state of the activity determines which
-callback methods the fragment may receive. For example, when the activity has received
-its {@link android.app.Activity#onCreate onCreate()} callback, the fragment receives no more
-than the {@link android.app.Fragment#onActivityCreated onActivityCreated()} callback. However,
-once the activity reaches the resumed state, you can freely add and remove fragments to the
-activity, so the fragment lifecycle is no longer inhibitted by the state of the activity. Yet,
-when the activity leaves the resumed state, the fragment again is pushed through its lifecycle by
-the activity (unless you explicitly destroy the fragment sooner).</p>
 
 
-<img src="{@docRoot}images/activity_fragment_lifecycle.png" alt=""/>
-<p class="img-caption"><strong>Figure 3.</strong> The activity lifecycle's affect on the lifecycle
-of a fragment.</p>
+<h2 id="CommunicatingWithActivity">Communicating with the Activity</h2>
 
+<p>Although a {@link android.app.Fragment} is implemented as an object that's independent from an
+{@link android.app.Activity} and can be used inside multiple activities, a given instance of
+a fragment is directly tied to the activity that contains it.</p>
 
-<h3 id="Integrating">Integrating with the Activity</h3>
-
-<p>Although a {@link android.app.Fragment} is implemented separate from an {@link
-android.app.Activity} and can be used inside multiple activities, a fragment is directly tied to its
-container activity and can access the Activity instance with {@link
-android.app.Fragment#getActivity()}. So, a fragment can
-easily perform tasks such as find a view in the activity:</p>
+<p>Specifically, the fragment can access the {@link android.app.Activity} instance with {@link
+android.app.Fragment#getActivity()} and easily perform tasks such as find a view in the
+activity layout:</p>
 
 <pre>
 View listView = {@link android.app.Fragment#getActivity()}.{@link android.app.Activity#findViewById findViewById}(R.id.list);
 </pre>
 
-<p>This makes it easy for your fragment to call public methods in the activity.</p>
-
-<p>Likewise, your activity can call public methods in the fragment when you have a reference to the
-{@link android.app.Fragment}. You can acquire a reference to the fragment with {@link
-android.app.FragmentManager#findFragmentById findFragmentById()} and cast it to your implementation of
-{@link android.app.Fragment}. For example:</p>
+<p>Likewise, your activity can call methods in the fragment by acquiring a reference to the
+{@link android.app.Fragment} from {@link android.app.FragmentManager}, using {@link
+android.app.FragmentManager#findFragmentById findFragmentById()} or {@link
+android.app.FragmentManager#findFragmentByTag findFragmentByTag()}. For example:</p>
 
 <pre>
-MyFragment fragment = (MyFragment) findFragmentById(R.id.myfragment);
-fragment.refreshList();
+ExampleFragment fragment = (ExampleFragment) getFragmentManager().findFragmentById(R.id.example_fragment);
 </pre>
 
 
-<h4 id="Callbacks">Creating event callbacks to the activity</h4>
+<h4 id="EventCallbacks">Creating event callbacks to the activity</h4>
 
 <p>In some cases, you might need a fragment to share events with the activity. A good way to do that
 is to define a callback interface inside the fragment and require that the host activity implement
-it. When the activity receives a callback, it can share the information with other fragments in the layout as
-necessary.</p>
+it. When the activity receives a callback through the interface, it can share the information with
+other fragments in the layout as necessary.</p>
 
 <p>For example, if a news application has two fragments in an activity&mdash;one to show a list of
 articles (fragment A) and another to display an article (fragment B)&mdash;then fragment A must tell
 the activity when a list item is selected so that it can tell fragment B to display the article. In
-this case, the following interface is defined inside fragment A:</p>
+this case, the {@code OnArticleSelectedListener} interface is declared inside fragment A:</p>
 
 <pre>
 public static class FragmentA extends ListFragment {
     ...
     // Container Activity must implement this interface
-    public interface SelectedCallback {
+    public interface OnArticleSelectedListener {
         public void onArticleSelected(Uri articleUri);
     }
     ...
 }
 </pre>
 
-<p>Then the activity that hosts the fragment implements the {@code SelectedCallback} interface and
+<p>Then the activity that hosts the fragment implements the {@code OnArticleSelectedListener}
+interface and
 overrides {@code onArticleSelected()} to notify fragment B of the event from fragment A. To ensure
 that the host activity implements this interface, fragment A's {@link
-android.app.Fragment#onAttach onAttach()} callback method (called when
-the fragment is added to the activity) instantiates an instance of {@code SelectedCallback} by
+android.app.Fragment#onAttach onAttach()} callback method (which the system calls when adding
+the fragment to the activity) instantiates an instance of {@code OnArticleSelectedListener} by
 casting the {@link android.app.Activity} that is passed into {@link android.app.Fragment#onAttach
 onAttach()}:</p>
 
 <pre>
 public static class FragmentA extends ListFragment {
+    OnArticleSelectedListener mListener;
     ...
     &#64;Override
     public void onAttach(Activity activity) {
         super.onAttach(activity);
         try {
-            mCallback = (SelectedCallback) activity;
+            mListener = (OnArticleSelectedListener) activity;
         } catch (ClassCastException e) {
-            activity.finish();
-            throw new ClassCastException(activity.toString() + " must implement SelectedCallback");
+            throw new ClassCastException(activity.toString() + " must implement OnArticleSelectedListener");
         }
     }
     ...
 }
 </pre>
 
-<p>If the activity has not implemented the interface, then a {@link java.lang.ClassCastException} is
-thrown and the activity is shut down. On success, the {@code mCallback} member holds a reference to
-the {@link android.app.Activity}, so that fragment A can share events with the activity by calling
-methods defined by the {@code SelectedCallback} interface. For example, if fragment A is an
+<p>If the activity has not implemented the interface, then the fragment throws a
+{@link java.lang.ClassCastException}.
+On success, the {@code mListener} member holds a reference to activity's implementation of 
+{@code OnArticleSelectedListener}, so that fragment A can share events with the activity by calling
+methods defined by the {@code OnArticleSelectedListener} interface. For example, if fragment A is an
 extension of {@link android.app.ListFragment}, each time
 the user clicks a list item, the system calls {@link android.app.ListFragment#onListItemClick
 onListItemClick()} in the fragment, which then calls {@code onArticleSelected()} to share
@@ -587,13 +574,14 @@
 
 <pre>
 public static class FragmentA extends ListFragment {
+    OnArticleSelectedListener mListener;
     ...
     &#64;Override
     public void onListItemClick(ListView l, View v, int position, long id) {
         // Append the clicked item's row ID with the content provider Uri
         Uri noteUri = ContentUris.{@link android.content.ContentUris#withAppendedId withAppendedId}(ArticleColumns.CONTENT_URI, id);
         // Send the event and Uri to the host activity
-        mCallback.onArticleSelected(noteUri);
+        mListener.onArticleSelected(noteUri);
     }
     ...
 }
@@ -611,38 +599,217 @@
 
 
 
+<h3 id="ActionBar">Adding items to the Action Bar</h3>
 
-
-
-<h2 id="Menus">Adding Action Items to the Activity</h2>
-
-<p>Your fragments can contribute action items to the activity's <a
-href="{@docRoot}guide/topics/ui/actionbar.html">action bar</a> (and menu items to the options menu)
-using the callback methods
+<p>Your fragments can contribute menu items to the activity's <a
+href="{@docRoot}guide/topics/ui/menus.html#options-menu">Options Menu</a> (and, consequently, the <a
+href="{@docRoot}guide/topics/ui/actionbar.html">Action Bar</a>) by implementing
 {@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater) onCreateOptionsMenu()}. In order
 for this method to receive calls, however, you must call {@link
-android.app.Fragment#setHasOptionsMenu(boolean) setHasOptionsMenu()} during the {@link
-android.app.Fragment#onCreate(Bundle) onCreate()} callback in order to indicate that the fragment
-would like to receive a call to {@link android.app.Fragment#onCreateOptionsMenu(Menu,MenuInflater)
-onCreateOptionsMenu()}. Any action or menu items that you add from the fragment are appended to the
-existing
-items for the options menu (including those added by other fragments in the activity). The
-fragment also receives item-selected events with the {@link
-android.app.Fragment#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} callback method.</p>
+android.app.Fragment#setHasOptionsMenu(boolean) setHasOptionsMenu()} during {@link
+android.app.Fragment#onCreate(Bundle) onCreate()}, to indicate that the fragment
+would like to add items to the Options Menu (otherwise, the fragment will not receive a call to
+{@link android.app.Fragment#onCreateOptionsMenu onCreateOptionsMenu()}).</p>
 
-<p>The {@link android.app.Fragment} class also contains methods to handle context menus. You can
-register a view to provide a context menu with {@link
+<p>Any items that you then add to the Options Menu from the fragment are appended to the existing
+menu items. The fragment also receives callbacks to {@link
+android.app.Fragment#onOptionsItemSelected(MenuItem) onOptionsItemSelected()} when a menu item
+is selected.</p>
+
+<p>You can also register a view in your fragment layout to provide a context menu by calling {@link
 android.app.Fragment#registerForContextMenu(View) registerForContextMenu()}. When the user opens
 the context menu, the fragment receives a call to {@link
 android.app.Fragment#onCreateContextMenu(ContextMenu,View,ContextMenu.ContextMenuInfo)
 onCreateContextMenu()}. When the user selects an item, the fragment receives a call to {@link
 android.app.Fragment#onContextItemSelected(MenuItem) onContextItemSelected()}.</p>
 
-<p>For more information, see <a href="{@docRoot}guide/topics/ui/menus.html">Creating
+<p class="note"><strong>Note:</strong> Although your fragment receives an on-item-selected callback
+for each menu item it adds, the activity is first to receive the respective callback when the user
+selects a menu item. If the activity's implementation of the on-item-selected callback does not
+handle the selected item, then the event is passed to the fragment's callback. This is true for
+the Options Menu and context menus.</p>
+
+<p>For more information about menus, see <a href="{@docRoot}guide/topics/ui/menus.html">Creating
 Menus</a> and <a href="{@docRoot}guide/topics/ui/actionbar.html">Using the Action Bar</a>.</p>
 
 
 
 
+<h2 id="Lifecycle">Handling the Fragment Lifecycle</h2>
+
+<div class="figure" style="width:403px">
+<img src="{@docRoot}images/activity_fragment_lifecycle.png" alt=""/>
+<p class="img-caption"><strong>Figure 3.</strong> The activity lifecycle's affect on the fragment
+lifecycle.</p>
+</div>
+
+<p>Managing the lifecycle of a fragment is a lot like managing the lifecycle of an activity. Like
+an activity, a fragment can exist in three states:</p>
+
+<dl>
+  <dt><i>Resumed</i></dt>
+    <dd>The fragment is visible in the running activity.</dd>
+
+  <dt><i>Paused</i></dt>
+    <dd>Another activity is in the foreground and has focus, but the activity in which this
+fragment lives is still visible (the foreground activity is partially transparent or doesn't
+cover the entire screen).</dd>
+
+  <dt><i>Stopped</i></dt>
+    <dd>The fragment is not visible. Either the host activity has been stopped or the
+fragment has been removed from the activity but added to the back stack. A stopped fragment is
+still alive (all state and member information is retained by the system). However, it is no longer
+visible to the user and will be killed if the activity is killed.</dd>
+</dl>
+
+<p>Also like an activity, you can retain the state of a fragment using a {@link
+android.os.Bundle}, in case the activity's process is killed and you need to restore the
+fragment state when the activity is recreated. You can save the state during the fragment's {@link
+android.app.Fragment#onSaveInstanceState onSaveInstanceState()} callback and restore it during
+either {@link android.app.Fragment#onCreate onCreate()}, {@link
+android.app.Fragment#onCreateView onCreateView()}, or {@link
+android.app.Fragment#onActivityCreated onActivityCreated()}. For more information about saving
+state, see the <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#SavingActivityState">Activities</a>
+document.</p>
+
+<p>The most significant difference in lifecycle between an activity and a fragment is how one is
+stored in its respective back stack. An activity is placed into a back stack of activities
+that's managed by the system when it's stopped, by default (so that the user can navigate back
+to it with the BACK key, as discussed in <a
+href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a>).
+However, a fragment is placed into a back stack managed by the host activity only when you
+explicitly request that the instance be saved by calling {@link
+android.app.FragmentTransaction#addToBackStack(String) addToBackStack()} during a transaction that
+removes the fragment.</p>
+
+<p>Otherwise, managing the fragment lifecycle is very similar to managing the activity
+lifecycle. So, the same practices for <a
+href="{@docRoot}guide/topics/fundamentals/activities.html#Lifecycle">managing the activity
+lifecycle</a> also apply to fragments. What you also need to understand, though, is how the life
+of the activity affects the life of the fragment.</p>
+
+
+<h3 id="CoordinatingWithActivity">Coordinating with the activity lifecycle</h3>
+
+<p>The lifecycle of the activity in which the fragment lives directly affects the lifecycle of the
+fragment, such that each lifecycle callback for the activity results in a similar callback for each
+fragment. For example, when the activity receives {@link android.app.Activity#onPause}, each
+fragment in the activity receives {@link android.app.Fragment#onPause}.</p>
+
+<p>Fragments have a few extra lifecycle callbacks, however, that handle unique interaction with the
+activity in order to perform actions such as build and destroy the fragment's UI. These additional
+callback methods are:</p>
+
+<dl>
+  <dt>{@link android.app.Fragment#onAttach onAttach()}</dt>
+    <dd>Called when the fragment has been associated with the activity (the {@link
+android.app.Activity} is passed in here).</dd>
+  <dt>{@link android.app.Fragment#onCreateView onCreateView()}</dt>
+    <dd>Called to create the view hierarchy associated with the fragment.</dd>
+  <dt>{@link android.app.Fragment#onActivityCreated onActivityCreated()}</dt>
+    <dd>Called when the activity's {@link android.app.Activity#onCreate
+onCreate()} method has returned.</dd>
+  <dt>{@link android.app.Fragment#onDestroyView onDestroyView()}</dt>
+    <dd>Called when the view hierarchy associated with the fragment is being removed.</dd>
+  <dt>{@link android.app.Fragment#onDetach onDetach()}</dt>
+    <dd>Called when the fragment is being disassociated from the activity.</dd>
+</dl>
+
+<p>The flow of a fragment's lifecycle, as it is affected by its host activity, is illustrated
+by figure 3. In this figure, you can see how each successive state of the activity determines which
+callback methods a fragment may receive. For example, when the activity has received its {@link
+android.app.Activity#onCreate onCreate()} callback, a fragment in the activity receives no more than
+the {@link android.app.Fragment#onActivityCreated onActivityCreated()} callback.</p>
+
+<p>Once the activity reaches the resumed state, you can freely add and remove fragments to the
+activity. Thus, only while the activity is in the resumed state can the lifecycle of a fragment
+change independently.</p>
+
+<p>However, when the activity leaves the resumed state, the fragment again is pushed through its
+lifecycle by the activity.</p>
+
+
+
+
+<h2 id="Example">Example</h2>
+
+<p>To bring everything discussed in this document together, here's an example of an activity
+using two fragments to create a two-pane layout. The activity below includes one fragment to
+show a list of Shakespeare play titles and another to show a summary of the play when selected
+from the list. It also demonstrates how to provide different configurations of the fragments,
+based on the screen configuration.</p>
+
+<p class="note"><strong>Note:</strong> The complete source code for this activity is available in
+<a href="resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.html">{@code
+FragmentLayout.java}</a>.</p>
+
+<p>The main activity applies a layout in the usual way, during {@link
+android.app.Activity#onCreate onCreate()}:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java main}
+
+<p>The layout applied is {@code fragment_layout.xml}:</p>
+
+{@sample development/samples/ApiDemos/res/layout-land/fragment_layout.xml layout}
+
+<p>Using this layout, the system instantiates the {@code TitlesFragment} (which lists the play
+titles) as soon as the activity loads the layout, while the {@link android.widget.FrameLayout}
+(where the fragment for showing the play summary will go) consumes space on the right side of the
+screen, but remains empty at first. As you'll see below, it's not until the user selects an item
+from the list that a fragment is placed into the {@link android.widget.FrameLayout}.</p>
+
+<p>However, not all screen configurations are wide enough to show both the list of
+plays and the summary, side by side. So, the layout above is used only for the landscape
+screen configuration, by saving it at {@code res/layout-land/fragment_layout.xml}.</p>
+
+<p>Thus, when the screen is in portrait orientation, the system applies the following layout, which
+is saved at {@code res/layout/fragment_layout.xml}:</p>
+
+{@sample development/samples/ApiDemos/res/layout/fragment_layout.xml layout}
+
+<p>This layout includes only {@code TitlesFragment}. This means that, when the device is in
+portrait orientation, only the list of play titles is visible. So, when the user clicks a list
+item in this configuration, the application will start a new activity to show the summary,
+instead of loading a second fragment.</p>
+
+<p>Next, you can see how this is accomplished in the fragment classes. First is {@code
+TitlesFragment}, which shows the list of Shakespeare play titles. This fragment extends {@link
+android.app.ListFragment} and relies on it to handle most of the list view work.</p>
+
+<p>As you inspect this code, notice that there are two possible behaviors when the user clicks a
+list item: depending on which of the two layouts is active, it can either create and display a new
+fragment to show the details in the same activity (adding the fragment to the {@link
+android.widget.FrameLayout}), or start a new activity (where the fragment can be shown).</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java titles}
+
+<p>The second fragment, {@code DetailsFragment} shows the play summary for the item selected from
+the list from {@code TitlesFragment}:</p>
+ 
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java details}
+
+<p>Recall from the {@code TitlesFragment} class, that, if the user clicks a list item and the
+current layout does <em>not</em> include the {@code R.id.details} view (which is where the
+{@code DetailsFragment} belongs), then the application starts the {@code DetailsActivity}
+activity to display the content of the item.</p>
+
+<p>Here is the {@code DetailsActivity}, which simply embeds the {@code DetailsFragment} to display
+the selected play summary when the screen is in portrait orientation:</p>
+
+{@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentLayout.java
+details_activity}
+ 
+<p>Notice that this activity finishes itself if the configuration is landscape, so that the main
+activity can take over and display the {@code DetailsFragment} alongside the {@code TitlesFragment}.
+This can happen if the user begins the {@code DetailsActivity} while in portrait orientation, but
+then rotates to landscape (which restarts the current activity).</p>
+
+
+<p>For more samples using fragments (and complete source files for this example),
+see the sample code available in <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/index.html#Fragment">
+ApiDemos</a> (available for download from the <a
+href="{@docRoot}resources/samples/get.html">Samples SDK component</a>).</p>
 
 
diff --git a/docs/html/images/fundamentals/fragments.png b/docs/html/images/fundamentals/fragments.png
new file mode 100644
index 0000000..b3b7b23
--- /dev/null
+++ b/docs/html/images/fundamentals/fragments.png
Binary files differ
diff --git a/graphics/java/android/graphics/Bitmap.java b/graphics/java/android/graphics/Bitmap.java
index a8efd00..e67ceed 100644
--- a/graphics/java/android/graphics/Bitmap.java
+++ b/graphics/java/android/graphics/Bitmap.java
@@ -53,6 +53,7 @@
      */
     public byte[] mBuffer;
 
+    @SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"}) // Keep to finalize native resources
     private final BitmapFinalizer mFinalizer;
 
     private final boolean mIsMutable;
diff --git a/graphics/java/android/graphics/BitmapFactory.java b/graphics/java/android/graphics/BitmapFactory.java
index 8309f7a..dd6bf19 100644
--- a/graphics/java/android/graphics/BitmapFactory.java
+++ b/graphics/java/android/graphics/BitmapFactory.java
@@ -64,6 +64,14 @@
         public Bitmap inBitmap;
 
         /**
+         * If set, decode methods will always return a mutable Bitmap instead of
+         * an immutable one. This can be used for instance to programmatically apply
+         * effects to a Bitmap loaded through BitmapFactory.
+         */
+        @SuppressWarnings({"UnusedDeclaration"}) // used in native code
+        public boolean inMutable;
+
+        /**
          * If set to true, the decoder will return null (no bitmap), but
          * the out... fields will still be set, allowing the caller to query
          * the bitmap without having to allocate the memory for its pixels.
@@ -523,7 +531,7 @@
             }
             bm.setDensity(targetDensity);
         }
-        
+
         return bm;
     }
     
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
index bab8ed3..7544f46 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/tablet/RecentAppsPanel.java
@@ -297,7 +297,7 @@
 
     private Drawable getFullResDefaultActivityIcon() {
         return getFullResIcon(Resources.getSystem(),
-                com.android.internal.R.drawable.sym_def_app_icon);
+                com.android.internal.R.mipmap.sym_def_app_icon);
     }
 
     private Drawable getFullResIcon(Resources resources, int iconId) {
diff --git a/services/java/com/android/server/DevicePolicyManagerService.java b/services/java/com/android/server/DevicePolicyManagerService.java
index c0ce256..8a9e351 100644
--- a/services/java/com/android/server/DevicePolicyManagerService.java
+++ b/services/java/com/android/server/DevicePolicyManagerService.java
@@ -145,6 +145,7 @@
         int maximumFailedPasswordsForWipe = 0;
         long passwordExpirationTimeout = 0L;
         long passwordExpirationDate = 0L;
+        boolean encryptionRequested = false;
 
         // TODO: review implementation decisions with frameworks team
         boolean specifiesGlobalProxy = false;
@@ -242,6 +243,11 @@
                 out.attribute(null, "value", Long.toString(passwordExpirationDate));
                 out.endTag(null, "password-expiration-date");
             }
+            if (encryptionRequested) {
+                out.startTag(null, "encryption-requested");
+                out.attribute(null, "value", Boolean.toString(encryptionRequested));
+                out.endTag(null, "encryption-requested");
+            }
         }
 
         void readFromXml(XmlPullParser parser)
@@ -290,7 +296,7 @@
                     maximumFailedPasswordsForWipe = Integer.parseInt(
                             parser.getAttributeValue(null, "value"));
                 } else if ("specifies-global-proxy".equals(tag)) {
-                    specifiesGlobalProxy = Boolean.getBoolean(
+                    specifiesGlobalProxy = Boolean.parseBoolean(
                             parser.getAttributeValue(null, "value"));
                 } else if ("global-proxy-spec".equals(tag)) {
                     globalProxySpec =
@@ -304,6 +310,9 @@
                 } else if ("password-expiration-date".equals(tag)) {
                     passwordExpirationDate = Long.parseLong(
                             parser.getAttributeValue(null, "value"));
+                } else if ("encryption-requested".equals(tag)) {
+                    encryptionRequested = Boolean.parseBoolean(
+                            parser.getAttributeValue(null, "value"));
                 } else {
                     Slog.w(TAG, "Unknown admin tag: " + tag);
                 }
@@ -356,6 +365,8 @@
                 pw.print(prefix); pw.print("globalProxyEclusionList=");
                         pw.println(globalProxyExclusionList);
             }
+            pw.print(prefix); pw.print("encryptionRequested=");
+                    pw.println(encryptionRequested);
         }
     }
 
@@ -1823,7 +1834,8 @@
     }
 
     /**
-     * Set the storage encryption request.
+     * Set the storage encryption request for a single admin.  Returns the new total request
+     * status (for all admins).
      */
     public int setStorageEncryption(ComponentName who, boolean encrypt) {
         synchronized (this) {
@@ -1834,29 +1846,94 @@
             ActiveAdmin ap = getActiveAdminForCallerLocked(who,
                     DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
 
-            // TODO: (1) Record the value for the admin so it's sticky
-            // TODO: (2) Compute "max" for all admins (if any admin requests encryption, then
-            //           we enable it.
-            // TODO: (3) Work with filesystem / mount service to start/stop encryption
-            return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+            // Quick exit:  If the filesystem does not support encryption, we can exit early.
+            if (!isEncryptionSupported()) {
+                return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+            }
+
+            // (1) Record the value for the admin so it's sticky
+            if (ap.encryptionRequested != encrypt) {
+                ap.encryptionRequested = encrypt;
+                saveSettingsLocked();
+            }
+
+            // (2) Compute "max" for all admins
+            boolean newRequested = false;
+            final int N = mAdminList.size();
+            for (int i = 0; i < N; i++) {
+                newRequested |= mAdminList.get(i).encryptionRequested;
+            }
+
+            // Notify OS of new request
+            setEncryptionRequested(newRequested);
+
+            // Return the new global request status
+            return newRequested
+                    ? DevicePolicyManager.ENCRYPTION_STATUS_ACTIVE
+                    : DevicePolicyManager.ENCRYPTION_STATUS_INACTIVE;
         }
     }
 
     /**
-     * Get the current storage encryption status for a given storage domain.
+     * Get the current storage encryption request status for a given admin, or aggregate of all
+     * active admins.
      */
-    public int getStorageEncryption(ComponentName who) {
+    public boolean getStorageEncryption(ComponentName who) {
         synchronized (this) {
             // Check for permissions if a particular caller is specified
             if (who != null) {
-                getActiveAdminForCallerLocked(who, DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
+                // When checking for a single caller, status is based on caller's request
+                ActiveAdmin ap = getActiveAdminForCallerLocked(who,
+                        DeviceAdminInfo.USES_ENCRYPTED_STORAGE);
+                return ap.encryptionRequested;
             }
 
-            // TODO: Work with filesystem / mount service to query encryption status
-            return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+            // If no particular caller is specified, return the aggregate set of requests.
+            // This is short circuited by returning true on the first hit.
+            final int N = mAdminList.size();
+            for (int i = 0; i < N; i++) {
+                if (mAdminList.get(i).encryptionRequested) {
+                    return true;
+                }
+            }
+            return false;
         }
     }
 
+    /**
+     * Get the current encryption status of the device.
+     */
+    public int getStorageEncryptionStatus() {
+        return getEncryptionStatus();
+    }
+
+    /**
+     * Hook to low-levels:  This should report if the filesystem supports encrypted storage.
+     */
+    private boolean isEncryptionSupported() {
+        // Note, this can be implemented as
+        //   return getEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+        // But is provided as a separate internal method if there's a faster way to do a
+        // simple check for supported-or-not.
+        return getEncryptionStatus() != DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+    }
+
+    /**
+     * Hook to low-levels:  Reporting the current status of encryption.
+     * @return A value such as {@link DevicePolicyManager#ENCRYPTION_STATUS_UNSUPPORTED} or
+     * {@link DevicePolicyManager#ENCRYPTION_STATUS_INACTIVE} or
+     * {@link DevicePolicyManager#ENCRYPTION_STATUS_ACTIVE}.
+     */
+    private int getEncryptionStatus() {
+        return DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED;
+    }
+
+    /**
+     * Hook to low-levels:  If needed, record the new admin setting for encryption.
+     */
+    private void setEncryptionRequested(boolean encrypt) {
+    }
+
     @Override
     protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
         if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.DUMP)
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index 19667d4..1eebd6a 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -4390,8 +4390,6 @@
         }
     };
 
-    private static final boolean DEBUG_OBB = false;
-
     private static final void sendPackageBroadcast(String action, String pkg,
             Bundle extras, IIntentReceiver finishedReceiver) {
         IActivityManager am = ActivityManagerNative.getDefault();
@@ -4641,64 +4639,6 @@
         }
     }
 
-    public void setPackageObbPaths(String packageName, String[] paths) {
-        if (DEBUG_OBB)
-            Log.v(TAG, "Setting .obb paths for " + packageName + " to: " + Arrays.toString(paths));
-        final int uid = Binder.getCallingUid();
-        final int permission = mContext.checkCallingPermission(
-                android.Manifest.permission.INSTALL_PACKAGES);
-        final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
-        if (!allowedByPermission) {
-            throw new SecurityException("Permission denial: attempt to set .obb file from pid="
-                    + Binder.getCallingPid());
-        }
-        synchronized (mPackages) {
-            final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
-            if (pkgSetting == null) {
-                throw new IllegalArgumentException("Unknown package: " + packageName);
-            }
-
-            if (paths != null) {
-                if (paths.length == 0) {
-                    // Don't bother storing an empty array.
-                    paths = null;
-                } else {
-                    // Don't allow the caller to manipulate our copy of the
-                    // list.
-                    paths = paths.clone();
-                }
-            }
-
-            // Only write settings file if the new and old settings are not the
-            // same.
-            if (!Arrays.equals(paths, pkgSetting.obbPathStrings)) {
-                pkgSetting.obbPathStrings = paths;
-                mSettings.writeLP();
-            }
-        }
-    }
-
-    public String[] getPackageObbPaths(String packageName) {
-        if (DEBUG_OBB)
-            Log.v(TAG, "Getting .obb paths for " + packageName);
-        final int uid = Binder.getCallingUid();
-        final int permission = mContext.checkCallingPermission(
-                android.Manifest.permission.INSTALL_PACKAGES);
-        final boolean allowedByPermission = (permission == PackageManager.PERMISSION_GRANTED);
-        synchronized (mPackages) {
-            final PackageSetting pkgSetting = mSettings.mPackages.get(packageName);
-            if (pkgSetting == null) {
-                throw new IllegalArgumentException("Unknown package: " + packageName);
-            }
-            if (!allowedByPermission && (uid != pkgSetting.userId)) {
-                throw new SecurityException("Permission denial: attempt to set .obb file from pid="
-                        + Binder.getCallingPid() + ", uid=" + uid + ", package uid="
-                        + pkgSetting.userId);
-            }
-            return pkgSetting.obbPathStrings;
-        }
-    }
-
     private void processPendingInstall(final InstallArgs args, final int currentStatus) {
         // Queue up an async operation since the package installation may take a little while.
         mHandler.post(new Runnable() {
@@ -4853,6 +4793,11 @@
                         .getExternalStorageAppMediaDirectory(mStats.packageName);
                 mStats.externalMediaSize = mContainerService
                         .calculateDirectorySize(externalCacheDir.getPath());
+
+                final File externalObbDir = Environment
+                        .getExternalStorageAppObbDirectory(mStats.packageName);
+                mStats.externalObbSize = mContainerService.calculateDirectorySize(externalObbDir
+                        .getPath());
             }
         }
 
@@ -7333,7 +7278,6 @@
                     pw.print("    codePath="); pw.println(ps.codePathString);
                     pw.print("    resourcePath="); pw.println(ps.resourcePathString);
                     pw.print("    nativeLibraryPath="); pw.println(ps.nativeLibraryPathString);
-                    pw.print("    obbPaths="); pw.println(Arrays.toString(ps.obbPathStrings));
                     pw.print("    versionCode="); pw.println(ps.versionCode);
                     if (ps.pkg != null) {
                         pw.print("    versionName="); pw.println(ps.pkg.mVersionName);
@@ -7917,7 +7861,6 @@
         File resourcePath;
         String resourcePathString;
         String nativeLibraryPathString;
-        String[] obbPathStrings;
         long timeStamp;
         long firstInstallTime;
         long lastUpdateTime;
@@ -7963,11 +7906,6 @@
             resourcePath = base.resourcePath;
             resourcePathString = base.resourcePathString;
             nativeLibraryPathString = base.nativeLibraryPathString;
-
-            if (base.obbPathStrings != null) {
-                obbPathStrings = base.obbPathStrings.clone();
-            }
-
             timeStamp = base.timeStamp;
             firstInstallTime = base.firstInstallTime;
             lastUpdateTime = base.lastUpdateTime;
@@ -9026,16 +8964,6 @@
             if (pkg.installerPackageName != null) {
                 serializer.attribute(null, "installer", pkg.installerPackageName);
             }
-            if (pkg.obbPathStrings != null && pkg.obbPathStrings.length > 0) {
-                int N = pkg.obbPathStrings.length;
-                serializer.startTag(null, "obbs");
-                for (int i = 0; i < N; i++) {
-                    serializer.startTag(null, "obb");
-                    serializer.attribute(null, "path", pkg.obbPathStrings[i]);
-                    serializer.endTag(null, "obb");
-                }
-                serializer.endTag(null, "obbs");
-            }
             pkg.signatures.writeXml(serializer, "sigs", mPastSignatures);
             if ((pkg.pkgFlags&ApplicationInfo.FLAG_SYSTEM) == 0) {
                 serializer.startTag(null, "perms");
@@ -9628,8 +9556,6 @@
                         readGrantedPermissionsLP(parser,
                                 packageSetting.grantedPermissions);
                         packageSetting.permissionsFixed = true;
-                    } else if (tagName.equals("obbs")) {
-                        readObbPathsLP(packageSetting, parser);
                     } else {
                         reportSettingsProblem(Log.WARN,
                                 "Unknown element under <package>: "
@@ -9834,34 +9760,6 @@
             }
         }
 
-        private void readObbPathsLP(PackageSettingBase packageSetting, XmlPullParser parser)
-                throws XmlPullParserException, IOException {
-            final List<String> obbPaths = new ArrayList<String>();
-            final int outerDepth = parser.getDepth();
-            int type;
-            while ((type = parser.next()) != XmlPullParser.END_DOCUMENT
-                    && (type != XmlPullParser.END_TAG || parser.getDepth() > outerDepth)) {
-                if (type == XmlPullParser.END_TAG || type == XmlPullParser.TEXT) {
-                    continue;
-                }
-
-                final String tagName = parser.getName();
-                if (tagName.equals("obb")) {
-                    final String path = parser.getAttributeValue(null, "path");
-                    obbPaths.add(path);
-                } else {
-                    reportSettingsProblem(Log.WARN, "Unknown element under <obbs>: "
-                            + parser.getName());
-                }
-                XmlUtils.skipCurrentTag(parser);
-            }
-            if (obbPaths.size() == 0) {
-                return;
-            } else {
-                packageSetting.obbPathStrings = obbPaths.toArray(new String[obbPaths.size()]);
-            }
-        }
-
         // Returns -1 if we could not find an available UserId to assign
         private int newUserIdLP(Object obj) {
             // Let's be stupidly inefficient for now...
diff --git a/services/java/com/android/server/UsbService.java b/services/java/com/android/server/UsbService.java
index 77ddf3b..8ef03d4 100644
--- a/services/java/com/android/server/UsbService.java
+++ b/services/java/com/android/server/UsbService.java
@@ -134,14 +134,17 @@
         mContext = context;
         init();  // set initial status
 
-        mUEventObserver.startObserving(USB_CONNECTED_MATCH);
-        mUEventObserver.startObserving(USB_CONFIGURATION_MATCH);
-        mUEventObserver.startObserving(USB_FUNCTIONS_MATCH);
+        if (mConfiguration >= 0) {
+            mUEventObserver.startObserving(USB_CONNECTED_MATCH);
+            mUEventObserver.startObserving(USB_CONFIGURATION_MATCH);
+            mUEventObserver.startObserving(USB_FUNCTIONS_MATCH);
+        }
     }
 
     private final void init() {
         char[] buffer = new char[1024];
 
+        mConfiguration = -1;
         try {
             FileReader file = new FileReader(USB_CONNECTED_PATH);
             int len = file.read(buffer, 0, 1024);
@@ -154,10 +157,12 @@
             mConfiguration = Integer.valueOf((new String(buffer, 0, len)).trim());
 
         } catch (FileNotFoundException e) {
-            Slog.w(TAG, "This kernel does not have USB configuration switch support");
+            Slog.i(TAG, "This kernel does not have USB configuration switch support");
         } catch (Exception e) {
             Slog.e(TAG, "" , e);
         }
+        if (mConfiguration < 0)
+            return;
 
         try {
             File[] files = new File(USB_COMPOSITE_CLASS_PATH).listFiles();
diff --git a/test-runner/src/android/test/mock/MockPackageManager.java b/test-runner/src/android/test/mock/MockPackageManager.java
index 2e4199e..0d20496 100644
--- a/test-runner/src/android/test/mock/MockPackageManager.java
+++ b/test-runner/src/android/test/mock/MockPackageManager.java
@@ -495,18 +495,4 @@
     public boolean isSafeMode() {
         throw new UnsupportedOperationException();
     }
-
-    public void setPackageObbPath(String packageName, String path) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void setPackageObbPaths(String packageName, String[] paths) {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public String[] getPackageObbPaths(String packageName) {
-        throw new UnsupportedOperationException();
-    }
 }
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
index 40543530..607a173 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/BitmapsActivity.java
@@ -25,6 +25,7 @@
 import android.graphics.PorterDuff;
 import android.graphics.PorterDuffXfermode;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.Gravity;
 import android.view.View;
 import android.view.animation.Animation;
@@ -61,7 +62,15 @@
 
             mBitmap1 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
             mBitmap2 = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset2);
+            
+            Log.d("Bitmap", "mBitmap1.isMutable() = " + mBitmap1.isMutable());
+            Log.d("Bitmap", "mBitmap2.isMutable() = " + mBitmap2.isMutable());
 
+            BitmapFactory.Options opts = new BitmapFactory.Options();
+            opts.inMutable = true;
+            Bitmap bitmap = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1, opts);
+            Log.d("Bitmap", "bitmap.isMutable() = " + bitmap.isMutable());
+            
             mBitmapPaint = new Paint();
             mDstIn = new PorterDuffXfermode(PorterDuff.Mode.DST_IN);
         }