Effect factory: Add in dumpsys the config parsing status

Help debugging effect config errors by printing the status of the
configuration file parsing.

Test: dumpsys media.audio_flinger |grep 'ffect configuration'
Change-Id: I08a0e7bc99755f978a0db2566ee8902abeb583ca
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/media/libeffects/factory/EffectsFactory.c b/media/libeffects/factory/EffectsFactory.c
index f5a9acd..cd0e765 100644
--- a/media/libeffects/factory/EffectsFactory.c
+++ b/media/libeffects/factory/EffectsFactory.c
@@ -37,6 +37,11 @@
 static list_elem_t *gCurLib;    // current library in enumeration process
 static list_elem_t *gCurEffect; // current effect in enumeration process
 static uint32_t gCurEffectIdx;       // current effect index in enumeration process
+/** Number of elements skipped during the effects configuration loading.
+ *  -1 if the config loader failed
+ *  -2 if config load was skipped
+ */
+static ssize_t gConfigNbElemSkipped = -2;
 
 static int gInitDone; // true is global initialization has been preformed
 static int gCanQueryEffect; // indicates that call to EffectQueryEffect() is valid, i.e. that the list of effects
@@ -437,12 +442,12 @@
     if (ignoreFxConfFiles) {
         ALOGI("Audio effects in configuration files will be ignored");
     } else {
-        ssize_t loadResult = EffectLoadXmlEffectConfig(NULL);
-        if (loadResult < 0) {
+        gConfigNbElemSkipped = EffectLoadXmlEffectConfig(NULL);
+        if (gConfigNbElemSkipped < 0) {
             ALOGW("Failed to load XML effect configuration, fallback to .conf");
             EffectLoadEffectConfig();
-        } else if (loadResult > 0) {
-            ALOGE("Effect config is partially invalid, skipped %zd elements", loadResult);
+        } else if (gConfigNbElemSkipped > 0) {
+            ALOGE("Effect config is partially invalid, skipped %zd elements", gConfigNbElemSkipped);
         }
     }
 
@@ -578,6 +583,20 @@
             e = e->next;
         }
     }
+    switch (gConfigNbElemSkipped) {
+    case -2:
+        dprintf(fd, "Effect configuration loading skipped.\n");
+        break;
+    case -1:
+        dprintf(fd, "XML effect configuration failed to load.\n");
+        break;
+    case 0:
+        dprintf(fd, "XML effect configuration loaded successfully.\n");
+        break;
+    default:
+        dprintf(fd, "XML effect configuration partially loaded, skipped %zd elements.\n",
+                gConfigNbElemSkipped);
+    }
     return ret;
 }