Merge "Improve a warning message in WebViewCore's EventHub"
diff --git a/core/java/android/net/http/SslError.java b/core/java/android/net/http/SslError.java
index 5998f5f..863304c 100644
--- a/core/java/android/net/http/SslError.java
+++ b/core/java/android/net/http/SslError.java
@@ -198,7 +198,8 @@
 
     /**
      * Gets the most severe SSL error in this object's set of errors.
-     * @return The most severe SSL error.
+     * Returns -1 if the set is empty.
+     * @return The most severe SSL error, or -1 if the set is empty.
      */
     public int getPrimaryError() {
         if (mErrors != 0) {
@@ -208,9 +209,11 @@
                     return error;
                 }
             }
+            // mErrors should never be set to an invalid value.
+            assert false;
         }
 
-        return 0;
+        return -1;
     }
 
     /**
diff --git a/core/java/android/webkit/SslErrorHandlerImpl.java b/core/java/android/webkit/SslErrorHandlerImpl.java
index 82cd3e8..b2e4b13 100644
--- a/core/java/android/webkit/SslErrorHandlerImpl.java
+++ b/core/java/android/webkit/SslErrorHandlerImpl.java
@@ -159,7 +159,7 @@
 
         if (DebugFlags.SSL_ERROR_HANDLER) {
             assert host != null;
-            assert primary != 0;
+            assert primary != -1;
         }
 
         if (mSslPrefTable.containsKey(host) && primary <= mSslPrefTable.getInt(host)) {
@@ -260,7 +260,7 @@
 
                 if (DebugFlags.SSL_ERROR_HANDLER) {
                     assert host != null;
-                    assert primary != 0;
+                    assert primary != -1;
                 }
                 boolean hasKey = mSslPrefTable.containsKey(host);
                 if (!hasKey || primary > mSslPrefTable.getInt(host)) {
diff --git a/core/java/android/webkit/WebTextView.java b/core/java/android/webkit/WebTextView.java
index 33f84a5..66371f5 100644
--- a/core/java/android/webkit/WebTextView.java
+++ b/core/java/android/webkit/WebTextView.java
@@ -832,7 +832,7 @@
             TextView tv =
                     (TextView) super.getView(position, convertView, parent);
             if (tv != null && mTextView != null) {
-                tv.setTextSize(mTextView.getTextSize());
+                tv.setTextSize(TypedValue.COMPLEX_UNIT_PX, mTextView.getTextSize());
             }
             return tv;
         }
@@ -896,7 +896,10 @@
      *          WebTextView represents.
      */
     /* package */ void setNodePointer(int ptr) {
-        mNodePointer = ptr;
+        if (ptr != mNodePointer) {
+            mNodePointer = ptr;
+            setAdapterCustom(null);
+        }
     }
 
     /**
@@ -1051,11 +1054,12 @@
         }
         setHint(null);
         setThreshold(1);
+        boolean autoComplete = false;
         if (single) {
             mWebView.requestLabel(mWebView.nativeFocusCandidateFramePointer(),
                     mNodePointer);
             maxLength = mWebView.nativeFocusCandidateMaxLength();
-            boolean autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
+            autoComplete = mWebView.nativeFocusCandidateIsAutoComplete();
             if (type != PASSWORD && (mAutoFillable || autoComplete)) {
                 String name = mWebView.nativeFocusCandidateName();
                 if (name != null && name.length() > 0) {
@@ -1070,8 +1074,9 @@
         setInputType(inputType);
         setImeOptions(imeOptions);
         setVisibility(VISIBLE);
-        AutoCompleteAdapter adapter = null;
-        setAdapterCustom(adapter);
+        if (!autoComplete) {
+            setAdapterCustom(null);
+        }
     }
 
     /**
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 89f21d7..5111969 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -3246,8 +3246,7 @@
     public void clearFormData() {
         checkThread();
         if (inEditingMode()) {
-            AutoCompleteAdapter adapter = null;
-            mWebTextView.setAdapterCustom(adapter);
+            mWebTextView.setAdapterCustom(null);
         }
     }
 
diff --git a/core/java/android/widget/SearchView.java b/core/java/android/widget/SearchView.java
index adf2b7b..6df80e4 100644
--- a/core/java/android/widget/SearchView.java
+++ b/core/java/android/widget/SearchView.java
@@ -92,6 +92,11 @@
     private static final boolean DBG = false;
     private static final String LOG_TAG = "SearchView";
 
+    /**
+     * Private constant for removing the microphone in the keyboard.
+     */
+    private static final String IME_OPTION_NO_MICROPHONE = "nm";
+
     private OnQueryTextListener mOnQueryChangeListener;
     private OnCloseListener mOnCloseListener;
     private OnFocusChangeListener mOnQueryTextFocusChangeListener;
@@ -256,7 +261,7 @@
         mQueryTextView.setOnItemClickListener(mOnItemClickListener);
         mQueryTextView.setOnItemSelectedListener(mOnItemSelectedListener);
         mQueryTextView.setOnKeyListener(mTextKeyListener);
-        // Inform any listener of focus changes 
+        // Inform any listener of focus changes
         mQueryTextView.setOnFocusChangeListener(new OnFocusChangeListener() {
 
             public void onFocusChange(View v, boolean hasFocus) {
@@ -335,6 +340,12 @@
         }
         // Cache the voice search capability
         mVoiceButtonEnabled = hasVoiceSearch();
+
+        if (mVoiceButtonEnabled) {
+            // Disable the microphone on the keyboard, as a mic is displayed near the text box
+            // TODO: use imeOptions to disable voice input when the new API will be available
+            mQueryTextView.setPrivateImeOptions(IME_OPTION_NO_MICROPHONE);
+        }
         updateViewsVisibility(isIconified());
     }
 
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
index 7cbff01..1c26920 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
index 7cbff01..1c26920 100644
--- a/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
index d4b3209..167d7d3 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
index ec7303e..4048260 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
index 19526fe..90e9c9c 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
index e8f9eef..4a3e57c 100644
--- a/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-hdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
index 31228b6..ab8ec69 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
index 31228b6..ab8ec69 100644
--- a/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
index 6f58ef0..351d539 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
index 3d8f134..e6072ee 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
index d480c55..79682c1 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
index 6a414fa..ba53c0b 100644
--- a/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-mdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
index 097160b..c6c3f1e 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
index 097160b..c6c3f1e 100644
--- a/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
+++ b/core/res/res/drawable-xhdpi/progress_primary_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
index 4715cfb..8cf3868 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_disabled_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
index d41d5a3..417b35a 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_focused_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
index 4f0e06d..8053d88 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_normal_holo.png
Binary files differ
diff --git a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
index 5d9f860..d17fa7d 100644
--- a/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
+++ b/core/res/res/drawable-xhdpi/scrubber_control_pressed_holo.png
Binary files differ
diff --git a/docs/html/resources/resources-data.js b/docs/html/resources/resources-data.js
index 9267373..c0a2284 100644
--- a/docs/html/resources/resources-data.js
+++ b/docs/html/resources/resources-data.js
@@ -578,13 +578,13 @@
     }
   },
   {
-    tags: ['sample', 'media' ],
+    tags: ['sample', 'media', 'updated'],
     path: 'samples/RandomMusicPlayer/index.html',
     title: {
       en: 'Random Music Player'
     },
     description: {
-      en: 'Demonstrates how to write a multimedia application that plays music from the device and from URLs. It manages media playback from a service and can play music in the background, respecting audio focus changes.'
+      en: 'Demonstrates how to write a multimedia application that plays music from the device and from URLs. It manages media playback from a service and can play music in the background, respecting audio focus changes. Also shows how to use the new Remote Control APIs in API level 14.'
     }
   },
   {
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 3b79f06..1e24599 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1972,6 +1972,12 @@
                     sampleIndex, &syncSampleIndex, findFlags);
         }
 
+        uint32_t sampleTime;
+        if (err == OK) {
+            err = mSampleTable->getMetaDataForSample(
+                    sampleIndex, NULL, NULL, &sampleTime);
+        }
+
         if (err != OK) {
             if (err == ERROR_OUT_OF_RANGE) {
                 // An attempt to seek past the end of the stream would
@@ -1984,10 +1990,6 @@
             return err;
         }
 
-        uint32_t sampleTime;
-        CHECK_EQ((status_t)OK, mSampleTable->getMetaDataForSample(
-                    sampleIndex, NULL, NULL, &sampleTime));
-
         if (mode == ReadOptions::SEEK_CLOSEST) {
             targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
         }