appium/appium — pull request #1171 by filmaj (2013-09-17 06:09:15+00:00)
Title: More robust unlock

This pull request introduces several changes/additions aimed at fixing appium's ability to unlock real Samsung Android devices. This is based on work done by @rockbot.

I've tested this on an Intel HAX emulator running 4.3,a Nexus 4 running 4.3, and a first-gen Nexus 7 running 4.3.

## Summary of Changes

1. A submodule to [unlock_apk](github.com/appium/unlock_apk) (an Android application tasked with unlocking an Android) is added, and a build step for unlock_apk is also added to `reset.sh --android`.
2. A `pushUnlock` method is added and hooked into `adb.js`'s `startAppium` function. `pushUnlock` calls `adb` to install `unlock.apk` on an available Android device or emulator.
3. A `device_state.js` module is added under `android/`. This module is to handle determining various useful things about a connected Android device or emulator's state. As a start, it has a single `isScreenLocked` function. I am hoping we can start teasing out `adb.js`' massive 1500+ lines of code into smaller, easier-to-digest, focused modules, at the existing committers blessing, of course. (/cc @jlipps @bootstraponline)

## Potential Issues

* Should we uninstall unlock.apk after every test? If so, this would need to be added. Related question: does this happen for other tools we rely on, like Android Bootstrap?
* I would like to confirm that this works with a real Samsung device (I do not have one handy at this time, boo). @rockbot, if you have time, could you help with that?

## Contribution Questions

* On how many different kinds of devices / emulators do committers to appium usually test on before deeming a new feature or bug fix acceptable?
* For this pull request, what kind of functional and/or unit tests would committers expect to exist to cover this functionality? I am trying to get a feel for the project so any pointers here would be appreciated :) (and I'll do my best to integrate into some manner of contributor guidelines document).