Android Exerciser Monkey starts playing audio files at random

前端 未结 2 1787
花落未央
花落未央 2021-02-14 00:06

I\'m running exerciser monkey to test my android app. As part of my app I play media files which give the pronunciation of a words. I\'ve put the files in a directory where they

2条回答
  •  野的像风
    2021-02-14 00:33

    I think this has to do with the fact the monkey sends various key codes including key codes for hardware keys that may not even exist on the device under test.

    I have experienced a similar issue using the monkey and investigated it by providing the -v -v options (repeated -v increases the debugging level) and slowing the rate down using the --throttle option I'd also experimented to find a small number of actions that made it occur.

    My command line ended up reading:

    adb shell monkey -p package.undertest.com -s 214765 --throttle 500 -v -v 130
    

    This revealed that just before the media player started, i got the following logged:

    Sleeping for 500 milliseconds
    :SendKey (ACTION_DOWN): 90    // KEYCODE_FORWARD
    :SendKey (ACTION_UP): 90    // KEYCODE_FORWARD
    

    I was then able to confirm that KEYCODE_FORWARD does start my media player (doubleTwist) on my Galaxy S by issuing the following command after I'd stopped the media player:

    adb shell input keyevent 90
    

    Note that the 90 is the keycode listed in the log above.

    By changing my command line to the monkey to add "--pct-nav 0" that successfully stopped it starting the media player.

    I don't know if it might be a different key code in your case, so you might need to experiment and it may not suit your purposes in using the monkey to turn off all the basic navigation events by setting --pct-nav 0.

提交回复
热议问题