Closed
Bug 851642
Opened 12 years ago
Closed 12 years ago
lockOrientation stops working, lets homescreen/apps freely rotate
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
People
(Reporter: Harald, Assigned: mounir)
References
(Blocks 1 open bug)
Details
(Whiteboard: [games:p?][apps watch list])
Attachments
(4 files)
This happens occasionally when debugging apps, that homescreen suddenly freely rotates freely between landscape and portrait.
screen.lockOrientation seems to unlock the screen at one point, I had the same problem in my app.
What happens:
At one point (not sure when), lockOrientation stops working and the screen feely rotates. This can be seen on homescreen but also apps using lockOrientation.
Steps to reproduce:
Install https://marketplace.firefox.com/app/game-pack/ , it uses screen.lockOrientation to lock orientation for each game. Switch between games and at one point lock orientation will stop working, only working again after restarting the whole app.
I see this happen a lot and it really breaks homescreen and apps UX. Therefor marking critical, maybe even blocker.
Comment 1•12 years ago
|
||
Mounir - Any ideas why lock orientation eventually stops working?
Component: Gaia → General
Flags: needinfo?(mounir)
Assignee | ||
Comment 2•12 years ago
|
||
Harald, do you have the same issue if you install this game on Android?
Flags: needinfo?(mounir) → needinfo?(hkirschner)
Reporter | ||
Comment 3•12 years ago
|
||
This is not related to this app, but I will try and come back with results.
Screwing up homescreen orientation happens a lot when switching between apps that lock orientation (which is mostly games).
Flags: needinfo?(hkirschner)
Assignee | ||
Comment 4•12 years ago
|
||
I'm asking because screen lock feature isn't only a Firefox OS thing. There is a common layer (the DOM layer) and a backend layer (one for Gonk, aka Firefox OS and one for Android). If there are issues only on Firefox OS, that means there is a bug in Gonk and we should CC the correct persons.
Reporter | ||
Comment 5•12 years ago
|
||
The app is packaged and can't be tested on Android at this point (but packaged apps will work soon).
I'd recommend a test case that just switched between 2 pages, both asking for different orientation. If I have time this week, I can create on.
Assignee | ||
Comment 6•12 years ago
|
||
Flagging you for information to keep track of this.
Flags: needinfo?(hkirschner)
Comment 7•12 years ago
|
||
I am seeing the same issue on the camera app on ikura:
Gecko http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/54285d67454b
Gaia c47ef39de04e634d847cc86b6acc616fabce69eb
BuildID 20130426070207
Version 18.0
I can reproduce this by rotating the phone with videocamera preview in focus. The camera icons at the bottom continue to rotate a bit after I'm in landscape orientation.
Comment 9•12 years ago
|
||
Impacts a preinstall - gamepack. Partner reproduced this as well, and TEF wasn't too happy about this bug either.
blocking-b2g: --- → tef?
Comment 10•12 years ago
|
||
Although note that a potential workaround here instead of fixing this in the short term is ask the app developer to use the app manifest to permanently lock the orientation to portrait-primary.
Updated•12 years ago
|
blocking-b2g: tef? → tef+
Reporter | ||
Comment 11•12 years ago
|
||
I don't see a workaround due to the nature of the bug. Once lockOrientation stops working once, calling it again doesn't work, even for homescreen. Only switching the screen off and on resets it.
I am open to ideas on how to work around it in the short term.
I will also work on test case, but until then I recommend to install the game pack; as it's the best reproduction we got.
Flags: needinfo?(hkirschner)
Reporter | ||
Comment 12•12 years ago
|
||
Showing the severity, even homescreen isn't locked anymore and freely rotates. This only stops when switch the screen off and on.
Comment 13•12 years ago
|
||
Alive, didn't we have an issue with orientation recently?
Assignee: nobody → alive
Comment 14•12 years ago
|
||
I couldn't reproduce by quickly switching the games in game-pack app. And I don't know what does comment 7 mean, exactly.
But I notice that if the user is on a game in game pack app and then press home button and then launch game-pack again, the orientation is wrong.
We couldn't fix anything from this but the app dev should listen to 'visibilitychange' event to handle app switch if they want to restore the orientation by themselves.
Comment 15•12 years ago
|
||
(In reply to Alive Kuo [:alive] from comment #14)
> I couldn't reproduce by quickly switching the games in game-pack app. And I
> don't know what does comment 7 mean, exactly.
>
> But I notice that if the user is on a game in game pack app and then press
> home button and then launch game-pack again, the orientation is wrong.
>
> We couldn't fix anything from this but the app dev should listen to
> 'visibilitychange' event to handle app switch if they want to restore the
> orientation by themselves.
What you are describing here that you've seen sounds like bug 865010.
Updated•12 years ago
|
Whiteboard: [games:p?]
Updated•12 years ago
|
QA Contact: jsmith
Comment 17•12 years ago
|
||
I was able to reproduce very easily on a 5/3 Unagi build.
See the STR Lisa gave in https://bugzilla.mozilla.org/show_bug.cgi?id=866478#c3 that worked for me to reproduce this.
Keywords: qawanted
Comment 18•12 years ago
|
||
issue reproduces pretty easily following STR from Comment 0
1. install https://marketplace.firefox.com/app/game-pack/
2. play any game that requires landscape mode - "Farm Lines"
3. tap home button to go to the homescreen
=> homescreen appears in landscape mode as shown on the screenshot attachment
tested on Inari device running the following build:
Gecko http://hg.mozilla.org/releases/mozilla-b2g18_v1_0_1/rev/3f3489356bbc
Gaia 3e232bce289c9e156d92553e752616cba284bc8f
Build 20130503070205
Version 18.0
Comment 19•12 years ago
|
||
I use the lasted v1.0.1 build and it's easy for homescreen app to turn upside down after unlocking lockscreen. Lemme check if something wrong in WM.
Comment 20•12 years ago
|
||
My thought is this might be a platform bug because the execution flow in gaia doesn't seem wrong:
1. Launch game-pack(screen.mozUnlockOrientation in system app:Window Manager)
2. Click a landscape game(screen.mozLockOrientation in game-pack app)
3. Press home button(screen.mozLockOrientation in system app:Window Manager)
The 3 call to mozLockOrientation doesn't fail but the orientation of homescreen app isn't locked.
During this test I also find another even more terrible thing: we don't prevent a background app to call mozLockOrientation. With this, if an app is trying to call |mozLockOrientation('landscape-primary') when it's in background, the homescreen would be corrupted by this API. Weird....
Updated•12 years ago
|
Whiteboard: [games:p?] → [games:p?][apps watch list1]
Comment 21•12 years ago
|
||
(In reply to Alive Kuo [:alive] from comment #20)
> My thought is this might be a platform bug because the execution flow in
> gaia doesn't seem wrong:
>
> 1. Launch game-pack(screen.mozUnlockOrientation in system app:Window Manager)
> 2. Click a landscape game(screen.mozLockOrientation in game-pack app)
> 3. Press home button(screen.mozLockOrientation in system app:Window Manager)
>
> The 3 call to mozLockOrientation doesn't fail but the orientation of
> homescreen app isn't locked.
The above and below (and the dependency) is contradict with one another.
Will this bug be fixed by bug 868914 or not? If so we need to raise that bug to tef+ ...
> During this test I also find another even more terrible thing: we don't
> prevent a background app to call mozLockOrientation. With this, if an app is
> trying to call |mozLockOrientation('landscape-primary') when it's in
> background, the homescreen would be corrupted by this API. Weird....
Comment 22•12 years ago
|
||
(In reply to Tim Guan-tin Chien [:timdream] (MoCo-TPE) from comment #21)
> (In reply to Alive Kuo [:alive] from comment #20)
> The above and below (and the dependency) is contradict with one another.
> Will this bug be fixed by bug 868914 or not? If so we need to raise that bug
> to tef+ ...
That bug have been already tef+'d.
Comment 23•12 years ago
|
||
Alive, see comment 20. Will this bug be fixed by bug 868914?
Flags: needinfo?(alive)
Comment 24•12 years ago
|
||
I am going to deassign myself per comment 20 because IMO this not a gaia bug and from gecko side I'm not qualified enough to figure out what's the root cause.
Bug 868914 is not relevant to this issue.
Assignee: alive → nobody
Flags: needinfo?(alive)
Comment 25•12 years ago
|
||
Mounir, see comment 20.
The call to screen.mozLockOrientation('portrait-primary') returns true,
and after that I don't see any call to lock/unlock from gaia side.
The way homescreen behaves like as if the orientation is locked, and soonly unlocked. The only reason I could come up is somebody calls screen.unlockOrientation, maybe in gecko, because it's not homescreen or system app theirself. This case isn't cover in bug 868914 though.
Comment 27•12 years ago
|
||
Today :bchen did some survey and he found that nsScreen object is destoryed after returning to homescreen.
My guess to this is:
1. When home button is pressed, the game-pack app is still visible.
1.5 We call lockOrientation: portrait-primary for homescreen in gaia here.
2. When the app zoom out animation ends, we set visibility of the app to be invisible.
3. The app is killed by OOM. Or it is crashed.
4. The screen object of the app is killed, and in the destructor it calls unlockOrientation in gecko.
4 overwrites what 1.5 does.
The problem is:
1. Why we need to call unlockOrientation in gecko? It's easy to introduce race condition.
2. Why the app seems to be OOM but only screen object is destroyed instead of the whole app? I don't see mozbrowsererror[fatal] event is passed to gaia.
Comment 28•12 years ago
|
||
backtrace for the |UnlockScreenOrientation|.
It looks like when we are pressing home key back to homescreen, the app
receive "memory-pressure" then trigger |nsScreen::Reset()|.
And we do |hal::UnlockScreenOrientation()| in |nsScreen::Reset()|.
Comment 29•12 years ago
|
||
Daniel - you tef+'d this, what test cycle/target milestone should be set on it?
Flags: needinfo?(dcoloma)
Updated•12 years ago
|
Assignee: nobody → mounir
Comment 30•12 years ago
|
||
(In reply to Alive Kuo [:alive] from comment #27)
> Today :bchen did some survey and he found that nsScreen object is destoryed
> after returning to homescreen.
>
> My guess to this is:
> 1. When home button is pressed, the game-pack app is still visible.
> 1.5 We call lockOrientation: portrait-primary for homescreen in gaia here.
> 2. When the app zoom out animation ends, we set visibility of the app to be
> invisible.
> 3. The app is killed by OOM. Or it is crashed.
> 4. The screen object of the app is killed, and in the destructor it calls
> unlockOrientation in gecko.
>
> 4 overwrites what 1.5 does.
>
> The problem is:
> 1. Why we need to call unlockOrientation in gecko? It's easy to introduce
> race condition.
> 2. Why the app seems to be OOM but only screen object is destroyed instead
> of the whole app? I don't see mozbrowsererror[fatal] event is passed to gaia.
Yes, this is a gecko bug. We can't rely on the destructor of a reference counted object to do anything at a predictable time. Mounir, we need to do the unlocking here based on navigation time, not based on when the nsScreen destructor gets called. Navigator already gets a call on navigation (Navigator::OnNavigation()), we should call into the nsScreen::Reset() code at the same time as well. Or something like that :)
Updated•12 years ago
|
Assignee | ||
Comment 32•12 years ago
|
||
This should fix the problem you have been experiencing on Firefox OS. I haven't tried it though.
On Firefox Android, this patch is fixing a lot of edge cases that were very flaky before.
Attachment #747533 -
Flags: review?(bugs)
Flags: needinfo?(mounir)
Updated•12 years ago
|
Whiteboard: [games:p?][apps watch list1] → [status: needs review][games:p?][apps watch list1]
Updated•12 years ago
|
Attachment #747533 -
Flags: review?(bugs) → review+
Updated•12 years ago
|
Flags: needinfo?(dcoloma)
Whiteboard: [status: needs review][games:p?][apps watch list1] → [status: needs landing/uplift][games:p?][apps watch list1]
Target Milestone: --- → 1.0.1 Cert2 (28may)
Updated•12 years ago
|
Whiteboard: [status: needs landing/uplift][games:p?][apps watch list1] → [status: needs landing/uplift][games:p?][apps watch list]
Assignee | ||
Comment 33•12 years ago
|
||
Sent to try: https://tbpl.mozilla.org/?tree=Try&rev=70d6ca550eee
Assignee | ||
Comment 34•12 years ago
|
||
Status: NEW → ASSIGNED
Component: General → DOM
Product: Boot2Gecko → Core
Version: unspecified → Trunk
Comment 35•12 years ago
|
||
(In reply to Mounir Lamouri (:mounir) from comment #32)
> Created attachment 747533 [details] [diff] [review]
> Patch
>
This patch should be also applied to 1.1 as the same issue occurs in leo.
Comment 36•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Comment 37•12 years ago
|
||
(In reply to Leo from comment #35)
> This patch should be also applied to 1.1 as the same issue occurs in leo.
tef+ includes both 1.0.1 and 1.1 landing. That said, this needs a branch-specific patch for uplift.
status-b2g18:
--- → affected
status-b2g18-v1.0.0:
--- → wontfix
status-b2g18-v1.0.1:
--- → affected
status-firefox21:
--- → wontfix
status-firefox22:
--- → wontfix
status-firefox23:
--- → fixed
Whiteboard: [status: needs landing/uplift][games:p?][apps watch list] → [games:p?][apps watch list]
Updated•12 years ago
|
status-firefox24:
--- → fixed
Assignee | ||
Comment 40•12 years ago
|
||
Assignee | ||
Comment 41•12 years ago
|
||
Updated•12 years ago
|
Keywords: branch-patch-needed
Comment 42•12 years ago
|
||
This patch doesn't work for me at all - I can still reproduce this bug with STR given https://bugzilla.mozilla.org/show_bug.cgi?id=851642#c18. Followup bug coming.
Comment 43•12 years ago
|
||
comment 42 was tested with a 5/16 unagi build on b2g18.
Build Id: 20130516230207
Comment 44•12 years ago
|
||
Also reproduced on an inari 1.01 5/17 build.
Comment 45•12 years ago
|
||
Per talking with Mounir, the issue I hit was a different bug.
As for this bug, this now works for me on b2g18 and 1.01.
Updated•11 years ago
|
Blocks: gecko-games
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•