Add new APIs to communicate with one another about the predefined sound behavior... 54/81854/17
authorSangchul Lee <sc11.lee@samsung.com>
Thu, 28 Jul 2016 23:10:21 +0000 (08:10 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 20 Sep 2016 00:01:13 +0000 (09:01 +0900)
 - New enumeration for sound behavior (SOUND_BEHAVIOR_NONE, SOUND_BEHAVIOR_NO_RESUME, SOUND_BEHAVIOR_FADING)
 - sound_manager_focus_set[get]_requesting_behavior() which is to set/get the requesting sound behavior before calling acquiring/releasing stream focus.
 - sound_manager_focus_get_requested_behavior() which is to get the requested sound behavior within sound_stream_focus_state_changed_cb().
 - Move internal APIs for getting focus status in the system to public header.
   : sound_manager_get_current_playback_focus()
   : sound_manager_get_current_recording_focus()

[Version] Release 0.3.65
[Profile] Common
[Issue Type] Feature Enhancement

Change-Id: I90421f80325a8d79d14495ee981283693dba009a
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/sound_manager.h
include/sound_manager_internal.h
include/sound_manager_internal_tv.h
include/sound_manager_private.h
packaging/capi-media-sound-manager.spec
src/sound_manager.c
src/sound_manager_internal.c
src/sound_manager_private.c
test/sound_manager_test.c

index 7649fed..75435c7 100644 (file)
@@ -141,6 +141,22 @@ typedef enum {
 } sound_stream_focus_state_e;
 
 /**
+ * @brief Enumeration for sound behavior.
+ * @since_tizen 3.0
+ * @remarks These values can be combined with bitwise 'or'.
+ * @see sound_manager_focus_set_requesting_behavior()
+ * @see sound_manager_focus_get_requesting_behavior()
+ * @see sound_manager_focus_get_requested_behavior()
+ * @see sound_manager_get_current_playback_focus()
+ * @see sound_manager_get_current_recording_focus()
+ */
+typedef enum {
+       SOUND_BEHAVIOR_NONE          = 0x0000,   /**< None (default) */
+       SOUND_BEHAVIOR_NO_RESUME     = 0x0001,   /**< No resumption */
+       SOUND_BEHAVIOR_FADING        = 0x0002,   /**< Fading effect */
+} sound_behavior_e;
+
+/**
  * @}
  */
 
@@ -155,11 +171,11 @@ typedef enum {
  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
  */
 typedef enum {
-       SOUND_SESSION_TYPE_MEDIA = 0,           /**< Media type */
-       SOUND_SESSION_TYPE_ALARM,                       /**< Alarm type */
-       SOUND_SESSION_TYPE_NOTIFICATION,                /**< Notification type */
-       SOUND_SESSION_TYPE_EMERGENCY,                   /**< Emergency type */
-       SOUND_SESSION_TYPE_VOIP,                        /**< VOIP type */
+       SOUND_SESSION_TYPE_MEDIA = 0,      /**< Media type */
+       SOUND_SESSION_TYPE_ALARM,          /**< Alarm type */
+       SOUND_SESSION_TYPE_NOTIFICATION,   /**< Notification type */
+       SOUND_SESSION_TYPE_EMERGENCY,      /**< Emergency type */
+       SOUND_SESSION_TYPE_VOIP,           /**< VoIP type */
 } sound_session_type_e;
 
 /**
@@ -344,9 +360,14 @@ typedef void (*sound_manager_volume_changed_cb) (sound_type_e type, unsigned int
  * @param[in]   extra_info     The extra information
  * @param[in]   user_data      The user data passed from the callback registration function
  * @pre You should register this callback using sound_manager_create_stream_information().
- * @post Use sound_manager_get_focus_state() in this callback to figure out how the focus state of the stream_info has been changed.
+ * @post Use sound_manager_get_focus_state() in this callback to figure out how the focus state of\n
+ *     the @a stream_info has been changed.\n
+ *     Use sound_manager_focus_get_requested_behavior() in this callback to check the recommended sound behavior\n
+ *     that should be followed to enhance the sound experience.
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
+ * @see sound_manager_get_focus_state()
+ * @see sound_manager_focus_get_requested_behavior()
  */
 typedef void (*sound_stream_focus_state_changed_cb) (sound_stream_info_h stream_info, sound_stream_focus_change_reason_e reason, const char *extra_info, void *user_data);
 
@@ -530,7 +551,7 @@ int sound_manager_unset_current_sound_type(void);
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @post  sound_manager_volume_changed_cb() will be invoked.
+ * @post sound_manager_volume_changed_cb() will be invoked.
  * @see sound_manager_unset_volume_changed_cb()
  * @see sound_manager_volume_changed_cb()
  */
@@ -560,14 +581,14 @@ int sound_manager_unset_volume_changed_cb(void);
  * @since_tizen 3.0
  *
  * @remarks    The registered callback is issued in the internal thread of the sound manager.\n
- *     Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
+ *     Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
  *     To apply the stream policy according to this stream information, this handle should be passed to other APIs\n
  *     related to playback or recording.(e.g. player, wav-player, audio-io, etc.)
  *
  * @param[in]  stream_type     The type of stream
- * @param[in]  callback        The focus state change callback function (optional, this can be null)
- * @param[in]  user_data       The user data to be passed to the callback function (optional, this can be null)
+ * @param[in]  callback        The focus state change callback function (optional, this can be NULL)
+ * @param[in]  user_data       The user data to be passed to the callback function (optional, this can be NULL)
  * @param[out] stream_info     The handle of stream information
  * @return @c 0 on success,
  *         otherwise a negative error value
@@ -590,8 +611,8 @@ int sound_manager_create_stream_information(sound_stream_type_e stream_type, sou
  * @brief Destroys the handle for stream information.
  * @since_tizen 3.0
  *
- * @remarks    Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
+ * @remarks    Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
  *
  * @param[in]  stream_info     The handle of stream information
  * @return @c 0 on success,
@@ -611,12 +632,34 @@ int sound_manager_create_stream_information(sound_stream_type_e stream_type, sou
 int sound_manager_destroy_stream_information(sound_stream_info_h stream_info);
 
 /**
+ * @brief Gets the sound type of the stream information.
+ * @since_tizen 3.0
+ *
+ * @remarks    In case of a @a stream_info made with #SOUND_STREAM_TYPE_EMERGENCY, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n
+ *     The reason is that there is no #sound_type_e matched with this @a stream_info.
+ *
+ * @param[in]  stream_info     The handle of stream information
+ * @param[out] sound_type      The sound type
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
+ * @pre Call sound_manager_create_stream_information() before calling this function.
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_set_volume()
+ * @see sound_manager_get_max_volume()
+ * @see sound_manager_get_volume()
+ */
+int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type);
+
+/**
  * @brief Adds the device to the stream information for the stream routing.
  * @since_tizen 3.0
  *
  * @remarks    Use sound_manager_get_current_device_list() and sound_manager_get_next_device() to get the device.\n
- *     SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the stream_info.\n
- *     The available types of the stream_info for this API are SOUND_STREAM_TYPE_VOIP and SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY.
+ *     #SOUND_MANAGER_ERROR_POLICY could be returned according to the stream type of the @a stream_info.\n
+ *     The available types of the @a stream_info for this function are #SOUND_STREAM_TYPE_VOIP and #SOUND_STREAM_TYPE_MEDIA_EXTERNAL_ONLY.
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  device          The device item from sound_device_list_h
@@ -646,7 +689,7 @@ int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @pre Call sound_manager_create_stream_information()/sound_manager_add_device_for_stream_routing() before calling this function.
+ * @pre Call sound_manager_create_stream_information() and sound_manager_add_device_for_stream_routing() before calling this function.
  * @post You can apply this setting by calling sound_manager_apply_stream_routing().
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
@@ -668,7 +711,7 @@ int sound_manager_remove_device_for_stream_routing(sound_stream_info_h stream_in
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @pre Call sound_manager_create_stream_information()/sound_manager_add_device_for_stream_routing() before calling this function.
+ * @pre Call sound_manager_create_stream_information() and sound_manager_add_device_for_stream_routing() before calling this function.
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  * @see sound_manager_add_device_for_stream_routing()
@@ -680,12 +723,12 @@ int sound_manager_apply_stream_routing(sound_stream_info_h stream_info);
  * @brief Acquires the stream focus.
  * @since_tizen 3.0
  *
- * @remarks    Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
+ * @remarks    Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  focus_mask      The focus mask that user wants to acquire
- * @param[in]  extra_info      The Extra information for this request (optional, this can be null)
+ * @param[in]  extra_info      The extra information for this request (optional, this can be NULL)
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
@@ -706,12 +749,12 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo
  * @brief Releases the acquired focus.
  * @since_tizen 3.0
  *
- * @remarks    Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
+ * @remarks    Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  focus_mask      The focus mask that user wants to release
- * @param[in]  extra_info      TheExtra information for this request (optional, this can be null)
+ * @param[in]  extra_info      The extra information for this request (optional, this can be NULL)
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
@@ -719,7 +762,7 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo
  * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
  * @retval #SOUND_MANAGER_ERROR_INVALID_STATE Invalid state
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
- * @pre Call sound_manager_create_stream_information()/sound_manager_acquire_focus() before calling this function.
+ * @pre Call sound_manager_create_stream_information() and sound_manager_acquire_focus() before calling this function.
  * @see sound_manager_create_stream_information()
  * @see sound_manager_destroy_stream_information()
  * @see sound_manager_acquire_focus()
@@ -750,8 +793,8 @@ int sound_manager_get_focus_state(sound_stream_info_h stream_info, sound_stream_
  * @brief Sets auto focus reacquisition property.
  * @since_tizen 3.0
  *
- * @remarks    The focus reacquistion is set as default.
- *      If you don't want to reacquire the focus you've lost automatically, disable the focus reacqusition setting by using this API and vice versa.
+ * @remarks    The focus reacquisition is set as default.
+ *     If you don't want to reacquire the focus you've lost automatically, disable the focus reacquisition setting by using this function and vice versa.
  *
  * @param[in]  stream_info     The handle of stream information
  * @param[in]  enable  The auto focus reacquisition property to set : (@c true = enable, @c false = disable)
@@ -782,35 +825,128 @@ int sound_manager_set_focus_reacquisition(sound_stream_info_h stream_info, bool
 int sound_manager_get_focus_reacquisition(sound_stream_info_h stream_info, bool *enabled);
 
 /**
- * @brief Gets the sound type of the stream information.
+ * @brief Sets sound behavior to be passed to the other handle which has been acquired or released a stream focus.
  * @since_tizen 3.0
  *
- * @remarks    In case of the stream_info made with #SOUND_STREAM_TYPE_EMERGENCY, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n
- *     Because there is no sound_type_e matched to this stream_info.
+ * @remarks    This function's purpose is to set the sound behavior to be applied by the other handle when acquiring or\n
+ *     releasing a stream focus. The other handle which will be affected by this handle can get this information by using\n
+ *     sound_manager_focus_get_requested_behavior() after sound_stream_focus_state_changed_cb() is called.
  *
  * @param[in]  stream_info     The handle of stream information
- * @param[out] sound_type      The sound type
+ * @param[in]  flags   The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
  * @return @c 0 on success,
  *         otherwise a negative error value
  * @retval #SOUND_MANAGER_ERROR_NONE Success
  * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
  * @pre Call sound_manager_create_stream_information() before calling this function.
+ * @post It will be passed to the other handle right after calling sound_manager_acquire_focus() or sound_manager_release_focus().
  * @see sound_manager_create_stream_information()
- * @see sound_manager_destroy_stream_information()
- * @see sound_manager_set_volume()
- * @see sound_manager_get_max_volume()
- * @see sound_manager_get_volume()
+ * @see sound_manager_acquire_focus()
+ * @see sound_manager_release_focus()
+ * @see sound_manager_focus_get_requesting_behavior()
+ * @see sound_manager_focus_get_requested_behavior()
  */
-int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type);
+int sound_manager_focus_set_requesting_behavior(sound_stream_info_h stream_info, int flags);
+
+/**
+ * @brief Gets sound behavior to be passed to the other handle which has been acquired or released a stream focus.
+ * @since_tizen 3.0
+ *
+ * @remarks    This function's purpose is to set the sound behavior to be applied by the other handle when acquiring or\n
+ *     releasing a stream focus. The other handle which will be affected by this handle can get this information by using\n
+ *     sound_manager_focus_get_requested_behavior() after sound_stream_focus_state_changed_cb() is called.
+ *
+ * @param[in]  stream_info     The handle of stream information
+ * @param[out] flags   The requesting sound behavior, values of #sound_behavior_e combined with bitwise 'or'
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @pre Call sound_manager_create_stream_information() before calling this function.
+ * @post It will be passed to the other handle right after calling sound_manager_acquire_focus() or sound_manager_release_focus().
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_acquire_focus()
+ * @see sound_manager_release_focus()
+ * @see sound_manager_focus_set_requesting_behavior()
+ * @see sound_manager_focus_get_requested_behavior()
+ */
+int sound_manager_focus_get_requesting_behavior(sound_stream_info_h stream_info, int *flags);
+
+/**
+ * @brief Gets the requested sound behavior.
+ * @since_tizen 3.0
+ *
+ * @remarks    The flags can be used as a guide to how to change the sound behavior right after getting\n
+ *     sound_stream_focus_state_changed_cb(). It is highly recommended to follow this sound behavior information\n
+ *     for the enhanced sound experience. Note that this function should be called within sound_stream_focus_state_changed_cb().
+ *
+ * @param[in]  stream_info     The handle of stream information
+ * @param[out] flags   The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @pre Called sound_stream_focus_state_changed_cb() before calling this function.
+ * @see sound_manager_create_stream_information()
+ * @see sound_manager_focus_set_requesting_behavior()
+ * @see sound_manager_focus_get_requesting_behavior()
+ * @see sound_manager_acquire_focus()
+ * @see sound_manager_release_focus()
+ */
+int sound_manager_focus_get_requested_behavior(sound_stream_info_h stream_info, int *flags);
+
+/**
+ * @brief Gets the reason for the current acquired playback focus.
+ * @since_tizen 3.0
+ *
+ * @remarks    If there is no acquired playback focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n
+ *     Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
+ *     The @a extra_info should be released using free().
+ *
+ * @param[out] acquired_by     The reason for the current acquired playback focus
+ * @param[out] flags   The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
+ * @param[out] extra_info The extra information of the acquired playback focus (optional, this can be NULL)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
+ * @see sound_manager_get_current_recording_focus()
+ */
+int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info);
+
+/**
+ * @brief Gets the reason for the current acquired recording focus.
+ * @since_tizen 3.0
+ *
+ * @remarks    If there is no acquired recording focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.\n
+ *     Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.\n
+ *     The @a extra_info should be released using free().
+ *
+ * @param[out] acquired_by     The reason for the current acquired recording focus
+ * @param[out] flags   The requested sound behavior that should be followed, values of #sound_behavior_e combined with bitwise 'or'
+ * @param[out] extra_info The extra information of the acquired recording focus (optional, this can be NULL)
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_INVALID_OPERATION Invalid operation
+ * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
+ * @see sound_manager_get_current_playback_focus()
+ */
+int sound_manager_get_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info);
 
 /**
  * @brief Registers the watch callback function to be invoked when the focus state for each sound stream type is changed regardless of the process.
  * @since_tizen 3.0
  *
  * @remarks    The registered callback is invoked by the internal thread of the sound manager.\n
- *     Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
+ *     Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
  *
  * @param[in]  focus_mask      The focus mask that user wants to watch
  * @param[in]  callback        The focus state change watch callback function
@@ -830,8 +966,8 @@ int sound_manager_add_focus_state_watch_cb(sound_stream_focus_mask_e focus_mask,
  * @brief Unregisters the focus state change watch callback.
  * @since_tizen 3.0
  *
- * @remarks    Do not call this API within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
- *     otherwise SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
+ * @remarks    Do not call this function within sound_stream_focus_state_changed_cb() or sound_stream_focus_state_watch_cb(),\n
+ *     otherwise #SOUND_MANAGER_ERROR_INVALID_OPERATION will be returned.
  *
  * @param[in]  id              The focus state change watch callback id
  * @return @c 0 on success,
@@ -984,7 +1120,7 @@ int sound_manager_get_media_session_resumption_option(sound_session_option_for_r
  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
- * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_VOIP) before calling this function.
+ * @pre Call sound_manager_set_session_type(#SOUND_SESSION_TYPE_VOIP) before calling this function.
  * @see sound_manager_set_session_type()
  * @see sound_manager_get_session_type()
  * @see sound_manager_get_voip_session_mode()
@@ -1003,7 +1139,7 @@ int sound_manager_set_voip_session_mode(sound_session_voip_mode_e mode);
  * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
  * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
  * @retval #SOUND_MANAGER_ERROR_POLICY Noncompliance with the sound system policy
- * @pre Call sound_manager_set_session_type(SOUND_SESSION_TYPE_VOIP) before calling this function.
+ * @pre Call sound_manager_set_session_type(#SOUND_SESSION_TYPE_VOIP) before calling this function.
  * @see sound_manager_set_session_type()
  * @see sound_manager_get_session_type()
  * @see sound_manager_set_voip_session_mode()
@@ -1078,7 +1214,7 @@ int sound_manager_get_current_device_list(sound_device_mask_e device_mask, sound
  * @brief Frees device list and each item of list.
  * @since_tizen 3.0
  *
- * @remarks    This API will deallocate not only device list itself but also each item.
+ * @remarks    This function will deallocate not only device list itself but also each item.
  *
  * @param[in]  device_list     The device list got with sound_manager_get_current_device_list.
  * @return @c 0 on success,
index 9f6e921..7ca4f3b 100644 (file)
@@ -217,42 +217,6 @@ int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_i
 
 /**
  * @internal
- * @brief Gets the reason for the current acquired playback focus.
- * @since_tizen 3.0
- *
- * @remarks    If there is no acquired playback focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.
- *
- * @param[out] acquired_by     The reason for the current acquired playback focus
- * @param[out] extra_info The extra information of the acquired playback focus (this can be null)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_reason_for_current_recording_focus()
- */
-int sound_manager_get_reason_for_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info);
-
-/**
- * @internal
- * @brief Gets the reason for the current acquired recording focus.
- * @since_tizen 3.0
- *
- * @remarks    If there is no acquired recording focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.
- *
- * @param[out] acquired_by     The reason for the current acquired recording focus
- * @param[out] extra_info The extra information of the acquired recording focus (this can be null)
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_reason_for_current_playback_focus()
- */
-int sound_manager_get_reason_for_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info);
-
-/**
- * @internal
  * @brief Creates a virtual stream handle.
  * @since_tizen 3.0
  * @param[in]  stream_info     The handle of stream information
index 8984097..8d64631 100644 (file)
@@ -174,42 +174,6 @@ int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_i
 
 /**
  * @internal
- * @brief Gets the reason for the current acquired playback focus.
- * @since_tizen 3.0
- * @param[out] acquired_by     The reason for the current acquired playback focus
- * @param[out] extra_info The extra information of the acquired playback focus (this can be null)
- *
- * @remarks    If there is no acquired playback focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.
- *
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_reason_for_current_recording_focus()
- */
-int sound_manager_get_reason_for_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info);
-
-/**
- * @internal
- * @brief Gets the reason for the current acquired recording focus.
- * @since_tizen 3.0
- * @param[out] acquired_by     The reason for the current acquired recording focus
- * @param[out] extra_info The extra information of the acquired recording focus (this can be null)
- *
- * @remarks    If there is no acquired recording focus in this system, it'll return #SOUND_MANAGER_ERROR_NO_DATA.
- *
- * @return @c 0 on success,
- *         otherwise a negative error value
- * @retval #SOUND_MANAGER_ERROR_NONE Success
- * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #SOUND_MANAGER_ERROR_NO_DATA No data
- * @see sound_manager_get_reason_for_current_playback_focus()
- */
-int sound_manager_get_reason_for_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info);
-
-/**
- * @internal
  * @brief Creates a virtual stream handle.
  * @since_tizen 3.0
  * @param[in]  stream_info     The handle of stream information
index 2ad55fc..45f7c90 100644 (file)
@@ -159,6 +159,8 @@ typedef struct _sound_stream_info_s {
        pa_context *pa_context;
        stream_conf_info_s stream_conf_info;
        sound_stream_focus_mask_e acquired_focus;
+       int requesting_flags;
+       int requested_flags;
        sound_stream_focus_state_changed_cb user_cb;
        void *user_data;
        manual_route_info_s manual_route_info;
@@ -224,7 +226,7 @@ void _voip_focus_state_change_callback(sound_stream_info_h stream_info, sound_st
 
 void _device_connected_cb(sound_device_h device, bool is_connected, void *user_data);
 
-void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, const char *extra_info, void *user_data);
+void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, int option, const char *extra_info, void *user_data);
 
 void _focus_watch_callback(int id, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, const char *extra_info, void *user_data);
 
index fc646e0..9dcfcfa 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       capi-media-sound-manager
 Summary:    Sound Manager library
-Version:    0.3.64
+Version:    0.3.65
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index aae3c41..e2a31eb 100644 (file)
@@ -240,6 +240,28 @@ int sound_manager_destroy_stream_information(sound_stream_info_h stream_info)
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
+int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type)
+{
+       int ret = MM_ERROR_NONE;
+       sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+       LOGI(">> enter");
+
+       SM_INSTANCE_CHECK(stream_h);
+       SM_NULL_ARG_CHECK(sound_type);
+
+       if (stream_h->stream_conf_info.volume_type == NULL) {
+               ret = MM_ERROR_SOUND_NO_DATA;
+               goto LEAVE;
+       }
+
+       ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type);
+       LOGI("sound type(%d)", *sound_type);
+
+LEAVE:
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
 int sound_manager_add_device_for_stream_routing(sound_stream_info_h stream_info, sound_device_h device)
 {
        int ret = MM_ERROR_NONE;
@@ -324,7 +346,7 @@ int sound_manager_acquire_focus(sound_stream_info_h stream_info, sound_stream_fo
                return _convert_sound_manager_error_code(__func__, MM_ERROR_POLICY_INTERNAL);
        }
 
-       ret = mm_sound_acquire_focus(stream_h->index, (mm_sound_focus_type_e)focus_mask, extra_info);
+       ret = mm_sound_acquire_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, stream_h->requesting_flags, extra_info);
        if (ret == MM_ERROR_NONE) {
                stream_h->acquired_focus |= focus_mask;
                _update_focus_status(stream_h->index, (unsigned int)stream_h->acquired_focus);
@@ -342,7 +364,7 @@ int sound_manager_release_focus(sound_stream_info_h stream_info, sound_stream_fo
 
        SM_INSTANCE_CHECK(stream_h);
 
-       ret = mm_sound_release_focus(stream_h->index, (mm_sound_focus_type_e)focus_mask, extra_info);
+       ret = mm_sound_release_focus_with_option(stream_h->index, (mm_sound_focus_type_e)focus_mask, stream_h->requesting_flags, extra_info);
        if (ret == MM_ERROR_NONE) {
                stream_h->acquired_focus &= ~focus_mask;
                _update_focus_status(stream_h->index, (unsigned int)stream_h->acquired_focus);
@@ -375,25 +397,139 @@ LEAVE:
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_sound_type(sound_stream_info_h stream_info, sound_type_e *sound_type)
+int sound_manager_focus_set_requesting_behavior(sound_stream_info_h stream_info, int flags)
+{
+       sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+       LOGI(">> enter");
+
+       SM_INSTANCE_CHECK(stream_h);
+       SM_RANGE_ARG_CHECK(flags,
+                               SOUND_BEHAVIOR_NONE,
+                               (SOUND_BEHAVIOR_NO_RESUME|SOUND_BEHAVIOR_FADING));
+
+       stream_h->requesting_flags = flags;
+
+       LOGI("the requesting sound behavior(0x%x) is set", stream_h->requesting_flags);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_focus_get_requesting_behavior(sound_stream_info_h stream_info, int *flags)
+{
+       sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+
+       LOGI(">> enter");
+
+       SM_INSTANCE_CHECK(stream_h);
+       SM_NULL_ARG_CHECK(flags);
+
+       *flags = stream_h->requesting_flags;
+
+       LOGI("the requesting sound behavior is (0x%x)", stream_h->requesting_flags);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_focus_get_requested_behavior(sound_stream_info_h stream_info, int *flags)
 {
        int ret = MM_ERROR_NONE;
        sound_stream_info_s *stream_h = (sound_stream_info_s*)stream_info;
+       bool is_focus_cb_thread = false;
 
        LOGI(">> enter");
 
        SM_INSTANCE_CHECK(stream_h);
-       SM_NULL_ARG_CHECK(sound_type);
+       SM_NULL_ARG_CHECK(flags);
 
-       if (stream_h->stream_conf_info.volume_type == NULL) {
-               ret = MM_ERROR_SOUND_NO_DATA;
-               goto LEAVE;
+       if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread)))
+               _convert_sound_manager_error_code(__func__, ret);
+
+       if (!is_focus_cb_thread) {
+               LOGE("this API should be called in focus state changed callback");
+               return SOUND_MANAGER_ERROR_INVALID_OPERATION;
        }
 
-       ret = _convert_sound_type_to_enum(stream_h->stream_conf_info.volume_type, sound_type);
-       LOGI("sound type(%d)", *sound_type);
+       *flags = stream_h->requested_flags;
+
+       LOGI("requested sound behavior is (0x%x)", stream_h->requested_flags);
+
+       return SOUND_MANAGER_ERROR_NONE;
+}
+
+int sound_manager_get_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info)
+{
+       int ret = MM_ERROR_NONE;
+       char *stream_type_str = NULL;
+       char *extra_info_str = NULL;
+       int option = 0;
+       bool is_focus_cb_thread = false;
+
+       LOGI(">> enter");
+
+       SM_NULL_ARG_CHECK(acquired_by);
+       SM_NULL_ARG_CHECK(flags);
+
+       if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread)))
+               _convert_sound_manager_error_code(__func__, ret);
+
+       if (is_focus_cb_thread) {
+               LOGE("this API should not be called in focus callback");
+               return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+       }
+
+       ret = mm_sound_get_stream_type_of_acquired_focus((int)SOUND_STREAM_FOCUS_FOR_PLAYBACK, &stream_type_str, &option, &extra_info_str);
+       if (ret == MM_ERROR_NONE) {
+               LOGI("current acquired PLAYBACK focus : stream_type[%s]", stream_type_str);
+               ret = _convert_stream_type_to_change_reason(stream_type_str, acquired_by);
+               if (ret == MM_ERROR_NONE) {
+                       LOGI("                                : reason[%d], flags[0x%x], extra_info[%s]", *acquired_by, option, extra_info_str);
+                       *flags = option;
+                       if (extra_info)
+                               *extra_info = extra_info_str;
+                       else
+                               free(extra_info_str);
+               }
+       }
+
+       return _convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, int *flags, char **extra_info)
+{
+       int ret = MM_ERROR_NONE;
+       char *stream_type_str = NULL;
+       char *extra_info_str = NULL;
+       int option = 0;
+       bool is_focus_cb_thread = false;
+
+       LOGI(">> enter");
+
+       SM_NULL_ARG_CHECK(acquired_by);
+       SM_NULL_ARG_CHECK(flags);
+
+       if ((ret = mm_sound_focus_is_cb_thread(&is_focus_cb_thread)))
+               _convert_sound_manager_error_code(__func__, ret);
+
+       if (is_focus_cb_thread) {
+               LOGE("this API should not be called in focus callback");
+               return SOUND_MANAGER_ERROR_INVALID_OPERATION;
+       }
+
+       ret = mm_sound_get_stream_type_of_acquired_focus((int)SOUND_STREAM_FOCUS_FOR_RECORDING, &stream_type_str, &option, &extra_info_str);
+       if (ret == MM_ERROR_NONE) {
+               LOGI("current acquired RECORDING focus : stream_type[%s]", stream_type_str);
+               ret = _convert_stream_type_to_change_reason(stream_type_str, acquired_by);
+               if (ret == MM_ERROR_NONE) {
+                       LOGI("                                 : reason[%d], flags[0x%x], extra_info[%s]", *acquired_by, option, extra_info_str);
+                       *flags = option;
+                       if (extra_info)
+                               *extra_info = extra_info_str;
+                       else
+                               free(extra_info_str);
+               }
+       }
 
-LEAVE:
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
index 9d78973..a042f55 100644 (file)
@@ -169,52 +169,6 @@ int sound_manager_get_index_from_stream_information(sound_stream_info_h stream_i
        return _convert_sound_manager_error_code(__func__, ret);
 }
 
-int sound_manager_get_reason_for_current_playback_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info)
-{
-       int ret = MM_ERROR_NONE;
-       char *stream_type_str = NULL;
-       char *extra_info_str = NULL;
-
-       LOGI(">> enter");
-
-       SM_NULL_ARG_CHECK(acquired_by);
-
-       ret = mm_sound_get_stream_type_of_acquired_focus((int)SOUND_STREAM_FOCUS_FOR_PLAYBACK, &stream_type_str, &extra_info_str);
-       if (ret == MM_ERROR_NONE) {
-               LOGI("current acquired [playback] focus: stream_type=%s", stream_type_str);
-               ret = _convert_stream_type_to_change_reason(stream_type_str, acquired_by);
-               if ((ret == MM_ERROR_NONE) && extra_info) {
-                       LOGI("                                  : reason=%d, extra_info=%s", *acquired_by, extra_info_str);
-                       *extra_info = extra_info_str;
-               }
-       }
-
-       return _convert_sound_manager_error_code(__func__, ret);
-}
-
-int sound_manager_get_reason_for_current_recording_focus(sound_stream_focus_change_reason_e *acquired_by, char **extra_info)
-{
-       int ret = MM_ERROR_NONE;
-       char *stream_type_str = NULL;
-       char *extra_info_str = NULL;
-
-       LOGI(">> enter");
-
-       SM_NULL_ARG_CHECK(acquired_by);
-
-       ret = mm_sound_get_stream_type_of_acquired_focus((int)SOUND_STREAM_FOCUS_FOR_RECORDING, &stream_type_str, &extra_info_str);
-       if (ret == MM_ERROR_NONE) {
-               LOGI("current acquired [recording] focus: stream_type=%s", stream_type_str);
-               ret = _convert_stream_type_to_change_reason(stream_type_str, acquired_by);
-               if ((ret == MM_ERROR_NONE) && extra_info) {
-                       LOGI("                                  : reason=%d, extra_info=%s", *acquired_by, extra_info_str);
-                       *extra_info = extra_info_str;
-               }
-       }
-
-       return _convert_sound_manager_error_code(__func__, ret);
-}
-
 int sound_manager_create_virtual_stream(sound_stream_info_h stream_info, virtual_sound_stream_h *virtual_stream)
 {
        int ret = MM_ERROR_NONE;
index b64253c..a3e8704 100644 (file)
@@ -451,7 +451,7 @@ const char* _convert_api_name(native_api_e api_name)
        return name;
 }
 
-void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, const char *extra_info, void *user_data)
+void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, mm_sound_focus_state_e state, const char *reason, int option, const char *extra_info, void *user_data)
 {
        int ret = MM_ERROR_NONE;
        int i = 0;
@@ -472,9 +472,15 @@ void _focus_state_change_callback(int index, mm_sound_focus_type_e focus_type, m
                        else if (state == FOCUS_IS_ACQUIRED)
                                sound_stream_info_arr[i]->acquired_focus |= focus_type;
 
+                       /* set flags for requested behavior */
+                       sound_stream_info_arr[i]->requested_flags = option;
+
                        LOGI("[FOCUS USER CALLBACK(%p) START]", sound_stream_info_arr[i]->user_cb);
                        sound_stream_info_arr[i]->user_cb((sound_stream_info_h)sound_stream_info_arr[i], change_reason, extra_info, sound_stream_info_arr[i]->user_data);
                        LOGI("[FOCUS USER CALLBACK(%p) END]", sound_stream_info_arr[i]->user_cb);
+
+                       /* unset flags for requested behavior */
+                       sound_stream_info_arr[i]->requested_flags = 0;
                        break;
                }
        }
index 5755e45..700e692 100644 (file)
@@ -72,6 +72,9 @@ enum {
        CURRENT_STATUS_REMOVE_FOCUS_WATCH_CB,
        CURRENT_STATUS_SET_FOCUS_REACQUISITION,
        CURRENT_STATUS_GET_FOCUS_REACQUISITION,
+       CURRENT_STATUS_SET_REQUESTING_BEHAVIOR,
+       CURRENT_STATUS_GET_REQUESTING_BEHAVIOR,
+       CURRENT_STATUS_GET_REQUESTED_BEHAVIOR,
        CURRENT_STATUS_GET_REASON_FOR_P_FOCUS,
        CURRENT_STATUS_GET_REASON_FOR_R_FOCUS,
        CURRENT_STATUS_CREATE_VIRTUAL_STREAM,
@@ -99,24 +102,18 @@ void focus_callback(sound_stream_info_h stream_info, sound_stream_focus_change_r
        int ret = SOUND_MANAGER_ERROR_NONE;
        sound_stream_focus_state_e playback_focus_state;
        sound_stream_focus_state_e recording_focus_state;
+       int flags = SOUND_BEHAVIOR_NONE;
+
        g_print("\n*** FOCUS callback is called, stream_info(%p) ***\n", stream_info);
-       g_print(" - change_reason(%d), extra_info(%s), user_data(%p)\n", reason, extra_info, user_data);
+
+       sound_manager_focus_get_requested_behavior(stream_info, &flags);
+       g_print(" - change_reason(%d), behavior(0x%x), extra_info(%s), user_data(%p)\n", reason, flags, extra_info, user_data);
 
        ret = sound_manager_get_focus_state(stream_info, &playback_focus_state, &recording_focus_state);
        if (!ret)
-               g_print(" - focus_state(playback_focus:%d, recording_focus:%d)\n", playback_focus_state, recording_focus_state);
-
-       if (playback_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
-               g_print(" -- PLAYBACK_FOCUS acquired\n");
-       else
-               g_print(" -- PLAYBACK_FOCUS released\n");
+               g_print(" - focus_state : PLAYBACK(%d), RECORDING(%d) (0:released, 1:acquired)\n", playback_focus_state, recording_focus_state);
 
-       if (recording_focus_state == SOUND_STREAM_FOCUS_STATE_ACQUIRED)
-               g_print(" -- FOCUS_RECORDING acquired\n");
-       else
-               g_print(" -- FOCUS_RECORDING released\n");
-
-       g_print("*** FOCUS callback is ended, stream_info(%p) ****\n", stream_info);
+       g_print("*** FOCUS callback is ended, stream_info(%p) ****\n\n", stream_info);
 
        return;
 }
@@ -222,6 +219,12 @@ void _interpret_main_menu(char *cmd)
                g_menu_state = CURRENT_STATUS_SET_FOCUS_REACQUISITION;
        else if (strncmp(cmd, "gfr", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_FOCUS_REACQUISITION;
+       else if (strncmp(cmd, "srb", 3) == 0)
+               g_menu_state = CURRENT_STATUS_SET_REQUESTING_BEHAVIOR;
+       else if (strncmp(cmd, "grb", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_REQUESTING_BEHAVIOR;
+       else if (strncmp(cmd, "grd", 3) == 0)
+               g_menu_state = CURRENT_STATUS_GET_REQUESTED_BEHAVIOR;
        else if (strncmp(cmd, "grp", 3) == 0)
                g_menu_state = CURRENT_STATUS_GET_REASON_FOR_P_FOCUS;
        else if (strncmp(cmd, "grr", 3) == 0)
@@ -304,9 +307,9 @@ void display_sub_basic()
        g_print("csi. Create Stream Info\t");
        g_print("dsi. Destroy Stream Info\n");
        g_print("gst. Get Sound Type\n");
-       g_print("ads. Add device for stream routing\t");
-       g_print("rds. Remove device for stream routing\t");
-       g_print("aps. Apply devices for stream routing\n");
+       g_print("ads. Add Device for Stream Routing\t");
+       g_print("rds. Remove Device for Stream Routing\t");
+       g_print("aps. Apply devices for Stream Routing\n");
        g_print("afc. Acquire Focus\t");
        g_print("rfc. Release Focus\t");
        g_print("gfs. Get Focus State\n");
@@ -314,6 +317,9 @@ void display_sub_basic()
        g_print("rfw. Remove Focus State Watch CB\n");
        g_print("sfr. Set Focus Reacquisition\t");
        g_print("gfr. Get Focus Reacquisition\n");
+       g_print("srb. Set Requesting Sound Behavior\t");
+       g_print("grb. Get Requesting Sound Behavior\t");
+       g_print("grd. Get Requested Sound Behavior\n");
        g_print("grp. Get Reason for Current Acquired Playback Focus\t");
        g_print("grr. Get Reason for Current Acquired Recording Focus\n");
        g_print("sso. *Set option for stream routing\n");
@@ -422,7 +428,13 @@ static void displaymenu()
        else if (g_menu_state == CURRENT_STATUS_SET_FOCUS_REACQUISITION)
                g_print("*** input focus reacquisition property (1:enable, 2:disable)\n");
        else if (g_menu_state == CURRENT_STATUS_GET_FOCUS_REACQUISITION)
-               g_print("*** press enter to get focus reacquisition property (1:enabled, 2:disabled)\n");
+               g_print("*** press enter to get focus reacquisition property\n");
+       else if (g_menu_state == CURRENT_STATUS_SET_REQUESTING_BEHAVIOR)
+               g_print("*** input flags for requesting audio behavior (0:none, 1:no_resume, 2:fading, 3:no_resume+fading)\n");
+       else if (g_menu_state == CURRENT_STATUS_GET_REQUESTING_BEHAVIOR)
+               g_print("*** press enter to get requesting audio behavior (0:none, 1:no_resume, 2:fading, 3:no_resume+fading)\n");
+       else if (g_menu_state == CURRENT_STATUS_GET_REQUESTED_BEHAVIOR)
+               g_print("*** press enter to get the requested audio behavior\n");
        else if (g_menu_state == CURRENT_STATUS_GET_REASON_FOR_P_FOCUS)
                g_print("*** press enter to get reason for current playback focus\n");
        else if (g_menu_state == CURRENT_STATUS_GET_REASON_FOR_R_FOCUS)
@@ -1403,15 +1415,74 @@ static void interpret(char *cmd)
                reset_menu_state();
                break;
        }
+       case CURRENT_STATUS_SET_REQUESTING_BEHAVIOR: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int flags;
+
+               switch (atoi(cmd)) {
+               case 0: /* none */
+                       flags = SOUND_BEHAVIOR_NONE;
+                       break;
+               case 1: /* no resumption */
+                       flags = SOUND_BEHAVIOR_NO_RESUME;
+                       break;
+               case 2: /* fading effect */
+                       flags = SOUND_BEHAVIOR_FADING;
+                       break;
+               case 3: /* no resumption + fading effect */
+                       flags = SOUND_BEHAVIOR_NO_RESUME | SOUND_BEHAVIOR_FADING;
+                       break;
+               default:
+                       flags = SOUND_BEHAVIOR_NONE;
+                       break;
+               }
+
+               ret = sound_manager_focus_set_requesting_behavior(g_stream_info_h, flags);
+               if (ret)
+                       g_print("fail to sound_manager_focus_set_requesting_behavior, ret(0x%x)\n", ret);
+
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_GET_REQUESTING_BEHAVIOR: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int flags;
+
+               ret = sound_manager_focus_get_requesting_behavior(g_stream_info_h, &flags);
+               if (ret)
+                       g_print("fail to sound_manager_focus_get_requesting_behavior, ret(0x%x)\n", ret);
+               else
+                       g_print("requesting behavior is (0x%x)\n", flags);
+
+               reset_menu_state();
+               break;
+       }
+       case CURRENT_STATUS_GET_REQUESTED_BEHAVIOR: {
+               int ret = SOUND_MANAGER_ERROR_NONE;
+               int flags;
+
+               ret = sound_manager_focus_get_requested_behavior(g_stream_info_h, &flags);
+               if (ret)
+                       g_print("fail to sound_manager_focus_get_requested_behavior, ret(0x%x)\n", ret);
+               else
+                       g_print("requested behavior is (0x%x)\n", flags);
+
+               reset_menu_state();
+               break;
+       }
        case CURRENT_STATUS_GET_REASON_FOR_P_FOCUS: {
                int ret = SOUND_MANAGER_ERROR_NONE;
                char *extra_info = NULL;
                sound_stream_focus_change_reason_e reason;
-               ret = sound_manager_get_reason_for_current_playback_focus(&reason, &extra_info);
+               int flags;
+
+               ret = sound_manager_get_current_playback_focus(&reason, &flags, &extra_info);
                if (ret)
-                       g_print("fail to sound_manager_get_reason_for_current_playback_focus, ret(0x%x)\n", ret);
+                       g_print("fail to sound_manager_get_current_playback_focus, ret(0x%x)\n", ret);
                else
-                       g_print("reason(%d), extra_info(%s)\n", reason, extra_info);
+                       g_print("reason(%d), flags(0x%x), extra_info(%s)\n", reason, flags, extra_info);
+               free(extra_info);
+
                reset_menu_state();
                break;
        }
@@ -1419,11 +1490,15 @@ static void interpret(char *cmd)
                int ret = SOUND_MANAGER_ERROR_NONE;
                char *extra_info = NULL;
                sound_stream_focus_change_reason_e reason;
-               ret = sound_manager_get_reason_for_current_recording_focus(&reason, &extra_info);
+               int flags;
+
+               ret = sound_manager_get_current_recording_focus(&reason, &flags, &extra_info);
                if (ret)
-                       g_print("fail to sound_manager_get_reason_for_current_recording_focus, ret(0x%x)\n", ret);
+                       g_print("fail to sound_manager_get_current_recording_focus, ret(0x%x)\n", ret);
                else
-                       g_print("reason(%d), extra_info(%s)\n", reason, extra_info);
+                       g_print("reason(%d), flags(0x%x), extra_info(%s)\n", reason, flags, extra_info);
+               free(extra_info);
+
                reset_menu_state();
                break;
        }