static int init_plugin(void)
{
+ MAS_LOGI("[ENTER]");
if (0 != multi_assistant_service_plugin_initialize()) {
MAS_LOGE("Fail to ws intialize");
return -1;
return g_current_service_state;
}
-static int pkg_app_list_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+static bool is_wakeup_engine(const pkgmgrinfo_appinfo_h handle)
{
+ bool is_wakeup_engine = false;
char *appid = NULL;
int ret = pkgmgrinfo_appinfo_get_appid (handle, &appid);
if (PMINFO_R_OK == ret && NULL != appid) {
- int *result = (int*)user_data;
- if (result) {
- for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM;loop++) {
- if (g_maclient_info[loop].used) {
- LOGD("comparing appid : %s %s", g_maclient_info[loop].wakeup_engine, appid);
- if (0 == strncmp(g_maclient_info[loop].wakeup_engine, appid, MAX_APPID_LEN)) {
- *result = 1;
- }
+ for (int loop = 0; loop < MAX_MACLIENT_INFO_NUM;loop++) {
+ if (g_maclient_info[loop].used) {
+ LOGD("comparing appid : %s %s", g_maclient_info[loop].wakeup_engine, appid);
+ if (0 == strncmp(g_maclient_info[loop].wakeup_engine, appid, MAX_APPID_LEN)) {
+ is_wakeup_engine = true;
}
}
}
} else {
LOGE("pkgmgrinfo_appinfo_get_appid failed! error code=%d", ret);
- return 0;
}
+ return is_wakeup_engine;
+}
+
+static bool is_voice_assistant(const pkgmgrinfo_appinfo_h handle)
+{
+ bool is_voice_assistant = false;
+ char* metadata_value = NULL;
+ const char* voice_assistant_metadata = "http://tizen.org/metadata/multi-assistant/name";
+ int ret = pkgmgrinfo_appinfo_get_metadata_value(handle, voice_assistant_metadata, &metadata_value);
+ if (PMINFO_R_OK == ret && NULL != metadata_value) {
+ is_voice_assistant = true;
+ } else {
+ LOGE("pkgmgrinfo_appinfo_get_metadata_value failed! error code=%d", ret);
+ }
+ return is_voice_assistant;
+}
+
+static int pkg_app_list_cb(const pkgmgrinfo_appinfo_h handle, void *user_data)
+{
+ int *result = (int*)user_data;
+ if (result) {
+ if (is_voice_assistant(handle)) {
+ *result = 1;
+ } else if (is_wakeup_engine(handle)) {
+ *result = 1;
+ }
+ }
return 0;
}