Unlock emulator screen automatically

XMLWordPrintable

    • Type: Improvement
    • Resolution: Cannot Reproduce
    • Priority: Minor
    • None
    • Environment:
      Jenkins 1.436, Jenkins Android Emulator Plugin 1.18
      Maven3, maven-android-plugin 2.2.1
      Android OS 2.2

      It seems to be useful to unlock emulator screen automatically before instrumentation test.

      I'm using Jenkins Android Emulator Plugin with instrumentation test cases (e.g. ActivityInstrumentationTestCase2).
      The last month I run into the problem of java.lang.SecurityException described here.

      I could workaround this problem by unlocking emulator screen before a build. To unlock screen, I added the following script to "Pre Steps" of the project settings.

      echo "event send EV_KEY:KEY_SOFT1:1" | nc -q1 localhost $ANDROID_AVD_ADB_PORT
      sleep 0.1
      echo "event send EV_KEY:KEY_SOFT1:0" | nc -q1 localhost $ANDROID_AVD_ADB_PORT
      sleep 0.1
      echo "event send EV_KEY:KEY_SOFT1:1" | nc -q1 localhost $ANDROID_AVD_ADB_PORT
      sleep 0.1
      echo "event send EV_KEY:KEY_SOFT1:0" | nc -q1 localhost $ANDROID_AVD_ADB_PORT
      sleep 0.1

      To make the script, I read this page as a reference.

      Although we can workaround the problem manually as I described here, it is useful if the Android Emulator Plugin unlocks emulator screen automatically.


      As an alternative to the script above, according to this page, just the following line might be OK.

      adb shell input keyevent 82

      (Once I tried but not worked on my environment.)


      (my blog post (Japanese))

            Assignee:
            Christopher Orr
            Reporter:
            Ikuo Matsumura
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: