Bug 1208520 - Add missing CATEGORY_BROWSABLE.r=mcomella, a=sylvestre
authorAllison Naaktgeboren <ally@mozilla.com>
Thu, 08 Oct 2015 17:24:14 -0700
changeset 298138 1d7fc1581e770af9865f789883aeca79d568f8c6
parent 298137 457cd535b48b619efa5dea77bd9f6bfd1fc162ba
child 298139 203e5d3c06ba63d4cea2b15107e508fde75b9c12
push id962
push userjlund@mozilla.com
push dateFri, 04 Dec 2015 23:28:54 +0000
treeherdermozilla-release@23a2d286e80f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmcomella, sylvestre
bugs1208520
milestone43.0a2
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
@@ -11,16 +11,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.gecko.util.ColorUtils;
 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;
@@ -136,20 +137,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);