PFW: Log criterion state at PFW start

BZ: 77959

The PFW will log criterion patch state at start before appling
configuration.

Change-Id: I4ac3676b9ba685c1e226a8495ffdbe98f0c08219
Signed-off-by: Kevin Rocard <kevinx.rocard@intel.com>
Reviewed-on: http://android.intel.com:8080/79965
Reviewed-by: De Chivre, Renaud <renaud.de.chivre@intel.com>
Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com>
Reviewed-by: cactus <cactus@intel.com>
Tested-by: cactus <cactus@intel.com>
diff --git a/parameter/SelectionCriterion.cpp b/parameter/SelectionCriterion.cpp
index 77bca4d..908aaf6 100644
--- a/parameter/SelectionCriterion.cpp
+++ b/parameter/SelectionCriterion.cpp
@@ -55,7 +55,7 @@
 
         _iState = iState;
 
-        log_info("Selection criterion changed event: %s", getFormattedDescription(false).c_str());
+        log_info("Selection criterion changed event: %s", getFormattedDescription(false, false).c_str());
 
         // Check if the previous criterion value has been taken into account (i.e. at least one Configuration was applied
         // since the last criterion change)
@@ -108,35 +108,56 @@
 }
 
 /// User request
-string CSelectionCriterion::getFormattedDescription(bool bWithTypeInfo) const
+string CSelectionCriterion::getFormattedDescription(bool bWithTypeInfo, bool bHumanReadable) const
 {
     string strFormattedDescription;
 
-    if (bWithTypeInfo) {
+    if (bHumanReadable) {
 
-        // Display type info
-        appendTitle(strFormattedDescription, getName() + ":");
+        if (bWithTypeInfo) {
 
-        // States
-        strFormattedDescription += "Possible states ";
+            // Display type info
+            appendTitle(strFormattedDescription, getName() + ":");
 
-        // Type Kind
-        strFormattedDescription += "(";
-        strFormattedDescription += _pType->isTypeInclusive() ? "Inclusive" : "Exclusive";
-        strFormattedDescription += "): ";
+            // States
+            strFormattedDescription += "Possible states ";
 
-        // States
-        strFormattedDescription += _pType->listPossibleValues() + "\n";
+            // Type Kind
+            strFormattedDescription += "(";
+            strFormattedDescription += _pType->isTypeInclusive() ? "Inclusive" : "Exclusive";
+            strFormattedDescription += "): ";
+
+            // States
+            strFormattedDescription += _pType->listPossibleValues() + "\n";
+
+            // Current State
+            strFormattedDescription += "Current state";
+        } else {
+            // Name only
+            strFormattedDescription = getName();
+        }
 
         // Current State
-        strFormattedDescription += "Current state";
+        strFormattedDescription += " = " + _pType->getFormattedState(_iState);
     } else {
-        // Name only
-        strFormattedDescription = getName();
+        // Name
+        strFormattedDescription = "Criterion name: " + getName();
+
+        if (bWithTypeInfo) {
+            // Type Kind
+            strFormattedDescription += ", type kind: ";
+            strFormattedDescription +=  _pType->isTypeInclusive() ? "inclusive" : "exclusive";
+        }
+
+        // Current State
+        strFormattedDescription += ", current state: " +
+                                   _pType->getFormattedState(_iState);
+
+         if (bWithTypeInfo) {
+            // States
+            strFormattedDescription += ", states: " +
+                                       _pType->listPossibleValues();
+        }
     }
-
-    // Current State
-    strFormattedDescription += " = " + _pType->getFormattedState(_iState);
-
     return strFormattedDescription;
 }