TizenRefApp-8799 [Call UI] Implement showing Voice Control icon on Incoming Call 91/137491/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 5 Jul 2017 11:55:41 +0000 (14:55 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Tue, 11 Jul 2017 04:52:20 +0000 (07:52 +0300)
Change-Id: Ic52c8b5d669a1d6331f1df3173e9a9d2a4b63a77

28 files changed:
edc/indicator.edc
inc/model/IndicatorState.h
inc/model/types.h
inc/presenters/IndicatorPresenter.h
inc/presenters/MainPage.h
inc/types.h
src/model/BatteryStateSource.cpp
src/model/BatteryStateSource.h
src/model/Call.cpp
src/model/Call.h
src/model/ConnectionStateSource.cpp
src/model/ConnectionStateSource.h
src/model/HdVoiceStateSource.cpp
src/model/HdVoiceStateSource.h
src/model/IIndicatorStateSource.h
src/model/IndicatorStateProvider.cpp
src/model/IndicatorStateProvider.h
src/model/RssiStateSource.cpp
src/model/RssiStateSource.h
src/model/SimSlotStateSource.cpp
src/model/SimSlotStateSource.h
src/model/VoiceControlStateProvider.cpp [new file with mode: 0644]
src/model/VoiceControlStateProvider.h [new file with mode: 0644]
src/model/VoiceControlStateSource.cpp [new file with mode: 0644]
src/model/VoiceControlStateSource.h [new file with mode: 0644]
src/model/implTypes.h
src/presenters/IndicatorPresenter.cpp
src/presenters/MainPage.cpp

index 9fa4127c741a41aed0711ecee6068d2e85b2b804..f47ce4b8256b8ccbefa7862a3dc5daeaaf858395 100644 (file)
 #define CU_RSSI_IMAGE_DIR  CU_INDI_ICONS_DIR"/4level"
 #define CU_BATT_IMAGE_DIR  CU_INDI_ICONS_DIR"/Battery"
 
-#define CU_BATT_ICON_H 32
-#define CU_BATT_ICON_W 22
+#define CU_INDI_CENTRAL_ICON_H 32
+#define CU_INDI_CENTRAL_ICON_W 22
 
-#define CU_INDI_ICON_H 26
-#define CU_INDI_ICON_W 24
+#define CU_INDI_REG_ICON_H  26
+#define CU_INDI_REG_ICON_W  24
 
 #define CU_SWL_CONN_COORD_X 104
 #define CU_SWL_CONN_COORD_Y 31
@@ -35,6 +35,9 @@
 #define CU_SWL_BATT_COORD_X 169
 #define CU_SWL_BATT_COORD_Y 14
 
+#define CU_SWL_VC_COORD_X   169
+#define CU_SWL_VC_COORD_Y   14
+
 #define CU_SWL_SIM_COORD_X 201
 #define CU_SWL_SIM_COORD_Y 20
 
 #define CU_SWL_HD_CALL_COORD_Y 31
 
 #define CU_SWL_CONN_REL1 CU_REL_W(CU_SWL_CONN_COORD_X) CU_REL_H(CU_SWL_CONN_COORD_Y)
-#define CU_SWL_CONN_REL2 CU_REL_W((CU_SWL_CONN_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_CONN_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_CONN_REL2 CU_REL_W((CU_SWL_CONN_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_CONN_COORD_Y+CU_INDI_REG_ICON_H))
 
 #define CU_SWL_RSSI_REL1 CU_REL_W(CU_SWL_RSSI_COORD_X) CU_REL_H(CU_SWL_RSSI_COORD_Y)
-#define CU_SWL_RSSI_REL2 CU_REL_W((CU_SWL_RSSI_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_RSSI_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_RSSI_REL2 CU_REL_W((CU_SWL_RSSI_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_RSSI_COORD_Y+CU_INDI_REG_ICON_H))
 
 #define CU_SWL_BATTERY_REL1 CU_REL_W(CU_SWL_BATT_COORD_X) CU_REL_H(CU_SWL_BATT_COORD_Y)
-#define CU_SWL_BATTERY_REL2 CU_REL_W((CU_SWL_BATT_COORD_X+CU_BATT_ICON_W)) CU_REL_H((CU_SWL_BATT_COORD_Y+CU_BATT_ICON_H))
+#define CU_SWL_BATTERY_REL2 CU_REL_W((CU_SWL_BATT_COORD_X+CU_INDI_CENTRAL_ICON_W)) CU_REL_H((CU_SWL_BATT_COORD_Y+CU_INDI_CENTRAL_ICON_H))
+
+#define CU_SWL_VC_REL1 CU_REL_W(CU_SWL_VC_COORD_X) CU_REL_H(CU_SWL_VC_COORD_Y)
+#define CU_SWL_VC_REL2 CU_REL_W((CU_SWL_VC_COORD_X+CU_INDI_CENTRAL_ICON_W)) CU_REL_H((CU_SWL_VC_COORD_Y+CU_INDI_CENTRAL_ICON_H))
 
 #define CU_SWL_SIM_REL1 CU_REL_W(CU_SWL_SIM_COORD_X) CU_REL_H(CU_SWL_SIM_COORD_Y)
-#define CU_SWL_SIM_REL2 CU_REL_W((CU_SWL_SIM_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_SIM_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_SIM_REL2 CU_REL_W((CU_SWL_SIM_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_SIM_COORD_Y+CU_INDI_REG_ICON_H))
 
 #define CU_SWL_HD_CALL_REL1 CU_REL_W(CU_SWL_HD_CALL_COORD_X) CU_REL_H(CU_SWL_HD_CALL_COORD_Y)
-#define CU_SWL_HD_CALL_REL2 CU_REL_W((CU_SWL_HD_CALL_COORD_X+CU_INDI_ICON_W)) CU_REL_H((CU_SWL_HD_CALL_COORD_Y+CU_INDI_ICON_H))
+#define CU_SWL_HD_CALL_REL2 CU_REL_W((CU_SWL_HD_CALL_COORD_X+CU_INDI_REG_ICON_W)) CU_REL_H((CU_SWL_HD_CALL_COORD_Y+CU_INDI_REG_ICON_H))
 
 // Indicator main layout
 
@@ -86,6 +92,13 @@ group { "elm/layout/callui/indicator";
                                rel2 { relative: CU_SWL_BATTERY_REL2; to: "bg"; }
                        }
                }
+               swallow { "swl.voice_control";
+                       scale;
+                       desc { "default";
+                               rel1 { relative: CU_SWL_VC_REL1; to: "bg"; }
+                               rel2 { relative: CU_SWL_VC_REL2; to: "bg"; }
+                       }
+               }
                swallow { "swl.sim";
                        scale;
                        desc { "default";
@@ -108,7 +121,7 @@ group { "elm/layout/callui/indicator";
 #define CU_DESC_CONN_IMAGE(_value) \
        desc { "state_"_value; \
                inherit: "default"; \
-               visible: 1; \
+               vis; \
                image.normal: CU_CONN_IMAGE_DIR"/"_value".png"; \
        } \
 
@@ -151,12 +164,12 @@ group { "elm/layout/callui/connection";
                image { "img.connection_type";
                        scale;
                        desc { "default";
-                               min: CU_INDI_ICON_W CU_INDI_ICON_H;
-                               max: CU_INDI_ICON_W CU_INDI_ICON_H;
+                               min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+                               max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
                                fixed: 1 1;
                                image.normal: CU_CONN_IMAGE_DIR"/edge_connected.png";
                                color_class: "AO0111";
-                               visible: 0;
+                               hid;
                        }
                        CU_DESC_CONN_IMAGE("edge_connected");
                        CU_DESC_CONN_IMAGE("gprs_connected");
@@ -174,11 +187,11 @@ group { "elm/layout/callui/connection";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_INDI_ICON_W CU_INDI_ICON_H;
-                               max: CU_INDI_ICON_W CU_INDI_ICON_H;
+                               min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+                               max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
                                image.normal: CU_CONN_IMAGE_DIR"/no_inout_connected.png";
                                color_class: "AO0111";
-                               visible: 0;
+                               hid;
                        }
                        CU_DESC_CONN_IMAGE("no_inout_connected");
                        CU_DESC_CONN_IMAGE("in_connected");
@@ -272,8 +285,8 @@ group { "elm/layout/callui/rssi";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_INDI_ICON_W CU_INDI_ICON_H;
-                               max: CU_INDI_ICON_W CU_INDI_ICON_H;
+                               min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+                               max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
                                image.normal: CU_INDI_ICONS_DIR"/b_ic_indicator_02.png";
                                color_class: "AO0111";
                        }
@@ -296,7 +309,7 @@ group { "elm/layout/callui/rssi";
                        }
                        desc { "none";
                                inherit: "default";
-                               visible: 0;
+                               hid;
                        }
                }
        }
@@ -381,8 +394,8 @@ group { "elm/layout/callui/battery";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_BATT_ICON_W CU_BATT_ICON_H;
-                               max: CU_BATT_ICON_W CU_BATT_ICON_H;
+                               min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+                               max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
                                image.normal: CU_BATT_IMAGE_DIR"/battery_bg.png";
                                color_class: "AO0111";
                        }
@@ -391,14 +404,14 @@ group { "elm/layout/callui/battery";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_BATT_ICON_W CU_BATT_ICON_H;
-                               max: CU_BATT_ICON_W CU_BATT_ICON_H;
+                               min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+                               max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
                                image.normal: CU_BATT_IMAGE_DIR"/battery_50.png";
                                color_class: "AO0111";
                        }
                        desc { "batt_lvl_hide";
                                inherit: "default";
-                               visible: 0;
+                               hid;
                        }
                        DESCRIPTION_BATTERY(05);
                        DESCRIPTION_BATTERY(10);
@@ -425,33 +438,33 @@ group { "elm/layout/callui/battery";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_BATT_ICON_W CU_BATT_ICON_H;
-                               max: CU_BATT_ICON_W CU_BATT_ICON_H;
+                               min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+                               max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
                                image.normal: CU_BATT_IMAGE_DIR"/battery_00.png";
                                color_class: "AO0111";
-                               visible: 0;
+                               hid;
                        }
                        desc { "low_battery";
                                inherit: "default";
-                               visible: 1;
+                               vis;
                        }
                        desc { "charging";
                                inherit: "default";
                                image.normal: CU_BATT_IMAGE_DIR"/battery_charging.png";
                                color_class: "AO0251";
-                               visible: 1;
+                               vis;
                        }
                        desc { "charging_problem";
                                inherit: "default";
                                image.normal: CU_BATT_IMAGE_DIR"/battery_not_charging.png";
                                color_class: "AO0254";
-                               visible: 1;
+                               vis;
                        }
                        desc { "unknown";
                                inherit: "default";
                                image.normal: CU_BATT_IMAGE_DIR"/battery_unknown.png";
                                color_class: "AO0251";
-                               visible: 1;
+                               vis;
                        }
                }
        }
@@ -511,6 +524,26 @@ group { "elm/layout/callui/battery";
        }
 }
 
+// Voice Control
+
+group { "elm/layout/callui/voice_control";
+       images {
+               image: CU_INDI_ICONS_DIR"/indi_voice_control.png" COMP;
+       }
+       parts {
+               image { "img.voice_control";
+                       scale;
+                       desc { "default";
+                               fixed: 1 1;
+                               min: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+                               max: CU_INDI_CENTRAL_ICON_W CU_INDI_CENTRAL_ICON_H;
+                               image.normal: CU_INDI_ICONS_DIR"/indi_voice_control.png";
+                               color_class: "AO0111";
+                       }
+               }
+       }
+}
+
 // SIM
 
 group { "elm/layout/callui/sim";
@@ -526,38 +559,38 @@ group { "elm/layout/callui/sim";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_INDI_ICON_W CU_INDI_ICON_H;
-                               max: CU_INDI_ICON_W CU_INDI_ICON_H;
+                               min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+                               max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
                                image.normal: CU_INDI_ICONS_DIR"/indi_gear_sim_call.png";
                                color_class: "AO0111";
-                               visible: 0;
+                               hid;
                        }
                        desc { "unknown";
                                inherit: "default";
                        }
                        desc { "gear_sim_call";
                                inherit: "default";
-                               visible: 1;
+                               vis;
                        }
                        desc { "forwarded_call";
                                inherit: "default";
                                image.normal: CU_INDI_ICONS_DIR"/indi_forwarded_call.png";
-                               visible: 1;
+                               vis;
                        }
                        desc { "mobile_sim_call";
                                inherit: "default";
                                image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_call.png";
-                               visible: 1;
+                               vis;
                        }
                        desc { "mobile_sim_01";
                                inherit: "default";
                                image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_01.png";
-                               visible: 1;
+                               vis;
                        }
                        desc { "mobile_sim_02";
                                inherit: "default";
                                image.normal: CU_INDI_ICONS_DIR"/indi_mobile_sim_02.png";
-                               visible: 1;
+                               vis;
                        }
                }
        }
@@ -612,18 +645,18 @@ group { "elm/layout/callui/hd_voice";
                        scale;
                        desc { "default";
                                fixed: 1 1;
-                               min: CU_INDI_ICON_W CU_INDI_ICON_H;
-                               max: CU_INDI_ICON_W CU_INDI_ICON_H;
+                               min: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
+                               max: CU_INDI_REG_ICON_W CU_INDI_REG_ICON_H;
                                image.normal: CU_INDI_ICONS_DIR"/indi_hd_voice_call.png";
                                color_class: "AO0111";
-                               visible: 0;
+                               hid;
                        }
                        desc { "disabled";
                                inherit: "default";
                        }
                        desc { "enabled";
                                inherit: "default";
-                               visible: 1;
+                               vis;
                        }
                }
        }
index b0a4d5d9759e674591cf816a152e8a58682f40c1..da7e45fd8f5fd0c72de7db4c87020e883a300052 100644 (file)
@@ -31,6 +31,7 @@ namespace callui {
        bool getRoamingState(IndicatorState state);
        int getBatteryLevel(IndicatorState state);
        BatteryState getBatteryState(IndicatorState state);
+       bool getVoiceControlState(IndicatorState state);
        SimSlot getSimSlotType(IndicatorState state);
        bool getSimForwardState(IndicatorState state);
        bool getHDVoiceState(IndicatorState state);
index e6b1f5759ae0871708106298253884f0544fdc28..ea83dc292173843449a1fedd6fc5c01e07b17a0f 100644 (file)
@@ -135,6 +135,7 @@ namespace callui {
                NW_CONNECTION = 0,
                RSSI,
                BATTERY,
+               VOICE_CONTROL,
                SIM_SLOT,
                HD_VOICE
        };
index 6492a11df2068b803de644ebcbe7166630f0d447..b0ac5dd95d135c370c812f080d3ad7aadd57cc9b 100644 (file)
@@ -50,6 +50,8 @@ namespace callui {
 
                ucl::Widget &getWidget();
 
+               void udapteIncomingCallMode(bool isIncomingCallMode);
+
        private:
                friend class ucl::ReffedObj<IndicatorPresenter>;
                IndicatorPresenter(ucl::IRefCountObj &rc,
@@ -61,6 +63,7 @@ namespace callui {
                ucl::Result createConnectionLayout();
                ucl::Result createRssiLayout();
                ucl::Result createBatteryLayout();
+               ucl::Result createVoiceControlLayout();
                ucl::Result createSimLayout();
                ucl::Result createHdVoiceLayout();
 
@@ -70,6 +73,8 @@ namespace callui {
                void updateSimState();
                void updateHdVoiceState();
 
+               void updateCentralIcon();
+
                // IIndicatorStateListener
 
                virtual void onStateChanged(IndicatorProperty property) override final;
@@ -81,7 +86,9 @@ namespace callui {
                ucl::LayoutSRef m_batteryLayout;
                ucl::LayoutSRef m_simLayout;
                ucl::LayoutSRef m_hdCallLayout;
+               ucl::LayoutSRef m_voiceControlLayout;
                IIndicatorStateProviderSRef m_provider;
+               bool m_isIncomingCallMode;
        };
 
        ucl::EdjeSignal getConnectionSignal(ConnectionType type);
index 610b7893fa8d512c92c3873ea3865581cfc9ff07..1d3ae89d9906b0e4293821b3a72dbddf5cc89d80 100644 (file)
@@ -57,7 +57,11 @@ namespace callui {
                ucl::Result showWindow();
                void updateCallMode();
 
-               ucl::Result processIncomingCall();
+               ucl::Result processIncomingCallMode();
+               void resetIncomingCallMode();
+               ucl::Result processRegularCallModes();
+               void resetRegularCallModes();
+
                ucl::Result createAcceptRejectPresenter();
                ucl::Result createRejectMsgPresenter(const IRejectMsgProviderSRef &provider);
                void RejectMsgStateCb(RejectMsgState state);
index 890fc083df487dfda10e7a60d70c0328060d57fc..6bf8e12b48a65225fbaac03f6f750ebae5ca0e66 100644 (file)
@@ -22,6 +22,7 @@
 #include "ucl/util/types.h"
 #include "ucl/util/memory.h"
 #include "ucl/util/delegation.h"
+#include "ucl/util/smartDelegation.h"
 #include "ucl/misc/RefCountAware.h"
 
 namespace callui {
@@ -34,6 +35,8 @@ namespace callui {
                RES_OPERATION_FAILED    = ucl::_RES_BEGIN - 4,
                RES_NOT_CONNECTED       = ucl::_RES_BEGIN - 5
        };
+
+       using NotiHandler = ucl::WeakDelegate<void()>;
 }
 
 #endif // __CALLUI_TYPES_H__
index 6c146a1a82ea904bca5ec6ffb8d7093ab64e6e68..6eb2769632d7638898a4f39f59b302b15c57558a 100644 (file)
@@ -178,7 +178,7 @@ namespace callui {
                return {m_bits.value};
        }
 
-       void BatteryStateSource::setStateChangeHandler(StateChangeHandler handler)
+       void BatteryStateSource::setStateChangeHandler(const NotiHandler &handler)
        {
                m_handler = handler;
        }
index 4506e566dd3fe33573b393ebb252eedcf53d3258..09c2a799c23a04c3d0f18060676834f6ce411592 100644 (file)
@@ -33,7 +33,7 @@ namespace callui {
                // IIndicatorStateSource
 
                virtual IndicatorState getState() const override final;
-               virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+               virtual void setStateChangeHandler(const NotiHandler &handler) override final;
 
        private:
                friend class ucl::ReffedObj<BatteryStateSource>;
@@ -68,7 +68,7 @@ namespace callui {
 
        private:
                Bits m_bits;
-               StateChangeHandler m_handler;
+               NotiHandler m_handler;
        };
 
 }
index dce95a00494787087a46e97e68884f481fac80ab..e54cd56058e59d4f657dfde99508e768d5a209c4 100644 (file)
 #include "CallClient.h"
 #include "CallManager.h"
 #include "SoundManager.h"
+
+#include "VoiceControlStateProvider.h"
 #include "IndicatorStateProvider.h"
+
 #include "ConnectionStateSource.h"
 #include "RssiStateSource.h"
 #include "BatteryStateSource.h"
+#include "VoiceControlStateSource.h"
 #include "SimSlotStateSource.h"
 #include "HdVoiceStateSource.h"
 
@@ -129,20 +133,30 @@ namespace callui {
        {
                auto callClient = CallClient::newInstance();
                if (!callClient) {
-                       LOG_RETURN(RES_FAIL, "Client::newInstance() failed!");
+                       LOG_RETURN(RES_FAIL,
+                                       "Client::newInstance() failed!");
                }
 
                m_callManager = CallManager::newInstance(callClient, asWeak(*this));
                if (!m_callManager) {
-                       LOG_RETURN(RES_FAIL, "CallManager::newInstance() failed!");
+                       LOG_RETURN(RES_FAIL,
+                                       "CallManager::newInstance() failed!");
                }
 
                m_soundManager = SoundManager::newInstance(callClient);
                if (!m_soundManager) {
-                       LOG_RETURN(RES_FAIL, "SoundManage::newInstance() failed!");
+                       LOG_RETURN(RES_FAIL,
+                                       "SoundManage::newInstance() failed!");
                }
 
-               FAIL_RETURN(initInidcatorStateProvider(), "Init Indicator State Provider failed!");
+               m_voiceControlPrv = VoiceControlStateProvider::newInstance();
+               if (!m_voiceControlPrv) {
+                       LOG_RETURN(RES_FAIL,
+                                       "VoiceControlStateProvider::newInstance() failed!");
+               }
+
+               FAIL_RETURN(initInidcatorStateProvider(),
+                               "Init Indicator State Provider failed!");
 
                return RES_OK;
        }
@@ -181,6 +195,16 @@ namespace callui {
                                IndicatorProperty::BATTERY, batteryStSrc),
                                "setStateSource() failed!");
 
+               auto voiceControlStSrc =
+                               VoiceControlStateSource::newInstance(m_voiceControlPrv);
+               if (!voiceControlStSrc) {
+                       LOG_RETURN(RES_FAIL,
+                                       "VoiceControlStateSource::newInstance() failed!");
+               }
+               FAIL_RETURN(m_indicatorStPrv->setStateSource(
+                               IndicatorProperty::VOICE_CONTROL, voiceControlStSrc),
+                               "setStateSource() failed!");
+
                m_simSlotStSrc = makeShared<SimSlotStateSource>(
                                m_callManager->getSimSlot(), getForwardedCallStatus());
                FAIL_RETURN(m_indicatorStPrv->setStateSource(
index 4459f54312bbce0917b07375c0bc91a29f40a683..cc185760a546f93df0d6e60765e9e24594ccdf4d 100644 (file)
@@ -71,6 +71,7 @@ namespace callui {
                SimSlotStateSourceSRef m_simSlotStSrc;
                HdVoiceStateSourceSRef m_hdCallStSrc;
                IndicatorStateProviderSRef m_indicatorStPrv;
+               VoiceControlStateProviderSRef m_voiceControlPrv;
        };
 
 }
index ff33839db919c231bf15416c02274779492b4b50..d2399e51d9bff08b930d40929f983cea2b13f1ba 100644 (file)
@@ -347,7 +347,7 @@ namespace callui {
                return {m_bits.value};
        }
 
-       void ConnectionStateSource::setStateChangeHandler(StateChangeHandler handler)
+       void ConnectionStateSource::setStateChangeHandler(const NotiHandler &handler)
        {
                m_handler = handler;
        }
index f8dad33f0c68e58815cb2b9440a2539b543068bf..041e3976146c8e3771b0f25e68fc060978b290e3 100644 (file)
@@ -33,7 +33,7 @@ namespace callui {
                // IIndicatorStateSource
 
                virtual IndicatorState getState() const override final;
-               virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+               virtual void setStateChangeHandler(const NotiHandler &handler) override final;
 
        private:
                friend class ucl::ReffedObj<ConnectionStateSource>;
@@ -76,7 +76,7 @@ namespace callui {
 
        private:
                Bits m_bits;
-               StateChangeHandler m_handler;
+               NotiHandler m_handler;
        };
 
 }
index 396ee05c3fbc567dbed95703152f074133cffbb9..90df2820c22fea1332d6e089ffdc1bd859384e39 100644 (file)
@@ -62,7 +62,7 @@ namespace callui {
                return {m_bits.value};
        }
 
-       void HdVoiceStateSource::setStateChangeHandler(StateChangeHandler handler)
+       void HdVoiceStateSource::setStateChangeHandler(const NotiHandler &handler)
        {
                m_handler = handler;
        }
index 678fad6cb89cb1ea83e9b0cb9de9bbc6b225d0e6..7b98b7e0e8b3fedd351b2c48ec8b96b39fe70c6d 100644 (file)
@@ -30,7 +30,7 @@ namespace callui {
                // IIndicatorStateSource
 
                virtual IndicatorState getState() const override final;
-               virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+               virtual void setStateChangeHandler(const NotiHandler &handler) override final;
 
        public:
                union Bits {
@@ -46,7 +46,7 @@ namespace callui {
 
        private:
                Bits m_bits;
-               StateChangeHandler m_handler;
+               NotiHandler m_handler;
        };
 
 }
index d334a173da5941a4027b8eb10ce8b4125e6fc581..53eb2cc5e30cdd2df2402b9cf8362da4c9284f48 100644 (file)
@@ -26,7 +26,7 @@ namespace callui {
        class IIndicatorStateSource : public ucl::Polymorphic {
        public:
                virtual IndicatorState getState() const = 0;
-               virtual void setStateChangeHandler(StateChangeHandler handler) = 0;
+               virtual void setStateChangeHandler(const NotiHandler &handler) = 0;
        };
 }
 
index 6175f7110bebde7b4bc997cb69cc46ae7a038049..4ef85e79721c2ce36cdb727821cd9bb54a4aebe7 100644 (file)
@@ -38,7 +38,8 @@ namespace callui {
                        m_source(source)
                {
                        m_source->setStateChangeHandler(
-                                       WEAK_DELEGATE(SourceHandler::onStateChanged, asWeak(*this)));
+                                       WEAK_DELEGATE(SourceHandler::onStateChanged,
+                                                       asWeak(*this)));
                }
 
                IndicatorState getState() const
@@ -85,17 +86,20 @@ namespace callui {
                return RES_OK;
        }
 
-       IndicatorState IndicatorStateProvider::getState(IndicatorProperty property) const
+       IndicatorState IndicatorStateProvider::getState(
+                       IndicatorProperty property) const
        {
                return m_sources[convertEnumValueToInt(property)]->getState();
        }
 
-       void IndicatorStateProvider::setListener(IIndicatorStateListenerWRef listener)
+       void IndicatorStateProvider::setListener(
+                       IIndicatorStateListenerWRef listener)
        {
                m_listener = listener;
        }
 
-       void IndicatorStateProvider::dispatchStateChanged(IndicatorProperty property) const
+       void IndicatorStateProvider::dispatchStateChanged(
+                       IndicatorProperty property) const
        {
                if (const auto listener = m_listener.lock()) {
                        listener->onStateChanged(property);
index 3c3a6ab50714d8eb7cf0e5c3839b87340c2e5063..fd091a6622815ead36c7fa82a3266f6305343c6e 100644 (file)
@@ -47,7 +47,7 @@ namespace callui {
 
        private:
                enum {
-                       STATE_COUNT = 5
+                       STATE_COUNT = 6
                };
 
                class SourceHandler;
index ef83230f7611fe22eb62d55f595b7163a8279f3f..71ce4d1d702d5616be0337ae089ebb8cbb800b4b 100644 (file)
@@ -205,7 +205,7 @@ namespace callui {
                return {m_bits.value};
        }
 
-       void RssiStateSource::setStateChangeHandler(StateChangeHandler handler)
+       void RssiStateSource::setStateChangeHandler(const NotiHandler &handler)
        {
                m_handler = handler;
        }
index 70747d16416cff8a984febedbe6779b97a75e060..967bf25e899b60d65105f9b38e3a3100877f76c8 100644 (file)
@@ -33,7 +33,7 @@ namespace callui {
                // IIndicatorStateSource
 
                virtual IndicatorState getState() const override final;
-               virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+               virtual void setStateChangeHandler(const NotiHandler &handler) override final;
 
        private:
                friend class ucl::ReffedObj<RssiStateSource>;
@@ -67,7 +67,7 @@ namespace callui {
 
        private:
                Bits m_bits;
-               StateChangeHandler m_handler;
+               NotiHandler m_handler;
        };
 
 }
index a5fe2dec0bd60bca57e71ffb5dfc57640def2dd7..e65f4b7d6724a944e70a4ebaec810dd898c53e3f 100644 (file)
@@ -72,7 +72,7 @@ namespace callui {
                return {m_bits.value};
        }
 
-       void SimSlotStateSource::setStateChangeHandler(StateChangeHandler handler)
+       void SimSlotStateSource::setStateChangeHandler(const NotiHandler &handler)
        {
                m_handler = handler;
        }
index 836c406c31ddffcfe862eca4d7dcc84e5762f183..686eb015b92036c4651ea46ea26f4092c4248fdd 100644 (file)
@@ -30,14 +30,14 @@ namespace callui {
                // IIndicatorStateSource
 
                virtual IndicatorState getState() const override final;
-               virtual void setStateChangeHandler(StateChangeHandler handler) override final;
+               virtual void setStateChangeHandler(const NotiHandler &handler) override final;
 
                public:
                        union Bits {
                                struct {
                                        uint8_t property : 4;
                                        uint8_t simSlot : 4;
-                                       bool isForwarded: 1;
+                                       uint8_t isForwarded: 1;
                                };
                                uint64_t value;
 
@@ -47,7 +47,7 @@ namespace callui {
 
                private:
                        Bits m_bits;
-                       StateChangeHandler m_handler;
+                       NotiHandler m_handler;
        };
 
 }
diff --git a/src/model/VoiceControlStateProvider.cpp b/src/model/VoiceControlStateProvider.cpp
new file mode 100644 (file)
index 0000000..d52999d
--- /dev/null
@@ -0,0 +1,121 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VoiceControlStateProvider.h"
+
+#include "common.h"
+
+// Temporary until VCONFLAG will not be added to a system
+#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL
+
+namespace callui {
+
+       using namespace ucl;
+
+       VoiceControlStateProvider::VoiceControlStateProvider():
+               m_enableState(false)
+       {
+       }
+
+       VoiceControlStateProvider::~VoiceControlStateProvider()
+       {
+               delSysStateCallback();
+       }
+
+       VoiceControlStateProviderSRef VoiceControlStateProvider::newInstance()
+       {
+               auto result = makeShared<VoiceControlStateProvider>();
+               FAIL_RETURN_VALUE(result->prepare(), {}, "result->prepare() failed!");
+               return result;
+       }
+
+       Result VoiceControlStateProvider::prepare()
+       {
+               FAIL_RETURN(addSysStateCallback(),
+                               "addSysStateCallbacks() failed!");
+
+               FAIL_RETURN(initState(), "initState() failed!");
+               return RES_OK;
+       }
+
+       Result VoiceControlStateProvider::initState()
+       {
+               auto val = 0;
+               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+                       LOG_RETURN(RES_FAIL, "vconf_get_bool() failed!");
+               }
+               updateState(val);
+
+               return RES_OK;
+       }
+
+       bool VoiceControlStateProvider::getState() const
+       {
+               return m_enableState;
+       }
+
+       void VoiceControlStateProvider::addStateChangeHandler(
+                       const NotiHandler &handler)
+       {
+               m_event += handler;
+       }
+
+       void VoiceControlStateProvider::removeStateChangeHandler(
+                       const NotiHandler &handler)
+       {
+               m_event -= handler;
+       }
+
+       Result VoiceControlStateProvider::addSysStateCallback()
+       {
+               if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+                               CALLBACK_B(VoiceControlStateProvider::onStateChanged),
+                               this) != 0) {
+                       LOG_RETURN(RES_FAIL, "vconf_notify_key_changed() failed");
+               }
+               return RES_OK;
+       }
+
+       void VoiceControlStateProvider::delSysStateCallback()
+       {
+               vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+                               CALLBACK_B(VoiceControlStateProvider::onStateChanged));
+       }
+
+       void VoiceControlStateProvider::onStateChanged(
+                       keynode_t *node)
+       {
+               auto val = 0;
+               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+                       LOG_RETURN_VOID(RES_FAIL, "vconf_get_bool() failed!");
+               }
+
+               if (updateState(val) && !m_event.isEmpty()) {
+                       m_event.dispatch();
+               }
+       }
+
+       bool VoiceControlStateProvider::updateState(bool isEnable)
+       {
+               if (m_enableState != isEnable) {
+                       m_enableState = isEnable;
+                       return true;
+               }
+               return false;
+       }
+
+
+}
diff --git a/src/model/VoiceControlStateProvider.h b/src/model/VoiceControlStateProvider.h
new file mode 100644 (file)
index 0000000..f0d493c
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
+#define __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
+
+#include <vconf.h>
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class VoiceControlStateProvider final {
+       public:
+               static VoiceControlStateProviderSRef newInstance();
+               virtual ~VoiceControlStateProvider();
+
+               bool getState() const;
+               void addStateChangeHandler(const NotiHandler &handler);
+               void removeStateChangeHandler(const NotiHandler &handler);
+
+       private:
+               friend class ucl::ReffedObj<VoiceControlStateProvider>;
+               VoiceControlStateProvider();
+
+               ucl::Result prepare();
+
+               ucl::Result addSysStateCallback();
+               void delSysStateCallback();
+               ucl::Result initState();
+               bool updateState(bool isEnable);
+
+               void onStateChanged(keynode_t *node);
+
+       private:
+               bool m_enableState;
+               ucl::Event<NotiHandler> m_event;
+       };
+
+}
+
+#endif // __CALLUI_MODEL_VOICE_CONTROL_STATE_PROVIDER_H__
diff --git a/src/model/VoiceControlStateSource.cpp b/src/model/VoiceControlStateSource.cpp
new file mode 100644 (file)
index 0000000..5009110
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "VoiceControlStateSource.h"
+
+#include "VoiceControlStateProvider.h"
+
+#include "common.h"
+
+namespace callui {
+
+       using namespace ucl;
+
+       VoiceControlStateSource::Bits::Bits():
+               property(convertEnumValueToInt(IndicatorProperty::VOICE_CONTROL)),
+               isEnable(0)
+       {
+       }
+
+       VoiceControlStateSource::Bits::Bits(const IndicatorState &state):
+                       value(state.value)
+       {
+               if (property != convertEnumValueToInt(
+                               IndicatorProperty::VOICE_CONTROL)) {
+                       ELOG("State of incorrect property type [%d]", property);
+                       *this = {};
+               }
+       }
+
+       VoiceControlStateSource::VoiceControlStateSource(IRefCountObj &rc,
+                       const VoiceControlStateProviderSRef &provider):
+               RefCountAware(&rc),
+               m_vcProvider(provider)
+       {
+               m_vcProvider->addStateChangeHandler(WEAK_DELEGATE(
+                               VoiceControlStateSource::onStateChangedEvent,
+                               asWeak(*this)));
+
+               updateStateBits(m_vcProvider->getState());
+       }
+
+       VoiceControlStateSource::~VoiceControlStateSource()
+       {
+               m_vcProvider->removeStateChangeHandler(WEAK_DELEGATE(
+                               VoiceControlStateSource::onStateChangedEvent,
+                               asWeak(*this)));
+       }
+
+       VoiceControlStateSourceSRef VoiceControlStateSource::newInstance(
+                       const VoiceControlStateProviderSRef &provider)
+       {
+               if (!provider) {
+                       LOG_RETURN_VALUE(RES_FAIL, {}, "provider is NULL");
+               }
+
+               return makeShared<VoiceControlStateSource>(provider);
+       }
+
+       void VoiceControlStateSource::onStateChangedEvent()
+       {
+               if (updateStateBits(m_vcProvider->getState()) && m_handler) {
+                       m_handler();
+               }
+       }
+
+       Result VoiceControlStateSource::initState()
+       {
+               updateStateBits(m_vcProvider->getState());
+               return RES_OK;
+       }
+
+       IndicatorState VoiceControlStateSource::getState() const
+       {
+               return {m_bits.value};
+       }
+
+       void VoiceControlStateSource::setStateChangeHandler(
+                       const NotiHandler &handler)
+       {
+               m_handler = handler;
+       }
+
+       bool VoiceControlStateSource::updateStateBits(bool isEnable)
+       {
+               if (m_bits.isEnable != isEnable) {
+                       m_bits.isEnable = isEnable;
+                       return true;
+               }
+               return false;
+       }
+
+       bool getVoiceControlState(IndicatorState state)
+       {
+               return VoiceControlStateSource::Bits(state).isEnable;
+       }
+
+}
diff --git a/src/model/VoiceControlStateSource.h b/src/model/VoiceControlStateSource.h
new file mode 100644 (file)
index 0000000..b0864bb
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2017 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://floralicense.org/license/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__
+#define __CALLUI_VOICE_CONTROL_STATE_SOURCE_H__
+
+#include "IIndicatorStateSource.h"
+
+#include <vconf.h>
+
+#include "implTypes.h"
+
+namespace callui {
+
+       class VoiceControlStateSource final :
+               public IIndicatorStateSource,
+               public ucl::RefCountAware {
+       public:
+               static VoiceControlStateSourceSRef newInstance(
+                               const VoiceControlStateProviderSRef &provider);
+               virtual ~VoiceControlStateSource();
+
+               // IIndicatorStateSource
+
+               virtual IndicatorState getState() const override final;
+               virtual void setStateChangeHandler(
+                               const NotiHandler &handler) override final;
+
+       private:
+               friend class ucl::ReffedObj<VoiceControlStateSource>;
+               VoiceControlStateSource(ucl::IRefCountObj &rc,
+                               const VoiceControlStateProviderSRef &provider);
+
+               ucl::Result prepare();
+
+               void onStateChangedEvent();
+               ucl::Result initState();
+               bool updateStateBits(bool isEnable);
+
+       public:
+               union Bits {
+                       struct {
+                               uint8_t property : 4;
+                               uint8_t isEnable : 1;
+                       };
+                       uint64_t value;
+
+                       Bits();
+                       Bits(const IndicatorState &state);
+               };
+
+       private:
+               Bits m_bits;
+               NotiHandler m_handler;
+               VoiceControlStateProviderSRef m_vcProvider;
+       };
+
+}
+
+#endif // __CALLUI_VOICE_ANSWER_STATE_SOURCE_H__
index e025c84ac4a51a28162f49e240677ee63a1e7a41..9575717192a8f2f68eba620e0caea85506d6f8c8 100644 (file)
@@ -66,6 +66,9 @@ namespace callui {
        UCL_DECLARE_REF_ALIASES(BatteryStateSource);
        UCL_DECLARE_REF_ALIASES(SimSlotStateSource);
        UCL_DECLARE_REF_ALIASES(HdVoiceStateSource);
+       UCL_DECLARE_REF_ALIASES(VoiceControlStateSource);
+
+       UCL_DECLARE_REF_ALIASES(VoiceControlStateProvider);
 
        UCL_DECLARE_REF_ALIASES(ContactInfoProvider);
 
@@ -75,8 +78,6 @@ namespace callui {
        using MuteStateEvent = ucl::Event<MuteStateHandler>;
        using VolumeLevelEvent = ucl::Event<VolumeLevelHandler>;
 
-       using StateChangeHandler = ucl::WeakDelegate<void()>;
-
        using BluetoothVolumeHandler = ucl::WeakDelegate<void(int)>;
 }
 
index 7ec1d57fda18d3a0ce5d4fd4f8b23c6775068be3..3ef7cb85e55b86e516f760aff3776cad8f8a5843 100644 (file)
@@ -45,12 +45,15 @@ namespace callui { namespace { namespace impl {
        constexpr LayoutTheme LAYOUT_HD_CALL
                        {"layout", "callui", "hd_voice"};
 
+       constexpr LayoutTheme LAYOUT_VOICE_CONTROL
+                       {"layout", "callui", "voice_control"};
 
-       constexpr EdjePart PART_CONNECTION {"swl.connection"};
-       constexpr EdjePart PART_RSSI {"swl.rssi"};
-       constexpr EdjePart PART_BATTERY {"swl.battery"};
-       constexpr EdjePart PART_SIM {"swl.sim"};
-       constexpr EdjePart PART_HD_VOICE {"swl.hd_voice"};
+       constexpr EdjePart PART_SWL_CONN {"swl.connection"};
+       constexpr EdjePart PART_SWL_RSSI {"swl.rssi"};
+       constexpr EdjePart PART_SWL_BATTERY {"swl.battery"};
+       constexpr EdjePart PART_SWL_VOICE_CONTROL {"swl.voice_control"};
+       constexpr EdjePart PART_SWL_SIM {"swl.sim"};
+       constexpr EdjePart PART_SWL_HD_VOICE {"swl.hd_voice"};
 
        constexpr EdjeSignal SIGL_BATT_LVL_HIDE {"batt_lvl_hide"};
 
@@ -200,7 +203,8 @@ namespace callui {
        IndicatorPresenter::IndicatorPresenter(IRefCountObj &rc,
                        const IIndicatorStateProviderSRef &provider):
                                        Presenter(rc),
-                                       m_provider(provider)
+                                       m_provider(provider),
+                                       m_isIncomingCallMode(false)
        {
        }
 
@@ -213,25 +217,23 @@ namespace callui {
        {
                FAIL_RETURN(Presenter::prepare(parent, PF_PASSIVE),
                                "Presenter::prepare() failed!");
-
                FAIL_RETURN(createWidget(parentWidget),
                                "createWidget() failed!");
-
                FAIL_RETURN(createConnectionLayout(),
                                "createConnectionLayout() failed!");
-
                FAIL_RETURN(createRssiLayout(),
                                "createRssiLayout() failed!");
-
                FAIL_RETURN(createBatteryLayout(),
                                "createBatteryLayout() failed!");
-
+               FAIL_RETURN(createVoiceControlLayout(),
+                               "createBatteryLayout() failed!");
                FAIL_RETURN(createSimLayout(),
                                "createSimLayout() failed!");
-
                FAIL_RETURN(createHdVoiceLayout(),
                                "createHdCallLayout() failed!");
 
+               updateCentralIcon();
+
                m_provider->setListener(asWeak(*this));
 
                return RES_OK;
@@ -258,7 +260,7 @@ namespace callui {
                if (!m_connLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
-               m_widget->setContent(*m_connLayout, impl::PART_CONNECTION);
+               m_widget->setContent(*m_connLayout, impl::PART_SWL_CONN);
 
                updateConnectionState();
 
@@ -273,7 +275,7 @@ namespace callui {
                if (!m_rssiLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
-               m_widget->setContent(*m_rssiLayout, impl::PART_RSSI);
+               m_widget->setContent(*m_rssiLayout, impl::PART_SWL_RSSI);
 
                updateRssiState();
 
@@ -288,13 +290,27 @@ namespace callui {
                if (!m_batteryLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
-               m_widget->setContent(*m_batteryLayout, impl::PART_BATTERY);
+               m_widget->setContent(*m_batteryLayout, impl::PART_SWL_BATTERY);
 
                updateBatteryState();
 
                return RES_OK;
        }
 
+       Result IndicatorPresenter::createVoiceControlLayout()
+       {
+               m_voiceControlLayout = Layout::Builder().
+                               setTheme(impl::LAYOUT_VOICE_CONTROL).
+                               build(*m_widget);
+               if (!m_voiceControlLayout) {
+                       LOG_RETURN(RES_FAIL, "Layout::build() failed!");
+               }
+
+               m_widget->setContent(*m_voiceControlLayout, impl::PART_SWL_VOICE_CONTROL);
+
+               return RES_OK;
+       }
+
        Result IndicatorPresenter::createSimLayout()
        {
                m_simLayout = Layout::Builder().
@@ -303,7 +319,7 @@ namespace callui {
                if (!m_simLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
-               m_widget->setContent(*m_simLayout, impl::PART_SIM);
+               m_widget->setContent(*m_simLayout, impl::PART_SWL_SIM);
 
                updateSimState();
 
@@ -318,7 +334,8 @@ namespace callui {
                if (!m_hdCallLayout) {
                        LOG_RETURN(RES_FAIL, "Layout::build() failed!");
                }
-               m_widget->setContent(*m_hdCallLayout, impl::PART_HD_VOICE);
+
+               m_widget->setContent(*m_hdCallLayout, impl::PART_SWL_HD_VOICE);
 
                updateHdVoiceState();
 
@@ -379,6 +396,39 @@ namespace callui {
                return *m_widget;
        }
 
+       void IndicatorPresenter::udapteIncomingCallMode(bool isIncomingCallMode)
+       {
+               if (m_isIncomingCallMode == isIncomingCallMode) {
+                       return;
+               }
+               m_isIncomingCallMode = isIncomingCallMode;
+               updateCentralIcon();
+       }
+
+       void IndicatorPresenter::updateCentralIcon()
+       {
+               if (m_isIncomingCallMode) {
+                       auto state = m_provider->getState(
+                                       IndicatorProperty::VOICE_CONTROL);
+
+                       if (getVoiceControlState(state)) {
+                               m_widget->setContent(*m_voiceControlLayout,
+                                               impl::PART_SWL_VOICE_CONTROL);
+                               show(*m_voiceControlLayout);
+
+                               m_widget->unsetContent(impl::PART_SWL_BATTERY);
+                               hide(*m_batteryLayout);
+                               return;
+                       }
+               }
+               m_widget->unsetContent(impl::PART_SWL_VOICE_CONTROL);
+               hide(*m_voiceControlLayout);
+
+               m_widget->setContent(*m_batteryLayout,
+                               impl::PART_SWL_BATTERY);
+               show(*m_batteryLayout);
+       }
+
        void IndicatorPresenter::onStateChanged(IndicatorProperty property)
        {
                switch (property) {
@@ -391,6 +441,9 @@ namespace callui {
                case IndicatorProperty::BATTERY:
                        updateBatteryState();
                        break;
+               case IndicatorProperty::VOICE_CONTROL:
+                       updateCentralIcon();
+                       break;
                case IndicatorProperty::SIM_SLOT:
                        updateSimState();
                        break;
index ea7683b6dc6d77c67f320fbf19859eecbe2d8cd4..dc6fce827dcb6ccf4826f65ff6fa64e73406d3d2 100644 (file)
@@ -202,7 +202,7 @@ namespace callui {
                }
        }
 
-       Result MainPage::processIncomingCall()
+       Result MainPage::processIncomingCallMode()
        {
                auto incom = m_cm->getIncomingCall();
                if (!incom) {
@@ -228,15 +228,49 @@ namespace callui {
                        }
                        m_rmLy->setText(STR_DECLINE_MESSAGES, impl::PART_TXT_REJECT_MSG);
 
-                       m_widget->setContent(m_rmLy->getEo(), impl::PART_SWL_REJECT_MSG);
+                       m_widget->setContent(*m_rmLy, impl::PART_SWL_REJECT_MSG);
 
                        FAIL_RETURN(createRejectMsgPresenter(provider),
                                        "createRejectMsgPresenter() failed!");
                }
 
+               if (m_indicator) {
+                       m_indicator->udapteIncomingCallMode(true);
+               }
+
+               return RES_OK;
+       }
+
+       void MainPage::resetIncomingCallMode()
+       {
+               m_rmPrs.reset();
+               m_acceptRejectPrs.reset();
+               m_rmLy.reset();
+
+               if (m_indicator) {
+                       m_indicator->udapteIncomingCallMode(false);
+               }
+       }
+
+       Result MainPage::processRegularCallModes()
+       {
+               FAIL_RETURN(createAccessoryPresenter(),
+                               "createAccessoryPresenter() failed");
+               FAIL_RETURN(createMoreOptionsPresenter(),
+                               "createMoreOptionsPresenter() failed");
+               FAIL_RETURN(createBottomBtn(impl::STYLE_BB_END_CALL),
+                               "createBottomBtn() failed");
+
                return RES_OK;
        }
 
+       void MainPage::resetRegularCallModes()
+       {
+               m_bottomBtn.reset();
+               m_accessoryPrs.reset();
+               m_moreOptionsPrs.reset();
+       }
+
        void MainPage::updateCallMode()
        {
                auto incom = m_cm->getIncomingCall();
@@ -374,30 +408,18 @@ namespace callui {
                }
                FAIL_RETURN_VOID(showWindow(), "showWindow failed!");
 
-               m_bottomBtn.reset();
-
                if (m_mode == CallMode::INCOMING) {
-                       m_accessoryPrs.reset();
-                       m_moreOptionsPrs.reset();
-
-                       FAIL_RETURN_VOID(processIncomingCall(),
+                       resetRegularCallModes();
+                       FAIL_RETURN_VOID(processIncomingCallMode(),
                                        "processIncomingCall() failed!");
                } else {
-                       m_rmPrs.reset();
-                       m_acceptRejectPrs.reset();
-                       m_rmLy.reset();
-
+                       resetIncomingCallMode();
                        if (m_mode == CallMode::END) {
-                               m_accessoryPrs.reset();
-                               m_moreOptionsPrs.reset();
+                               resetRegularCallModes();
                                startEndCallTimer();
                        } else {
-                               FAIL_RETURN_VOID(createAccessoryPresenter(),
-                                               "createAccessoryPresenter() failed");
-                               FAIL_RETURN_VOID(createMoreOptionsPresenter(),
-                                               "createMoreOptionsPresenter() failed");
-                               FAIL_RETURN_VOID(createBottomBtn(impl::STYLE_BB_END_CALL),
-                                               "createBottomBtn() failed");
+                               FAIL_RETURN_VOID(processRegularCallModes(),
+                                               "processRegularCallModes() failed!");
                        }
                }
 
@@ -461,7 +483,7 @@ namespace callui {
                        LOG_RETURN(RES_FAIL, "Indicator::build() failed!");
                }
 
-               m_widget->setContent(m_indicator->getWidget().getEo(), impl::PART_SWL_INDICATOR);
+               m_widget->setContent(m_indicator->getWidget(), impl::PART_SWL_INDICATOR);
 
                return RES_OK;
        }
@@ -554,7 +576,7 @@ namespace callui {
                                        "AcceptRejectPresenter::build() failed!");
                }
 
-               m_widget->setContent(m_acceptRejectPrs->getWidget().getEo(),
+               m_widget->setContent(m_acceptRejectPrs->getWidget(),
                                impl::PART_SWL_ACCEPT_REJECT);
 
                return RES_OK;
@@ -574,7 +596,8 @@ namespace callui {
                }
        }
 
-       Result MainPage::createRejectMsgPresenter(const IRejectMsgProviderSRef &provider)
+       Result MainPage::createRejectMsgPresenter(
+                       const IRejectMsgProviderSRef &provider)
        {
                m_rmPrs = RejectMsgPresenter::Builder().
                                setProvider(provider).
@@ -590,8 +613,7 @@ namespace callui {
                                        "RejectMessagePresenter::build() failed!");
                }
 
-               m_widget->setContent(m_rmPrs->getWidget().getEo(),
-                                               impl::PART_SWL_OVERLAY);
+               m_widget->setContent(m_rmPrs->getWidget(), impl::PART_SWL_OVERLAY);
 
                return RES_OK;
        }
@@ -611,7 +633,7 @@ namespace callui {
                if (!m_callInfoPrs) {
                        LOG_RETURN(RES_FAIL, "CallerInfo::build() failed!");
                }
-               m_widget->setContent(m_callInfoPrs->getWidget().getEo(),
+               m_widget->setContent(m_callInfoPrs->getWidget(),
                                impl::PART_SWL_CALL_INFO);
 
                return RES_OK;