Refine search provider check

   Bug: 2868373
   the search provider test is now restricted to the
   authority oart of the url only

Change-Id: Iee6adec7df70347ed8443d3e61500e3d5e4eb8d4
diff --git a/src/com/android/browser/Tab.java b/src/com/android/browser/Tab.java
index 8bf32b0..69213cd 100644
--- a/src/com/android/browser/Tab.java
+++ b/src/com/android/browser/Tab.java
@@ -538,6 +538,13 @@
     private final WebViewClient mWebViewClient = new WebViewClient() {
         private Message mDontResend;
         private Message mResend;
+
+        private boolean providersDiffer(String url, String otherUrl) {
+            Uri uri1 = Uri.parse(url);
+            Uri uri2 = Uri.parse(otherUrl);
+            return !uri1.getEncodedAuthority().equals(uri2.getEncodedAuthority());
+        }
+
         @Override
         public void onPageStarted(WebView view, String url, Bitmap favicon) {
             mInPageLoad = true;
@@ -546,7 +553,7 @@
                     view.isPrivateBrowsingEnabled(), url, favicon);
             mLoadStartTime = SystemClock.uptimeMillis();
             if (mVoiceSearchData != null
-                    && !url.equals(mVoiceSearchData.mLastVoiceSearchUrl)) {
+                    && providersDiffer(url, mVoiceSearchData.mLastVoiceSearchUrl)) {
                 if (mVoiceSearchData.mSourceIsGoogle) {
                     Intent i = new Intent(LoggingEvents.ACTION_LOG_EVENT);
                     i.putExtra(LoggingEvents.EXTRA_FLUSH, true);