Add e2e cmdline tests and fix Flush with no producers

Adds end-to-end coverage of the cmdline interface.
It is not simple anymore and recently became a source of bugs.
Furthermore, fix a minor bug that caused Flush() on an empty
tracing session to timeout (and waste time during tests).

Bug:120607375
Change-Id: Idcdbdd4a03712988beb65ec0b386769898ec98d8
diff --git a/Android.bp b/Android.bp
index fb4bd23..e78ed28 100644
--- a/Android.bp
+++ b/Android.bp
@@ -2680,11 +2680,14 @@
   shared_libs: [
     "libandroid",
     "libbase",
+    "libbinder",
     "liblog",
     "libprocinfo",
     "libprotobuf-cpp-full",
     "libprotobuf-cpp-lite",
+    "libservices",
     "libunwindstack",
+    "libutils",
   ],
   static_libs: [
     "libgmock",
@@ -2731,6 +2734,7 @@
   cflags: [
     "-DGOOGLE_PROTOBUF_NO_RTTI",
     "-DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
+    "-DPERFETTO_BUILD_WITH_ANDROID",
   ],
   product_variables: {
     pdk: {
@@ -2871,6 +2875,7 @@
     "libprotobuf-cpp-lite",
   ],
   static_libs: [
+    "libgmock",
     "libgtest",
     "perfetto_src_tracing_ipc",
     "perfetto_trace_protos",