Merge branch 'tizen_3.0' into tizen 41/108141/1 accepted/tizen/common/20170112.174225 accepted/tizen/ivi/20170111.222045 accepted/tizen/mobile/20170111.221912 accepted/tizen/tv/20170111.221933 accepted/tizen/wearable/20170111.221955 submit/tizen/20170111.041200
authorInkyun Kil <inkyun.kil@samsung.com>
Tue, 3 Jan 2017 06:17:24 +0000 (15:17 +0900)
committerInkyun Kil <inkyun.kil@samsung.com>
Tue, 3 Jan 2017 06:17:31 +0000 (15:17 +0900)
Change-Id: Ia38089142c1004e59902f9c5634791db755f81b5

1  2 
src/appcore.c

diff --combined src/appcore.c
@@@ -58,6 -58,7 +58,7 @@@ static enum appcore_event to_ae[SE_MAX
        APPCORE_EVENT_LANG_CHANGE,      /* SE_LANGCGH */
        APPCORE_EVENT_REGION_CHANGE,
        APPCORE_EVENT_SUSPENDED_STATE_CHANGE,
+       APPCORE_EVENT_UPDATE_REQUESTED,
  };
  
  static int appcore_event_initialized[SE_MAX] = {0,};
@@@ -228,6 -229,17 +229,17 @@@ static int __app_pause(void *data
        return 0;
  }
  
+ static int __app_update_requested(void *data)
+ {
+       struct appcore *ac = data;
+       _retv_if(ac == NULL || ac->ops == NULL, -1);
+       _retv_if(ac->ops->cb_app == NULL, 0);
+       ac->ops->cb_app(AE_UPDATE_REQUESTED, ac->ops->data, NULL);
+       return 0;
+ }
  static int __sys_do_default(struct appcore *ac, enum sys_event event)
  {
        int r;
@@@ -499,7 -511,6 +511,7 @@@ static int __aul_handler(aul_type type
  #ifdef _APPFW_FEATURE_BACKGROUND_MANAGEMENT
        const char *bg = NULL;
        struct appcore *ac = data;
 +      int suspend = APPCORE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND;
  #endif
  
        switch (type) {
        case AUL_WAKE:
                _DBG("[APP %d]     AUL event: AUL_WAKE", _pid);
                if (!ac->allowed_bg && ac->suspended_state) {
 -                      int suspend = APPCORE_SUSPENDED_STATE_DID_EXIT_FROM_SUSPEND;
                        __remove_suspend_timer(data);
                        __sys_do(ac, &suspend, SE_SUSPENDED_STATE);
                        ac->suspended_state = false;
                }
 +
 +              if (b) {
 +                      bg = bundle_get_val(b, AUL_K_ALLOWED_BG);
 +                      if (bg && strcmp(bg, "ALLOWED_BG") == 0) {
 +                              _DBG("[__SUSPEND__] allowed background");
 +                              ac->allowed_bg = true;
 +                      }
 +              }
                break;
        case AUL_SUSPEND:
                _DBG("[APP %d]     AUL event: AUL_SUSPEND", _pid);
 -              if (!ac->allowed_bg && !ac->suspended_state) {
 +              ac->allowed_bg = false;
 +              if (!ac->suspended_state) {
                        __remove_suspend_timer(data);
                        __flush_memory((gpointer)ac);
                }
                break;
  #endif
+       case AUL_UPDATE_REQUESTED:
+               _DBG("[APP %d]     AUL event: AUL_UPDATE_REQUESTED", _pid);
+               __app_update_requested(data);
+               break;
        default:
                _DBG("[APP %d]     AUL event: %d", _pid, type);
                /* do nothing */