summaryrefslogtreecommitdiffstats
path: root/broadcastradio
diff options
context:
space:
mode:
authorTomasz Wasilczyk <twasilczyk@google.com>2018-01-12 15:15:59 -0800
committerTomasz Wasilczyk <twasilczyk@google.com>2018-01-15 08:34:28 -0800
commita425dedbe82424b8ac024bbc3582684494b3d9ac (patch)
tree015d075c77c3a2f87b4fd55844d3277fd950d0f5 /broadcastradio
parent43a354641e7609c170ca35d8dcecbe75e333a3d7 (diff)
downloadandroid_hardware_interfaces-a425dedbe82424b8ac024bbc3582684494b3d9ac.tar.gz
android_hardware_interfaces-a425dedbe82424b8ac024bbc3582684494b3d9ac.tar.bz2
android_hardware_interfaces-a425dedbe82424b8ac024bbc3582684494b3d9ac.zip
Allow spaces in DAB frequency labels and make it up to 7 characters long.
There is no standard for DAB label format, the regexp is based on our partners knowledge. Bug: 69958423 Test: VTS Change-Id: I917508408de22f8a75d39d4e9badddd385869b03
Diffstat (limited to 'broadcastradio')
-rw-r--r--broadcastradio/2.0/types.hal4
-rw-r--r--broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp6
2 files changed, 7 insertions, 3 deletions
diff --git a/broadcastradio/2.0/types.hal b/broadcastradio/2.0/types.hal
index 1fd3715eb..003c444da 100644
--- a/broadcastradio/2.0/types.hal
+++ b/broadcastradio/2.0/types.hal
@@ -215,7 +215,9 @@ struct DabTableEntry {
/**
* Channel name, i.e. 5A, 7B.
*
- * It must match the following regular expression: /^[A-Z0-9]{2,5}$/.
+ * It must match the following regular expression:
+ * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters
+ * without spaces allowed at the beginning nor end).
*/
string label;
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index 8d9d622c8..9695d3299 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -332,11 +332,13 @@ TEST_F(BroadcastRadioHalTest, GetDabRegionConfig) {
}
ASSERT_EQ(Result::OK, halResult);
- std::regex re("^[A-Z0-9]{2,5}$");
+ std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$");
// double-check correctness of the test
ASSERT_TRUE(std::regex_match("5A", re));
ASSERT_FALSE(std::regex_match("5a", re));
- ASSERT_FALSE(std::regex_match("123ABC", re));
+ ASSERT_FALSE(std::regex_match("1234ABCD", re));
+ ASSERT_TRUE(std::regex_match("CN 12D", re));
+ ASSERT_FALSE(std::regex_match(" 5A", re));
for (auto&& entry : config) {
EXPECT_TRUE(std::regex_match(std::string(entry.label), re));