Merge "Expose SearchManager constants for global search"
diff --git a/core/java/android/provider/CallLog.java b/core/java/android/provider/CallLog.java
index f0605ad..7854423 100644
--- a/core/java/android/provider/CallLog.java
+++ b/core/java/android/provider/CallLog.java
@@ -22,7 +22,6 @@
 import android.content.ContentResolver;
 import android.content.ContentValues;
 import android.content.Context;
-import android.database.Cursor;
 import android.net.Uri;
 import android.text.TextUtils;
 
@@ -112,25 +111,25 @@
          * <P>Type: TEXT</P>
          */
         public static final String CACHED_NAME = "name";
-
+        
         /**
          * The cached number type (Home, Work, etc) associated with the
          * phone number, if it exists.
          * This value is not guaranteed to be current, if the contact information
          * associated with this number has changed.
-         * <P>Type: INTEGER</P>
+         * <P>Type: INTEGER</P> 
          */
         public static final String CACHED_NUMBER_TYPE = "numbertype";
-
+        
         /**
          * The cached number label, for a custom number type, associated with the
          * phone number, if it exists.
          * This value is not guaranteed to be current, if the contact information
          * associated with this number has changed.
-         * <P>Type: TEXT</P>
+         * <P>Type: TEXT</P> 
          */
         public static final String CACHED_NUMBER_LABEL = "numberlabel";
-
+        
         /**
          * Adds a call to the call log.
          *
@@ -138,15 +137,15 @@
          * if the contact is unknown.
          * @param context the context used to get the ContentResolver
          * @param number the phone number to be added to the calls db
-         * @param presentation the number presenting rules set by the network for
+         * @param presentation the number presenting rules set by the network for 
          *        "allowed", "payphone", "restricted" or "unknown"
          * @param callType enumerated values for "incoming", "outgoing", or "missed"
          * @param start time stamp for the call in milliseconds
          * @param duration call duration in seconds
-         *
+         * 
          * {@hide}
          */
-        public static Uri addCall(CallerInfo ci, Context context, String number,
+        public static Uri addCall(CallerInfo ci, Context context, String number, 
                 int presentation, int callType, long start, int duration) {
             final ContentResolver resolver = context.getContentResolver();
 
@@ -176,47 +175,22 @@
                 values.put(CACHED_NUMBER_TYPE, ci.numberType);
                 values.put(CACHED_NUMBER_LABEL, ci.numberLabel);
             }
-
+            
             if ((ci != null) && (ci.person_id > 0)) {
                 ContactsContract.Contacts.markAsContacted(resolver, ci.person_id);
             }
-
+            
             Uri result = resolver.insert(CONTENT_URI, values);
-
+            
             removeExpiredEntries(context);
-
+            
             return result;
         }
-
-        /**
-         * Query the call log database for the last dialed number.
-         * @param context To get the content resolver from.
-         * @return The last outgoing phone number dialed or an empty
-         * string if none exist.
-         */
-        public static String getLastOutgoingCall(Context context) {
-            final ContentResolver resolver = context.getContentResolver();
-            Cursor c = null;
-            try {
-                c = resolver.query(
-                    CONTENT_URI,
-                    new String[] {NUMBER},
-                    TYPE + " = " + OUTGOING_TYPE,
-                    null,
-                    DEFAULT_SORT_ORDER + " LIMIT 1");
-                if (c == null || !c.moveToFirst()) {
-                    return "";
-                }
-                return c.getString(0);
-            } finally {
-                if (c != null) c.close();
-            }
-        }
-
+        
         private static void removeExpiredEntries(Context context) {
             final ContentResolver resolver = context.getContentResolver();
             resolver.delete(CONTENT_URI, "_id IN " +
-                    "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER
+                    "(SELECT _id FROM calls ORDER BY " + DEFAULT_SORT_ORDER 
                     + " LIMIT -1 OFFSET 500)", null);
         }
     }
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index df4cab0..a3d3521 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -6177,7 +6177,10 @@
      * @see #getDrawingCache()
      */
     public void setDrawingCacheBackgroundColor(int color) {
-        mDrawingCacheBackgroundColor = color;
+        if (color != mDrawingCacheBackgroundColor) {
+            mDrawingCacheBackgroundColor = color;
+            mPrivateFlags &= ~DRAWING_CACHE_VALID;
+        }
     }
 
     /**
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 32199a0..b795080 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -3250,7 +3250,14 @@
      * @param color The background color
      */
     public void setCacheColorHint(int color) {
-        mCacheColorHint = color;
+        if (color != mCacheColorHint) {
+            mCacheColorHint = color;
+            int count = getChildCount();
+            for (int i = 0; i < count; i++) {
+                getChildAt(i).setDrawingCacheBackgroundColor(color);
+            }
+            mRecycler.setCacheColorHint(color);
+        }
     }
 
     /**
@@ -3670,5 +3677,38 @@
                 }
             }
         }
+
+        /**
+         * Updates the cache color hint of all known views.
+         *
+         * @param color The new cache color hint.
+         */
+        void setCacheColorHint(int color) {
+            if (mViewTypeCount == 1) {
+                final ArrayList<View> scrap = mCurrentScrap;
+                final int scrapCount = scrap.size();
+                for (int i = 0; i < scrapCount; i++) {
+                    scrap.get(i).setDrawingCacheBackgroundColor(color);
+                }
+            } else {
+                final int typeCount = mViewTypeCount;
+                for (int i = 0; i < typeCount; i++) {
+                    final ArrayList<View> scrap = mScrapViews[i];
+                    final int scrapCount = scrap.size();
+                    for (int j = 0; j < scrapCount; j++) {
+                        scrap.get(i).setDrawingCacheBackgroundColor(color);
+                    }
+                }
+            }
+            // Just in case this is called during a layout pass
+            final View[] activeViews = mActiveViews;
+            final int count = activeViews.length;
+            for (int i = 0; i < count; ++i) {
+                final View victim = activeViews[i];
+                if (victim != null) {
+                    victim.setDrawingCacheBackgroundColor(color);
+                }
+            }
+        }
     }
 }