Add generic flags to ProgramInfo struct.
Start with two for HD Radio/DAB: live and muted. And a vendor range.
Test: it builds.
Bug: b/32621193
Change-Id: I3761bab2abb31a29f8bcbf53683774e465cdcf5a
diff --git a/broadcastradio/1.1/default/Utils.cpp b/broadcastradio/1.1/default/Utils.cpp
index 6d4777d..e21344e 100644
--- a/broadcastradio/1.1/default/Utils.cpp
+++ b/broadcastradio/1.1/default/Utils.cpp
@@ -236,7 +236,7 @@
info_1_0.signalStrength = halInfo->signal_strength;
convertMetaDataFromHal(info_1_0.metadata, halInfo->metadata);
// TODO(b/34348946): add support for HAL 1.1 fields
- info_1_1.digitalStatus = DigitalStatus::INVALID;
+ info_1_1.flags = 0;
}
//static
diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal
index 3b212eb..b6f72d2 100644
--- a/broadcastradio/1.1/types.hal
+++ b/broadcastradio/1.1/types.hal
@@ -1,4 +1,4 @@
-/*
+/**
* Copyright 2017 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,18 +26,38 @@
TEMPORARILY_UNAVAILABLE,
};
-enum DigitalStatus : int32_t {
- INVALID = -1,
- UNAVAILABLE = 1, // current program is analog-only
- AVAILABLE = 2, // digital mode is available, but disabled
- BUFFERING = 3, // digital mode is available and buffering has started
- ACTIVE = 4, // digital mode is currently playing
+/**
+ * Extra flags for program information.
+ */
+enum ProgramInfoFlags : uint32_t {
+ /**
+ * Set when the program is currently playing live stream.
+ * This may result in a slightly altered reception parameters,
+ * usually targetted at reduced latency.
+ */
+ LIVE = 1 << 0,
+
+ /**
+ * Radio stream is not playing, ie. due to bad reception conditions or
+ * buffering. In this state volume knob MAY be disabled to prevent user
+ * increasing volume too much.
+ */
+ MUTED = 1 << 1,
};
-/* Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
+/**
+ * Radio program information. Returned by the HAL with event RADIO_EVENT_TUNED.
* Contains information on currently tuned channel.
*/
struct ProgramInfo {
@1.0::ProgramInfo base;
- DigitalStatus digitalStatus;
+ bitfield<ProgramInfoFlags> flags;
+
+ /**
+ * Vendors are allowed to define their own set of flags and store it in this
+ * field. They MUST verify vendor/product name from Properties struct
+ * (IBroadcastRadio::getProperties) before doing any interpretation
+ * of such values.
+ */
+ uint32_t vendorFlags;
};