[PFW] Fix issue when setting a parameter of a configuration not applicable

BZ: 93374

This patch aims to fix an issue when using the command setConfigurationParameter
to update the value of a parameter of a configuration.
The autosync shall be turned off when updating the value of a parameter in a
configuration that is not currently applicable.

Change-Id: I12f9d37e544dc7b54f1bed0470783fdfc8568b7c
Signed-off-by: Frédéric Boisnard <fredericx.boisnard@intel.com>
Reviewed-on: http://android.intel.com:8080/96832
Reviewed-by: cactus <cactus@intel.com>
Reviewed-by: Gonzalve, Sebastien <sebastien.gonzalve@intel.com>
Reviewed-by: Denneulin, Guillaume <guillaume.denneulin@intel.com>
Reviewed-by: De Chivre, Renaud <renaud.de.chivre@intel.com>
Reviewed-by: Benavoli, Patrick <patrick.benavoli@intel.com>
Tested-by: Dixon, CharlesX <charlesx.dixon@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
diff --git a/parameter/ParameterMgr.cpp b/parameter/ParameterMgr.cpp
index e8ab863..092a496 100644
--- a/parameter/ParameterMgr.cpp
+++ b/parameter/ParameterMgr.cpp
@@ -1333,6 +1333,12 @@
     // Define context
     CParameterAccessContext parameterAccessContext(strError, _pMainParameterBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex);
 
+    // Activate the auto synchronization with the hardware
+    if (bSet) {
+
+        parameterAccessContext.setAutoSync(_bAutoSyncOn);
+    }
+
     return accessValue(parameterAccessContext, strPath, strValue, bSet, strError);
 }
 
@@ -1366,7 +1372,7 @@
 
     /// Update the Configuration Blackboard
 
-    // Define Configuration context using Base Offset
+    // Define Configuration context using Base Offset and keep Auto Sync off to prevent access to HW
     CParameterAccessContext parameterAccessContext(strError, pConfigurationBlackboard, _bValueSpaceIsRaw, _bOutputRawFormatIsHex, uiBaseOffset);
 
     // Access Value in the Configuration Blackboard
@@ -1382,6 +1388,12 @@
         // Define Main context
         parameterAccessContext.setParameterBlackboard(_pMainParameterBlackboard);
 
+        // Activate the auto synchronization with the hardware
+        if (bSet) {
+
+            parameterAccessContext.setAutoSync(_bAutoSyncOn);
+        }
+
         // Access Value in the Main Blackboard
         return accessValue(parameterAccessContext, strPath, strValue, bSet, strError);
     }
@@ -1403,12 +1415,6 @@
         return false;
     }
 
-    // Auto Sync
-    if (bSet) {
-
-        parameterAccessContext.setAutoSync(_bAutoSyncOn);
-    }
-
     // Do the get
     return getConstSystemClass()->accessValue(pathNavigator, strValue, bSet, parameterAccessContext);
 }