public bool ExecuteAndWait()
            {
                lock (mSyncLock)
                {
                    mTriggerEvent.Reset();
                    mExecutionSuccessful = false;
                    mResultException     = null;
                }

                Log.V(cLogTag, "Executing command {0} in a separate thread, waiting for text \"{1}\"", mCommand, mTrigger);

                new Thread(delegate()
                {
                    try
                    {
                        mActivityProvider.ExecuteAdbCommand(mCommand, false, this);
                        mExecutionSuccessful = true;
                    }
                    catch (Exception ex)
                    {
                        mResultException = ex;
                    }

                    lock (mSyncLock)
                    {
                        mKillTimerMap.TryGetValue(mProcessId, out Timer killTimer);

                        if (killTimer != null)
                        {
                            Log.V(cLogTag, "[Process {0}] Process exited, cancelling kill timer for separate thread command {1}", mProcessId, mCommand);
                            killTimer.Change(Timeout.Infinite, Timeout.Infinite);
                            mKillTimerMap.Remove(mProcessId);
                        }

                        mTriggerEvent.Set();
                    }
                }).Start();

                mTriggerEvent.WaitOne();

                lock (mSyncLock)
                {
                    return(mExecutionSuccessful);
                }
            }
            public void Start()
            {
                Thread monitorThread = new Thread(delegate()
                {
                    while (!StopRequested)
                    {
                        try
                        {
                            mActivityProvider.ExecuteAdbCommand("status-window", false, this);
                        }
                        catch (AdbExeException adbExeEx)
                        {
                            if (!StopRequested)
                            {
                                Log.E(cLogTag, "An error occured trying to monitor device status: {0}. Waiting 5 seconds before retrying.", adbExeEx.Message);
                                Thread.Sleep(5000);
                            }
                        }
                        catch { }
                    }

                    Log.I(cLogTag, "Stop requested for device monitor thread, exiting");

                    lock (mSyncLock)
                    {
                        mStopRequested = false;
                    }
                })
                {
                    IsBackground = true,
                    Name         = "AdbExeAP Monitor"
                };

                Log.I(cLogTag, "Starting device status monitor thread");
                monitorThread.Start();
            }