Create Broadcast radio HAL 1.1; implement DigitalStatus enum.

Test: VTS
Change-Id: I338c467c4e373cae547f331ba876afa040238376
diff --git a/audio/2.0/default/Android.mk b/audio/2.0/default/Android.mk
index a1ac61d..93f7ad0 100644
--- a/audio/2.0/default/Android.mk
+++ b/audio/2.0/default/Android.mk
@@ -69,7 +69,8 @@
     android.hardware.audio.common@2.0 \
     android.hardware.audio.effect@2.0 \
     android.hardware.soundtrigger@2.0 \
-    android.hardware.broadcastradio@1.0
+    android.hardware.broadcastradio@1.0 \
+    android.hardware.broadcastradio@1.1
 
 ifeq ($(strip $(AUDIOSERVER_MULTILIB)),)
 LOCAL_MULTILIB := 32
@@ -77,4 +78,8 @@
 LOCAL_MULTILIB := $(AUDIOSERVER_MULTILIB)
 endif
 
+ifeq ($(TARGET_USES_BCRADIO_FUTURE_FEATURES),true)
+LOCAL_CFLAGS += -DTARGET_USES_BCRADIO_FUTURE_FEATURES
+endif
+
 include $(BUILD_EXECUTABLE)
diff --git a/audio/2.0/default/service.cpp b/audio/2.0/default/service.cpp
index 935d556..f3a858a 100644
--- a/audio/2.0/default/service.cpp
+++ b/audio/2.0/default/service.cpp
@@ -22,6 +22,7 @@
 #include <android/hardware/audio/effect/2.0/IEffectsFactory.h>
 #include <android/hardware/soundtrigger/2.0/ISoundTriggerHw.h>
 #include <android/hardware/broadcastradio/1.0/IBroadcastRadioFactory.h>
+#include <android/hardware/broadcastradio/1.1/IBroadcastRadioFactory.h>
 
 using android::hardware::configureRpcThreadpool;
 using android::hardware::joinRpcThreadpool;
@@ -31,7 +32,13 @@
 using android::hardware::audio::V2_0::IDevicesFactory;
 using android::hardware::soundtrigger::V2_0::ISoundTriggerHw;
 using android::hardware::registerPassthroughServiceImplementation;
-using android::hardware::broadcastradio::V1_0::IBroadcastRadioFactory;
+namespace broadcastradio = android::hardware::broadcastradio;
+
+#ifdef TARGET_USES_BCRADIO_FUTURE_FEATURES
+static const bool useBroadcastRadioFutureFeatures = true;
+#else
+static const bool useBroadcastRadioFutureFeatures = false;
+#endif
 
 using android::OK;
 
@@ -45,7 +52,13 @@
     // Soundtrigger and FM radio might be not present.
     status = registerPassthroughServiceImplementation<ISoundTriggerHw>("sound_trigger.primary");
     ALOGE_IF(status != OK, "Error while registering soundtrigger service: %d", status);
-    status = registerPassthroughServiceImplementation<IBroadcastRadioFactory>();
+    if (useBroadcastRadioFutureFeatures) {
+        status = registerPassthroughServiceImplementation<
+            broadcastradio::V1_1::IBroadcastRadioFactory>();
+    } else {
+        status = registerPassthroughServiceImplementation<
+            broadcastradio::V1_0::IBroadcastRadioFactory>();
+    }
     ALOGE_IF(status != OK, "Error while registering fm radio service: %d", status);
     joinRpcThreadpool();
     return status;