Check acquire focus type for backward compatibility 11/127911/3
authorGilbok Lee <gilbok.lee@samsung.com>
Tue, 2 May 2017 09:33:41 +0000 (18:33 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Tue, 16 May 2017 03:29:32 +0000 (12:29 +0900)
[Version] 0.2.27
[Profile] Mobile, Wearable
[Issue Type] Backward compatibility

Change-Id: I4b35f974a51a6c5f863495640166af8e0e55eb0b

packaging/libmm-radio.spec
src/mm_radio_priv_emulator.c
src/mm_radio_priv_hal.c

index dc9a83b..1bbe61c 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-radio
 Summary:    Multimedia Framework Radio Library
-Version:    0.2.26
+Version:    0.2.27
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
index 7fa2ae2..609f6a6 100644 (file)
@@ -585,6 +585,29 @@ int _mmradio_start(mm_radio_t * radio)
                        return ret;
                }
        }
+
+       /* check previous acquired focus */
+       if (radio->sound_focus.watch_id > 0) {
+               char *stream_type = NULL;
+               char *ext_info = NULL;
+               int option = 0;
+
+               ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info);
+               if (ret == MM_ERROR_NONE) {
+                       MMRADIO_LOG_DEBUG("Focus is acquired by stream_type[%s], option[%d], ext_info[%s]",
+                               stream_type, option, ext_info);
+                       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")) {
+                               MMRADIO_LOG_DEBUG("Blcoked by session policy, focus_acquired_by[%s]", stream_type);
+                               free(ext_info);
+                               free(stream_type);
+                               return MM_ERROR_POLICY_BLOCKED;
+                       }
+                       free(ext_info);
+                       free(stream_type);
+               }
+       }
 #endif
 
        /* set stored frequency */
index 5fc7d30..dbbbc5d 100644 (file)
@@ -553,6 +553,29 @@ int _mmradio_start(mm_radio_t *radio)
                        return ret;
                }
        }
+
+       /* check previous acquired focus */
+       if (radio->sound_focus.watch_id > 0) {
+               char *stream_type = NULL;
+               char *ext_info = NULL;
+               int option = 0;
+
+               ret = mm_sound_get_stream_type_of_acquired_focus(FOCUS_FOR_BOTH, &stream_type, &option, &ext_info);
+               if (ret == MM_ERROR_NONE) {
+                       MMRADIO_LOG_DEBUG("Focus is acquired by stream_type[%s], option[%d], ext_info[%s]",
+                               stream_type, option, ext_info);
+                       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")) {
+                               MMRADIO_LOG_DEBUG("Blcoked by session policy, focus_acquired_by[%s]", stream_type);
+                               free(ext_info);
+                               free(stream_type);
+                               return MM_ERROR_POLICY_BLOCKED;
+                       }
+                       free(ext_info);
+                       free(stream_type);
+               }
+       }
 #endif
 
        if (!radio->is_ready) {