#include <account.h>
#include <glib.h>
#include <app.h>
+#include <system_info.h>
/************************************************************************/
/** @addtogroup itc-accounts-svc
* @ingroup itc
* @{
*/
+typedef enum {
+ _PROFILE_UNKNOWN = 0,
+ _PROFILE_MOBILE = 0x1,
+ _PROFILE_WEARABLE = 0x2,
+ _PROFILE_TV = 0x4,
+ _PROFILE_IVI = 0x8,
+ _PROFILE_COMMON = 0x10,
+} tizen_profile_t;
#define API_NAMESPACE "ACCOUNTS_SVC_ITC"
-#define ICONPATH "icontexto_256.png"
-#define SERVICEPROID "http://tizen.org/account/capability/contact"
-#define TIMEOUT_CB 10000
-#define ACCESSTOKEN "access-token"
-#define APPID "native.accounts-svc-itc"
-#define EMAILID "TCTSampleAccount@tizen.org"
-#define USERNAME "TizenLite Test"
-#define PATH_LEN 1024
-#define BUFFERSIZE 256
-#define BUFFER 20
+#define ICONPATH "icontexto_256.png"
+#define SERVICEPROID "http://tizen.org/account/capability/contact"
+#define TIMEOUT_CB 10000
+#define ACCESSTOKEN "access-token"
+#define APPID "native.accounts-svc-itc"
+#define EMAILID "TCTSampleAccount@tizen.org"
+#define USERNAME "TizenLite Test"
+#define PATH_LEN 1024
+#define BUFFERSIZE 256
+#define BUFFER 20
#define CALENDAR_CAPABILITY "http://tizen.org/account/capability/calendar"
#define CONTACT_CAPABILITY "http://tizen.org/account/capability/contact"
-#define ACCOUNT_ICON_PATH "/shared/res/account.png"
+#define ACCOUNT_ICON_PATH "/shared/res/account.png"
#define ACCOUNT_SMALL_ICON_PATH "/shared/res/account_small.png"
#define SERVICE_PROVIDER_ID "http://www.tizen.org/"
-#define MULTIPLE_ACCOUNT_SUPPORT 1
+#define MULTIPLE_ACCOUNT_SUPPORT 1
#define RPM_INSTALL_LOCATION "/usr/apps/native-accounts-svc-itc"
#define TPK_APP_PREFIX "org.tizen."
#define ACCOUNT_FEATURE "http://tizen.org/feature/account"
}\
}
+/* Accessing system info */
+int system_info_get_platform_string(const char *key, char **value);
+
/*********************** Global Variables *******************************/
bool g_bAccountLabelCB;
static GMainLoop *mainloop;
char g_eProviderFeature[10][BUFFERSIZE] = {CALENDAR_CAPABILITY, CONTACT_CAPABILITY};
+tizen_profile_t profile;
+
+static inline tizen_profile_t get_tizen_profile()
+{
+ char *profileName = NULL;
+
+ if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
+ return profile;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+
+ /* To pass the checking of g_ir */
+ if (!profileName)
+ return _PROFILE_UNKNOWN;
+
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = _PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = _PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = _PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = _PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = _PROFILE_COMMON;
+ }
+
+ free(profileName);
+ return profile;
+}
+
+
/**
* @function ITs_accounts_svc_startup
* @description Called before each test. creates a account handle
return 1;
}
}
+
+ /*if profile is TV then change the icon path*/
+ if (get_tizen_profile() == _PROFILE_TV) {
+ int str_len = strlen("/opt/usr/apps");
+ memset(pszValue, 0, PATH_LEN);
+ strncpy(pszValue, "/opt/usr/apps", str_len);
+ pszValue[str_len+1] = '\0';
+ }
+
FPRINTF("[Line : %d][%s] Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+
int path_size = strlen(pszValue) + strlen(psz_pkg_id) + strlen(ACCOUNT_ICON_PATH) + 2;
pszACTUAL_FILE_PATH = (char*)calloc(path_size, sizeof(char));
if (pszACTUAL_FILE_PATH == NULL)
return 1;
}
}
+
+ /*if profile is TV then change the icon path*/
+ if (get_tizen_profile() == _PROFILE_TV) {
+ int str_len = strlen("/opt/usr/apps");
+ memset(pszValue, 0, PATH_LEN);
+ strncpy(pszValue, "/opt/usr/apps", str_len);
+ pszValue[str_len+1] = '\0';
+ }
+
FPRINTF("[Line : %d][%s] Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
+
int path_size = strlen(pszValue) + strlen(psz_pkg_id) + strlen(ACCOUNT_SMALL_ICON_PATH) + 2;
pszACTUAL_FILE_PATH = (char*)calloc(path_size, sizeof(char));
if (pszACTUAL_FILE_PATH == NULL)
SMALL_ICON
};
+typedef enum {
+ _PROFILE_UNKNOWN = 0,
+ _PROFILE_MOBILE = 0x1,
+ _PROFILE_WEARABLE = 0x2,
+ _PROFILE_TV = 0x4,
+ _PROFILE_IVI = 0x8,
+ _PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
+/* Accessing system info */
+int system_info_get_platform_string(const char *key, char **value);
+
//& set: AccountsSvc
static bool created = false;
static account_h account = NULL;
static const account_capability_state_e capability_state = ACCOUNT_CAPABILITY_ENABLED;
static const int test_multi_account_support = 1;
+tizen_profile_t profile;
+
+static inline tizen_profile_t get_tizen_profile()
+{
+ char *profileName = NULL;
+
+ if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
+ return profile;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+
+ /* To pass the checking of g_ir */
+ if (!profileName)
+ return _PROFILE_UNKNOWN;
+
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = _PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = _PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = _PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = _PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = _PROFILE_COMMON;
+ }
+
+ free(profileName);
+ return profile;
+}
+
+
static gboolean timeout_cb(gpointer data) {
printf("timeout!\n");
_is_fail = true;
return NULL;
}
}
+
+ /*if profile is TV then change the icon path*/
+ if (get_tizen_profile() == _PROFILE_TV) {
+ int str_len = strlen("/opt/usr/apps");
+ memset(pszValue, 0, BUFFERSIZE);
+ strncpy(pszValue, "/opt/usr/apps", str_len);
+ pszValue[str_len+1] = '\0';
+ }
+
PRINT_UTC_LOG("[Line : %d][%s] Values Received = %s\\n", __LINE__, API_NAMESPACE, pszValue);
if (type == ICON)
{