Rotation is inverted on Android

Hi,

I noticed a problem with screen orientation. The tablet is in Portrait position, but Appium thinks it’s Landscape. When I rotate the screen using the rotate(ScreenOrientation.PORTRAIT) method, the screen rotates to landscape.
Using a Nexus 10, Android 5.0.2, Appium 1.3.4.1, Appium Java client 2.2.0

Here’s a snippet of Appium logs showing what happens when I try to rotate to Lanscape, being in Portrait mode:

info: <-- GET /wd/hub/session/9faa9007-25f5-4ab3-a1d6-393db91844c2 200 5.426 ms - 787 {"status":0,"value":{"platform":"LINUX","browserName":"","platformVersion":"5.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"platformVersion":"5.0.1","app":"C:\\Projects\\appium\\android\\app\\AppStag284.apk","platformName":"Android","deviceName":"Nexus 10","browserName":"","appActivity":"app.textbooks.SplashActivity","rotatable":true,"appPackage":"staging.com.kno.textbooks"},"app":"C:\\Projects\\appium\\android\\app\\AppStag284.apk","platformName":"Android","deviceName":"Nexus 10","appActivity":"app.textbooks.SplashActivity","rotatable":true,"appPackage":"staging.com.app.textbooks"},"sessionId":"9faa9007-25f5-4ab3-a1d6-393db91844c2"}
info: --> POST /wd/hub/session/9faa9007-25f5-4ab3-a1d6-393db91844c2/orientation {"orientation":"LANDSCAPE"}
info: [debug] Pushing command to appium work queue: ["orientation",{"orientation":"LANDSCAPE"}]
info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"orientation","params":{"orientation":"LANDSCAPE"}}
info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
info: [debug] [BOOTSTRAP] [debug] Got command action: orientation
info: [debug] [BOOTSTRAP] [debug] Desired orientation: LANDSCAPE
info: [debug] [BOOTSTRAP] [debug] Current rotation: ROTATION_270
info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"Already in landscape mode."}
info: [debug] Responding to client with success: {"status":0,"value":"Already in landscape mode.","sessionId":"9faa9007-25f5-4ab3-a1d6-393db91844c2"}
info: <-- POST /wd/hub/session/9faa9007-25f5-4ab3-a1d6-393db91844c2/orientation 200 9.493 ms - 100 {"status":0,"value":"Already in landscape mode.","sessionId":"9faa9007-25f5-4ab3-a1d6-393db91844c2"}

Same issue with Samsung Galaxy Note 10. It works correctly on smartphone though, so it must be a tablet issue.

Hi Fanch,
Facing the same issue, any update…

I didn’t try with new versions of appium, but I don’t think someone has posted an issue on github about this.

I am seeing this issue as well. Using node.js. My test begins in portrait mode, and in order to get it to rotate to landscape mode, I need to use the command “setOrientation(‘PORTRAIT’)”.