Refactor: Split Activation into common and ubi

Activations has a few functions coupled with ubi, split them into
ubi/activation_ubi

* Keep common code in activation.
* Make start/finishActivation() pure virtual.
* Move ubi specific code into ubi.
* Move ubiVolumnCreated into ubi.
* Make validateSignature() not inline, otherwise it gets compile error.

Tested: On the last commit of the patch series, run code update and
        factory reset on Witherspoon and all work fine.

Change-Id: I7c8a0de6b0be4b1e9814ea75fd802a014b4aacfc
Signed-off-by: Lei YU <mine260309@gmail.com>
diff --git a/activation.hpp b/activation.hpp
index 2fc08d7..7e8eec5 100644
--- a/activation.hpp
+++ b/activation.hpp
@@ -64,7 +64,7 @@
         bus.emit_interfaces_added(path.c_str(), interfaces);
     }
 
-    ~RedundancyPriority()
+    virtual ~RedundancyPriority()
     {
         std::vector<std::string> interfaces({interface});
         bus.emit_interfaces_removed(path.c_str(), interfaces);
@@ -203,6 +203,7 @@
         // Emit deferred signal.
         emit_object_added();
     }
+    virtual ~Activation() = default;
 
     /** @brief Activation property get function
      *
@@ -210,14 +211,6 @@
      */
     using ActivationInherit::activation;
 
-    /** @brief Overloaded Activation property setter function
-     *
-     *  @param[in] value - One of Activation::Activations
-     *
-     *  @return Success or exception thrown
-     */
-    Activations activation(Activations value) override;
-
     /** @brief Overloaded requestedActivation property setter function
      *
      *  @param[in] value - One of Activation::RequestedActivations
@@ -227,16 +220,6 @@
     RequestedActivations
         requestedActivation(RequestedActivations value) override;
 
-    /** @brief Check if systemd state change is relevant to this object
-     *
-     * Instance specific interface to handle the detected systemd state
-     * change
-     *
-     * @param[in]  msg       - Data associated with subscribed signal
-     *
-     */
-    void unitStateChange(sdbusplus::message::message& msg);
-
     /**
      * @brief subscribe to the systemd signals
      *
@@ -279,17 +262,23 @@
     /** @brief Used to subscribe to dbus systemd signals **/
     sdbusplus::bus::match_t systemdSignals;
 
-    /** @brief Tracks whether the read-only & read-write volumes have been
-     *created as part of the activation process. **/
-    bool ubiVolumesCreated = false;
-
     /** @brief activation status property get function
      *
      * @returns Activations - The activation value
      */
     using ActivationInherit::activation;
 
-  private:
+  protected:
+    /** @brief Check if systemd state change is relevant to this object
+     *
+     * Instance specific interface to handle the detected systemd state
+     * change
+     *
+     * @param[in]  msg       - Data associated with subscribed signal
+     *
+     */
+    virtual void unitStateChange(sdbusplus::message::message& msg) = 0;
+
     /**
      * @brief Deletes the version from Image Manager and the
      *        untar image from image upload dir.
@@ -297,10 +286,10 @@
     void deleteImageManagerObject();
 
     /** @brief Member function for clarity & brevity at activation start */
-    void startActivation();
+    virtual void startActivation() = 0;
 
     /** @brief Member function for clarity & brevity at activation end */
-    void finishActivation();
+    virtual void finishActivation() = 0;
 
 #ifdef WANT_SIGNATURE_VERIFY
     /**
@@ -315,7 +304,7 @@
      *          false for unsuccessful signature validation or
      *          any internal failure during the mapper call.
      */
-    inline bool validateSignature();
+    bool validateSignature();
 
     /**
      * @brief Gets the fieldModeEnabled property value.