Properly shut down sl4a sessions.
b/18842457
b/18864151

Replace 'terminate' option with proper shutdown through messaging.
Shutdown sequence:
1. droid.closeSl4aSession
2. droid's sl4a session gets the shutdown command and sends a shutdown event.
3. droid's sl4a session breaks out of event loop and cleans up.
4. event_dispatcher on the python side gets the shutdown event and calls
droid.closeSl4aSession on its own droid session.
5. event_dispatcher breaks out of event loop and stops.
6. event_dispatcher's droid session gets the shutdown command and sends
a shutdown event.
7. event_dispatcher's droid session breaks out of event loop and cleans up.
8. The second shutdown event is ignored.

Add a couple of simple tests for sl4a start and shutdown.

Cherry-pick from mwd: https://partner-android-review.googlesource.com/#/c/212234/

Change-Id: I6e8e6809decdb0f7de8b8f160459389f4eee6d34
4 files changed