Fix remaining broadcastradio 1.1 VTS TODOs.

This includes:
- cover all AM/FM bands, not just first one
- fix flakiness on late callback dereference
- fix 1.0 tuneComplete check
- move utils includes into separate subdirectories

Bug: b/36864490
Test: VTS
Change-Id: I6e2427ac29abd6278c9783cf83b4df05195ac7ea
diff --git a/broadcastradio/1.1/utils/Android.bp b/broadcastradio/1.1/utils/Android.bp
index 73c6680..e80d133 100644
--- a/broadcastradio/1.1/utils/Android.bp
+++ b/broadcastradio/1.1/utils/Android.bp
@@ -27,7 +27,7 @@
         "Utils.cpp",
         "WorkerThread.cpp",
     ],
-    export_include_dirs: ["."],
+    export_include_dirs: ["include"],
     shared_libs: [
         "android.hardware.broadcastradio@1.1",
     ],
diff --git a/broadcastradio/1.1/utils/Utils.cpp b/broadcastradio/1.1/utils/Utils.cpp
index f8a4479..8bb7691 100644
--- a/broadcastradio/1.1/utils/Utils.cpp
+++ b/broadcastradio/1.1/utils/Utils.cpp
@@ -16,7 +16,7 @@
 #define LOG_TAG "BroadcastRadioDefault.utils"
 //#define LOG_NDEBUG 0
 
-#include "Utils.h"
+#include <broadcastradio-utils/Utils.h>
 
 #include <log/log.h>
 
@@ -208,6 +208,26 @@
 
 }  // namespace utils
 }  // namespace V1_1
+
+namespace V1_0 {
+
+bool operator==(const BandConfig& l, const BandConfig& r) {
+    if (l.type != r.type) return false;
+    if (l.antennaConnected != r.antennaConnected) return false;
+    if (l.lowerLimit != r.lowerLimit) return false;
+    if (l.upperLimit != r.upperLimit) return false;
+    if (l.spacings != r.spacings) return false;
+    if (l.type == Band::AM || l.type == Band::AM_HD) {
+        return l.ext.am == r.ext.am;
+    } else if (l.type == Band::FM || l.type == Band::FM_HD) {
+        return l.ext.fm == r.ext.fm;
+    } else {
+        ALOGW("Unsupported band config type: %s", toString(l.type).c_str());
+        return false;
+    }
+}
+
+}  // namespace V1_0
 }  // namespace broadcastradio
 }  // namespace hardware
 }  // namespace android
diff --git a/broadcastradio/1.1/utils/WorkerThread.cpp b/broadcastradio/1.1/utils/WorkerThread.cpp
index a3ceaa1..bfcbb39 100644
--- a/broadcastradio/1.1/utils/WorkerThread.cpp
+++ b/broadcastradio/1.1/utils/WorkerThread.cpp
@@ -17,7 +17,7 @@
 #define LOG_TAG "WorkerThread"
 //#define LOG_NDEBUG 0
 
-#include "WorkerThread.h"
+#include <broadcastradio-utils/WorkerThread.h>
 
 #include <log/log.h>
 
diff --git a/broadcastradio/1.1/utils/Utils.h b/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
similarity index 95%
rename from broadcastradio/1.1/utils/Utils.h
rename to broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
index cd86ffa..a7da9fe 100644
--- a/broadcastradio/1.1/utils/Utils.h
+++ b/broadcastradio/1.1/utils/include/broadcastradio-utils/Utils.h
@@ -66,6 +66,13 @@
 
 }  // namespace utils
 }  // namespace V1_1
+
+namespace V1_0 {
+
+bool operator==(const BandConfig& l, const BandConfig& r);
+
+}  // namespace V1_0
+
 }  // namespace broadcastradio
 }  // namespace hardware
 }  // namespace android
diff --git a/broadcastradio/1.1/utils/WorkerThread.h b/broadcastradio/1.1/utils/include/broadcastradio-utils/WorkerThread.h
similarity index 100%
rename from broadcastradio/1.1/utils/WorkerThread.h
rename to broadcastradio/1.1/utils/include/broadcastradio-utils/WorkerThread.h