PFW: Add resync mechanism if a subsystem needs resync

BZ: 76267

In the case of a hw subsystems reset, it's possible that its
parameter managed by the PFW may not be aligned with the PFW
blackboard.
A re-synchronization mechanism is implemented to ensure that the
subsystem is re-synchronized on the next configurations application.

Change-Id: I032150955d25a7020cf494e69456897b4c157916
Signed-off-by: Guillaume Denneulin <guillaume.denneulin@intel.com>
Reviewed-on: http://android.intel.com:8080/83015
Reviewed-by: Rocard, KevinX <kevinx.rocard@intel.com>
Reviewed-by: Centelles, Sylvain <sylvain.centelles@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/ConfigurableDomain.cpp b/parameter/ConfigurableDomain.cpp
index 7d713a1..6d1c19c 100644
--- a/parameter/ConfigurableDomain.cpp
+++ b/parameter/ConfigurableDomain.cpp
@@ -438,8 +438,15 @@
 }
 
 // Configuration application if required
-void CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet& syncerSet, bool bForce) const
+void CConfigurableDomain::apply(CParameterBlackboard* pParameterBlackboard, CSyncerSet* pSyncerSet, bool bForce) const
 {
+    // Apply configuration only if the blackboard will
+    // be synchronized either now or by syncerSet.
+    if(!pSyncerSet ^ _bSequenceAware) {
+        // The configuration can not be syncronised
+        return;
+    }
+
     if (bForce) {
         // Force a configuration restore by forgetting about last applied configuration
         _pLastAppliedConfiguration = NULL;
@@ -451,19 +458,24 @@
         // Check not the last one before applying
         if (!_pLastAppliedConfiguration || _pLastAppliedConfiguration != pApplicableDomainConfiguration) {
 
-            log_info("Applying configuration \"%s\" from domain \"%s\"", pApplicableDomainConfiguration->getName().c_str(), getName().c_str());
+            log_info("Applying configuration \"%s\" from domain \"%s\"",
+                     pApplicableDomainConfiguration->getName().c_str(),
+                     getName().c_str());
+
+            // Check if we need to synchronize during restore
+            bool bSync = !pSyncerSet && _bSequenceAware;
 
             // Do the restore
-            pApplicableDomainConfiguration->restore(pParameterBlackboard, _bSequenceAware, NULL);
+            pApplicableDomainConfiguration->restore(pParameterBlackboard, bSync, NULL);
 
             // Record last applied configuration
             _pLastAppliedConfiguration = pApplicableDomainConfiguration;
 
-            // Check we did not already sync the changes
-            if (!_bSequenceAware) {
+            // Check we need to provide syncer set to caller
+            if (pSyncerSet && !_bSequenceAware) {
 
                 // Since we applied changes, add our own sync set to the given one
-                syncerSet += _syncerSet;
+                *pSyncerSet += _syncerSet;
             }
         }
     }