Closed Bug 873668 Opened 11 years ago Closed 6 years ago

Orientation lock is lost when going to the homescreen and returning to an app that locks landscape orientation

Categories

(Firefox OS Graveyard :: General, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: jsmith, Assigned: alive)

References

Details

Devices: Inari, Unagi
Build: B2G18, 1.01 5/17/2013

STR

1. Install the Game Pack app
2. Play a game that requires landscape - Farm Lines
3. Hit the home button
4. Return to the app

Expected

The app should be locked to landscape when we return to the app.

Actual

The app is free to rotate at this point - so orientation lock is completely lost.
Summary: Orientation lock is lost when going to the homescreen and returning to the app → Orientation lock is lost when going to the homescreen and returning to an app that locks landscape orientation
Blocks: 851642
blocking-b2g: --- → tef?
As said in IRC, this is likely because the app sets the orientation at run time. When that happens, if you go back to the homescreen, the orientation will be set back to portrait. When going back to the application, the orientation will not be reverted. The application should probably listen to the visibility event to set the orientation back to what it wants it to be.
No longer blocks: 851642
Component: DOM → General
Product: Core → Boot2Gecko
Version: Trunk → unspecified
After talking with Mounir, this isn't a blocker for 1.01. There's an easy work around for the app developer in comment 1. I'll keep this bug open for the long term solution to this problem and file a different bug to fix this within the preinstalled app.
blocking-b2g: tef? → ---
I'm making a game and this feels extremely unintuitive. When I lock the orientation, I'm locking it for *my* app, and it should always stay way. Games are very important for out platform, so I hope we can fix this sooner than later.
I've added this to my code:

        document.addEventListener('visibilitychange', function() {
            if(!document.hidden) {
                screen.mozLockOrientation('landscape-primary');
            }
        });

But it doesn't seem to quite work. If I "alert" something before I lock the orientation, it works, but without it nothing happens. I'm guessing that it's trying to lock it too early, while the app is being brought back up? I also tried testing for `document.visibilityState == 'visible'` but that didn't work either.

Developers shouldn't have to worry about this, it should stay in the same orientation state that I expect.
Working on 908601 and I saw this bug, taken and see if I could resolve it in the same patch.
Assignee: nobody → alive
Any update on this? This is a sore spot for games right now.
Could you please test to set "orientation": "landscape" in your manifest.webapp file ?
Flags: needinfo?(jlong)
Not working on games for Firefox OS anymore, sorry.
Flags: needinfo?(jlong)
Firefox OS is not being worked on
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.