adb: fdevent: move CheckMainThread logic to fdevent_context.

Test: adb_test
Change-Id: I10b93293af22d54ec739dc0f95c95df3ab082fb6
diff --git a/adb/fdevent/fdevent.h b/adb/fdevent/fdevent.h
index 0147ad5..c007e51 100644
--- a/adb/fdevent/fdevent.h
+++ b/adb/fdevent/fdevent.h
@@ -75,8 +75,9 @@
     // Implementations should call FlushRunQueue on every iteration.
     virtual void Loop() = 0;
 
-    // Assert that the caller is running on the context's main thread.
-    virtual void CheckMainThread() = 0;
+    // Assert that the caller is either running on the context's main thread, or that there is no
+    // active main thread.
+    void CheckMainThread();
 
     // Queue an operation to be run on the main thread.
     void Run(std::function<void()> fn);
@@ -92,6 +93,8 @@
     // Run all pending functions enqueued via Run().
     void FlushRunQueue() EXCLUDES(run_queue_mutex_);
 
+    std::optional<uint64_t> main_thread_id_ = std::nullopt;
+
   private:
     std::mutex run_queue_mutex_;
     std::deque<std::function<void()>> run_queue_ GUARDED_BY(run_queue_mutex_);