Closed
Bug 805011
Opened 13 years ago
Closed 13 years ago
Android emulator doesn't handle screen orientation
Categories
(Firefox OS Graveyard :: General, defect)
Firefox OS Graveyard
General
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: whimboo, Unassigned)
References
()
Details
Lately I have started to check how to implement Marionette tests for the Screen Orientation API on bug 805005. What has already been discovered before by Geo and which I can second is the emulator doesn't work as expected. When you are connected via telnet and send updates for the sensor it gets applied but the orientation never changes. It always stays at portrait-primary. You can flip the orientation in the emulator UI by keystrokes but checking via telnet also doesn't show an update.
I'm not sure if this is a problem with our implementation in Firefox OS or a general issue with the emulator. First thing I would like to check is if those commands work with an Android stock OS. If it does we would have a bug in our implementation.
Anyone already has some thoughts on it?
| Reporter | ||
Comment 1•13 years ago
|
||
As talked with Michael on IRC those two repositories are most likely the ones I would have to check first:
https://github.com/mozilla-b2g/platform_external_qemu
https://github.com/mozilla-b2g/android-development
| Reporter | ||
Comment 2•13 years ago
|
||
Additionally some parts could also be located in:
https://github.com/mozilla-b2g/android-sdk
Comment 3•13 years ago
|
||
You can't just send sensor events to change emualtor orientation. You have to press CTRL+F11, the whole emulator changes its layout to a landscape one. But this seems to update values reported by acceleration sensor only, the orientation sensor reports the same values before and after the transition.
Comment 4•13 years ago
|
||
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #3)
> You can't just send sensor events to change emualtor orientation. You have
> to press CTRL+F11, the whole emulator changes its layout to a landscape one.
> But this seems to update values reported by acceleration sensor only, the
> orientation sensor reports the same values before and after the transition.
https://github.com/mozilla-b2g/platform_external_qemu/blob/master/android/hw-sensors.c#L627
| Reporter | ||
Comment 5•13 years ago
|
||
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #3)
> You can't just send sensor events to change emualtor orientation. You have
> to press CTRL+F11, the whole emulator changes its layout to a landscape one.
> But this seems to update values reported by acceleration sensor only, the
> orientation sensor reports the same values before and after the transition.
Yeah, pressing Ctrl+F11/F12 only changes the orientation of the emulator but not for the currently run activity inside the emulator. So that is not helpful.
I was searching a lot in the last couple of days and as it looks like the issue here is a bug in the emulator code itself, which exists for a long time now. See the link to the Google code issue below. It has started to appear with Gingerbread and so far no fix has been made available.
http://code.google.com/p/android/issues/detail?id=13189
I played around with Marionette and the emulator and tried to set the screen orientation. I was partly successful in terms of the above mentioned bug. What I can do is the following:
* Set landscape primary but can't reset to portrait-primary
* Flip between secondary orientations as often as I can but can't go back to the primary ones
* Returning to the primary orientations after a secondary one has been selected you have to restart Firefox to see it updated
Code I was running:
import marionette
m = marionette.Marionette(emulator="arm", homedir="./")
m.start_session()
m.emulator._run_telnet("sensor set orientation 0:0:90")
m.emulator._run_telnet("sensor set orientation 0:90:0")
m.emulator._run_telnet("sensor set orientation 0:0:0")
As a workaround we could restart the application under test given that the home screen doesn't support any other orientation as portrait-primary. But that would not let us test the onmozorientationchange event. So I will probably have a look into the emulator code to get this fixed.
| Reporter | ||
Comment 6•13 years ago
|
||
So this is not a problem anymore. I got it fully working and also have a nearly finished marionette.emulator.screen class in hand.
The only issue I still have is that the emulator doesn't correctly initialize the orientation sensor values. So when starting the emulator you get '0:0:0' instead of '0:-90:0'. But that can easily be fixed with an additional check. Btw. setting the value to '0:0:0' later doesn't have any affect.
There is nothing else on this bug we can do here. I call it WFM now.
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•