# This is a combination of 20 commits.
# The first commit's message is:
didLaunch flag is set at the end of launch sequence

didLaunch was not set at the end of the launch sequence; it was only
set in the onLaunch method, but apparently onLaunch is no longer
called.

# The 2nd commit message will be skipped:

#	"Ping" ADB to check whether we're still connected
#
#	On Android Emulator, ADB is disconnected when we toggle Airplane Mode
#	or mobile Data. However, the problem does not manifest itself when
#	querying the list of devices via adb devices: the emulator is still
#	listed. After attempting to ping the emulator via a shell command, the
#	emulator is no longer listed and a kill-server is necessary to get ADB
#	back up and running

# The 3rd commit message will be skipped:

#	Partial recovery from a loss of ADB connection caused by turning off the data connection in the emulator

# The 4th commit message will be skipped:

#	Conditionnally restart UI Automator in case of unexpected exit, mainly to address the use case of disconnecting the netwok on Android Emulator, which triggers a loss of ADB connection, and subsequently UI Automator connection

# The 5th commit message will be skipped:

#	New method mobile: toggleData on Android

# The 6th commit message will be skipped:

#	toggleData method on iOS

# The 7th commit message will be skipped:

#	toggleFlightMode method

# The 8th commit message will be skipped:

#	Implementing mobile:background command for Android and Selendroid

# The 9th commit message will be skipped:

#	Support full-reset for selendroid

# The 10th commit message will be skipped:

#	Merge changes from remote repos

# The 11th commit message will be skipped:

#	Pulled merge from remote repo

# The 12th commit message will be skipped:

#	Support full-reset for selendroid

# The 13th commit message will be skipped:

#	Implementing mobile:background command for Android and Selendroid

# The 14th commit message will be skipped:

#	Remove debug log

# The 15th commit message will be skipped:

#	Tidy up spaces according to pull request review

# The 16th commit message will be skipped:

#	Fixed indentation according to Appium project style guide (2 spaces indent)

# The 17th commit message will be skipped:

#	Fixed error management in background method

# The 18th commit message will be skipped:

#	Add an argument to ADB.startApp in order to choose whether to stop the app prior to starting it

# The 19th commit message will be skipped:

#	Refactored mobile:background method for Android: using ADB.startApp rather than directly issuing am start command to ADB shell, do not return to callback until app is back to foreground

# The 20th commit message will be skipped:

#	Mimick the launcher start intent for the app when starting it
#
#	The Android launcher uses the following settings to start apps:
#	- MAIN action
#	- LAUNCHER category
#	- FLAG_ACTIVITY_NEW_TASK
#	- FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
#	Without those settings there were discrepancies between Selendroid and
#	Android when trying to bring the app back to foreground: it would not
#	bring back the existing Activity stack but create new activities
didLaunch flag is set at the end of launch sequence

didLaunch was not set at the end of the launch sequence; it was only
set in the onLaunch method, but apparently onLaunch is no longer
called.