[NextBrowser] Launch SSO app on press of account button 77/317777/3
authorTarun Verma <tarun1.verma@samsung.com>
Tue, 17 Sep 2024 09:31:05 +0000 (15:01 +0530)
committerBot Blink <blinkbot@samsung.com>
Tue, 17 Sep 2024 10:19:03 +0000 (10:19 +0000)
Change-Id: I21bd0780dd0956c2c17cc1a9dcf84fad31788602
Signed-off-by: Tarun Verma <tarun1.verma@samsung.com>
chrome/browser/ui/samsung/samsung_account_manager.cc
components/samsung/account_provider/account_provider_impl.cc
components/samsung/account_provider/account_provider_impl.h
components/samsung/public/account_provider/account_provider.cc
components/samsung/public/account_provider/account_provider.h

index 46ca670c833ec2fb6cbdcca9faa8840ffb8ca191..be6dcf7c06bf522ac0443e65f2bc47ace9a287a4 100644 (file)
@@ -147,6 +147,7 @@ SamsungLoginInfo SamsungAccountManager::GetLoginInfoFromSSO() {
 
 void SamsungAccountManager::LaunchSSOMenu() {
   LOG(INFO) << "Launch SSO menu";
+  account_provider_->LaunchSSOMenu();
 }
 
 gfx::Image SamsungAccountManager::GetUserIcon() {
index c5a3fecc83bef8977f8f769fc15c30a44f260d09..87e5d7fef9cf00b76ed734bf26921ed1d922151a 100644 (file)
@@ -1,5 +1,6 @@
 #include "components/samsung/account_provider/account_provider_impl.h"
 
+#include <app_control.h>
 #include <map>
 #include "base/logging.h"
 #include "components/samsung/public/account_provider/account_provider.h"
@@ -81,3 +82,38 @@ int AccountProviderImpl::sso_account_list_cb(void* user_data,
   self->account_provider_->SSOAccountList(data);
   return SSO_TRUE;
 }
+
+void AccountProviderImpl::LaunchSSOMenu() {
+  char* app_id_mod = NULL;  // to match the function argument
+  SSORESULT res = sso_get_account_ui_application_package_id(
+      &app_id_mod);  // New added API from 23 platform
+  if (res != SSO_TRUE) {
+    LOG(INFO) << "fail to get app id";
+    return;
+  }
+  LOG(INFO) << "successfully got app id";
+  if (app_id_mod != NULL) {
+    std::string app_id(app_id_mod);
+    LOG(INFO) << "app_id is[" << app_id.c_str() << "]";
+    free(app_id_mod);
+    int ret;
+    app_control_h app_control;
+    ret = app_control_create(&app_control);
+    if (ret != APP_CONTROL_ERROR_NONE) {
+      LOG(INFO) << "app_control_create ret value: " << ret;
+    }
+    app_control_set_operation(app_control, APP_CONTROL_OPERATION_DEFAULT);
+    ret = app_control_set_app_id(app_control, app_id.c_str());
+    if (ret != APP_CONTROL_ERROR_NONE) {
+      LOG(INFO) << "app_control_set_app_id ret: " << ret;
+    }
+    ret = app_control_send_launch_request(app_control, NULL,
+                                          NULL);  // != APP_CONTROL_ERROR_NONE
+    if (ret != APP_CONTROL_ERROR_NONE) {
+      LOG(INFO) << "app_control_send_launch_request ret: " << ret;
+    }
+    app_control_destroy(app_control);
+  } else {
+    LOG(INFO) << "Failed to get app_id";
+  }
+}
index f73173b77208c8ec9bc8284dc806aed83e3be13e..fa0561226cfbf0dc865079610b31f4cd74212e80 100644 (file)
@@ -21,6 +21,7 @@ class AccountProviderImpl {
   void GetLinkedAccountsFromSSO();
   bool UserLoggedinState();
   std::string GetLogginInfoFromSSO();
+  void LaunchSSOMenu();
 
  private:
   static int sso_state_changed_cb(void* user_data,
index 55964542eee98f02e2c09ab11790d8bffd4395a4..0e55f1ccd3124737563940e059b43d4537311b48 100644 (file)
@@ -63,4 +63,8 @@ void NotifySSOAccountList(std::string loggedAccountList) {
 */
 }
 
+void AccountProvider::LaunchSSOMenu() {
+  account_provider_impl_->LaunchSSOMenu();
+}
+
 //}
index 61e61ae64117d09608ed4817bdd5507b558dd77c..aef300a962224d604851c562499d1a5b72ff1481 100644 (file)
@@ -32,6 +32,7 @@ class AccountProvider {
   void GetLinkedAccountsFromSSO();
   std::string GetlogginInfoFromSSO();
   void SSOAccountList(std::string loggedAccountList);
+  void LaunchSSOMenu();
 
  private:
   void NotifyLoginStateChanged(bool state);