Apply all Canvas transformations to ColorDrawable.

Change-Id: I29252c58224b236d0770ec005da9842990ef2c06
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java
index 8bd797b..3d21048 100644
--- a/core/java/android/widget/ExpandableListView.java
+++ b/core/java/android/widget/ExpandableListView.java
@@ -185,7 +185,6 @@
     
     /** Drawable to be used as a divider when it is adjacent to any children */
     private Drawable mChildDivider;
-    private boolean mClipChildDivider;
 
     // Bounds of the indicator to be drawn
     private final Rect mIndicatorRect = new Rect();
@@ -379,7 +378,6 @@
      */
     public void setChildDivider(Drawable childDivider) {
         mChildDivider = childDivider;
-        mClipChildDivider = childDivider != null && childDivider instanceof ColorDrawable;
     }
 
     @Override
@@ -396,17 +394,8 @@
                     pos.groupMetadata.lastChildFlPos != pos.groupMetadata.flPos)) {
                 // These are the cases where we draw the child divider
                 final Drawable divider = mChildDivider;
-                final boolean clip = mClipChildDivider;
-                if (!clip) {
-                    divider.setBounds(bounds);
-                } else {
-                    canvas.save();
-                    canvas.clipRect(bounds);
-                }
+                divider.setBounds(bounds);
                 divider.draw(canvas);
-                if (clip) {
-                    canvas.restore();
-                }
                 pos.recycle();
                 return;
             }
diff --git a/core/java/android/widget/ListView.java b/core/java/android/widget/ListView.java
index e5a34e8..7c4897a 100644
--- a/core/java/android/widget/ListView.java
+++ b/core/java/android/widget/ListView.java
@@ -107,7 +107,6 @@
     
     private boolean mIsCacheColorOpaque;
     private boolean mDividerIsOpaque;
-    private boolean mClipDivider;
 
     private boolean mHeaderDividersEnabled;
     private boolean mFooterDividersEnabled;
@@ -3057,20 +3056,9 @@
     void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
         // This widget draws the same divider for all children
         final Drawable divider = mDivider;
-        final boolean clipDivider = mClipDivider;
 
-        if (!clipDivider) {
-            divider.setBounds(bounds);
-        } else {
-            canvas.save();
-            canvas.clipRect(bounds);
-        }
-
+        divider.setBounds(bounds);
         divider.draw(canvas);
-
-        if (clipDivider) {
-            canvas.restore();
-        }
     }
 
     /**
@@ -3091,10 +3079,8 @@
     public void setDivider(Drawable divider) {
         if (divider != null) {
             mDividerHeight = divider.getIntrinsicHeight();
-            mClipDivider = divider instanceof ColorDrawable;
         } else {
             mDividerHeight = 0;
-            mClipDivider = false;
         }
         mDivider = divider;
         mDividerIsOpaque = divider == null || divider.getOpacity() == PixelFormat.OPAQUE;
diff --git a/graphics/java/android/graphics/drawable/ColorDrawable.java b/graphics/java/android/graphics/drawable/ColorDrawable.java
index 604c602..a25fad4 100644
--- a/graphics/java/android/graphics/drawable/ColorDrawable.java
+++ b/graphics/java/android/graphics/drawable/ColorDrawable.java
@@ -26,10 +26,8 @@
 import java.io.IOException;
 
 /**
- * A specialized Drawable that fills the Canvas with a specified color,
- * with respect to the clip region. Note that a ColorDrawable ignores the ColorFilter.
- * It also ignores the Bounds, meaning it will draw everywhere in the current clip,
- * even if setBounds(...) was called with a smaller area.
+ * A specialized Drawable that fills the Canvas with a specified color.
+ * Note that a ColorDrawable ignores the ColorFilter.
  *
  * <p>It can be defined in an XML file with the <code>&lt;color></code> element.</p>
  *
@@ -37,6 +35,7 @@
  */
 public class ColorDrawable extends Drawable {
     private ColorState mState;
+    private final Paint mPaint = new Paint();
 
     /**
      * Creates a new black ColorDrawable.
@@ -66,7 +65,10 @@
 
     @Override
     public void draw(Canvas canvas) {
-        canvas.drawColor(mState.mUseColor);
+        if ((mState.mUseColor >>> 24) != 0) {
+            mPaint.setColor(mState.mUseColor);
+            canvas.drawRect(getBounds(), mPaint);
+        }
     }
 
     /**