Merge change I93f500a5 into eclair

* changes:
  Fix issue 2203561: Sholes: audio playing out of earpiece.
diff --git a/Android.mk b/Android.mk
index d92809a..5034c7e 100644
--- a/Android.mk
+++ b/Android.mk
@@ -208,6 +208,7 @@
 	frameworks/base/core/java/android/accounts/IAccountAuthenticatorResponse.aidl \
 	frameworks/base/core/java/android/app/Notification.aidl \
 	frameworks/base/core/java/android/app/PendingIntent.aidl \
+	frameworks/base/core/java/android/bluetooth/BluetoothDevice.aidl \
 	frameworks/base/core/java/android/content/ComponentName.aidl \
 	frameworks/base/core/java/android/content/Intent.aidl \
 	frameworks/base/core/java/android/content/IntentSender.aidl \
diff --git a/api/5.xml b/api/5.xml
index 6148047..73df0cb 100644
--- a/api/5.xml
+++ b/api/5.xml
@@ -162357,17 +162357,6 @@
  visibility="protected"
 >
 </field>
-<field name="FLAG_USE_CHILD_DRAWING_ORDER"
- type="int"
- transient="false"
- volatile="false"
- value="1024"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="protected"
->
-</field>
 <field name="FOCUS_AFTER_DESCENDANTS"
  type="int"
  transient="false"
diff --git a/api/current.xml b/api/current.xml
index 3abd38b..e72a88c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -161987,6 +161987,17 @@
  visibility="public"
 >
 </method>
+<method name="isChildrenDrawingOrderEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+</method>
 <method name="isChildrenDrawnWithCacheEnabled"
  return="boolean"
  abstract="false"
@@ -162370,6 +162381,19 @@
 <parameter name="enabled" type="boolean">
 </parameter>
 </method>
+<method name="setChildrenDrawingOrderEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="protected"
+>
+<parameter name="enabled" type="boolean">
+</parameter>
+</method>
 <method name="setChildrenDrawnWithCacheEnabled"
  return="void"
  abstract="false"
@@ -162537,17 +162561,6 @@
  visibility="protected"
 >
 </field>
-<field name="FLAG_USE_CHILD_DRAWING_ORDER"
- type="int"
- transient="false"
- volatile="false"
- value="1024"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="protected"
->
-</field>
 <field name="FOCUS_AFTER_DESCENDANTS"
  type="int"
  transient="false"
diff --git a/core/java/android/os/IHardwareService.aidl b/core/java/android/os/IHardwareService.aidl
index 594c0e8..34f30a7 100755
--- a/core/java/android/os/IHardwareService.aidl
+++ b/core/java/android/os/IHardwareService.aidl
@@ -1,16 +1,16 @@
 /**
  * Copyright (c) 2007, The Android Open Source Project
  *
- * Licensed under the Apache License, Version 2.0 (the "License"); 
- * you may not use this file except in compliance with the License. 
- * You may obtain a copy of the License at 
+ * 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 
+ *     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 
+ * 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.
  */
 
@@ -23,13 +23,13 @@
     void vibrate(long milliseconds, IBinder token);
     void vibratePattern(in long[] pattern, int repeat, IBinder token);
     void cancelVibrate(IBinder token);
-    
+
     // flashlight support
     boolean getFlashlightEnabled();
     void setFlashlightEnabled(boolean on);
     void enableCameraFlash(int milliseconds);
 
     // for the phone
-    void setAttentionLight(boolean on);
+    void setAttentionLight(boolean on, int color);
 }
 
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index f7b7f02..e2f15c7 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -150,6 +150,8 @@
     /**
      * When set, the drawing method will call {@link #getChildDrawingOrder(int, int)}
      * to get the index of the child to draw for that iteration.
+     * 
+     * @hide
      */
     protected static final int FLAG_USE_CHILD_DRAWING_ORDER = 0x400;
 
@@ -1307,11 +1309,14 @@
      * if you want to change the drawing order of children. By default, it
      * returns i.
      * <p>
-     * NOTE: In order for this method to be called, the
-     * {@link #FLAG_USE_CHILD_DRAWING_ORDER} must be set.
+     * NOTE: In order for this method to be called, you must enable child ordering
+     * first by calling {@link #setChildrenDrawingOrderEnabled(boolean)}.
      *
      * @param i The current iteration.
      * @return The index of the child to draw this iteration.
+     * 
+     * @see #setChildrenDrawingOrderEnabled(boolean)
+     * @see #isChildrenDrawingOrderEnabled()
      */
     protected int getChildDrawingOrder(int childCount, int i) {
         return i;
@@ -2706,6 +2711,35 @@
         setBooleanFlag(FLAG_CHILDREN_DRAWN_WITH_CACHE, enabled);
     }
 
+    /**
+     * Indicates whether the ViewGroup is drawing its children in the order defined by
+     * {@link #getChildDrawingOrder(int, int)}.
+     *
+     * @return true if children drawing order is defined by {@link #getChildDrawingOrder(int, int)},
+     *         false otherwise
+     *
+     * @see #setChildrenDrawingOrderEnabled(boolean)
+     * @see #getChildDrawingOrder(int, int)
+     */
+    @ViewDebug.ExportedProperty
+    protected boolean isChildrenDrawingOrderEnabled() {
+        return (mGroupFlags & FLAG_USE_CHILD_DRAWING_ORDER) == FLAG_USE_CHILD_DRAWING_ORDER;
+    }
+
+    /**
+     * Tells the ViewGroup whether to draw its children in the order defined by the method
+     * {@link #getChildDrawingOrder(int, int)}.
+     *
+     * @param enabled true if the order of the children when drawing is determined by
+     *        {@link #getChildDrawingOrder(int, int)}, false otherwise
+     *
+     * @see #isChildrenDrawingOrderEnabled()
+     * @see #getChildDrawingOrder(int, int)
+     */
+    protected void setChildrenDrawingOrderEnabled(boolean enabled) {
+        setBooleanFlag(FLAG_USE_CHILD_DRAWING_ORDER, enabled);
+    }
+
     private void setBooleanFlag(int flag, boolean value) {
         if (value) {
             mGroupFlags |= flag;
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index bfb25b8..8aab595 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -14,6 +14,11 @@
      limitations under the License.
 -->
 
+<!-- Formatting note: terminate all comments with a period, to avoid breaking 
+     the documentation output. To suppress comment lines from the documentation 
+     output, insert an eat-comment element after the comment lines.
+-->
+
 <resources>
     <!-- These are the standard attributes that make up a complete theme. -->
     <declare-styleable name="Theme">
@@ -47,27 +52,27 @@
         <!-- =========== -->
         <eat-comment />
 
-        <!-- Default appearance of text: color, typeface, size, and style -->
+        <!-- Default appearance of text: color, typeface, size, and style. -->
         <attr name="textAppearance" format="reference" />
         <!-- Default appearance of text against an inverted background:
-             color, typeface, size, and style -->
+             color, typeface, size, and style. -->
         <attr name="textAppearanceInverse" format="reference" />
 
-        <!-- The most prominent text color, for the  -->
+        <!-- The most prominent text color.  -->
         <attr name="textColorPrimary" format="reference|color" />
-        <!-- Secondary text color -->
+        <!-- Secondary text color. -->
         <attr name="textColorSecondary" format="reference|color" />
-        <!-- Tertiary text color -->
+        <!-- Tertiary text color. -->
         <attr name="textColorTertiary" format="reference|color" />
 
-        <!-- Primary inverse text color, useful for inverted backgrounds -->
+        <!-- Primary inverse text color, useful for inverted backgrounds. -->
         <attr name="textColorPrimaryInverse" format="reference|color" />
-        <!-- Secondary inverse text color, useful for inverted backgrounds -->
+        <!-- Secondary inverse text color, useful for inverted backgrounds. -->
         <attr name="textColorSecondaryInverse" format="reference|color" />
-        <!-- Tertiary inverse text color, useful for inverted backgrounds -->
+        <!-- Tertiary inverse text color, useful for inverted backgrounds. -->
         <attr name="textColorTertiaryInverse" format="reference|color" />
 
-        <!-- Inverse hint text color -->
+        <!-- Inverse hint text color. -->
         <attr name="textColorHintInverse" format="reference|color" />
 
         <!-- Bright text color. Only differentiates based on the disabled state. -->
@@ -122,14 +127,14 @@
              to the candidate text as it is edited. -->
         <attr name="candidatesTextStyleSpans" format="reference|string" />
 
-        <!-- Drawable to use for check marks -->
+        <!-- Drawable to use for check marks. -->
         <attr name="textCheckMark" format="reference" />
         <attr name="textCheckMarkInverse" format="reference" />
 
-        <!-- Drawable to use for multiple choice indicators-->
+        <!-- Drawable to use for multiple choice indicators. -->
         <attr name="listChoiceIndicatorMultiple" format="reference" />
 
-        <!-- Drawable to use for single choice indicators-->
+        <!-- Drawable to use for single choice indicators. -->
         <attr name="listChoiceIndicatorSingle" format="reference" />
 
         <!-- ============= -->
@@ -163,9 +168,9 @@
         <!-- =========== -->
         <eat-comment />
 
-        <!-- The preferred list item height -->
+        <!-- The preferred list item height. -->
         <attr name="listPreferredItemHeight" format="dimension" />
-        <!-- The drawable for the list divider -->
+        <!-- The drawable for the list divider. -->
         <!-- The list item height for search results. @hide -->
         <attr name="searchResultListItemHeight" format="dimension" />
         <attr name="listDivider" format="reference" />
@@ -341,9 +346,9 @@
         <attr name="gestureOverlayViewStyle" format="reference" />
         <!-- Default GridView style. -->
         <attr name="gridViewStyle" format="reference" />
-        <!-- The style resource to use for an ImageButton -->
+        <!-- The style resource to use for an ImageButton. -->
         <attr name="imageButtonStyle" format="reference" />
-        <!-- The style resource to use for an ImageButton that is an image well -->
+        <!-- The style resource to use for an ImageButton that is an image well. -->
         <attr name="imageWellStyle" format="reference" />
         <!-- Default ListView style. -->
         <attr name="listViewStyle" format="reference" />
@@ -747,21 +752,21 @@
          automatically found and converted to clickable links.  The default
          value is "none", disabling this feature. -->
     <attr name="autoLink">
-        <!-- Match no patterns (default) -->
+        <!-- Match no patterns (default). -->
         <flag name="none" value="0x00" />
-        <!-- Match Web URLs -->
+        <!-- Match Web URLs. -->
         <flag name="web" value="0x01" />
-        <!-- Match email addresses -->
+        <!-- Match email addresses. -->
         <flag name="email" value="0x02" />
-        <!-- Match phone numbers -->
+        <!-- Match phone numbers. -->
         <flag name="phone" value="0x04" />
-        <!-- Match map addresses -->
+        <!-- Match map addresses. -->
         <flag name="map" value="0x08" />
-        <!-- Match all patterns (equivalent to web|email|phone|map) -->
+        <!-- Match all patterns (equivalent to web|email|phone|map). -->
         <flag name="all" value="0x0f" />
     </attr>
 
-    <!-- Reference to an array resource that will populate a list/adapter -->
+    <!-- Reference to an array resource that will populate a list/adapter. -->
     <attr name="entries" format="reference" />
 
     <!-- Standard gravity constant that a child can supply to its parent.
@@ -813,7 +818,7 @@
     <eat-comment />
 
     <!-- This enum provides the same keycode values as can be found in
-        {@link android.view.KeyEvent} -->
+        {@link android.view.KeyEvent}. -->
     <attr name="keycode">
         <enum name="KEYCODE_UNKNOWN" value="0" />
         <enum name="KEYCODE_SOFT_LEFT" value="1" />
@@ -1185,7 +1190,7 @@
         <attr name="scrollbarTrackVertical" format="reference" />
         <!-- Defines whether the horizontal scrollbar track should always be drawn. -->
         <attr name="scrollbarAlwaysDrawHorizontalTrack" format="boolean" />
-        <!-- Defines whether the vertical scrollbar track should always be drawn -->
+        <!-- Defines whether the vertical scrollbar track should always be drawn. -->
         <attr name="scrollbarAlwaysDrawVerticalTrack" format="boolean" />
 
         <!-- Defines which edges should be fadeded on scrolling. -->
@@ -1296,7 +1301,7 @@
              exactly one parameter of type View. For instance, if you specify
              <code>android:onClick="sayHello"</code>, you must declare a
              <code>public void sayHello(View v)</code> method of your context
-             (typically, your Activity.)-->
+             (typically, your Activity). -->
         <attr name="onClick" format="string" />
     </declare-styleable>
 
@@ -1467,7 +1472,7 @@
              value is true. -->
         <attr name="scrollingCache" format="boolean" />
         <!-- When set to true, the list will filter results as the user types. The
-             List's adapter must support the Filterable interface for this to work -->
+             List's adapter must support the Filterable interface for this to work. -->
         <attr name="textFilterEnabled" format="boolean" />
         <!-- Sets the transcript mode for the list. In transcript mode, the list
              scrolls to the bottom to make new items visible when they are added. -->
@@ -1519,15 +1524,15 @@
         <attr name="format" format="string" localization="suggested" />
     </declare-styleable>
     <declare-styleable name="CompoundButton">
-        <!-- Indicates the initial checked state of this button -->
+        <!-- Indicates the initial checked state of this button. -->
         <attr name="checked" format="boolean" />
         <!-- Drawable used for the button graphic (e.g. checkbox, radio button, etc). -->
         <attr name="button" format="reference"/>
     </declare-styleable>
     <declare-styleable name="CheckedTextView">
-        <!-- Indicates the initial checked state of this text -->
+        <!-- Indicates the initial checked state of this text. -->
         <attr name="checked" />
-        <!-- Drawable used for the check mark graphic -->
+        <!-- Drawable used for the check mark graphic. -->
         <attr name="checkMark" format="reference"/>
     </declare-styleable>
     <declare-styleable name="EditText">
@@ -1648,12 +1653,12 @@
         <!-- An optional argument to supply a maximum height for this view.
              See {see android.widget.ImageView#setMaxHeight} for details. -->
         <attr name="maxHeight" format="dimension" />
-        <!-- Set a tinting color for the image -->
+        <!-- Set a tinting color for the image. -->
         <attr name="tint" format="color" />
         <!-- If true, the image view will be baseline aligned with based on its
-             bottom edge -->
+             bottom edge. -->
         <attr name="baselineAlignBottom" format="boolean" />
-         <!-- If true, the image will be cropped to fit within its padding -->
+         <!-- If true, the image will be cropped to fit within its padding. -->
         <attr name="cropToPadding" format="boolean" />
     </declare-styleable>
     <declare-styleable name="ToggleButton">
@@ -1681,7 +1686,7 @@
         <attr name="baselineAligned" format="boolean" />
         <!-- When a linear layout is part of another layout that is baseline
           aligned, it can specify which of its children to baseline align to
-          (i.e which child TextView).-->
+          (that is, which child TextView).-->
         <attr name="baselineAlignedChildIndex" format="integer" min="0"/>
         <!-- Defines the maximum weight sum. If unspecified, the sum is computed
              by adding the layout_weight of all of the children. This can be
@@ -1704,11 +1709,11 @@
              allows up to one item to be in a chosen state. By setting the choiceMode to
              multipleChoice, the list allows any number of items to be chosen. -->
         <attr name="choiceMode">
-            <!-- Normal list that does not indicate choices -->
+            <!-- Normal list that does not indicate choices. -->
             <enum name="none" value="0" />
-            <!-- The list allows up to one choice -->
+            <!-- The list allows up to one choice. -->
             <enum name="singleChoice" value="1" />
-            <!-- The list allows multiple choices -->
+            <!-- The list allows multiple choices. -->
             <enum name="multipleChoice" value="2" />
         </attr>
         <!-- When set to false, the ListView will not draw the divider after each header view.
@@ -1729,7 +1734,7 @@
         <attr name="headerBackground" format="color|reference" />
         <!-- Default background for each menu item. -->
         <attr name="itemBackground" format="color|reference" />
-        <!-- Default animations for the menu -->
+        <!-- Default animations for the menu. -->
         <attr name="windowAnimationStyle" />
         <!-- Default disabled icon alpha for each menu item that shows an icon. -->
         <attr name="itemIconDisabledAlpha" format="float" />
@@ -1743,7 +1748,7 @@
         <attr name="maxItemsPerRow" format="integer" />
         <!-- Defines the maximum number of items to show. -->
         <attr name="maxItems" format="integer" />
-        <!-- 'More' icon -->
+        <!-- 'More' icon. -->
         <attr name="moreIcon" format="reference" />
     </declare-styleable>
 
@@ -1783,7 +1788,7 @@
     </declare-styleable>
 
     <declare-styleable name="SeekBar">
-        <!-- Draws the thumb on a seekbar -->
+        <!-- Draws the thumb on a seekbar. -->
         <attr name="thumb" format="reference" />
         <!-- An offset for the thumb that allows it to extend out of the range of the track. -->
         <attr name="thumbOffset" format="dimension" />
@@ -1810,19 +1815,19 @@
         <attr name="orientation" />
     </declare-styleable>
     <declare-styleable name="TableLayout">
-        <!-- The 0 based index of the columns to stretch. The column indices
+        <!-- The zero-based index of the columns to stretch. The column indices
              must be separated by a comma: 1, 2, 5. Illegal and duplicate
              indices are ignored. You can stretch all columns by using the
              value "*" instead. Note that a column can be marked stretchable
              and shrinkable at the same time. -->
         <attr name="stretchColumns" format="string" />
-       <!-- The 0 based index of the columns to shrink. The column indices
+       <!-- The zero-based index of the columns to shrink. The column indices
              must be separated by a comma: 1, 2, 5. Illegal and duplicate
              indices are ignored. You can shrink all columns by using the
              value "*" instead. Note that a column can be marked stretchable
              and shrinkable at the same time. -->
         <attr name="shrinkColumns" format="string" />
-        <!-- The 0 based index of the columns to collapse. The column indices
+        <!-- The zero-based index of the columns to collapse. The column indices
              must be separated by a comma: 1, 2, 5. Illegal and duplicate
              indices are ignored. -->
         <attr name="collapseColumns" format="string" />
@@ -1884,7 +1889,7 @@
         <attr name="textAppearance" />
         <!-- Size of the text. Recommended dimension type for text is "sp" for scaled-pixels (example: 15sp). -->
         <attr name="textSize" />
-        <!-- Sets the horizontal scaling factor for the text -->
+        <!-- Sets the horizontal scaling factor for the text. -->
         <attr name="textScaleX" format="float" />
         <!-- Typeface (normal, sans, serif, monospace) for the text. -->
         <attr name="typeface" />
@@ -1892,35 +1897,35 @@
         <attr name="textStyle" />
         <!-- Text color for links. -->
         <attr name="textColorLink" />
-        <!-- Makes the cursor visible (the default) or invisible -->
+        <!-- Makes the cursor visible (the default) or invisible. -->
         <attr name="cursorVisible" format="boolean" />
-        <!-- Makes the TextView be at most this many lines tall -->
+        <!-- Makes the TextView be at most this many lines tall. -->
         <attr name="maxLines" format="integer" min="0" />
-        <!-- Makes the TextView be at most this many pixels tall -->
+        <!-- Makes the TextView be at most this many pixels tall. -->
         <attr name="maxHeight" />
-        <!-- Makes the TextView be exactly this many lines tall -->
+        <!-- Makes the TextView be exactly this many lines tall. -->
         <attr name="lines" format="integer" min="0" />
         <!-- Makes the TextView be exactly this many pixels tall.
              You could get the same effect by specifying this number in the
              layout parameters. -->
         <attr name="height" format="dimension" />
-        <!-- Makes the TextView be at least this many lines tall -->
+        <!-- Makes the TextView be at least this many lines tall. -->
         <attr name="minLines" format="integer" min="0" />
-        <!-- Makes the TextView be at least this many pixels tall -->
+        <!-- Makes the TextView be at least this many pixels tall. -->
         <attr name="minHeight" />
-        <!-- Makes the TextView be at most this many ems wide -->
+        <!-- Makes the TextView be at most this many ems wide. -->
         <attr name="maxEms" format="integer" min="0" />
-        <!-- Makes the TextView be at most this many pixels wide -->
+        <!-- Makes the TextView be at most this many pixels wide. -->
         <attr name="maxWidth" />
-        <!-- Makes the TextView be exactly this many ems wide -->
+        <!-- Makes the TextView be exactly this many ems wide. -->
         <attr name="ems" format="integer" min="0" />
         <!-- Makes the TextView be exactly this many pixels wide.
              You could get the same effect by specifying this number in the
              layout parameters. -->
         <attr name="width" format="dimension" />
-        <!-- Makes the TextView be at least this many ems wide -->
+        <!-- Makes the TextView be at least this many ems wide. -->
         <attr name="minEms" format="integer" min="0" />
-        <!-- Makes the TextView be at least this many pixels wide -->
+        <!-- Makes the TextView be at least this many pixels wide. -->
         <attr name="minWidth" />
         <!-- Specifies how to align the text by the view's x- and/or y-axis
              when the text is smaller than the view. -->
@@ -1946,7 +1951,7 @@
              inputType attributes are found,  the inputType flags will override the value of
              singleLine.) } -->
         <attr name="singleLine" format="boolean" />
-        <!-- {@deprecated Use state_enabled instead.} -->
+        <!-- Specifies whether the TextView is enabled or not. {@deprecated Use state_enabled instead}. -->
         <attr name="enabled" format="boolean" />
         <!-- If the text is selectable, select it all when the view takes
              focus instead of moving the cursor to the start or end. -->
@@ -2050,7 +2055,7 @@
         <!-- The number of times to repeat the marquee animation. Only applied if the
              TextView has marquee enabled. -->
         <attr name="marqueeRepeatLimit" format="integer">
-            <!-- Indicates that marquee should repeat indefinitely  -->
+            <!-- Indicates that marquee should repeat indefinitely. -->
             <enum name="marquee_forever" value="-1" />
         </attr>
         <attr name="inputType" />
@@ -2149,9 +2154,9 @@
         <attr name="prompt" format="reference" />
     </declare-styleable>
     <declare-styleable name="DatePicker">
-        <!-- The first year (inclusive) i.e. 1940 -->
+        <!-- The first year (inclusive), for example "1940". -->
         <attr name="startYear" format="integer" />
-        <!-- The last year (inclusive) i.e. 2010 -->
+        <!-- The last year (inclusive), for example "2010". -->
         <attr name="endYear" format="integer" />
     </declare-styleable>
 
@@ -2160,7 +2165,7 @@
             <!-- Always show only the first line. -->
             <enum name="oneLine" value="1" />
             <!-- When selected show both lines, otherwise show only the first line.
-                 This is the default mode-->
+                 This is the default mode. -->
             <enum name="collapsing" value="2" />
             <!-- Always show both lines. -->
             <enum name="twoLine" value="3" />
@@ -2323,7 +2328,7 @@
     <declare-styleable name="Drawable">
         <!-- Provides initial visibility state of the drawable; the default
              value is false.  See
-             {@link android.graphics.drawable.Drawable#setVisible} -->
+             {@link android.graphics.drawable.Drawable#setVisible}. -->
         <attr name="visible" format="boolean" />
     </declare-styleable>
 
@@ -2343,7 +2348,7 @@
         <attr name="constantSize" format="boolean" />
         <!-- Enables or disables dithering of the bitmap if the bitmap does not have the
              same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with
-             an RGB 565 screen.) -->
+             an RGB 565 screen). -->
         <attr name="dither" format="boolean" />
     </declare-styleable>
 
@@ -2490,7 +2495,7 @@
         <attr name="filter" format="boolean" />
         <!-- Enables or disables dithering of the bitmap if the bitmap does not have the
              same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with
-             an RGB 565 screen.) -->
+             an RGB 565 screen). -->
         <attr name="dither" />
         <!-- Defines the gravity for the bitmap. The gravity indicates where to position
              the drawable in its container if the bitmap is smaller than the container. -->
@@ -2516,7 +2521,7 @@
         <attr name="src" />
         <!-- Enables or disables dithering of the bitmap if the bitmap does not have the
              same pixel configuration as the screen (for instance: a ARGB 8888 bitmap with
-             an RGB 565 screen.) -->
+             an RGB 565 screen). -->
         <attr name="dither" />
     </declare-styleable>
 
@@ -3350,7 +3355,7 @@
         <!-- Size of the text for custom keys with some text and no icon. -->
         <attr name="labelTextSize" format="dimension" />
 
-        <!-- Color to use for the label in a key -->
+        <!-- Color to use for the label in a key. -->
         <attr name="keyTextColor" format="color" />
 
         <!-- Layout resource for key press feedback.-->
@@ -3365,7 +3370,7 @@
         <!-- Amount to offset the touch Y coordinate by, for bias correction. -->
         <attr name="verticalCorrection" format="dimension" />
 
-        <!-- Layout resource for popup keyboards -->
+        <!-- Layout resource for popup keyboards. -->
         <attr name="popupLayout" format="reference" />
 
         <attr name="shadowColor" />
@@ -3374,74 +3379,75 @@
 
     <declare-styleable name="KeyboardViewPreviewState">
         <!-- State for {@link android.inputmethodservice.KeyboardView KeyboardView}
-                key preview background -->
+                key preview background. -->
         <attr name="state_long_pressable" format="boolean" />
     </declare-styleable>
 
     <declare-styleable name="Keyboard">
-        <!-- Default width of a key, in pixels or percentage of display width -->
+        <!-- Default width of a key, in pixels or percentage of display width. -->
         <attr name="keyWidth" format="dimension|fraction" />
-        <!-- Default height of a key, in pixels or percentage of display width -->
+        <!-- Default height of a key, in pixels or percentage of display width. -->
         <attr name="keyHeight" format="dimension|fraction" />
-        <!-- Default horizontal gap between keys -->
+        <!-- Default horizontal gap between keys. -->
         <attr name="horizontalGap" format="dimension|fraction" />
-        <!-- Default vertical gap between rows of keys -->
+        <!-- Default vertical gap between rows of keys. -->
         <attr name="verticalGap" format="dimension|fraction" />
     </declare-styleable>
 
     <declare-styleable name="Keyboard_Row">
-        <!-- Row edge flags-->
+        <!-- Row edge flags. -->
         <attr name="rowEdgeFlags">
-            <!-- Row is anchored to the top of the keyboard -->
+            <!-- Row is anchored to the top of the keyboard. -->
             <flag name="top" value="4" />
-            <!-- Row is anchored to the bottom of the keyboard -->
+            <!-- Row is anchored to the bottom of the keyboard. -->
             <flag name="bottom" value="8" />
         </attr>
         <!-- Mode of the keyboard. If the mode doesn't match the
-             requested keyboard mode, the row will be skipped -->
+             requested keyboard mode, the row will be skipped. -->
         <attr name="keyboardMode" format="reference" />
     </declare-styleable>
 
     <declare-styleable name="Keyboard_Key">
-        <!-- The unicode value or comma-separated values that this key outputs -->
+        <!-- The unicode value or comma-separated values that this key outputs. -->
         <attr name="codes" format="integer|string" />
-        <!-- The XML keyboard layout of any popup keyboard -->
+        <!-- The XML keyboard layout of any popup keyboard. -->
         <attr name="popupKeyboard" format="reference" />
-        <!-- The characters to display in the popup keyboard -->
+        <!-- The characters to display in the popup keyboard. -->
         <attr name="popupCharacters" format="string" />
-        <!-- Key edge flags -->
+        <!-- Key edge flags. -->
         <attr name="keyEdgeFlags">
-            <!-- Key is anchored to the left of the keyboard -->
+            <!-- Key is anchored to the left of the keyboard. -->
             <flag name="left" value="1" />
-            <!-- Key is anchored to the right of the keyboard -->
+            <!-- Key is anchored to the right of the keyboard. -->
             <flag name="right" value="2" />
         </attr>
-        <!-- Whether this is a modifier key such as Alt or Shift -->
+        <!-- Whether this is a modifier key such as Alt or Shift. -->
         <attr name="isModifier" format="boolean" />
-        <!-- Whether this is a toggle key -->
+        <!-- Whether this is a toggle key. -->
         <attr name="isSticky" format="boolean" />
-        <!-- Whether long-pressing on this key will make it repeat -->
+        <!-- Whether long-pressing on this key will make it repeat. -->
         <attr name="isRepeatable" format="boolean" />
-        <!-- The icon to show in the popup preview -->
+        <!-- The icon to show in the popup preview. -->
         <attr name="iconPreview" format="reference" />
-        <!-- The string of characters to output when this key is pressed -->
+        <!-- The string of characters to output when this key is pressed. -->
         <attr name="keyOutputText" format="string" />
-        <!-- The label to display on the key -->
+        <!-- The label to display on the key. -->
         <attr name="keyLabel" format="string" />
-        <!-- The icon to display on the key instead of the label -->
+        <!-- The icon to display on the key instead of the label. -->
         <attr name="keyIcon" format="reference" />
         <!-- Mode of the keyboard. If the mode doesn't match the
-             requested keyboard mode, the key will be skipped -->
+             requested keyboard mode, the key will be skipped. -->
         <attr name="keyboardMode" />
     </declare-styleable>
 
     <!-- =============================== -->
     <!-- AppWidget package class attributes -->
     <!-- =============================== -->
-
+    <eat-comment />
+    
     <!-- Use <code>appwidget-provider</code> as the root tag of the XML resource that
-         describes an AppWidget provider.  See TODO android.appwidget package
-         for more info.
+         describes an AppWidget provider.  See {@link android.appwidget android.appwidget}
+         package for more info.
      -->
     <declare-styleable name="AppWidgetProviderInfo">
         <!-- Minimum width of the AppWidget. -->
@@ -3460,7 +3466,8 @@
     <!-- =============================== -->
     <!-- App package class attributes -->
     <!-- =============================== -->
-
+    <eat-comment />
+    
     <!-- Use <code>wallpaper</code> as the root tag of the XML resource that
          describes an
          {@link android.service.wallpaper.WallpaperService}, which is
@@ -3481,27 +3488,29 @@
     <!-- =============================== -->
     <!-- Accounts package class attributes -->
     <!-- =============================== -->
-
+    <eat-comment />
+    
     <!-- Use <code>account-authenticator</code> as the root tag of the XML resource that
          describes an account authenticator.
      -->
     <declare-styleable name="AccountAuthenticator">
-        <!-- the account type this authenticator handles. -->
+        <!-- The account type this authenticator handles. -->
         <attr name="accountType" format="string"/>
-        <!-- the user-visible name of the authenticator. -->
+        <!-- The user-visible name of the authenticator. -->
         <attr name="label"/>
-        <!-- the icon of the authenticator. -->
+        <!-- The icon of the authenticator. -->
         <attr name="icon"/>
-        <!-- smaller icon of the authenticator -->
+        <!-- Smaller icon of the authenticator. -->
         <attr name="smallIcon" format="reference"/>
-        <!-- a preferences.xml file for authenticator-specific settings -->
+        <!-- A preferences.xml file for authenticator-specific settings. -->
         <attr name="accountPreferences" format="reference"/>
     </declare-styleable>
 
     <!-- =============================== -->
     <!-- Accounts package class attributes -->
     <!-- =============================== -->
-
+    <eat-comment />
+    
     <!-- Use <code>account-authenticator</code> as the root tag of the XML resource that
          describes an account authenticator.
      -->
@@ -3516,29 +3525,32 @@
     <!-- =============================== -->
     <!-- Contacts meta-data attributes -->
     <!-- =============================== -->
-
-    <!-- TODO: remove this deprecated styleable -->
+    <eat-comment />
+    
+    <!-- TODO: remove this deprecated styleable. -->
+    <eat-comment />
     <declare-styleable name="Icon">
         <attr name="icon" />
         <attr name="mimeType" />
     </declare-styleable>
 
     <!-- TODO: remove this deprecated styleable -->
+    <eat-comment />
     <declare-styleable name="IconDefault">
         <attr name="icon" />
     </declare-styleable>
 
-    <!-- Maps a specific contact data MIME-type to styling information -->
+    <!-- Maps a specific contact data MIME-type to styling information. -->
     <declare-styleable name="ContactsDataKind">
-        <!-- Mime-type handled by this mapping -->
+        <!-- Mime-type handled by this mapping. -->
         <attr name="mimeType" />
-        <!-- Icon used to represent data of this kind -->
+        <!-- Icon used to represent data of this kind. -->
         <attr name="icon" />
-        <!-- Column in data table that summarizes this data -->
+        <!-- Column in data table that summarizes this data. -->
         <attr name="summaryColumn" format="string" />
-        <!-- Column in data table that contains details for this data -->
+        <!-- Column in data table that contains details for this data. -->
         <attr name="detailColumn" format="string" />
-        <!-- Flag indicating that detail should be built from SocialProvider -->
+        <!-- Flag indicating that detail should be built from SocialProvider. -->
         <attr name="detailSocialSummary" format="boolean" />
     </declare-styleable>
 
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 85f5ce3..4a3da11 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -661,7 +661,7 @@
              for normal behavior. -->
         <attr name="hasCode" format="boolean" />
         <attr name="persistent" />
-        <!-- Specify whether the components in this application are enabled or not (i.e. can be
+        <!-- Specify whether the components in this application are enabled or not (that is, can be
              instantiated by the system).
              If "false", it overrides any component specific values (a value of "true" will not
              override the component specific values). -->
@@ -929,7 +929,7 @@
     <declare-styleable name="AndroidManifestProvider" parent="AndroidManifestApplication">
         <!-- Required name of the class implementing the provider, deriving from
             {@link android.content.ContentProvider}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyProvider); as a
+            qualified class name (for example, com.mycompany.myapp.MyProvider); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
@@ -944,7 +944,7 @@
         <attr name="permission" />
         <attr name="multiprocess" />
         <attr name="initOrder" />
-        <!-- Specify whether this provider is enabled or not (i.e. can be instantiated by the system).
+        <!-- Specify whether this provider is enabled or not (that is, can be instantiated by the system).
              It can also be specified for an application as a whole, in which case a value of "false"
              will override any component specific values (a value of "true" will not override the
              component specific values). -->
@@ -1007,7 +1007,7 @@
     <declare-styleable name="AndroidManifestService" parent="AndroidManifestApplication">
         <!-- Required name of the class implementing the service, deriving from
             {@link android.app.Service}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyService); as a
+            qualified class name (for example, com.mycompany.myapp.MyService); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
@@ -1015,7 +1015,7 @@
         <attr name="icon" />
         <attr name="permission" />
         <attr name="process" />
-        <!-- Specify whether the service is enabled or not (i.e. can be instantiated by the system).
+        <!-- Specify whether the service is enabled or not (that is, can be instantiated by the system).
              It can also be specified for an application as a whole, in which case a value of "false"
              will override any component specific values (a value of "true" will not override the
              component specific values). -->
@@ -1038,7 +1038,7 @@
     <declare-styleable name="AndroidManifestReceiver" parent="AndroidManifestApplication">
         <!-- Required name of the class implementing the receiver, deriving from
             {@link android.content.BroadcastReceiver}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyReceiver); as a
+            qualified class name (for example, com.mycompany.myapp.MyReceiver); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
@@ -1046,7 +1046,7 @@
         <attr name="icon" />
         <attr name="permission" />
         <attr name="process" />
-        <!-- Specify whether the receiver is enabled or not (i.e. can be instantiated by the system).
+        <!-- Specify whether the receiver is enabled or not (that is, can be instantiated by the system).
              It can also be specified for an application as a whole, in which case a value of "false"
              will override any component specific values (a value of "true" will not override the
              component specific values). -->
@@ -1068,7 +1068,7 @@
     <declare-styleable name="AndroidManifestActivity" parent="AndroidManifestApplication">
         <!-- Required name of the class implementing the activity, deriving from
             {@link android.app.Activity}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyActivity); as a
+            qualified class name (for example, com.mycompany.myapp.MyActivity); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
@@ -1090,7 +1090,7 @@
         <attr name="alwaysRetainTaskState" />
         <attr name="stateNotNeeded" />
         <attr name="excludeFromRecents" />
-        <!-- Specify whether the activity is enabled or not (i.e. can be instantiated by the system).
+        <!-- Specify whether the activity is enabled or not (that is, can be instantiated by the system).
              It can also be specified for an application as a whole, in which case a value of "false"
              will override any component specific values (a value of "true" will not override the
              component specific values). -->
@@ -1115,7 +1115,7 @@
     <declare-styleable name="AndroidManifestActivityAlias" parent="AndroidManifestApplication">
         <!-- Required name of the class implementing the activity, deriving from
             {@link android.app.Activity}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyActivity); as a
+            qualified class name (for example, com.mycompany.myapp.MyActivity); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
@@ -1128,7 +1128,7 @@
         <attr name="label" />
         <attr name="icon" />
         <attr name="permission" />
-        <!-- Specify whether the activity-alias is enabled or not (i.e. can be instantiated by the system).
+        <!-- Specify whether the activity-alias is enabled or not (that is, can be instantiated by the system).
              It can also be specified for an application as a whole, in which case a value of "false"
              will override any component specific values (a value of "true" will not override the
              component specific values). -->
@@ -1295,7 +1295,7 @@
     <declare-styleable name="AndroidManifestInstrumentation" parent="AndroidManifest">
         <!-- Required name of the class implementing the instrumentation, deriving from
             {@link android.app.Instrumentation}.  This is a fully
-            qualified class name (i.e., com.mycompany.myapp.MyActivity); as a
+            qualified class name (for example, com.mycompany.myapp.MyActivity); as a
             short-hand if the first character of the class
             is a period then it is appended to your package name. -->
         <attr name="name" />
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h
index d8ab63d..8c7392b 100644
--- a/include/media/mediarecorder.h
+++ b/include/media/mediarecorder.h
@@ -42,7 +42,8 @@
     AUDIO_SOURCE_VOICE_DOWNLINK = 3,
     AUDIO_SOURCE_VOICE_CALL = 4,
     AUDIO_SOURCE_CAMCORDER = 5,
-    AUDIO_SOURCE_MAX = AUDIO_SOURCE_CAMCORDER,
+    AUDIO_SOURCE_VOICE_RECOGNITION = 6,
+    AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_RECOGNITION,
 
     AUDIO_SOURCE_LIST_END  // must be last - used to validate audio source type
 };
diff --git a/libs/binder/IPCThreadState.cpp b/libs/binder/IPCThreadState.cpp
index 86c3df6..d474571 100644
--- a/libs/binder/IPCThreadState.cpp
+++ b/libs/binder/IPCThreadState.cpp
@@ -422,31 +422,13 @@
                     << getReturnString(cmd) << endl;
             }
 
-            bool isTainted = false;
-
-            {
-                SchedPolicy policy;
-                get_sched_policy(getpid(), &policy);
-
-                if (policy == SP_BACKGROUND) {
-                    isTainted = true;
-                }
-            }
 
             result = executeCommand(cmd);
 
-            // Make sure that after executing the commands that we put the thread back into the
-            // default cgroup.
-            {
-                int pid = getpid();
-                SchedPolicy policy;
-                get_sched_policy(pid, &policy);
-
-                if (!isTainted && policy == SP_BACKGROUND) {
-                    LOGW("*** THREAD %p (PID %p) was left in SP_BACKGROUND with a priority of %d\n",
-                        (void*)pthread_self(), pid, getpriority(PRIO_PROCESS, pid));
-                }
-            }
+            // Make sure that after executing the command that we put the thread back into the
+            // default cgroup. This is just a failsafe incase the thread's priority or cgroup was 
+            // not properly restored.
+            set_sched_policy(getpid(), SP_FOREGROUND);
         }
         
         // Let this thread exit the thread pool if it is no longer
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 9bb00c6..0b42cf6 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -135,6 +135,12 @@
 
         /** Voice call uplink + downlink audio source */
         public static final int VOICE_CALL = 4;
+
+        /** @hide Microphone audio source with same orientation as camera */
+        public static final int CAMCORDER = 5;
+
+        /** @hide Microphone audio source tuned for voice recognition */
+        public static final int VOICE_RECOGNITION = 6;
     }
 
     /**
@@ -274,7 +280,7 @@
      * Gets the maximum value for audio sources.
      * @see android.media.MediaRecorder.AudioSource
      */
-    public static final int getAudioSourceMax() { return AudioSource.VOICE_CALL; }
+    public static final int getAudioSourceMax() { return AudioSource.VOICE_RECOGNITION; }
 
     /**
      * Sets the video source to be used for recording. If this method is not
diff --git a/opengl/libagl/egl.cpp b/opengl/libagl/egl.cpp
index 80ddc02..673c174 100644
--- a/opengl/libagl/egl.cpp
+++ b/opengl/libagl/egl.cpp
@@ -40,6 +40,7 @@
 #include <pixelflinger/pixelflinger.h>
 
 #include <private/ui/android_natives_priv.h>
+#include <private/ui/sw_gralloc_handle.h>
 
 #include <hardware/copybit.h>
 
@@ -449,15 +450,26 @@
 status_t egl_window_surface_v2_t::lock(
         android_native_buffer_t* buf, int usage, void** vaddr)
 {
-    int err = module->lock(module, buf->handle, 
-            usage, 0, 0, buf->width, buf->height, vaddr);
+    int err;
+    if (sw_gralloc_handle_t::validate(buf->handle) < 0) {
+        err = module->lock(module, buf->handle,
+                usage, 0, 0, buf->width, buf->height, vaddr);
+    } else {
+        sw_gralloc_handle_t const* hnd =
+                reinterpret_cast<sw_gralloc_handle_t const*>(buf->handle);
+        *vaddr = (void*)hnd->base;
+        err = NO_ERROR;
+    }
     return err;
 }
 
 status_t egl_window_surface_v2_t::unlock(android_native_buffer_t* buf)
 {
     if (!buf) return BAD_VALUE;
-    int err = module->unlock(module, buf->handle);
+    int err = NO_ERROR;
+    if (sw_gralloc_handle_t::validate(buf->handle) < 0) {
+        err = module->unlock(module, buf->handle);
+    }
     return err;
 }
 
@@ -623,6 +635,7 @@
     switch (format) {
     case HAL_PIXEL_FORMAT_RGB_565:
     case HAL_PIXEL_FORMAT_RGBA_8888:
+    case HAL_PIXEL_FORMAT_RGBX_8888:
     case HAL_PIXEL_FORMAT_RGBA_4444:
     case HAL_PIXEL_FORMAT_RGBA_5551:
     case HAL_PIXEL_FORMAT_BGRA_8888:
@@ -792,6 +805,7 @@
         case GGL_PIXEL_FORMAT_A_8:          size *= 1; break;
         case GGL_PIXEL_FORMAT_RGB_565:      size *= 2; break;
         case GGL_PIXEL_FORMAT_RGBA_8888:    size *= 4; break;
+        case GGL_PIXEL_FORMAT_RGBX_8888:    size *= 4; break;
         default:
             LOGE("incompatible pixel format for pbuffer (format=%d)", f);
             pbuffer.data = 0;
@@ -963,7 +977,7 @@
 // These configs can override the base attribute list
 // NOTE: when adding a config here, don't forget to update eglCreate*Surface()
 
-
+// 565 configs
 static config_pair_t const config_0_attribute_list[] = {
         { EGL_BUFFER_SIZE,     16 },
         { EGL_ALPHA_SIZE,       0 },
@@ -986,8 +1000,32 @@
         { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
 };
 
+// RGB 888 configs
 static config_pair_t const config_2_attribute_list[] = {
         { EGL_BUFFER_SIZE,     32 },
+        { EGL_ALPHA_SIZE,       0 },
+        { EGL_BLUE_SIZE,        8 },
+        { EGL_GREEN_SIZE,       8 },
+        { EGL_RED_SIZE,         8 },
+        { EGL_DEPTH_SIZE,       0 },
+        { EGL_CONFIG_ID,        6 },
+        { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
+};
+
+static config_pair_t const config_3_attribute_list[] = {
+        { EGL_BUFFER_SIZE,     32 },
+        { EGL_ALPHA_SIZE,       0 },
+        { EGL_BLUE_SIZE,        8 },
+        { EGL_GREEN_SIZE,       8 },
+        { EGL_RED_SIZE,         8 },
+        { EGL_DEPTH_SIZE,      16 },
+        { EGL_CONFIG_ID,        7 },
+        { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
+};
+
+// 8888 configs
+static config_pair_t const config_4_attribute_list[] = {
+        { EGL_BUFFER_SIZE,     32 },
         { EGL_ALPHA_SIZE,       8 },
         { EGL_BLUE_SIZE,        8 },
         { EGL_GREEN_SIZE,       8 },
@@ -997,7 +1035,7 @@
         { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
 };
 
-static config_pair_t const config_3_attribute_list[] = {
+static config_pair_t const config_5_attribute_list[] = {
         { EGL_BUFFER_SIZE,     32 },
         { EGL_ALPHA_SIZE,       8 },
         { EGL_BLUE_SIZE,        8 },
@@ -1008,7 +1046,8 @@
         { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
 };
 
-static config_pair_t const config_4_attribute_list[] = {
+// A8 configs
+static config_pair_t const config_6_attribute_list[] = {
         { EGL_BUFFER_SIZE,      8 },
         { EGL_ALPHA_SIZE,       8 },
         { EGL_BLUE_SIZE,        0 },
@@ -1019,7 +1058,7 @@
         { EGL_SURFACE_TYPE,     EGL_WINDOW_BIT|EGL_PBUFFER_BIT|EGL_PIXMAP_BIT },
 };
 
-static config_pair_t const config_5_attribute_list[] = {
+static config_pair_t const config_7_attribute_list[] = {
         { EGL_BUFFER_SIZE,      8 },
         { EGL_ALPHA_SIZE,       8 },
         { EGL_BLUE_SIZE,        0 },
@@ -1037,6 +1076,8 @@
         { config_3_attribute_list, NELEM(config_3_attribute_list) },
         { config_4_attribute_list, NELEM(config_4_attribute_list) },
         { config_5_attribute_list, NELEM(config_5_attribute_list) },
+        { config_6_attribute_list, NELEM(config_6_attribute_list) },
+        { config_7_attribute_list, NELEM(config_7_attribute_list) },
 };
 
 static config_management_t const gConfigManagement[] = {
@@ -1083,6 +1124,50 @@
 
 // ----------------------------------------------------------------------------
 
+static status_t getConfigFormatInfo(EGLint configID,
+        int32_t& pixelFormat, int32_t& depthFormat)
+{
+    switch(configID) {
+    case 0:
+        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
+        depthFormat = 0;
+        break;
+    case 1:
+        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
+        depthFormat = GGL_PIXEL_FORMAT_Z_16;
+        break;
+    case 2:
+        pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888;
+        depthFormat = 0;
+        break;
+    case 3:
+        pixelFormat = GGL_PIXEL_FORMAT_RGBX_8888;
+        depthFormat = GGL_PIXEL_FORMAT_Z_16;
+        break;
+    case 4:
+        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
+        depthFormat = 0;
+        break;
+    case 5:
+        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
+        depthFormat = GGL_PIXEL_FORMAT_Z_16;
+        break;
+    case 6:
+        pixelFormat = GGL_PIXEL_FORMAT_A_8;
+        depthFormat = 0;
+        break;
+    case 7:
+        pixelFormat = GGL_PIXEL_FORMAT_A_8;
+        depthFormat = GGL_PIXEL_FORMAT_Z_16;
+        break;
+    default:
+        return NAME_NOT_FOUND;
+    }
+    return NO_ERROR;
+}
+
+// ----------------------------------------------------------------------------
+
 template<typename T>
 static int binarySearch(T const sortedArray[], int first, int last, EGLint key)
 {
@@ -1226,32 +1311,7 @@
 
     int32_t depthFormat;
     int32_t pixelFormat;
-    switch(configID) {
-    case 0:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = 0;
-        break;
-    case 1:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 2:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = 0;
-        break;
-    case 3:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 4:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = 0;
-        break;
-    case 5:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    default:
+    if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
         return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
     }
 
@@ -1300,32 +1360,7 @@
 
     int32_t depthFormat;
     int32_t pixelFormat;
-    switch(configID) {
-    case 0:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = 0;
-        break;
-    case 1:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 2:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = 0;
-        break;
-    case 3:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 4:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = 0;
-        break;
-    case 5:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    default:
+    if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
         return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
     }
 
@@ -1364,32 +1399,7 @@
 
     int32_t depthFormat;
     int32_t pixelFormat;
-    switch(configID) {
-    case 0:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = 0;
-        break;
-    case 1:
-        pixelFormat = GGL_PIXEL_FORMAT_RGB_565;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 2:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = 0;
-        break;
-    case 3:
-        pixelFormat = GGL_PIXEL_FORMAT_RGBA_8888;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    case 4:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = 0;
-        break;
-    case 5:
-        pixelFormat = GGL_PIXEL_FORMAT_A_8;
-        depthFormat = GGL_PIXEL_FORMAT_Z_16;
-        break;
-    default:
+    if (getConfigFormatInfo(configID, pixelFormat, depthFormat) != NO_ERROR) {
         return setError(EGL_BAD_MATCH, EGL_NO_SURFACE);
     }
 
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 754e6e5..c3b591e 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -1260,9 +1260,20 @@
 
     // ----- Restore handling -----
 
-    private boolean signaturesMatch(Signature[] storedSigs, Signature[] deviceSigs) {
+    private boolean signaturesMatch(Signature[] storedSigs, PackageInfo target) {
+        // If the target resides on the system partition, we allow it to restore
+        // data from the like-named package in a restore set even if the signatures
+        // do not match.  (Unlike general applications, those flashed to the system
+        // partition will be signed with the device's platform certificate, so on
+        // different phones the same system app will have different signatures.)
+        if ((target.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
+            if (DEBUG) Log.v(TAG, "System app " + target.packageName + " - skipping sig check");
+            return true;
+        }
+
         // Allow unsigned apps, but not signed on one device and unsigned on the other
         // !!! TODO: is this the right policy?
+        Signature[] deviceSigs = target.signatures;
         if (DEBUG) Log.v(TAG, "signaturesMatch(): stored=" + storedSigs
                 + " device=" + deviceSigs);
         if ((storedSigs == null || storedSigs.length == 0)
@@ -1465,7 +1476,7 @@
                         continue;
                     }
 
-                    if (!signaturesMatch(metaInfo.signatures, packageInfo.signatures)) {
+                    if (!signaturesMatch(metaInfo.signatures, packageInfo)) {
                         Log.w(TAG, "Signature mismatch restoring " + packageName);
                         EventLog.writeEvent(RESTORE_AGENT_FAILURE_EVENT, packageName,
                                 "Signature mismatch");
diff --git a/services/java/com/android/server/HardwareService.java b/services/java/com/android/server/HardwareService.java
index b1d58ce..3e3cf06 100755
--- a/services/java/com/android/server/HardwareService.java
+++ b/services/java/com/android/server/HardwareService.java
@@ -52,6 +52,7 @@
 
     static final int LIGHT_FLASH_NONE = 0;
     static final int LIGHT_FLASH_TIMED = 1;
+    static final int LIGHT_FLASH_HARDWARE = 2;
 
     private final LinkedList<Vibration> mVibrations;
     private Vibration mCurrentVibration;
@@ -125,7 +126,7 @@
         mVibrations = new LinkedList<Vibration>();
 
         mBatteryStats = BatteryStatsService.getService();
-        
+
         IntentFilter filter = new IntentFilter();
         filter.addAction(Intent.ACTION_SCREEN_OFF);
         context.registerReceiver(mIntentReceiver, filter);
@@ -239,15 +240,15 @@
             Binder.restoreCallingIdentity(identity);
         }
     }
-    
+
     public boolean getFlashlightEnabled() {
         return Hardware.getFlashlightEnabled();
     }
-    
+
     public void setFlashlightEnabled(boolean on) {
-        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.FLASHLIGHT) 
+        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.FLASHLIGHT)
                 != PackageManager.PERMISSION_GRANTED &&
-                mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) 
+                mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST)
                 != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException("Requires FLASHLIGHT or HARDWARE_TEST permission");
         }
@@ -255,9 +256,9 @@
     }
 
     public void enableCameraFlash(int milliseconds) {
-        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CAMERA) 
+        if (mContext.checkCallingOrSelfPermission(android.Manifest.permission.CAMERA)
                 != PackageManager.PERMISSION_GRANTED &&
-                mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST) 
+                mContext.checkCallingOrSelfPermission(android.Manifest.permission.HARDWARE_TEST)
                 != PackageManager.PERMISSION_GRANTED) {
             throw new SecurityException("Requires CAMERA or HARDWARE_TEST permission");
         }
@@ -282,13 +283,13 @@
         setLight_native(mNativePointer, light, color, mode, onMS, offMS);
     }
 
-    public void setAttentionLight(boolean on) {
+    public void setAttentionLight(boolean on, int color) {
         // Not worthy of a permission.  We shouldn't have a flashlight permission.
         synchronized (this) {
             mAttentionLightOn = on;
             mPulsing = false;
-            setLight_native(mNativePointer, LIGHT_ID_ATTENTION, on ? 0xffffffff : 0,
-                    LIGHT_FLASH_NONE, 0, 0);
+            setLight_native(mNativePointer, LIGHT_ID_ATTENTION, color,
+                    LIGHT_FLASH_HARDWARE, on ? 3 : 0, 0);
         }
     }
 
@@ -302,8 +303,8 @@
             }
             if (!mAttentionLightOn && !mPulsing) {
                 mPulsing = true;
-                setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0xff101010,
-                        LIGHT_FLASH_NONE, 0, 0);
+                setLight_native(mNativePointer, LIGHT_ID_ATTENTION, 0x00ffffff,
+                        LIGHT_FLASH_HARDWARE, 7, 0);
                 mH.sendMessageDelayed(Message.obtain(mH, 1), 3000);
             }
         }
@@ -391,7 +392,7 @@
     private class VibrateThread extends Thread {
         final Vibration mVibration;
         boolean mDone;
-    
+
         VibrateThread(Vibration vib) {
             mVibration = vib;
             mWakeLock.acquire();
@@ -425,7 +426,7 @@
                 long duration = 0;
 
                 while (!mDone) {
-                    // add off-time duration to any accumulated on-time duration 
+                    // add off-time duration to any accumulated on-time duration
                     if (index < len) {
                         duration += pattern[index++];
                     }
@@ -478,7 +479,7 @@
             }
         }
     };
-    
+
     private static native int init_native();
     private static native void finalize_native(int ptr);
 
@@ -489,7 +490,7 @@
     private final PowerManager.WakeLock mWakeLock;
 
     private final IBatteryStats mBatteryStats;
-    
+
     volatile VibrateThread mThread;
 
     private int mNativePointer;
diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java
index f75f7195..93b469f 100644
--- a/services/java/com/android/server/PowerManagerService.java
+++ b/services/java/com/android/server/PowerManagerService.java
@@ -1760,7 +1760,8 @@
         try {
             if (mScreenBrightnessOverride >= 0) {
                 return mScreenBrightnessOverride;
-            } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness) {
+            } else if (mLightSensorBrightness >= 0 && mUseSoftwareAutoBrightness
+                    && mAutoBrightessEnabled) {
                 return mLightSensorBrightness;
             }
             final int brightness = Settings.System.getInt(mContext.getContentResolver(),
diff --git a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java b/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java
index fb1b9ad..f2f7743 100755
--- a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java
@@ -137,7 +137,8 @@
         verifyTestFiles1(cacheDir, "testtmpdir", 5);
     }
     
-    @LargeTest
+    // TODO: flaky test
+    // @LargeTest
     public void testFreeApplicationCacheSomeFiles() throws Exception {
         StatFs st = new StatFs("/data");
         long blks1 = getFreeStorageBlks(st);
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 10849921..fdcada4 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1285,10 +1285,10 @@
                     hasTable = true;
                     fprintf(fp,
                             "%s   <p>Includes the following attributes:</p>\n"
-                            "%s   <table border=\"2\" width=\"85%%\" align=\"center\" frame=\"hsides\" rules=\"all\" cellpadding=\"5\">\n"
+                            "%s   <table>\n"
                             "%s   <colgroup align=\"left\" />\n"
                             "%s   <colgroup align=\"left\" />\n"
-                            "%s   <tr><th>Attribute<th>Summary</tr>\n",
+                            "%s   <tr><th>Attribute</th><th>Description</th></tr>\n",
                             indentStr,
                             indentStr,
                             indentStr,
@@ -1322,7 +1322,7 @@
                 }
                 String16 name(name8);
                 fixupSymbol(&name);
-                fprintf(fp, "%s   <tr><th><code>{@link #%s_%s %s:%s}</code><td>%s</tr>\n",
+                fprintf(fp, "%s   <tr><td><code>{@link #%s_%s %s:%s}</code></td><td>%s</td></tr>\n",
                         indentStr, nclassName.string(),
                         String8(name).string(),
                         assets->getPackage().string(),
diff --git a/tools/aapt/ResourceTable.cpp b/tools/aapt/ResourceTable.cpp
index 3cf6a71..19b9b01 100644
--- a/tools/aapt/ResourceTable.cpp
+++ b/tools/aapt/ResourceTable.cpp
@@ -480,22 +480,22 @@
                     enumOrFlagsComment.append((attr.type&ResTable_map::TYPE_ENUM)
                                        ? String16(" be one of the following constant values.")
                                        : String16(" be one or more (separated by '|') of the following constant values."));
-                    enumOrFlagsComment.append(String16("</p>\n<table border=\"2\" width=\"85%\" align=\"center\" frame=\"hsides\" rules=\"all\" cellpadding=\"5\">\n"
+                    enumOrFlagsComment.append(String16("</p>\n<table>\n"
                                                 "<colgroup align=\"left\" />\n"
                                                 "<colgroup align=\"left\" />\n"
                                                 "<colgroup align=\"left\" />\n"
-                                                "<tr><th>Constant<th>Value<th>Description</tr>"));
+                                                "<tr><th>Constant</th><th>Value</th><th>Description</th></tr>"));
                 }
                 
-                enumOrFlagsComment.append(String16("\n<tr><th><code>"));
+                enumOrFlagsComment.append(String16("\n<tr><td><code>"));
                 enumOrFlagsComment.append(itemIdent);
-                enumOrFlagsComment.append(String16("</code><td>"));
+                enumOrFlagsComment.append(String16("</code></td><td>"));
                 enumOrFlagsComment.append(value);
-                enumOrFlagsComment.append(String16("<td>"));
+                enumOrFlagsComment.append(String16("</td><td>"));
                 if (block.getComment(&len)) {
                     enumOrFlagsComment.append(String16(block.getComment(&len)));
                 }
-                enumOrFlagsComment.append(String16("</tr>"));
+                enumOrFlagsComment.append(String16("</td></tr>"));
                 
                 err = outTable->addBag(SourcePos(in->getPrintableSource(), block.getLineNumber()),
                                        myPackage,