Add basic support for App Install Flow (#33445)

* Add logic for the basic app installation flow

* Add more logic

* Update basic logic

* Update codebase

* Update code

* Update code

* Add missing content apps

* Update TODO comment

* Update code per comments

* Update Logic per comments

* Update code to make android work

* Update per comments

* Restyled by whitespace

* Restyled by clang-format

* Restyled by prettier-markdown

---------

Co-authored-by: Restyled.io <commits@restyled.io>
diff --git a/src/controller/CommissionerDiscoveryController.h b/src/controller/CommissionerDiscoveryController.h
index 521fe5c..b221164 100644
--- a/src/controller/CommissionerDiscoveryController.h
+++ b/src/controller/CommissionerDiscoveryController.h
@@ -150,6 +150,21 @@
      */
     virtual void PromptCommissioningFailed(const char * commissioneeName, CHIP_ERROR error) = 0;
 
+    /**
+     * @brief
+     *   Called to prompt the user for consent to allow the app commissioneeName/vendorId/productId to be installed.
+     * For example "[commissioneeName] is requesting permission to install app to this TV, approve?"
+     *
+     * If user responds with OK then implementor should call CommissionerRespondOk();
+     * If user responds with Cancel then implementor should call CommissionerRespondCancel();
+     *
+     *  @param[in]    vendorId           The vendorId in the DNS-SD advertisement of the requesting commissionee.
+     *  @param[in]    productId          The productId in the DNS-SD advertisement of the requesting commissionee.
+     *  @param[in]    commissioneeName   The commissioneeName in the DNS-SD advertisement of the requesting commissionee.
+     *
+     */
+    virtual void PromptForAppInstallOKPermission(uint16_t vendorId, uint16_t productId, const char * commissioneeName) = 0;
+
     virtual ~UserPrompter() = default;
 };
 
@@ -158,7 +173,7 @@
 public:
     /**
      * @brief
-     *   Called to determine if the given target app is available to the commissionee with the given given
+     *   Called to determine if the given target app is available to the commissionee with the given
      * vendorId/productId, and if so, return the passcode.
      *
      * This will be called by the main chip thread so any blocking work should be moved to a separate thread.
@@ -204,6 +219,25 @@
     virtual ~PasscodeService() = default;
 };
 
+class DLL_EXPORT AppInstallationService
+{
+public:
+    /**
+     * @brief
+     *   Called to check if the given target app is available to the commissione with th given
+     *   vendorId/productId
+     *
+     * This will be called by the main chip thread so any blocking work should be moved to a separate thread.
+     *
+     *  @param[in]    vendorId           The vendorId in the DNS-SD advertisement of the requesting commissionee.
+     *  @param[in]    productId          The productId in the DNS-SD advertisement of the requesting commissionee.
+     *
+     */
+    virtual bool LookupTargetContentApp(uint16_t vendorId, uint16_t productId) = 0;
+
+    virtual ~AppInstallationService() = default;
+};
+
 class DLL_EXPORT PostCommissioningListener
 {
 public:
@@ -393,6 +427,14 @@
     inline PasscodeService * GetPasscodeService() { return mPasscodeService; }
 
     /**
+     * Assign an AppInstallationService
+     */
+    inline void SetAppInstallationService(AppInstallationService * appInstallationService)
+    {
+        mAppInstallationService = appInstallationService;
+    }
+
+    /**
      * Assign a Commissioner Callback to perform commissioning once user consent has been given
      */
     inline void SetCommissionerCallback(CommissionerCallback * commissionerCallback)
@@ -430,6 +472,7 @@
     UserDirectedCommissioningServer * mUdcServer           = nullptr;
     UserPrompter * mUserPrompter                           = nullptr;
     PasscodeService * mPasscodeService                     = nullptr;
+    AppInstallationService * mAppInstallationService       = nullptr;
     CommissionerCallback * mCommissionerCallback           = nullptr;
     PostCommissioningListener * mPostCommissioningListener = nullptr;
 };