Added Softkey-Container sequence in common profile 24/234424/2 accepted/tizen/unified/20200615.135412 submit/tizen/20200612.075129
authordivyanshugautam17 <divyanshu.gm@samsung.com>
Tue, 26 May 2020 08:47:17 +0000 (14:17 +0530)
committerdivyanshugautam17 <divyanshu.gm@samsung.com>
Fri, 12 Jun 2020 07:14:55 +0000 (12:44 +0530)
Change-Id: Iefa2b76598770689506dbc94ee0c16cf4ee0af39

include/common/home_mgr.h
src/common/home_mgr.c
src/common/starter.c

index a31fce9..5cf92ad 100755 (executable)
@@ -22,9 +22,12 @@ extern int home_mgr_get_home_pid(void);
 extern int home_mgr_get_volume_pid(void);
 extern int home_mgr_get_indicator_pid(void);
 extern int home_mgr_get_quickpanel_pid(void);
+extern int home_mgr_get_softkey_pid(void);
 
 extern void home_mgr_init(void *data);
 extern void home_mgr_fini(void);
+extern void softkey_mgr_init(void);
+extern void softkey_mgr_fini(void);
 
 void home_mgr_relaunch_homescreen(void);
 void home_mgr_relaunch_volume(void);
index f4b41ad..9a98b8d 100755 (executable)
@@ -44,6 +44,7 @@
 
 #define APPID_INDICATOR "org.tizen.indicator"
 #define APPID_QUICKPANEL "org.tizen.quickpanel"
+#define APPID_SOFTKEY "org.tizen.softkey-container"
 
 int errno;
 static struct {
@@ -51,6 +52,7 @@ static struct {
        pid_t volume_pid;
        pid_t indicator_pid;
        pid_t quickpanel_pid;
+       pid_t softkey_pid;
        int power_off;
 
        Ecore_Timer *dead_timer;
@@ -62,6 +64,7 @@ static struct {
        .volume_pid = (pid_t)-1,
        .indicator_pid = (pid_t)-1,
        .quickpanel_pid = (pid_t)-1,
+       .softkey_pid = (pid_t)-1,
        .power_off = 0,
 
        .dead_timer = NULL,
@@ -93,6 +96,11 @@ int home_mgr_get_quickpanel_pid(void)
        return s_home_mgr.quickpanel_pid;
 }
 
+int home_mgr_get_softkey_pid(void)
+{
+       return s_home_mgr.softkey_pid;
+}
+
 static void _after_launch_home(int pid)
 {
        if (pid != s_home_mgr.home_pid) {
@@ -277,6 +285,11 @@ static void _after_launch_quickpanel(int pid)
        s_home_mgr.quickpanel_pid = pid;
 }
 
+static void _after_launch_softkey(int pid)
+{
+       s_home_mgr.softkey_pid = pid;
+}
+
 static void _launch_after_home(int pid)
 {
        if (pid != s_home_mgr.home_pid) {
@@ -421,6 +434,57 @@ void home_mgr_relaunch_quickpanel(void)
        process_mgr_must_launch(APPID_QUICKPANEL, NULL, NULL, NULL, _after_launch_quickpanel);
 }
 
+void home_mgr_softkey_process_terminate(void)
+{
+       process_mgr_terminate_app(s_home_mgr.softkey_pid,1);
+       s_home_mgr.softkey_pid = 0;
+}
+
+static void home_mgr_softkey_change(void *user_data)
+{
+       _D("home_mgr_softkey_change");
+       int state = TRUE;
+       int ret = 0;
+       ret = vconf_get_bool(VCONFKEY_SETAPPL_SOFT_KEY, &state);
+       if (ret<0) {
+               _D("fail to get VCONFKEY_SETAPPL_SOFT_KEY:%d", ret);
+               return;
+       }
+
+       _D("VCONFKEY_SETAPPL_SOFT_KEY STATUS == %d ", state);
+       if(state == TRUE) {
+               process_mgr_must_launch(APPID_SOFTKEY, NULL, NULL, NULL, _after_launch_softkey);
+       } else {
+               _D("terminating softkey");
+               int softkey_pid = home_mgr_get_softkey_pid();
+               _D("SoftKey Process Id == %d ", softkey_pid);
+               if(softkey_pid > 0) {
+                       home_mgr_softkey_process_terminate();
+               }
+       }
+}
+
+static void _softkey_vconf_change_cb(keynode_t *node, void *data)
+{
+       _D("_softkey_vconf_change_cb");
+       home_mgr_softkey_change(data);
+}
+
+void softkey_mgr_init(void)
+{
+       int ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_SOFT_KEY, _softkey_vconf_change_cb, NULL);
+       if (ret != 0) {
+               _E("Failed to get vconfkey change for softkey app");
+       }
+}
+
+void softkey_mgr_fini(void)
+{
+       if (vconf_ignore_key_changed(VCONFKEY_SETAPPL_SOFT_KEY, _softkey_vconf_change_cb) < 0) {
+               _E("Failed to unregister the callback for %s", VCONFKEY_SETAPPL_SOFT_KEY);
+       }
+}
+
 static int _power_off_cb(status_active_key_e key, void *data)
 {
        int val = status_active_get()->sysman_power_off_status;
@@ -446,6 +510,7 @@ static Eina_Bool _launch_apps_idler_cb(void *data)
 #endif
        process_mgr_must_launch(APPID_INDICATOR, NULL, NULL, NULL, _after_launch_indicator);
        process_mgr_must_launch(APPID_QUICKPANEL, NULL, NULL, NULL, _after_launch_quickpanel);
+       home_mgr_softkey_change(NULL);
        return ECORE_CALLBACK_CANCEL;
 }
 
index d518d5e..7f4b791 100755 (executable)
@@ -302,6 +302,7 @@ static void _init(void)
        hw_key_create_window();
        home_mgr_init(NULL);
        oobe_mgr_init();
+       softkey_mgr_init();
 
        r = aul_listen_app_dead_signal(_check_dead_signal, NULL);
        if (r < 0) {
@@ -314,6 +315,7 @@ static void _init(void)
 static void _fini(void)
 {
        home_mgr_fini();
+       softkey_mgr_fini();
        hw_key_destroy_window();
 #if LOCKSCREEN_ENABLE
        lock_mgr_daemon_end();