audio: capEngine: Allow built-in strategies to omit the 'id' attribute

For builtin strategy, the "id" must be set from the name.
These builtin strategies must be provisionned in the structure file.
The parameters associated to these strategies will use their legacy
name (whereas vendor strategies are referred with "vx_<id>".

Bug: 390449625
Test: m

Change-Id: I63763f1e05f1ca2cdd7e3163d2e0c4e6b3979446
Signed-off-by: François Gaffie <francois.gaffie@ampere.cars>
diff --git a/audio/aidl/default/XsdcConversion.cpp b/audio/aidl/default/XsdcConversion.cpp
index b42d7f5..5845903 100644
--- a/audio/aidl/default/XsdcConversion.cpp
+++ b/audio/aidl/default/XsdcConversion.cpp
@@ -816,4 +816,23 @@
     }
     return aidlCurvePoint;
 }
+
+/**
+ * The hard coded id must be in sync with policy.h definition of legacy strategy ids.
+ */
+std::unordered_map<std::string, int> getLegacyProductStrategyMap() {
+#define STRATEGY_ENTRY(name, id) {"STRATEGY_" #name, static_cast<int>(id)}
+
+        return {STRATEGY_ENTRY(MEDIA, 5),
+                STRATEGY_ENTRY(PHONE, 0),
+                STRATEGY_ENTRY(SONIFICATION, 1),
+                STRATEGY_ENTRY(SONIFICATION_RESPECTFUL, 4),
+                STRATEGY_ENTRY(DTMF, 6),
+                STRATEGY_ENTRY(ENFORCED_AUDIBLE, 2),
+                STRATEGY_ENTRY(CALL_ASSISTANT, 7),
+                STRATEGY_ENTRY(TRANSMITTED_THROUGH_SPEAKER,8),
+                STRATEGY_ENTRY(ACCESSIBILITY, 3)};
+#undef STRATEGY_ENTRY
+}
+
 }  // namespace aidl::android::hardware::audio::core::internal