#include <bundle_internal.h>
#include <pkgmgr-info.h>
#include <aul_app_com.h>
+#include <aul_screen_connector.h>
#include "appcore-watch-log.h"
#include "watch_app_private.h"
#define ONE_DAY_IN_SEC 86400
#define METADATA_TICK_PER_SECOND "http://developer.samsung.com/tizen/metadata/tickpersecond"
#define METADATA_MINUTE_TICK "http://developer.samsung.com/tizen/metadata/minutetick"
-#define WATCH_CONTROL_STATE "watch,state"
typedef enum {
WATCH_APP_STATE_NOT_RUNNING = 0, /* The application has been launched or was running but was terminated */
WVS_RESUME
};
-enum viewer_visible_state {
- WATCH_CONTROL_UNKNOWN,
- WATCH_CONTROL_PAUSE,
- WATCH_CONTROL_RESUME
-};
-
#define WATCH_APP_EVENT_MAX 5
static Ecore_Timer *watch_tick = NULL;
static alarm_id_t alarm_id = 0;
int width;
int height;
enum watch_visible_state watch_visibility;
- enum viewer_visible_state viewer_visibility;
+ int viewer_visibility;
bool ambient_mode;
bool ambient_mode_skip_resume;
void *data;
_W("_watch_core_resume");
__context.watch_visibility = WVS_RESUME;
- if (__context.viewer_visibility != WATCH_CONTROL_RESUME) {
+ if (__context.viewer_visibility != AUL_SCREEN_STATUS_RESUME) {
_D("Viewer is paused, do not resume watch");
return APP_ERROR_NONE;
}
__on_pause(NULL);
} else {
__context.watch_visibility = WVS_RESUME;
- if (__context.viewer_visibility == WATCH_CONTROL_RESUME)
+ if (__context.viewer_visibility == AUL_SCREEN_STATUS_RESUME)
__on_resume(NULL);
else
_D("Viewer is paused, do not resume watch");
int *state = NULL;
size_t state_sz = 0;
- bundle_get_byte(envelope, WATCH_CONTROL_STATE, (void **)&state,
+ bundle_get_byte(envelope, "__AUL_SC_VIEWER_STATUS__", (void **)&state,
&state_sz);
+ if (state == NULL) {
+ _E("Failed to get viewer status");
+ return -1;
+ }
__context.viewer_visibility = *state;
_D("set viewer state to %d", *state);
- if (*state == WATCH_CONTROL_RESUME &&
+ if (*state == AUL_SCREEN_STATUS_RESUME &&
__context.watch_visibility == WVS_RESUME)
__on_resume(NULL);
- else if (*state == WATCH_CONTROL_PAUSE)
+ else if (*state == AUL_SCREEN_STATUS_PAUSE)
__on_pause(NULL);
return 0;
__context.callback = *callback;
__context.width = width;
__context.height = height;
- __context.viewer_visibility = WATCH_CONTROL_UNKNOWN;
+ __context.viewer_visibility = -1;
__context.watch_visibility = WVS_UNKNOWN;
__context.ambient_mode = false;
__context.ambient_mode_skip_resume = false;