Android Emulator Orientation Change Through Emulator Console or ADB

前端 未结 1 1767
梦如初夏
梦如初夏 2021-02-11 03:39

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 config

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-11 04:26

    Finally I figure out a way to do it.

    First I will try to clarify the question a little bit:

    usually people talking about 'rotate' the AVD screen actually mean changing the skin layout to portrait/landscape (Mimic rotation of the tablet). Which can be done by press "7/9" key on number keypad or press ctrl+Fn+F12. In this case, the direction of the display will not change, sometimes the display will be annoying Left-to-right or right-to-left, in stead of natural up-to-bottom. This can be solved by uncheck the auto-rotation in android setting.

    However, in some case we would like to see the effect of the gravity sensor. I think this is actually related to the OP's question. Unlike the GPS, there is no GUI tools of Eclipse to do this. The OP is very close to solve the problem. However, the orientation sensor is not the correct one, we need to use the gravity/acceleration sensor to rotate the screen automatically. try following command and observe the display direction with auto-rotation on:

    sensor set acceleration 9.77622:0:0
    sensor set acceleration 0:9.77622:0
    sensor set acceleration 0:0:9.77622
    

    0 讨论(0)
提交回复
热议问题