Closed
Bug 851721
Opened 12 years ago
Closed 12 years ago
Do not receive xpcom-shutdown event when phone is powering off
Categories
(Firefox OS Graveyard :: General, defect)
Tracking
(blocking-b2g:tef+, firefox20 wontfix, firefox21 wontfix, firefox22 verified, b2g18 verified, b2g18-v1.0.0 wontfix, b2g18-v1.0.1 verified)
People
(Reporter: anshulj, Assigned: m1)
References
Details
Attachments
(1 file, 2 obsolete files)
1.37 KB,
patch
|
m1
:
review+
|
Details | Diff | Splinter Review |
When powering off the device we do not receive the xpcom-shutdown event in our XPCOM component. We need this event to run the shutdown sequence.
Comment 1•12 years ago
|
||
I was told that the xpcom-shutdown event isn't sent in release builds (of b2g)
Assignee | ||
Comment 2•12 years ago
|
||
(tef+, but not necessarily on making xpcom-shutdown event fire in release builds but on the more general problem of, "how can a live xpcom component get notified of a device powerdown/reboot request" with the Gonk backend. It looks like we could hack something into LinuxPower.cpp for Gonk but that feels like a last resort hack.)
blocking-b2g: tef? → tef+
Comment 3•12 years ago
|
||
I'm not sure if we can use xpcom from within hal/ but if we can you could send observer notifications from there.
Assignee | ||
Comment 4•12 years ago
|
||
Or if not from the hal, maybe the mozPower implementation could emit a notification?
Comment 5•12 years ago
|
||
(In reply to Michael Vines [:m1] [:evilmachines] from comment #4)
> Or if not from the hal, maybe the mozPower implementation could emit a
> notification?
Sure. That looks trivial to add in dom/power/PowerManager.cpp
Assignee | ||
Comment 6•12 years ago
|
||
Kewl. I'll take a stab at this. Any preferences to what the event should be called? For our use case we don't need to distinguish between power-off and reboot but do we want to add this now just to be more general? Forgive my ignorance, are observer notifications synchronous?
Assignee: nobody → mvines
Comment 7•12 years ago
|
||
Ha, let's bikeshed the naming... I would do something like system-power-off and system-reboot (and yes, keep 2 different ones). Observer notifications are synchronous, so the notifyObservers() call only returns after all observers have run. This let us use them to inspect/modify http requests for instance.
Assignee | ||
Comment 8•12 years ago
|
||
Wow I was thinking of those exact event names too!
dom/power/PowerManager.cpp looks like it runs in a content process, would an observer notification there make it up to the main processed? I'm guessing no, and if so then maybe dom/power/PowerManagerService.cpp is a better place for this?
Comment 9•12 years ago
|
||
We need these do happen in the parent indeed. Quickly reading the power manager code, I don't think it's remoted, but I can be very wrong.
Comment 10•12 years ago
|
||
All the parent/child communication is done in the hal/ code. Even PowerManagerService is not remoted.
Assignee | ||
Comment 11•12 years ago
|
||
Attached patch emits the two new events from PowerManagerService.cpp. While PowerManagerService isn't remoted, turns out that only the system app uses mozPower to shutdown/reboot so we're already in the main process. Not so future proof but solves the v1.0.1 need nicely and with low risk, and avoids adding a Gonk-only notification into LinuxPower.cpp.
Attachment #727332 -
Flags: feedback?(kchen)
Attachment #727332 -
Flags: feedback?(fabrice)
Comment 12•12 years ago
|
||
Comment on attachment 727332 [details] [diff] [review]
Emit "system-reboot" and "system-power-off" events
Review of attachment 727332 [details] [diff] [review]:
-----------------------------------------------------------------
I'll defer to Kanru that knows this part of the code well. The power API is usable by any certified app so I'm not a big fan of having that not being properly remoted.
::: dom/power/PowerManagerService.cpp
@@ +116,5 @@
> PowerManagerService::Reboot()
> {
> + nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
> + if (obsServ)
> + obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
I haven't checked in this file, but usually the code style is to use if () { } even for single liners.
@@ +117,5 @@
> {
> + nsCOMPtr<nsIObserverService> obsServ = services::GetObserverService();
> + if (obsServ)
> + obsServ->NotifyObservers(nullptr, "system-reboot", nullptr);
> +
nit: trailing ws
Attachment #727332 -
Flags: feedback?(fabrice)
Assignee | ||
Comment 13•12 years ago
|
||
Would folks prefer to add this to hal/linux/LinuxPower.cpp?
Assignee | ||
Comment 14•12 years ago
|
||
Same stuff moved to LinuxPower.cpp.
Attachment #727332 -
Attachment is obsolete: true
Attachment #727332 -
Flags: feedback?(kchen)
Attachment #728597 -
Flags: review?(kchen)
Assignee | ||
Updated•12 years ago
|
Attachment #728597 -
Flags: review?(fabrice)
Updated•12 years ago
|
Attachment #728597 -
Flags: review?(kchen) → review+
Assignee | ||
Comment 15•12 years ago
|
||
Same as patch 2 but in hg style. Carrying forward r+
Attachment #728597 -
Attachment is obsolete: true
Attachment #728597 -
Flags: review?(fabrice)
Attachment #728684 -
Flags: review+
Assignee | ||
Updated•12 years ago
|
Comment 16•12 years ago
|
||
Keywords: checkin-needed
Comment 17•12 years ago
|
||
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → B2G C4 (2jan on)
Comment 18•12 years ago
|
||
https://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/11ce13afa92b
https://hg.mozilla.org/releases/mozilla-b2g18/rev/c4e97cdad62a
status-b2g18-v1.0.0:
--- → wontfix
status-firefox20:
--- → wontfix
status-firefox21:
--- → wontfix
status-firefox22:
--- → fixed
Comment 19•12 years ago
|
||
Issue covered by test case: https://moztrap.mozilla.org/manage/cases/?filter-id=1330
Flags: in-moztrap-
Comment 20•12 years ago
|
||
Can you please provide steps to verify this fix - as we will blackbox test from the UI?
Comment 21•12 years ago
|
||
Anshul if you can Verify this bug out, it would be much appreciated.
Flags: needinfo?(anshulj)
Keywords: verifyme
Reporter | ||
Comment 22•12 years ago
|
||
I have already verified this bug.
Status: RESOLVED → VERIFIED
Flags: needinfo?(anshulj)
Depends on: 993737
You need to log in
before you can comment on or make changes to this bug.
Description
•