Closed Bug 814074 Opened 13 years ago Closed 13 years ago

Send a system message to the application when the application is not running anymore but waits for a notification

Categories

(Firefox OS Graveyard :: General, defect, P1)

x86_64
Linux
defect

Tracking

(blocking-basecamp:+, firefox18 fixed, firefox19 fixed, firefox20 fixed)

RESOLVED FIXED
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed
firefox20 --- fixed

People

(Reporter: vingtetun, Assigned: vingtetun)

References

Details

(Keywords: smoketest)

Attachments

(1 file, 5 obsolete files)

Attached patch wip-0.1 (obsolete) — Splinter Review
When an application use the desktop notification API but is closed (because of an OOM or by a user action) the notification stays and clicking on it does nothing. This affects the dialer and soon the sms application. This patch use the support provided by bug 778668 to know what is the source of the notification and use system message to open it if needed, sending the title/text of the notification to the application in order to let it reposition the UI to the right state.
Attachment #684089 - Flags: feedback?(fabrice)
Since this blocks a blocker and also fix the the broken notification with the dialer i believe this is a blocker.
blocking-basecamp: --- → ?
Component: Gaia → General
Attached patch Patch (obsolete) — Splinter Review
This patch is on top of the patch from fabrice in bug 778668. If the original application has been killed/closed it send a system message to the application (if this one has registered to receive them) with the content of the title and text of the notification to let it a chance to resume the UI in a correct state. Asking r? to fabrice for the shell.js change. Asking r? to cjones for the ContentParent.cpp
Attachment #684089 - Attachment is obsolete: true
Attachment #684089 - Flags: feedback?(fabrice)
Attachment #684384 - Flags: review?(jones.chris.g)
Attachment #684384 - Flags: review?(fabrice)
blocking-basecamp: ? → +
Comment on attachment 684384 [details] [diff] [review] Patch Review of attachment 684384 [details] [diff] [review]: ----------------------------------------------------------------- ::: b2g/chrome/content/shell.js @@ +696,5 @@ > + target = messages[i]["notification"]; > + break; > + } > + } > + You also need to look for system messages in entry_points there. @@ +697,5 @@ > + break; > + } > + } > + > + // The application does not expect any system messages for notications, nit: s/notications/notifications @@ +704,5 @@ > + return; > + > + gSystemMessenger.sendMessage("notification", > + { title: listener.title, body: listener.text }, > + Services.io.newURI(origin + target, null, null), We must resolve the uri properly here, with newURI(target, null, origin)
Attachment #684384 - Flags: review?(fabrice)
Comment on attachment 684384 [details] [diff] [review] Patch >diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp >index 8dc7f8a..26af2e7 100644 >--- a/dom/ipc/ContentParent.cpp >+++ b/dom/ipc/ContentParent.cpp >@@ -1022,7 +1022,7 @@ ContentParent::Observe(nsISupports* aSubject, > } > > if (!mIsAlive || !mSubprocess) >- return NS_OK; >+ return NS_ERROR_NOT_AVAILABLE; What's the motivation for this change? With that settled, fabrice's review is sufficient for this.
Attachment #684384 - Flags: review?(jones.chris.g)
(In reply to Chris Jones [:cjones] [:warhammer] from comment #4) > Comment on attachment 684384 [details] [diff] [review] > Patch > > >diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp > >index 8dc7f8a..26af2e7 100644 > >--- a/dom/ipc/ContentParent.cpp > >+++ b/dom/ipc/ContentParent.cpp > >@@ -1022,7 +1022,7 @@ ContentParent::Observe(nsISupports* aSubject, > > } > > > > if (!mIsAlive || !mSubprocess) > >- return NS_OK; > >+ return NS_ERROR_NOT_AVAILABLE; > > What's the motivation for this change? > I need a way to know if the process that create the notification has died or not. If there an other way I would be fine with it.
Comment on attachment 684384 [details] [diff] [review] Patch OK, that seems fine in this context. Please push to try to ensure this doesn't trip observer service notifications to remote content.
Attachment #684384 - Flags: review+
Summary: Send a system message to the application when the application is not running anymore → Send a system message to the application when the application is not running anymore but waits for a notification
Vivien, can this patch land now?
Assignee: nobody → 21
smoketest blocker. it prevents user from tapping their sms message from notification to launch into SMS app.
Keywords: smoketest
(In reply to JP Rosevear [:jpr] from comment #8) > Vivien, can this patch land now? No. The underlying code has changed. This patch needs a new version. Working on it.
Attached patch Patch v3 (obsolete) — Splinter Review
Attachment #684384 - Attachment is obsolete: true
Attachment #686924 - Attachment is obsolete: true
Attachment #686924 - Flags: review?(fabrice)
Attachment #687011 - Flags: review?(fabrice)
Comment on attachment 687011 [details] [diff] [review] Patch v3 Review of attachment 687011 [details] [diff] [review]: ----------------------------------------------------------------- I'd like to take another look with the manifest helper. ::: b2g/chrome/content/shell.js @@ +641,5 @@ > + } else if (uid.startsWith("alert")) { > + try { > + listener.observer.observe(null, topic, listener.cookie); > + } catch (e) { > + } Nit: trailing whitespace :P @@ +683,5 @@ > + continue; > + > + for (let i = 0; i < messages.length; i++) { > + let message = messages[i]; > + if (message == "notification") { s/==/=== @@ +684,5 @@ > + > + for (let i = 0; i < messages.length; i++) { > + let message = messages[i]; > + if (message == "notification") { > + target = app.launch_path; That doesn't work because you fail to take l10n into account. You should use the ManifestHelper form AppsUtils.jsm, and resolve uris using https://mxr.mozilla.org/mozilla-central/source/dom/apps/src/AppsUtils.jsm#363 @@ +699,5 @@ > + // If there is any notification listener, let's map it on > + // the listener so it will be used in when it will be time to > + // wake up the application. > + if (target) { > + listener.target = app.origin + target; Use Services.io.newURI(target, null, app.origin).spec in a try{} catch(){} or resolveURI from the manifest helper.
Attachment #687011 - Flags: review?(fabrice) → review-
Attached patch Patch v4 (obsolete) — Splinter Review
Attachment #687011 - Attachment is obsolete: true
Attachment #687038 - Flags: review?(fabrice)
Comment on attachment 687038 [details] [diff] [review] Patch v4 Review of attachment 687038 [details] [diff] [review]: ----------------------------------------------------------------- r- because we need to get this entry points thing right. ::: b2g/chrome/content/shell.js @@ +661,5 @@ > + > + let app = DOMApplicationRegistry.getAppByManifestURL(listener.manifestURL); > + DOMApplicationRegistry.getManifestFor(app.origin, function(manifest) { > + let helper = new ManifestHelper(manifest, app.origin); > + var getEntryPointFor = function(messages) { nit s/var/let @@ +687,5 @@ > + if (!entryPoints) > + return; > + > + // XXX This code would take the last one declared. What else can be done > + // at this stage? don't we want to check that the url that launched the notification is the same as the entry point url? ::: dom/apps/src/AppsUtils.jsm @@ +293,5 @@ > return this._localeProp("launch_path"); > }, > > + get entry_points() { > + return this._localeProp("entry_points"); entry points are not under a locale, this is the other way around. That also means that fullLaunchPath is buggy, and works in gaia because we use the same url for all languages. For instance the manifest of the communications app looks like: "entry_points": { "dialer": { "launch_path": "/dialer/index.html#keyboard-view", "name": "Phone", "icons": { "120": "/dialer/style/icons/Dialer.png", "60": "/dialer/style/icons/60/Dialer.png" }, "locales": { "ar": { "name": "هاتف", "description": "Gaia هاتف" }, "en-US": { "name": "Phone", "description": "Gaia Phone" }, "fr": { "name": "téléphone", "description": "téléphone Gaia" },
Attachment #687038 - Flags: review?(fabrice) → review-
Attached patch Patch v5Splinter Review
Let's get rid of entry points for now. I have opened a followup.
Attachment #687038 - Attachment is obsolete: true
Attachment #687053 - Flags: review?(fabrice)
Comment on attachment 687053 [details] [diff] [review] Patch v5 Review of attachment 687053 [details] [diff] [review]: ----------------------------------------------------------------- r=me with nits addressed ::: b2g/chrome/content/shell.js @@ +661,5 @@ > + > + let app = DOMApplicationRegistry.getAppByManifestURL(listener.manifestURL); > + DOMApplicationRegistry.getManifestFor(app.origin, function(manifest) { > + let helper = new ManifestHelper(manifest, app.origin); > + let getEntryPointFor = function(messages) { nit: rename this function since it doesn't deal with entry points anymore. ::: dom/apps/src/AppsUtils.jsm @@ +295,5 @@ > > + get entry_points() { > + return this._localeProp("entry_points"); > + }, > + nit: remove that for now.
Raised priority for smoketest blocker.
Severity: normal → critical
Priority: -- → P1
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Depends on: 822908
Tony advised commenting on this bug - using: Gecko http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/059a7e0badf7 Gaia 4164424049f9caa4e6b26aefe3a4fa7421451b2b BuildID 20130217070201 Version 18.0 I am seeing an issue where when I send SMS messages to my phone while the screen is locked, when I open the screen the SMS app never launches - it just sits on the homescreen. I will open a new bug now to track this.
Depends on: 870969
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: