Bug 1153193 - Add EXTRA_DEVICES_ONLY flag to share intents. r=rnewman, a=sledru
authorMichael Comella <michael.l.comella@gmail.com>
Fri, 10 Apr 2015 08:12:51 -0700
changeset 258444 7081bbd2b331
parent 258443 0a9b3f3e962d
child 258445 2ffc047abd90
push id4669
push userryanvm@gmail.com
push dateMon, 13 Apr 2015 16:55:40 +0000
treeherdermozilla-beta@333017ad43a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman, sledru
Bug 1153193 - Add EXTRA_DEVICES_ONLY flag to share intents. r=rnewman, a=sledru Before we only added this flag to the share intent used by the browser toolbar menu. Practically, this has the effect of having "Add to <current channel>" opening the share overlay with *only* the device list wherever getShareIntent() is used. Ideally, this method is used anywhere we use ACTION_SEND. I've noticed this change makes both sharing from the long-press context menu and about:reader to display *only* the device list.
--- a/mobile/android/base/GeckoAppShell.java
+++ b/mobile/android/base/GeckoAppShell.java
@@ -38,16 +38,17 @@ import org.mozilla.gecko.gfx.BitmapUtils
 import org.mozilla.gecko.gfx.LayerView;
 import org.mozilla.gecko.gfx.PanZoomController;
 import org.mozilla.gecko.mozglue.ContextUtils;
 import org.mozilla.gecko.mozglue.GeckoLoader;
 import org.mozilla.gecko.mozglue.JNITarget;
 import org.mozilla.gecko.mozglue.RobocopTarget;
 import org.mozilla.gecko.mozglue.generatorannotations.OptionalGeneratedParameter;
 import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
+import org.mozilla.gecko.overlays.ui.ShareDialog;
 import org.mozilla.gecko.prompts.PromptService;
 import org.mozilla.gecko.util.EventCallback;
 import org.mozilla.gecko.util.GeckoRequest;
 import org.mozilla.gecko.util.HardwareUtils;
 import org.mozilla.gecko.util.NativeEventListener;
 import org.mozilla.gecko.util.NativeJSContainer;
 import org.mozilla.gecko.util.NativeJSObject;
 import org.mozilla.gecko.util.ProxySelector;
@@ -1130,16 +1131,17 @@ public class GeckoAppShell
     public static Intent getShareIntent(final Context context,
                                         final String targetURI,
                                         final String mimeType,
                                         final String title) {
         Intent shareIntent = getIntentForActionString(Intent.ACTION_SEND);
         shareIntent.putExtra(Intent.EXTRA_TEXT, targetURI);
         shareIntent.putExtra(Intent.EXTRA_SUBJECT, title);
+        shareIntent.putExtra(ShareDialog.INTENT_EXTRA_DEVICES_ONLY, true);
         // Note that EXTRA_TITLE is intended to be used for share dialog
         // titles. Common usage (e.g., Pocket) suggests that it's sometimes
         // interpreted as an alternate to EXTRA_SUBJECT, so we include it.
         shareIntent.putExtra(Intent.EXTRA_TITLE, title);
         if (mimeType != null && mimeType.length() > 0) {