Change VENDOR program types to range.

Bug: b/64331420
Test: VTS, instrumentation
Change-Id: If91d8e6835ed3acaf429bb05b96f3d3a7985d19b
diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal
index 3e616c8..8b8fc6f 100644
--- a/broadcastradio/1.1/types.hal
+++ b/broadcastradio/1.1/types.hal
@@ -128,11 +128,14 @@
 /**
  * Type of a radio technology.
  *
+ * VENDOR program types must be opaque to the framework.
+ *
  * There are multiple VENDOR program types just to make vendor implementation
  * easier with multiple properitary radio technologies. They are treated the
  * same by the framework.
  *
  * All other values are reserved for future use.
+ * Values not matching any enumerated constant must be ignored.
  */
 enum ProgramType : uint32_t {
     AM = 1,  // analogue AM radio (with or without RDS)
@@ -142,10 +145,10 @@
     DAB,     // Digital audio broadcasting
     DRMO,    // Digital Radio Mondiale
     SXM,     // SiriusXM Satellite Radio
-    VENDOR1, // Vendor-specific, not synced across devices.
-    VENDOR2, // Vendor-specific, not synced across devices.
-    VENDOR3, // Vendor-specific, not synced across devices.
-    VENDOR4, // Vendor-specific, not synced across devices.
+
+    // Vendor-specific, not synced across devices.
+    VENDOR_START = 1000,
+    VENDOR_END = 1999,
 };
 
 /**
@@ -155,10 +158,13 @@
  * it for secondary IDs. For example, a satellite program may set AM/FM fallback
  * frequency, if a station broadcasts both via satellite and AM/FM.
  *
+ * VENDOR identifier types must be opaque to the framework.
+ *
  * The value format for each (but VENDOR_PRIMARY) identifier is strictly defined
  * to maintain interoperability between devices made by different vendors.
  *
  * All other values are reserved for future use.
+ * Values not matching any enumerated constant must be ignored.
  */
 enum IdentifierType : uint32_t {
     AMFM_FREQUENCY = 1,  // kHz
@@ -208,12 +214,12 @@
      * Primary identifier for vendor-specific radio technology.
      * The value format is determined by a vendor.
      *
-     * It must not be used in any other programType than VENDORx.
+     * It must not be used in any other programType than corresponding VENDOR
+     * type between VENDOR_START and VENDOR_END (eg. identifier type 1015 must
+     * not be used in any program type other than 1015).
      */
-    VENDOR1_PRIMARY,
-    VENDOR2_PRIMARY,
-    VENDOR3_PRIMARY,
-    VENDOR4_PRIMARY,
+    VENDOR_PRIMARY_START = ProgramType:VENDOR_START,
+    VENDOR_PRIMARY_END = ProgramType:VENDOR_END,
 };
 
 /**
diff --git a/broadcastradio/1.1/utils/Utils.cpp b/broadcastradio/1.1/utils/Utils.cpp
index 50a407c..8ccd98e 100644
--- a/broadcastradio/1.1/utils/Utils.cpp
+++ b/broadcastradio/1.1/utils/Utils.cpp
@@ -93,11 +93,7 @@
                 return haveEqualIds(a, b, IdentifierType::SXM_SERVICE_ID);
             }
             return haveEqualIds(a, b, IdentifierType::SXM_CHANNEL);
-        case ProgramType::VENDOR1:
-        case ProgramType::VENDOR2:
-        case ProgramType::VENDOR3:
-        case ProgramType::VENDOR4:
-        default:
+        default:  // includes all vendor types
             ALOGW("Unsupported program type: %s", toString(type).c_str());
             return false;
     }
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index 55abe9b..a46378e 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -69,10 +69,6 @@
     ProgramType::AM,  ProgramType::FM,   ProgramType::AM_HD, ProgramType::FM_HD,
     ProgramType::DAB, ProgramType::DRMO, ProgramType::SXM};
 
-static constexpr IdentifierType kVendorPrimartIds[] = {
-    IdentifierType::VENDOR1_PRIMARY, IdentifierType::VENDOR2_PRIMARY,
-    IdentifierType::VENDOR3_PRIMARY, IdentifierType::VENDOR4_PRIMARY};
-
 static void printSkipped(std::string msg) {
     std::cout << "[  SKIPPED ] " << msg << std::endl;
 }
@@ -382,15 +378,12 @@
 
     for (auto ptype : kStandardProgramTypes) {
         ALOGD("Checking %s...", toString(ptype).c_str());
-        for (auto idtype : kVendorPrimartIds) {
-            ALOGD("...with %s", toString(idtype).c_str());
-            ProgramSelector sel = {};
-            sel.programType = static_cast<uint32_t>(ptype);
-            sel.primaryId.type = static_cast<uint32_t>(idtype);
+        ProgramSelector sel = {};
+        sel.programType = static_cast<uint32_t>(ptype);
+        sel.primaryId.type = static_cast<uint32_t>(IdentifierType::VENDOR_PRIMARY_START);
 
-            auto tuneResult = mTuner->tuneByProgramSelector(sel);
-            ASSERT_NE(Result::OK, tuneResult);
-        }
+        auto tuneResult = mTuner->tuneByProgramSelector(sel);
+        ASSERT_NE(Result::OK, tuneResult);
     }
 }