#include <amd_api_compinfo.h>
#include <amd_api_comp_status.h>
#include <amd_api_logger.h>
+#include <amd_api_launch_mode.h>
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+#include <bundle_internal.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+bool amd_launch_mode_is_group_mode(bundle *kb, uid_t uid);
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <stdbool.h>
+#include <sys/types.h>
+
+#include <bundle_internal.h>
+
+bool _launch_mode_is_group_mode(bundle *kb, uid_t uid);
\ No newline at end of file
#define QUERY_KEY_ICON "icon="
#define QUERY_KEY_NAME "name="
#define AUL_SVC_K_URI "__APP_SVC_URI__"
+#define APP_SVC_K_LAUNCH_MODE "__APP_SVC_LAUNCH_MODE__"
struct rua_launch_context_s {
char *id;
static int __on_launch_app_start_start(const char *msg, int arg1, int arg2,
void *arg3, bundle *data)
{
+ amd_request_h req = (amd_request_h)arg3;
+ bundle *kb = data;
+ const char *launch_mode;
+ uid_t uid;
+
+ launch_mode = bundle_get_val(kb, APP_SVC_K_LAUNCH_MODE);
+ if (launch_mode && strcmp(launch_mode, "single")) {
+ uid = amd_request_get_target_uid(req);
+ if (!amd_launch_mode_is_group_mode(kb, uid))
+ bundle_del(kb, AUL_K_INSTANCE_ID);
+ }
+
_rua_launch_context_free();
_rua_launch_context_set(data);
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <aul.h>
+#include <system_info.h>
+#include <aul_comp_types.h>
+
+#include <amd.h>
+
+#define APP_SVC_K_LAUNCH_MODE "__APP_SVC_LAUNCH_MODE__"
+
+bool _launch_mode_is_group_mode(bundle *kb, uid_t uid)
+{
+ const char *str;
+ const char *mode = NULL;
+ const char *appid;
+ const char *comp_type;
+ const char *comp_id;
+ const char *type;
+ amd_appinfo_h ai;
+ amd_compinfo_h ci;
+
+ if (!kb)
+ return false;
+
+ appid = bundle_get_val(kb, AUL_K_APPID);
+ if (!appid)
+ return false;
+
+ ai = amd_appinfo_find(uid, appid);
+ if (!ai)
+ return false;
+
+ comp_type = amd_appinfo_get_value(ai, AMD_AIT_COMPTYPE);
+ if (comp_type && !strcmp(comp_type, APP_TYPE_UI)) {
+ mode = amd_appinfo_get_value(ai, AMD_AIT_LAUNCH_MODE);
+ } else if (comp_type && !strcmp(comp_type, APP_TYPE_COMPONENT_BASED)) {
+ comp_id = bundle_get_val(kb, AUL_K_COMPONENT_ID);
+ if (!comp_id)
+ return false;
+
+ ci = amd_compinfo_find(uid, comp_id);
+ if (!ci)
+ return false;
+
+ type = amd_compinfo_get_value(ci, AMD_COMPINFO_TYPE_TYPE);
+ if (!type || strcmp(type, "frame") != 0)
+ return false;
+
+ mode = amd_compinfo_get_value(ci,
+ AMD_COMPINFO_TYPE_LAUNCH_MODE);
+ }
+
+ if (mode && !strcmp(mode, "caller")) {
+ str = bundle_get_val(kb, APP_SVC_K_LAUNCH_MODE);
+ if (str && !strcmp(str, "group"))
+ return true;
+ } else if (mode && !strcmp(mode, "group")) {
+ return true;
+ }
+
+ return false;
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define _GNU_SOURCE
+
+#include "amd_api.h"
+#include "amd_api_launch_mode.h"
+#include "amd_launch_mode.h"
+
+EXPORT_API bool amd_launch_mode_is_group_mode(bundle *kb, uid_t uid)
+{
+ return _launch_mode_is_group_mode(kb, uid);
+}
\ No newline at end of file