+/* Conditions below are from ASM conflict table of Tizen 2.4 */
+static int __mmcamcorder_simulate_asm_conflict_table(int session_type, int pid)
+{
+ int ret = MM_ERROR_NONE;
+ char *stream_type = NULL;
+ char *ext_info = NULL;
+ int option = 0;
+
+ /* check previous acquired focus of other PID */
+ ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info);
+ if (ret == MM_ERROR_NONE && stream_type) {
+ if (ext_info && (pid != atoi(ext_info))) { /* 'ext_info' should contain pid */
+ if ((session_type == MM_SESSION_TYPE_CALL) ||
+ (session_type == MM_SESSION_TYPE_VIDEOCALL) ||
+ (session_type == MM_SESSION_TYPE_VOIP)) {
+ /* case 1. if my session type is call/videocall/voip */
+ if (!strcmp(stream_type, "call-voice") ||
+ !strcmp(stream_type, "call-video") ||
+ !strcmp(stream_type, "ringtone-call")) {
+ _mmcam_dbg_err("Blocked by session policy, stream_type[%s] of acquired focus", stream_type);
+ ret = MM_ERROR_POLICY_BLOCKED;
+ }
+ } else if ((session_type == MM_SESSION_TYPE_MEDIA) ||
+ (session_type == MM_SESSION_TYPE_MEDIA_RECORD)) {
+ /* case 2. if my session type is media */
+ if (!strcmp(stream_type, "alarm") ||
+ !strcmp(stream_type, "ringtone-voip") ||
+ !strcmp(stream_type, "ringtone-call") ||
+ !strcmp(stream_type, "voip") ||
+ !strcmp(stream_type, "call-voice") ||
+ !strcmp(stream_type, "call-video")) {
+ _mmcam_dbg_err("Blocked by session policy, stream_type[%s] of acquired focus", stream_type);
+ ret = MM_ERROR_POLICY_BLOCKED;
+ }
+ }
+ } else {
+ _mmcam_dbg_log("acquired focus is same process with it, skip it");
+ }
+ } else {
+ /* No data case */
+ _mmcam_dbg_warn("get stream type failed 0x%x, stream type %s, but ignore it",
+ ret, stream_type ? stream_type : "NULL");
+ ret = MM_ERROR_NONE;
+ }
+
+ if (stream_type) {
+ free(stream_type);
+ stream_type = NULL;
+ }
+
+ if (ext_info) {
+ free(ext_info);
+ ext_info = NULL;
+ }
+
+ return ret;
+}
+