Closed Bug 982461 Opened 6 years ago Closed 6 years ago

Support launching an intent to the current application package

Categories

(Firefox for Android :: General, defect)

ARM
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 30

People

(Reporter: Margaret, Assigned: Margaret)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
With this patch, my add-on can simply do this to open an intent:

  let msg = {
    type: "Intent:Open",
    className: "org.mozilla.gecko.home.HomePanelPicker"
  };
  sendMessageToJava(msg);

Without this patch, I would need to pass in the package name for the app, and an add-on doesn't know that.

This will also be useful to us when we move this feature into the browser, so that we won't need to pre-process things to avoid opening the picker in the wrong version of fennec.
Attachment #8389573 - Flags: review?(wjohnston)
Comment on attachment 8389573 [details] [diff] [review]
patch

Review of attachment 8389573 [details] [diff] [review]:
-----------------------------------------------------------------

I hate these methods :)

::: mobile/android/base/GeckoAppShell.java
@@ +1144,5 @@
>          if (intent == null) {
>              return false;
>          }
>  
> +        if (className.length() > 0) {

Lets flip these to TextUtils.isEmpty(). Also, they aren't documented apparently. Their names are pretty self explanatory, but would be nice to just toss them in so the docs match the function signature.

@@ +1148,5 @@
> +        if (className.length() > 0) {
> +            if (packageName.length() > 0) {
> +                intent.setClassName(packageName, className);
> +            } else {
> +                intent.setClassName(context, className);

Add a little note that we're assuming the packageName is the Fennec's.
Attachment #8389573 - Flags: review?(wjohnston) → review+
Assignee: nobody → margaret.leibovic
https://hg.mozilla.org/mozilla-central/rev/8de8e275a35b
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 30
You need to log in before you can comment on or make changes to this bug.