Closed
Bug 572605
Opened 14 years ago
Closed 14 years ago
Handle intents/links from other apps while Fennec is already running
Categories
(Core Graveyard :: Widget: Android, defect)
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: mbrubeck, Assigned: mbrubeck)
References
Details
Attachments
(1 file, 4 obsolete files)
5.59 KB,
patch
|
mwu
:
review+
|
Details | Diff | Splinter Review |
We need to implement Activity.onNewIntent so that we can handle intents sent while our activity is already running. The attached patch is incomplete, more is coming.
Assignee | ||
Comment 1•14 years ago
|
||
Here's a working patch that handles the ACTION_VIEW intent. Still need to add and test ACTION_WEB_SEARCH.
Attachment #451819 -
Attachment is obsolete: true
Assignee | ||
Comment 2•14 years ago
|
||
Comment on attachment 451946 [details] [diff] [review] patch ACTION_WEB_SEARCH looks like it will require totally different logic. Let's go ahead and land this and add that one separately.
Attachment #451946 -
Attachment description: WIP 2 → patch
Attachment #451946 -
Flags: review?(mwu)
Comment 3•14 years ago
|
||
Comment on attachment 451946 [details] [diff] [review] patch Please use the existing string field (mCharacters). The fields change meaning depending on event type. Also, add a new constructor for GeckoEvent which automatically sets the right event type and string. The event posting stuff on the java wrapper side will be fixed eventually - the current event handling is an artifact of the old java wrapper code which put the event queue in the java wrapper.
Attachment #451946 -
Flags: review?(mwu) → review-
Assignee | ||
Comment 4•14 years ago
|
||
- Use the existing mCharacters field. - Add a new GeckoEvent(String uri) constructor.
Attachment #451946 -
Attachment is obsolete: true
Attachment #452050 -
Flags: review?(mwu)
Comment 5•14 years ago
|
||
Comment on attachment 452050 [details] [diff] [review] patch v2 >-AndroidGeckoEvent::ReadCharactersField(JNIEnv *jenv) >+AndroidGeckoEvent::ReadStringField(JNIEnv *jenv, jfieldID field, nsString &str) > { >- jstring s = (jstring) jenv->GetObjectField(wrapped_obj, jCharactersField); >+ jstring s = (jstring) jenv->GetObjectField(wrapped_obj, field); > if (!s) { >- mCharacters.SetIsVoid(PR_TRUE); >+ str.SetIsVoid(PR_TRUE); > return; > } > > int len = jenv->GetStringLength(s); >- mCharacters.SetLength(len); >- jenv->GetStringRegion(s, 0, len, mCharacters.BeginWriting()); >+ str.SetLength(len); >+ jenv->GetStringRegion(s, 0, len, str.BeginWriting()); > } These changes can mostly be reverted now, though feel free to keep the rename to ReadStringField if you prefer that name. >+ case AndroidGeckoEvent::LOAD_URI: { >+ nsCOMPtr<nsICommandLineRunner> cmdline >+ (do_CreateInstance("@mozilla.org/toolkit/command-line;1")); >+ if (cmdline) { Break early if there's no cmdline. >+ char* argv[3] = { >+ "dummyappname", >+ "-remote", >+ ToNewUTF8String(curEvent->Characters()) >+ }; >+ nsresult rv = cmdline->Init(3, argv, nsnull, nsICommandLine::STATE_REMOTE_AUTO); >+ if (NS_SUCCEEDED(rv)) >+ cmdline->Run(); >+ } >+ break; >+ } >+ Leak. Free the new string with nsMemory::Free. Looks pretty close now! r+ with these issues fixed.
Attachment #452050 -
Flags: review?(mwu) → review+
Assignee | ||
Comment 6•14 years ago
|
||
- Revert the GetStringField changes. - nsMemory::Free the allocated string.
Attachment #452050 -
Attachment is obsolete: true
Attachment #452133 -
Flags: review?(mwu)
Assignee | ||
Comment 7•14 years ago
|
||
Same patch, rebased against latest mozilla-central. But with the latest m-c, I am now getting NS_ERROR_UNEXPECTED in nsINavBookmarksService.getBookmarkIdsForURI, PlacesUtils.jsm:953 when opening a link from another apps, and the content of the new tab does not render. This is triggered at http://mxr.mozilla.org/mobile-browser/source/chrome/content/browser-ui.js#592 - when I wrap updateStar in a try/catch block then the new tab renders correctly (but the star is not updated). I'm not sure what caused this, still investigating.
Attachment #452133 -
Attachment is obsolete: true
Attachment #452282 -
Flags: review?(mwu)
Attachment #452133 -
Flags: review?(mwu)
Comment 8•14 years ago
|
||
I switched to using an early break and added a null check for the converted string. http://hg.mozilla.org/mozilla-central/rev/b0db6edc6d67
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Updated•14 years ago
|
Attachment #452282 -
Flags: review?(mwu) → review+
Updated•3 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•