Merge "Ensure theme attributes are set appropriately"
diff --git a/api/current.txt b/api/current.txt
index 3230bd8..d7664b9 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -10632,6 +10632,7 @@
     method public void setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode);
     method public final void setTileModeY(android.graphics.Shader.TileMode);
     method public void setTint(android.content.res.ColorStateList);
+    method public void setTintMode(android.graphics.PorterDuff.Mode);
   }
 
   public class ClipDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
@@ -10909,6 +10910,7 @@
     method public void setTargetDensity(android.util.DisplayMetrics);
     method public void setTargetDensity(int);
     method public void setTint(android.content.res.ColorStateList);
+    method public void setTintMode(android.graphics.PorterDuff.Mode);
   }
 
   public class PaintDrawable extends android.graphics.drawable.ShapeDrawable {
@@ -10999,6 +11001,9 @@
 
   public class TouchFeedbackDrawable extends android.graphics.drawable.LayerDrawable {
     method public android.graphics.Rect getDirtyBounds();
+    method public android.content.res.ColorStateList getTint();
+    method public void setTint(android.content.res.ColorStateList);
+    method public void setTintMode(android.graphics.PorterDuff.Mode);
   }
 
   public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback {
diff --git a/core/java/android/provider/SearchIndexablesContract.java b/core/java/android/provider/SearchIndexablesContract.java
index 05f3a1c..1754dce 100644
--- a/core/java/android/provider/SearchIndexablesContract.java
+++ b/core/java/android/provider/SearchIndexablesContract.java
@@ -58,33 +58,64 @@
      * Indexable xml resources colums.
      */
     public static final String[] INDEXABLES_XML_RES_COLUMNS = new String[] {
-            XmlResource.COLUMN_RANK,
-            XmlResource.COLUMN_XML_RESID,
-            XmlResource.COLUMN_CLASS_NAME,
-            XmlResource.COLUMN_ICON_RESID,
-            XmlResource.COLUMN_INTENT_ACTION,
-            XmlResource.COLUMN_INTENT_TARGET_PACKAGE,
-            XmlResource.COLUMN_INTENT_TARGET_CLASS
+            XmlResource.COLUMN_RANK,                    // 0
+            XmlResource.COLUMN_XML_RESID,               // 1
+            XmlResource.COLUMN_CLASS_NAME,              // 2
+            XmlResource.COLUMN_ICON_RESID,              // 3
+            XmlResource.COLUMN_INTENT_ACTION,           // 4
+            XmlResource.COLUMN_INTENT_TARGET_PACKAGE,   // 5
+            XmlResource.COLUMN_INTENT_TARGET_CLASS      // 6
     };
 
     /**
+     * Indexable xml resources colums indices.
+     */
+    public static final int COLUMN_INDEX_XML_RES_RANK = 0;
+    public static final int COLUMN_INDEX_XML_RES_RESID = 1;
+    public static final int COLUMN_INDEX_XML_RES_CLASS_NAME = 2;
+    public static final int COLUMN_INDEX_XML_RES_ICON_RESID = 3;
+    public static final int COLUMN_INDEX_XML_RES_INTENT_ACTION = 4;
+    public static final int COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE = 5;
+    public static final int COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS = 6;
+
+    /**
      * Indexable raw data colums.
      */
     public static final String[] INDEXABLES_RAW_COLUMNS = new String[] {
-            RawData.COLUMN_RANK,
-            RawData.COLUMN_TITLE,
-            RawData.COLUMN_SUMMARY_ON,
-            RawData.COLUMN_SUMMARY_OFF,
-            RawData.COLUMN_KEYWORDS,
-            RawData.COLUMN_SCREEN_TITLE,
-            RawData.COLUMN_CLASS_NAME,
-            RawData.COLUMN_ICON_RESID,
-            RawData.COLUMN_INTENT_ACTION,
-            RawData.COLUMN_INTENT_TARGET_PACKAGE,
-            RawData.COLUMN_INTENT_TARGET_CLASS,
+            RawData.COLUMN_RANK,                    // 0
+            RawData.COLUMN_TITLE,                   // 1
+            RawData.COLUMN_SUMMARY_ON,              // 2
+            RawData.COLUMN_SUMMARY_OFF,             // 3
+            RawData.COLUMN_ENTRIES,                 // 4
+            RawData.COLUMN_KEYWORDS,                // 5
+            RawData.COLUMN_SCREEN_TITLE,            // 6
+            RawData.COLUMN_CLASS_NAME,              // 7
+            RawData.COLUMN_ICON_RESID,              // 8
+            RawData.COLUMN_INTENT_ACTION,           // 9
+            RawData.COLUMN_INTENT_TARGET_PACKAGE,   // 10
+            RawData.COLUMN_INTENT_TARGET_CLASS,     // 11
+            RawData.COLUMN_KEY,                     // 12
     };
 
     /**
+     * Indexable raw data colums indices.
+     */
+    public static final int COLUMN_INDEX_RAW_RANK = 0;
+    public static final int COLUMN_INDEX_RAW_TITLE = 1;
+    public static final int COLUMN_INDEX_RAW_SUMMARY_ON = 2;
+    public static final int COLUMN_INDEX_RAW_SUMMARY_OFF = 3;
+    public static final int COLUMN_INDEX_RAW_ENTRIES = 4;
+    public static final int COLUMN_INDEX_RAW_KEYWORDS = 5;
+    public static final int COLUMN_INDEX_RAW_SCREEN_TITLE = 6;
+    public static final int COLUMN_INDEX_RAW_CLASS_NAME = 7;
+    public static final int COLUMN_INDEX_RAW_ICON_RESID = 8;
+    public static final int COLUMN_INDEX_RAW_INTENT_ACTION = 9;
+    public static final int COLUMN_INDEX_RAW_INTENT_TARGET_PACKAGE = 10;
+    public static final int COLUMN_INDEX_RAW_INTENT_TARGET_CLASS = 11;
+    public static final int COLUMN_INDEX_RAW_KEY = 12;
+
+
+    /**
      * Constants related to a {@link SearchIndexableResource}.
      *
      * This is a description of
@@ -134,6 +165,11 @@
         public static final String COLUMN_SUMMARY_OFF = "summaryOff";
 
         /**
+         * Entries associated with the raw data (when the data can can several values).
+         */
+        public static final String COLUMN_ENTRIES = "entries";
+
+        /**
          * Keywords' raw data.
          */
         public static final String COLUMN_KEYWORDS = "keywords";
@@ -142,6 +178,11 @@
          * Fragment's title associated with the raw data.
          */
         public static final String COLUMN_SCREEN_TITLE = "screenTitle";
+
+        /**
+         * Key associated with the raw data. The key needs to be unique.
+         */
+        public static final String COLUMN_KEY = "key";
     }
 
     /**
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 46cb9b2..e100a4d 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -4409,14 +4409,23 @@
         <!-- When a tint color is set, specifies its Porter-Duff blending mode. The
              default value is src_in, which treats the drawable as an alpha mask. -->
         <attr name="tintMode">
-            <!-- [Sa * Da, Sc * Da] -->
-            <enum name="src_in" value="0" />
-            <!-- [Da, Sc * Da + (1 - Sa) * Dc] -->
-            <enum name="src_atop" value="1" />
-            <!-- [Sa * Da, Sc * Dc] -->
-            <enum name="multiply" value="2" />
+            <!-- The tint is drawn on top of the drawable.
+                 [Sa + (1 - Sa)*Da, Rc = Sc + (1 - Sa)*Dc] -->
+            <enum name="src_over" value="3" />
+            <!-- The tint is masked by the alpha channel of the drawable. The drawable’s
+                 color channels are thrown out. [Sa * Da, Sc * Da] -->
+            <enum name="src_in" value="5" />
+            <!-- The tint is drawn above the drawable, but with the drawable’s alpha
+                 channel masking the result. [Da, Sc * Da + (1 - Sa) * Dc] -->
+            <enum name="src_atop" value="9" />
+            <!-- Multiplies the color and alpha channels of the drawable with those of
+                 the tint. [Sa * Da, Sc * Dc] -->
+            <enum name="multiply" value="14" />
             <!-- [Sa + Da - Sa * Da, Sc + Dc - Sc * Dc] -->
-            <enum name="screen" value="3" />
+            <enum name="screen" value="15" />
+            <!-- Combines the tint and drawable color and alpha channels, clamping the
+                 result to valid color values. Saturate(S + D) -->
+            <enum name="add" value="16" />
         </attr>
     </declare-styleable>
 
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index 19131f2..66a88a2 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -595,7 +595,6 @@
      * Specifies the blending mode used to apply tint.
      *
      * @param tintMode A Porter-Duff blending mode
-     * @hide Pending finalization of supported Modes
      */
     public void setTintMode(Mode tintMode) {
         if (mBitmapState.mTintMode != tintMode) {
@@ -606,10 +605,7 @@
     }
 
     /**
-     * Returns the tint mode for this drawable, or {@code null} if none set.
-     *
-     * @return the tint mode for this drawable, or {@code null} if none set
-     * @hide
+     * @hide only needed by a hack within ProgressBar
      */
     public Mode getTintMode() {
         return mBitmapState.mTintMode;
diff --git a/graphics/java/android/graphics/drawable/Drawable.java b/graphics/java/android/graphics/drawable/Drawable.java
index 077db7a..21cd5db 100644
--- a/graphics/java/android/graphics/drawable/Drawable.java
+++ b/graphics/java/android/graphics/drawable/Drawable.java
@@ -1248,16 +1248,14 @@
      */
     static PorterDuff.Mode parseTintMode(int value, Mode defaultMode) {
         switch (value) {
-            case 0:
-                return Mode.SRC_IN;
-            case 1:
-                return Mode.SRC_ATOP;
-            case 2:
-                return Mode.MULTIPLY;
-            case 3:
-                return Mode.SCREEN;
+            case 3: return Mode.SRC_OVER;
+            case 5: return Mode.SRC_IN;
+            case 9: return Mode.SRC_ATOP;
+            case 14: return Mode.MULTIPLY;
+            case 15: return Mode.SCREEN;
+            case 16: return Mode.ADD;
+            default: return defaultMode;
         }
-        return defaultMode;
     }
 }
 
diff --git a/graphics/java/android/graphics/drawable/NinePatchDrawable.java b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
index 66193a5..3e9ca0a 100644
--- a/graphics/java/android/graphics/drawable/NinePatchDrawable.java
+++ b/graphics/java/android/graphics/drawable/NinePatchDrawable.java
@@ -345,7 +345,6 @@
      * Specifies the blending mode used to apply tint.
      *
      * @param tintMode A Porter-Duff blending mode
-     * @hide Pending finalization of supported Modes
      */
     public void setTintMode(Mode tintMode) {
         if (mNinePatchState.mTintMode != tintMode) {
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
index 3323a25..2810c43 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
@@ -124,6 +124,41 @@
         return super.isStateful() || mState.mTint != null && mState.mTint.isStateful();
     }
 
+    /**
+     * Specifies a tint for drawing touch feedback ripples.
+     *
+     * @param tint Color state list to use for tinting touch feedback ripples,
+     *        or null to clear the tint
+     */
+    public void setTint(ColorStateList tint) {
+        if (mState.mTint != tint) {
+            mState.mTint = tint;
+            invalidateSelf();
+        }
+    }
+
+    /**
+     * Returns the tint color for touch feedback ripples.
+     *
+     * @return Color state list to use for tinting touch feedback ripples, or
+     *         null if none set
+     */
+    public ColorStateList getTint() {
+        return mState.mTint;
+    }
+
+    /**
+     * Specifies the blending mode used to draw touch feedback ripples.
+     *
+     * @param tintMode A Porter-Duff blending mode
+     */
+    public void setTintMode(Mode tintMode) {
+        if (mState.mTintMode != tintMode) {
+            mState.mTintMode = tintMode;
+            invalidateSelf();
+        }
+    }
+
     @Override
     public void inflate(Resources r, XmlPullParser parser, AttributeSet attrs, Theme theme)
             throws XmlPullParserException, IOException {