Bug 1208520 - Add missing CATEGORY_BROWSABLE. r=mcomella, a=sylvestre
authorAllison Naaktgeboren <ally@mozilla.com>
Thu, 08 Oct 2015 17:24:14 -0700
changeset 289544 28efbb818caa
parent 289543 170d90101b72
child 289545 a27cc6aa6e0d
push id5178
push usercbook@mozilla.com
push date2015-10-15 09:17 +0000
treeherdermozilla-beta@b09a797a251b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella, sylvestre
bugs1208520
milestone42.0
Bug 1208520 - Add missing CATEGORY_BROWSABLE. r=mcomella, a=sylvestre
mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
--- a/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
+++ b/mobile/android/search/java/org/mozilla/search/PostSearchFragment.java
@@ -10,16 +10,17 @@ import java.net.URL;
 
 import org.mozilla.gecko.AppConstants;
 import org.mozilla.gecko.R;
 import org.mozilla.gecko.Telemetry;
 import org.mozilla.gecko.TelemetryContract;
 import org.mozilla.search.providers.SearchEngine;
 
 import android.annotation.SuppressLint;
+import android.content.ActivityNotFoundException;
 import android.content.Intent;
 import android.graphics.Bitmap;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.support.v4.app.Fragment;
 import android.text.TextUtils;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -135,20 +136,30 @@ public class PostSearchFragment extends 
                     i.setClassName(AppConstants.ANDROID_PACKAGE_NAME, AppConstants.MOZ_ANDROID_BROWSER_INTENT_CLASS);
                     Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL,
                             TelemetryContract.Method.CONTENT, "search-result");
                 } else {
                     Telemetry.sendUIEvent(TelemetryContract.Event.LAUNCH,
                             TelemetryContract.Method.INTENT, "search-result");
                 }
 
+                i.addCategory(Intent.CATEGORY_BROWSABLE);
+                i.setComponent(null);
+                if (AppConstants.Versions.feature15Plus) {
+                    i.setSelector(null);
+                }
+
                 startActivity(i);
                 return true;
             } catch (URISyntaxException e) {
                 Log.e(LOG_TAG, "Error parsing intent URI", e);
+            } catch (SecurityException e) {
+                Log.e(LOG_TAG, "SecurityException handling arbitrary intent content");
+            } catch (ActivityNotFoundException e) {
+                Log.e(LOG_TAG, "Intent not actionable");
             }
 
             return false;
         }
 
         @Override
         public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
             Log.e(LOG_TAG, "Error loading search results: " + description);