I am trying to build an automated test framework for checking basic things that an app should respond to, without crashing. One of those is checking if an app responds to configuration change properly. Now, since it is automated, I have to switch the emulator's orientation between landscape and portrait and observe if it crashes, PROGRAMMATICALLY. [caps cuz there are many questions relating to ctrl+F12 or num pad 7]
I am trying to figure out an adb or emulator console command to get this done.
i did a telnet to localhost:5554 and entered the following commands:
$sensor status // gives the enabled/disabled status of all sensors
acceleration: enabled.
magnetic-field: enabled.
orientation: enabled.
temperature: enabled.
proximity: enabled.
OK
$sensor get orientation
orientation = 0:0:0
$sensor set orientation 90:0:0
OK
I tried different combinations of this and it doesn't respond. To get the value that is set when it is in landscape mode, I manually changed the orientation using ctrl+F12 and tried getting the orientation sensor status again, and to my dismay, the value didn't change.
A certain blog also mentioned this particular command in ADB
$service call window 18 i32 1
$service call window 18 i32 0
for switching orientations. But, I get this error message
Result: Parcel(fffffffc ffffffff '........')
It would be great if I could get a solution to this.