TizenRefApp-9228 [Call UI] Fix issue with setting volume level on connected BT headset 00/147000/3
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 31 Aug 2017 12:17:13 +0000 (15:17 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Mon, 11 Sep 2017 05:30:29 +0000 (08:30 +0300)
Change-Id: I36c5e718739ce559c5cd2cac48077a2ad62b103f

12 files changed:
call-ui/model/ISoundManager.h
call-ui/model/impl/BluetoothManager.cpp
call-ui/model/impl/BluetoothManager.h
call-ui/model/impl/SoundManager.cpp
call-ui/model/impl/SoundManager.h
call-ui/model/types.h
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/presenters/misc/AccessoryPresenter.h
call-ui/presenters/pages/KeypadPage.cpp
call-ui/presenters/pages/KeypadPage.h
call-ui/view/AcceptRejectWidget.cpp
tizen-manifest.xml

index 6b4e54c9105dd62d965fb4dbbcc4e3f794894c47..7f42c3996d58882076777d911c656230f84a5f75 100644 (file)
@@ -33,24 +33,24 @@ namespace callui {
                virtual ucl::Result startDtmf(const unsigned char dtmfDigit) = 0;
                virtual ucl::Result stopDtmf() = 0;
                virtual void addAudioStateHandler(
-                               const AudioStateHandler &handler) = 0;
+                               NotiHandler handler) = 0;
                virtual void delAudioStateHandler(
-                               const AudioStateHandler &handler) = 0;
+                               const NotiHandler &handler) = 0;
                virtual void addMuteStateHandler(
-                               const MuteStateHandler &handler) = 0;
+                               NotiHandler handler) = 0;
                virtual void delMuteStateHandler(
-                               const MuteStateHandler &handler) = 0;
+                               const NotiHandler &handler) = 0;
                virtual void addVolumeStateHandler(
-                               const VolumeLevelHandler &handler) = 0;
+                               NotiHandler handler) = 0;
                virtual void delVolumeStateHandler(
-                               const VolumeLevelHandler &handler) = 0;
+                               const NotiHandler &handler) = 0;
                virtual int getMaxVolume() const = 0;
                virtual int getVolume() const = 0;
                virtual ucl::Result setVolume(int value) = 0;
                virtual bool isBTSupported() const = 0;
                virtual bool isBTHeadsetConnected() const = 0;
                virtual void addBTHeadsetConnectionChangeHandler(
-                               const NotiHandler &handler) = 0;
+                               NotiHandler handler) = 0;
                virtual void delBTHeadsetConnectionChangeHandler(
                                const NotiHandler &handler) = 0;
        };
index a9144b3f8d24b42f6c4f48c83567654d9fed5783..ff1a5a4afdd9a2463e1d23ad5493b49b45756d7c 100644 (file)
@@ -27,6 +27,35 @@ namespace callui { namespace { namespace impl {
 
        constexpr auto BT_VOLUME_MAX = 15;
 
+       bool isScoOpened()
+       {
+               bool isOpened = false;
+               auto res = bt_ag_is_sco_opened(&isOpened);
+               if (res != BT_ERROR_NONE) {
+                       LOG_RETURN_VALUE(RES_FAIL, false,
+                                       "bt_ag_is_sco_opened() failed! "
+                                       "res[%d] msg[%s]", res, get_error_message(res));
+               }
+               DLOG("BT SCO open state [%d]", isOpened);
+
+               return isOpened;
+       }
+
+       bool isCallCurrentSoundType()
+       {
+               sound_type_e soundType = SOUND_TYPE_SYSTEM;
+               auto res = sound_manager_get_current_sound_type(&soundType);
+               if (res != SOUND_MANAGER_ERROR_NONE) {
+                       LOG_RETURN_VALUE(RES_FAIL, false,
+                                       "sound_manager_get_current_sound_type() failed! "
+                                       "res[%d] msg[%s]", res, get_error_message(res));
+               }
+               bool ret = (soundType == SOUND_TYPE_CALL);
+               DLOG("Current sound type is Call [%s]", ret ? "YES" : "NO");
+
+               return ret;
+       }
+
 }}}
 
 namespace callui {
@@ -72,10 +101,10 @@ namespace callui {
 
        Result BluetoothManager::initializeBluetooth()
        {
-               auto ret = bt_initialize();
-               if (ret != BT_ERROR_NONE) {
+               auto res = bt_initialize();
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL, "BT initialize failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
 
                }
                m_btInitialized = true;
@@ -84,16 +113,19 @@ namespace callui {
 
        void BluetoothManager::deinitializeBluetooth()
        {
-               bt_deinitialize();
+               if (m_btInitialized) {
+                       m_btInitialized = false;
+                       bt_deinitialize();
+               }
        }
 
        int BluetoothManager::getVolume() const
        {
                auto vol = 0;
-               auto ret = bt_ag_get_speaker_gain(&vol);
-               if (ret != BT_ERROR_NONE) {
+               auto res = bt_ag_get_speaker_gain(&vol);
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN_VALUE(RES_FAIL, -1, "bt_ag_get_speaker_gain() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
                DLOG("BT Volume level [%d]", vol);
                return vol;
@@ -106,36 +138,35 @@ namespace callui {
 
        Result BluetoothManager::setVolume(int volume)
        {
-               auto ret = bt_ag_notify_speaker_gain(volume);
-               if (ret != BT_ERROR_NONE) {
+               auto res = bt_ag_notify_speaker_gain(volume);
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL, "bt_ag_notify_speaker_gain() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
                return RES_OK;
        }
 
        void BluetoothManager::setVolumeStateHandler(
-                       const VolumeStateHandler &handler)
+                       const NotiHandler &handler)
        {
                m_btVolumeHandler = handler;
        }
 
        Result BluetoothManager::registerAudioHandling()
        {
-               auto ret = bt_audio_initialize();
-               if (ret != BT_ERROR_NONE) {
+               auto res = bt_audio_initialize();
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL, "bt_audio_initialize() failed! ",
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
                m_btAudioInitialized = true;
 
-               ret = bt_ag_set_speaker_gain_changed_cb(
+               res = bt_ag_set_speaker_gain_changed_cb(
                                CALLBACK_B(BluetoothManager::onVolumeChanged), this);
-               if (ret != BT_ERROR_NONE) {
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL, "bt_ag_set_speaker_gain_changed_cb() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
-
                return RES_OK;
        }
 
@@ -144,17 +175,17 @@ namespace callui {
                bt_ag_unset_speaker_gain_changed_cb();
 
                if (m_btAudioInitialized) {
-                       bt_audio_deinitialize();
                        m_btAudioInitialized = false;
+                       bt_audio_deinitialize();
                }
        }
 
        Result BluetoothManager::registerHeadsetConnectionHandling()
        {
-               auto ret = vconf_notify_key_changed(VCONFKEY_BT_DEVICE,
+               auto res = vconf_notify_key_changed(VCONFKEY_BT_DEVICE,
                                CALLBACK_B(BluetoothManager::onHeadsetConnectionChanged),
                                this);
-               if (ret != 0) {
+               if (res != 0) {
                        LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed!");
                }
                return RES_OK;
@@ -169,23 +200,9 @@ namespace callui {
 
        void BluetoothManager::onVolumeChanged(int volume)
        {
-               sound_type_e soundType = SOUND_TYPE_SYSTEM;
-               auto ret = sound_manager_get_current_sound_type(&soundType);
-               if (ret != SOUND_MANAGER_ERROR_NONE) {
-                       LOG_RETURN_VOID(RES_FAIL, "sound_manager_get_current_sound_type() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
-               }
-
-               bool isSCOOpened = false;
-               ret = bt_ag_is_sco_opened(&isSCOOpened);
-               if (ret != BT_ERROR_NONE) {
-                       LOG_RETURN_VOID(RES_FAIL, "sound_manager_get_current_sound_type() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
-               }
-
-               if (isSCOOpened && soundType == SOUND_TYPE_CALL) {
+               if (impl::isScoOpened() && impl::isCallCurrentSoundType()) {
                        if (m_btVolumeHandler) {
-                               m_btVolumeHandler(volume);
+                               m_btVolumeHandler();
                        }
                }
        }
@@ -200,13 +217,13 @@ namespace callui {
                m_btConnectionHandler = handler;
        }
 
-       bool BluetoothManager::getHeadsetConnectionState()
+       bool BluetoothManager::getHeadsetConnectionState() const
        {
                bt_adapter_state_e adapterState = BT_ADAPTER_DISABLED;
-               auto ret = bt_adapter_get_state(&adapterState);
-               if (ret != BT_ERROR_NONE) {
+               auto res = bt_adapter_get_state(&adapterState);
+               if (res != BT_ERROR_NONE) {
                        LOG_RETURN_VALUE(RES_FAIL, false, "bt_adapter_get_state() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
 
                if (adapterState == BT_ADAPTER_DISABLED) {
@@ -214,10 +231,10 @@ namespace callui {
                }
 
                auto dev = 0;
-               ret = vconf_get_int(VCONFKEY_BT_DEVICE, &dev);
-               if (ret != 0) {
+               res = vconf_get_int(VCONFKEY_BT_DEVICE, &dev);
+               if (res != 0) {
                        LOG_RETURN_VALUE(RES_FAIL, false, "vconf_get_int() failed! "
-                                       "ret[%d] msg[%s]", ret, get_error_message(ret));
+                                       "res[%d] msg[%s]", res, get_error_message(res));
                }
 
                if (dev == VCONFKEY_BT_DEVICE_NONE) {
@@ -235,6 +252,7 @@ namespace callui {
        void BluetoothManager::setHeadsetConnectionState(bool isConnected)
        {
                if (m_isHeadsetConnected != isConnected) {
+                       DLOG("BT Headset connection state update");
                        m_isHeadsetConnected = isConnected;
                        if (m_btConnectionHandler) {
                                m_btConnectionHandler();
@@ -244,7 +262,8 @@ namespace callui {
 
        void BluetoothManager::onHeadsetConnectionChanged(keynode_t *node)
        {
-               bool isConnected = getHeadsetConnectionState();
+               auto isConnected = getHeadsetConnectionState();
+               DLOG("BT Headset connection state [%s]", isConnected ? "YES" : "NO");
                setHeadsetConnectionState(isConnected);
        }
 
index 35029e227962a43f0a3a6a29603589587eea62a7..8b89ba8878ff462f9f841b3b737bd150a0472341 100644 (file)
@@ -26,9 +26,6 @@ namespace callui {
        UCL_DECLARE_REF_ALIASES(BluetoothManager);
 
        class BluetoothManager final {
-       public:
-               using VolumeStateHandler = ucl::WeakDelegate<void(int)>;
-
        public:
                static BluetoothManagerSRef newInstance();
 
@@ -36,7 +33,7 @@ namespace callui {
                int getMaxVolume() const;
                ucl::Result setVolume(int volume);
 
-               void setVolumeStateHandler(const VolumeStateHandler &handler);
+               void setVolumeStateHandler(const NotiHandler &handler);
 
                bool isHeadsetConnected() const;
                void setHeadsetConnectionChangeHandler(const NotiHandler &handler);
@@ -58,15 +55,16 @@ namespace callui {
                ucl::Result registerHeadsetConnectionHandling();
                void unregisterHeadsetConnectionHandling();
 
-               bool getHeadsetConnectionState();
+               bool getHeadsetConnectionState() const;
                void setHeadsetConnectionState(bool isConnected);
                void onHeadsetConnectionChanged(keynode_t *node);
 
        private:
-               VolumeStateHandler m_btVolumeHandler;
+               NotiHandler m_btVolumeHandler;
                NotiHandler m_btConnectionHandler;
                bool m_btInitialized;
                bool m_btAudioInitialized;
+
                bool m_isHeadsetConnected;
        };
 }
index 12d34c0122df672a1bcacfcabd1bb263490d55ba..852c8572e131cd99315119a83cc1e6ba1fe64f8f 100644 (file)
 
 #include "common.h"
 
-namespace callui { namespace { namespace impl {
-
-       using namespace ucl;
-
-       Result getBTHeadsetConnectedState(bool &state)
-       {
-               Result res = RES_FAIL;
-               state = false;
-
-               sound_device_list_h deviceList = nullptr;
-               auto ret = sound_manager_get_device_list(
-                               SOUND_DEVICE_ALL_MASK, &deviceList);
-               if (ret != SOUND_MANAGER_ERROR_NONE) {
-                       LOG_RETURN(RES_FAIL, "sound_manager_get_device_list() failed. "
-                                       "[%d][%s]", ret, get_error_message(ret));
-               }
-               sound_device_type_e searchType = SOUND_DEVICE_BLUETOOTH_VOICE;
-               sound_device_h device;
-               sound_device_type_e type;
-
-               while (true) {
-                       device = nullptr;
-                       ret = sound_manager_get_next_device(deviceList, &device);
-
-                       if (ret == SOUND_MANAGER_ERROR_NO_DATA) {
-                               res = RES_OK;
-                               ILOG("No more device to check");
-                               break;
-                       } else if (ret != SOUND_MANAGER_ERROR_NONE) {
-                               UCL_FAIL_BREAK(res, "sound_manager_get_next_device() failed. "
-                                               "[%d][%s]", ret, get_error_message(ret));
-                       }
-
-                       if (!device) {
-                               UCL_FAIL_BREAK(res, "device is NULL");
-                       }
-
-                       sound_manager_get_device_type(device, &type);
-                       if (searchType == type) {
-                               DLOG("Bluetooth voice device found");
-                               state = true;
-                       }
-
-                       // For debug only
-                       int id;
-                       char *name;
-                       sound_device_io_direction_e direction;
-                       sound_manager_get_device_id(device, &id);
-                       sound_manager_get_device_name(device, &name);
-                       sound_manager_get_device_io_direction(device, &direction);
-                       DLOG("--------------------------");
-                       DLOG("Device ID [%d]", id);
-                       DLOG("Device name [%s]", name);
-                       DLOG("Device IO direction [%d]", direction);
-                       DLOG("Device type [%d]", type);
-               }
-               sound_manager_free_device_list(deviceList);
-
-               return res;
-       }
-}}}
-
 namespace callui {
 
        using namespace ucl;
@@ -87,14 +25,14 @@ namespace callui {
        SoundManager::SoundManager(IRefCountObj &rc, const CallClientSRef &client):
                        RefCountAware(&rc),
                        m_client(client),
-                       m_deviceVolumeCbID(-1)
+                       m_deviceVolumeCbId(-1)
        {
        }
 
        SoundManager::~SoundManager()
        {
-               if (m_deviceVolumeCbID >= 0) {
-                       sound_manager_remove_volume_changed_cb(m_deviceVolumeCbID);
+               if (m_deviceVolumeCbId >= 0) {
+                       sound_manager_remove_volume_changed_cb(m_deviceVolumeCbId);
                }
                cm_unset_audio_state_changed_cb(*m_client);
                cm_unset_mute_status_cb(*m_client);
@@ -115,14 +53,13 @@ namespace callui {
                        ILOG("Ignored. Unhandled state [%d]", state);
                        return;
                }
-               m_audioStateEvent.dispatch(convertCMAudioState(state));
+
+               m_audioStateEvent.dispatch();
        }
 
        void SoundManager::onMuteStateChanged(cm_mute_status_e status)
        {
-               DLOG();
-
-               m_muteStateEvent.dispatch(status == CM_MUTE_STATUS_ON);
+               m_muteStateEvent.dispatch();
        }
 
        Result SoundManager::prepare()
@@ -151,7 +88,7 @@ namespace callui {
                int ret = sound_manager_add_volume_changed_cb(
                                CALLBACK_B(SoundManager::onGearVolumeChanged),
                                this,
-                               &m_deviceVolumeCbID);
+                               &m_deviceVolumeCbId);
                if (ret != SOUND_MANAGER_ERROR_NONE) {
                        LOG_RETURN(RES_FAIL,
                                        "sound_manager_add_volume_changed_cb() failed");
@@ -190,17 +127,11 @@ namespace callui {
                        LOG_RETURN(RES_NOT_SUPPORTED, "Bluetooth not supported");
                }
 
-               bool state = false;
-               Result res = impl::getBTHeadsetConnectedState(state);
-               DLOG("Sound manager BT Headset connection status [%d], res [%s]",
-                               state, getResultData(res).name);
-
-               if (!isBTHeadsetConnected()) {
-                       LOG_RETURN(RES_NOT_CONNECTED,
-                                       "Bluetooth headset device not connected");
-               }
-
                if (isEnable) {
+                       if (!isBTHeadsetConnected()) {
+                               LOG_RETURN(RES_NOT_CONNECTED,
+                                               "Bluetooth headset device not connected");
+                       }
                        return convertCMResult(cm_bluetooth_on(*m_client));
                } else {
                        return convertCMResult(cm_bluetooth_off(*m_client));
@@ -241,32 +172,32 @@ namespace callui {
                return convertCMResult(cm_stop_dtmf(*m_client));
        }
 
-       void SoundManager::addAudioStateHandler(const AudioStateHandler &handler)
+       void SoundManager::addAudioStateHandler(NotiHandler handler)
        {
-               m_audioStateEvent += handler;
+               m_audioStateEvent += std::move(handler);
        }
 
-       void SoundManager::delAudioStateHandler(const AudioStateHandler &handler)
+       void SoundManager::delAudioStateHandler(const NotiHandler &handler)
        {
                m_audioStateEvent -= handler;
        }
 
-       void SoundManager::addMuteStateHandler(const MuteStateHandler &handler)
+       void SoundManager::addMuteStateHandler(NotiHandler handler)
        {
-               m_muteStateEvent += handler;
+               m_muteStateEvent += std::move(handler);
        }
 
-       void SoundManager::delMuteStateHandler(const MuteStateHandler &handler)
+       void SoundManager::delMuteStateHandler(const NotiHandler &handler)
        {
                m_muteStateEvent -= handler;
        }
 
-       void SoundManager::addVolumeStateHandler(const VolumeLevelHandler &handler)
+       void SoundManager::addVolumeStateHandler(NotiHandler handler)
        {
-               m_volumeLevelEvent += handler;
+               m_volumeLevelEvent += std::move(handler);
        }
 
-       void SoundManager::delVolumeStateHandler(const VolumeLevelHandler &handler)
+       void SoundManager::delVolumeStateHandler(const NotiHandler &handler)
        {
                m_volumeLevelEvent -= handler;
        }
@@ -340,9 +271,9 @@ namespace callui {
        }
 
        void SoundManager::addBTHeadsetConnectionChangeHandler(
-                       const NotiHandler &handler)
+                       NotiHandler handler)
        {
-               m_btVoiceDeviceConnEvent += handler;
+               m_btVoiceDeviceConnEvent += std::move(handler);
        }
 
        void SoundManager::delBTHeadsetConnectionChangeHandler(
@@ -353,23 +284,20 @@ namespace callui {
 
        void SoundManager::onGearVolumeChanged(sound_type_e type, unsigned int volume)
        {
-               DLOG("Volume [%d]", volume);
                if (type != SOUND_TYPE_CALL) {
                        ILOG("Ignored. Not type Call.");
                        return;
                }
 
                if (getAudioState() != AudioStateType::BT) {
-                       m_volumeLevelEvent.dispatch(volume);
+                       m_volumeLevelEvent.dispatch();
                }
        }
 
-       void SoundManager::onBTHeadsetVolumeChanged(int volume)
+       void SoundManager::onBTHeadsetVolumeChanged()
        {
-               DLOG("Volume [%d]", volume);
-
                if (getAudioState() == AudioStateType::BT) {
-                       m_volumeLevelEvent.dispatch(volume);
+                       m_volumeLevelEvent.dispatch();
                }
        }
 
index 224c90cc26fd20981f9bf701343e901c7e6fbfd2..afae43a12b06c183ede5d73ca7d31fe9f96ca5f5 100644 (file)
@@ -52,19 +52,19 @@ namespace callui {
                virtual ucl::Result stopDtmf() override final;
 
                virtual void addAudioStateHandler(
-                               const AudioStateHandler &handler) override final;
+                               NotiHandler handler) override final;
                virtual void delAudioStateHandler(
-                               const AudioStateHandler &handler) override final;
+                               const NotiHandler &handler) override final;
 
                virtual void addMuteStateHandler(
-                               const MuteStateHandler &handler) override final;
+                               NotiHandler handler) override final;
                virtual void delMuteStateHandler(
-                               const MuteStateHandler &handler) override final;
+                               const NotiHandler &handler) override final;
 
                virtual void addVolumeStateHandler(
-                               const VolumeLevelHandler &handler) override final;
+                               NotiHandler handler) override final;
                virtual void delVolumeStateHandler(
-                               const VolumeLevelHandler &handler) override final;
+                               const NotiHandler &handler) override final;
 
                virtual int getMaxVolume() const override final;
                virtual int getVolume() const override final;
@@ -74,7 +74,7 @@ namespace callui {
 
                virtual bool isBTHeadsetConnected() const override final;
                virtual void addBTHeadsetConnectionChangeHandler(
-                               const NotiHandler &handler) override final;
+                               NotiHandler handler) override final;
                virtual void delBTHeadsetConnectionChangeHandler(
                                const NotiHandler &handler) override final;
 
@@ -89,17 +89,17 @@ namespace callui {
                void onMuteStateChanged(cm_mute_status_e status);
                void onHeadsetConnectionChanged();
 
-               void onBTHeadsetVolumeChanged(int volume);
+               void onBTHeadsetVolumeChanged();
                void onGearVolumeChanged(sound_type_e type, unsigned int volume);
 
        private:
                CallClientSRef m_client;
                BluetoothManagerSRef m_btManager;
-               ucl::Event<AudioStateHandler> m_audioStateEvent;
-               ucl::Event<MuteStateHandler> m_muteStateEvent;
-               ucl::Event<VolumeLevelHandler> m_volumeLevelEvent;
+               ucl::Event<NotiHandler> m_audioStateEvent;
+               ucl::Event<NotiHandler> m_muteStateEvent;
+               ucl::Event<NotiHandler> m_volumeLevelEvent;
                ucl::Event<NotiHandler> m_btVoiceDeviceConnEvent;
-               int m_deviceVolumeCbID;
+               int m_deviceVolumeCbId;
        };
 
 }
index 32c0c4c9443aea9ee1c8358200ae099ba93d4be5..f91a0ad53c93d0c514297735446345ed305a22f1 100644 (file)
@@ -140,10 +140,6 @@ namespace callui {
                HD_VOICE
        };
 
-       using AudioStateHandler = ucl::WeakDelegate<void(AudioStateType)>;
-       using MuteStateHandler = ucl::WeakDelegate<void(bool)>;
-       using VolumeLevelHandler = ucl::WeakDelegate<void(int)>;
-
 }
 
 #endif // __CALL_UI_MODEL_TYPES_H__
index 3cf07f1009e778e7ad76a7a1f20687b3e23cd71e..c27a3c6a02bc706f95b3f54fec276044c687d69e 100644 (file)
@@ -130,7 +130,8 @@ namespace callui {
                FAIL_RETURN(createVolumeControl(),
                                "createVolumeControl() failed");
 
-               updateVolume(m_sm->getVolume());
+
+               updateCurrentVolume();
 
                registerCallbacks();
 
@@ -179,6 +180,8 @@ namespace callui {
        {
                updateMode(cm);
 
+               m_audioState = m_sm->getAudioState();
+
                FAIL_RETURN(updateModeRelativeComponents(cm),
                                "updateModeRelativeComponents() failed");
 
@@ -210,6 +213,9 @@ namespace callui {
 
        Result AccessoryPresenter::setActiveCallCompomnents()
        {
+               updateMaxVolume();
+               updateCurrentVolume();
+
                FAIL_RETURN(createVolumeBtn(), "createVolumeBtn() failed");
                m_widget->setContent(*m_volumeBtn, impl::PART_SWL_SLOT1);
 
@@ -446,6 +452,7 @@ namespace callui {
                } else {
                        auto res = m_sm->setBluetoothState(true);
                        if (res == RES_NOT_CONNECTED) {
+                               DLOG("Launch bluetooth settings...");
                                FAIL_RETURN_VOID(launchBluetoothSettings(),
                                                "launchBluetoothSettings() failed");
                        } else {
@@ -664,25 +671,20 @@ namespace callui {
                }
        }
 
-       void AccessoryPresenter::onAudioStateChanged(AudioStateType state)
+       void AccessoryPresenter::onAudioStateChanged()
        {
+               auto state = m_sm->getAudioState();
                if ((m_audioState != AudioStateType::BT &&
                                state == AudioStateType::BT) ||
                                (m_audioState == AudioStateType::BT &&
                                                state != AudioStateType::BT)) {
-                       m_audioState = state;
 
-                       m_vc->setValue(0);
-                       m_slider->setValue(0);
-
-                       auto maxVol = m_sm->getMaxVolume();
-                       m_vc->setMaxValue(maxVol);
-                       m_slider->setMaxValue(maxVol);
+                       m_audioState = state;
 
-                       updateVolume(m_sm->getVolume());
+                       updateMaxVolume();
+                       updateCurrentVolume();
 
                        if (m_bluetoothBtn) {
-
                                if (m_audioState == AudioStateType::BT) {
                                        m_bluetoothBtn->emit(impl::SIGNAL_TURN_ON);
                                        // Screen Reader
@@ -698,14 +700,14 @@ namespace callui {
                }
        }
 
-       void AccessoryPresenter::updateVolume(int value)
+       void AccessoryPresenter::updateCurrentVolume()
        {
-               m_vc->setValue(value);
-               m_slider->setValue(value);
-
                auto max = m_sm->getMaxVolume();
                auto cur = m_sm->getVolume();
 
+               m_vc->setValue(cur);
+               m_slider->setValue(cur);
+
                if (cur == max) {
                        m_vc->setIncreaseBtnEnable(false);
                        m_vc->setDecreaseBtnEnable(true);
@@ -727,26 +729,35 @@ namespace callui {
                }
        }
 
-       void AccessoryPresenter::onVolumeLevelChanged(int value)
+       void AccessoryPresenter::updateMaxVolume()
        {
-               updateVolume(value);
+               auto max = m_sm->getMaxVolume();
+
+               m_vc->setMaxValue(max);
+               m_slider->setMaxValue(max);
        }
 
-       void AccessoryPresenter::onMuteStateChanged(bool isMuted)
+       void AccessoryPresenter::onVolumeLevelChanged()
+       {
+               updateCurrentVolume();
+       }
+
+       void AccessoryPresenter::onMuteStateChanged()
        {
                if (!m_muteBtn) {
                        return;
                }
+
                if (!elm_object_disabled_get(*m_muteBtn))
-                       updateMuteBtn(isMuted);
+                       updateMuteBtn();
        }
 
-       void AccessoryPresenter::updateMuteBtn(bool isMuted)
+       void AccessoryPresenter::updateMuteBtn()
        {
                if (!m_muteBtn) {
                        return;
                }
-               isMuted ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) :
+               m_sm->getMuteState() ? m_muteBtn->emit(impl::SIGNAL_TURN_ON) :
                                m_muteBtn->emit(impl::SIGNAL_TURN_OFF);
        }
 
index 2fee27045d8f53be1881d55ac5d285ce7913ab48..90b9adc2cee7c2c0436051e82e3ebe393c8eb506 100644 (file)
@@ -112,17 +112,18 @@ namespace callui {
                void tryIncreaseVolume();
                void tryDecreaseVolume();
 
-               void onAudioStateChanged(AudioStateType state);
-               void onVolumeLevelChanged(int value);
-               void onMuteStateChanged(bool isMuted);
-               void updateMuteBtn(bool isMuted);
+               void onAudioStateChanged();
+               void onVolumeLevelChanged();
+               void onMuteStateChanged();
+               void updateMuteBtn();
 
                Eina_Bool onVCTimerCb();
                void startVCTimer();
                void restartVCTimer();
                void stopVCTimer();
 
-               void updateVolume(int value);
+               void updateCurrentVolume();
+               void updateMaxVolume();
 
                void updateMode(const ICallManagerSRef &cm);
                AccessoryPresenter::ComponentsMode getCurrentMode(const ICallManagerSRef &cm);
index a967e861abfd047739d6b0b6c67ffa00c8bfd704..60312253f931c7ccacc426359e5fdcc06120a181 100644 (file)
@@ -181,7 +181,7 @@ namespace callui {
 
                registerCallbacks();
 
-               updateVolume(m_sm->getVolume());
+               updateVolume();
 
                FAIL_RETURN(createAtspiHighlightHelper(),
                                "createAtspiHighlightHelper() failed!");
@@ -444,13 +444,13 @@ namespace callui {
                }
        }
 
-       void KeypadPage::updateVolume(int value)
+       void KeypadPage::updateVolume()
        {
-               m_vc->setValue(value);
-
                auto max = m_sm->getMaxVolume();
                auto cur = m_sm->getVolume();
 
+               m_vc->setValue(cur);
+
                if (cur == max) {
                        m_vc->setIncreaseBtnEnable(false);
                        m_vc->setDecreaseBtnEnable(true);
@@ -469,26 +469,28 @@ namespace callui {
                }
        }
 
-       void KeypadPage::onAudioStateChanged(AudioStateType state)
+       void KeypadPage::updateMaxVolume()
        {
+               m_vc->setMaxValue(m_sm->getMaxVolume());
+       }
+
+       void KeypadPage::onAudioStateChanged()
+       {
+               auto state = m_sm->getAudioState();
                if ((m_audioState != AudioStateType::BT &&
                                state == AudioStateType::BT) ||
                                (m_audioState == AudioStateType::BT &&
                                                state != AudioStateType::BT)) {
                        m_audioState = state;
 
-                       m_vc->setValue(0);
-
-                       auto maxVol = m_sm->getMaxVolume();
-                       m_vc->setMaxValue(maxVol);
-
-                       updateVolume(m_sm->getVolume());
+                       updateMaxVolume();
+                       updateVolume();
                }
        }
 
-       void KeypadPage::onVolumeLevelChanged(int value)
+       void KeypadPage::onVolumeLevelChanged()
        {
-               updateVolume(value);
+               updateVolume();
        }
 
        Eina_Bool KeypadPage::onVCTimerCb()
index 351fb27537213b9b8a217f45a7e8bc86d7cc7534..17f32989ce66dc2ee3d37939c0197218b55d41c3 100644 (file)
@@ -72,7 +72,7 @@ namespace callui {
                void startDtmf(const unsigned char digit);
                void stopDtmf();
 
-               void onAudioStateChanged(AudioStateType state);
+               void onAudioStateChanged();
                void onVolumeControlEventCb(VolumeControl::Event event);
                Eina_Bool onVCTimerCb();
                void startVCTimer();
@@ -80,8 +80,9 @@ namespace callui {
                void stopVCTimer();
                void tryIncreaseVolume();
                void tryDecreaseVolume();
-               void updateVolume(int value);
-               void onVolumeLevelChanged(int value);
+               void updateVolume();
+               void updateMaxVolume();
+               void onVolumeLevelChanged();
                Eina_Bool onRotaryEvent(Eext_Rotary_Event_Info *info);
 
                void registerCallbacks();
index 5e94849e251acbd1020a34dd15b674254c7c4894..7468f036c0d8825c643b0250abe2f8514ce41b97 100644 (file)
@@ -1368,6 +1368,8 @@ namespace callui {
                        DLOG("Accept icon type is already set");
                }
 
+               m_acceptBtnType = type;
+
                if (!m_accIcon) {
                        return;
                }
index 6a76d4d76749b1b7090ae10f3568258ab8e0fde8..0c547f774127b6f6bfd446c9b334b84bc0496ee4 100644 (file)
@@ -25,5 +25,6 @@
         <privilege>http://tizen.org/privilege/notification</privilege>
         <privilege>http://tizen.org/privilege/message.read</privilege>
         <privilege>http://tizen.org/privilege/callhistory.read</privilege>
+        <privilege>http://tizen.org/privilege/bluetooth.admin</privilege>
     </privileges>
 </manifest>