Fix TizenRefApp-8997 Keypad isn't closed by Home key 47/145647/1
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 11 Aug 2017 13:49:43 +0000 (16:49 +0300)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Wed, 23 Aug 2017 07:26:03 +0000 (10:26 +0300)
Fix TizenRefApp-9011 Power key does not turn LCD off during cally
Fix TizenRefApp-9116 More options displayed when closing Keypad
Change name VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER -> VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL

Change-Id: I4a9ff4b871ef3cfd253e8e7d9d3b0472247c5a4b

18 files changed:
call-ui/model/impl/SoundManager.cpp
call-ui/model/impl/VoiceControlStateProvider.cpp
call-ui/presenters/Instance.cpp
call-ui/presenters/Instance.h
call-ui/presenters/common.h
call-ui/presenters/misc/AccessoryPresenter.cpp
call-ui/presenters/misc/AtspiHighlightHelper.cpp
call-ui/presenters/misc/MoreOptionsPresenter.cpp
call-ui/presenters/misc/MoreOptionsPresenter.h
call-ui/presenters/misc/helpers.cpp
call-ui/presenters/misc/helpers.h
call-ui/presenters/pages/KeypadPage.cpp
call-ui/presenters/pages/KeypadPage.h
call-ui/presenters/pages/MainPage.cpp
call-ui/presenters/pages/MainPage.h
call-ui/presenters/types.h
call-ui/view/AcceptRejectWidget.cpp
edc/main_ly.edc

index a29f12e6c600e965c68399e0d2bee529a3ecb244..12d34c0122df672a1bcacfcabd1bb263490d55ba 100644 (file)
@@ -112,7 +112,7 @@ namespace callui {
                DLOG();
 
                if (state == CM_AUDIO_STATE_NONE_E) {
-                       ILOG("Ignore. Unhandled state [%d]", state);
+                       ILOG("Ignored. Unhandled state [%d]", state);
                        return;
                }
                m_audioStateEvent.dispatch(convertCMAudioState(state));
index e05f9ca1d91d9b66db81b28a36c1c6843b93ddf3..384d3cb45dc5014db5e1ec5a5a7603a64a043195 100644 (file)
@@ -19,7 +19,7 @@
 #include "common.h"
 
 // Temporary until VCONFLAG will not be added to a system
-#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL
+#define VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL
 
 namespace callui {
 
@@ -54,7 +54,7 @@ namespace callui {
        Result VoiceControlStateProvider::initState()
        {
                auto val = 0;
-               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, &val) != 0) {
                        LOG_RETURN(RES_FAIL, "vconf_get_bool() failed!"
                                        "err[%d]", vconf_get_ext_errno());
                }
@@ -82,7 +82,7 @@ namespace callui {
 
        Result VoiceControlStateProvider::addSysStateCallback()
        {
-               if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+               if (vconf_notify_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL,
                                CALLBACK_B(VoiceControlStateProvider::onStateChanged),
                                this) != 0) {
 
@@ -94,7 +94,7 @@ namespace callui {
 
        void VoiceControlStateProvider::delSysStateCallback()
        {
-               vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER,
+               vconf_ignore_key_changed(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL,
                                CALLBACK_B(VoiceControlStateProvider::onStateChanged));
        }
 
@@ -102,7 +102,7 @@ namespace callui {
                        keynode_t *node)
        {
                auto val = 0;
-               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER, &val) != 0) {
+               if (vconf_get_bool(VCONFKEY_CISSAPPL_CALL_VOICE_ANSWER_BOOL, &val) != 0) {
                        LOG_RETURN_VOID(RES_FAIL, "vconf_get_bool() failed!"
                                        "err[%d]", vconf_get_ext_errno());
                }
index 7086452aa9f9a7fd06d17049baa95308630a73f6..0fb6df43b056ca24e5445aa9a1396cad56407061 100644 (file)
 #include "pages/MainPage.h"
 
 #include "call-ui/resources.h"
+#include "call-ui/presenters/types.h"
 #include "common.h"
 
 namespace callui { namespace { namespace impl {
 
        using namespace ucl;
 
+       constexpr auto POWER_KEY_HOLD_TIMEOUT = 0.4;
+
        const char *STR_POWER_KEY = "XF86PowerOff";
 
 }}}
@@ -47,12 +50,16 @@ namespace callui {
                RefCountAware(&rc),
                m_sysEventProvider(sysEventProvider),
                m_context(nullptr),
-               m_keyUpEventHandler(nullptr)
+               m_keyUpEventHandler(nullptr),
+               m_keyDownEventHandler(nullptr),
+               m_ignorePowerClick(false)
        {
        }
 
        Instance::~Instance()
        {
+               m_powerKeyHoldTimout.reset();
+
                elm_win_keygrab_unset(*m_win, impl::STR_POWER_KEY, 0, 0);
 
                if (m_keyUpEventHandler) {
@@ -69,10 +76,13 @@ namespace callui {
                m_win = m_context->getWindow();
 
                elm_win_keygrab_set(*m_win, impl::STR_POWER_KEY, 0, 0, 0,
-                               ELM_WIN_KEYGRAB_EXCLUSIVE);
+                               ELM_WIN_KEYGRAB_TOPMOST);
 
                m_keyUpEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_UP,
                                CALLBACK_A(Instance::onKeyUpEventCb), this);
+               m_keyDownEventHandler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN,
+                               CALLBACK_A(Instance::onKeyDownEventCb), this);
+
                if (!m_keyUpEventHandler) {
                        LOG_RETURN(RES_FAIL, "m_eventHandler is NULL");
                }
@@ -105,12 +115,16 @@ namespace callui {
 
        void Instance::onPause()
        {
-               ILOG("PAUSED");
+               DLOG("PAUSE");
+
+               setInstancePaused(*m_win, true);
        }
 
        void Instance::onResume()
        {
-               ILOG("RESUMED");
+               DLOG("RESUME");
+
+               setInstancePaused(*m_win, false);
        }
 
        void Instance::onAppControl(app_control_h appControl)
@@ -154,20 +168,69 @@ namespace callui {
                return RES_OK;
        }
 
+       Eina_Bool Instance::onKeyDownEventCb(int type, void *event)
+       {
+               if (!event) {
+                       LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, "event is NULL");
+               }
+
+               Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
+               if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) {
+                       DLOG("Key Power [Down]");
+                       return processPowerKeyDownEvent();
+               }
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
        Eina_Bool Instance::onKeyUpEventCb(int type, void *event)
        {
                if (!event) {
-                       LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_DONE, "event is NULL");
+                       LOG_RETURN_VALUE(RES_FAIL, ECORE_CALLBACK_PASS_ON, "event is NULL");
                }
 
                Ecore_Event_Key *ev = static_cast<Ecore_Event_Key *>(event);
                if (!strcmp(ev->keyname, impl::STR_POWER_KEY)) {
-                       DLOG("Key power [Up]");
-                       m_win->callEvent(WIN_POWER_KEY_UP_EVENT, nullptr);
+                       DLOG("Key Power [Up]");
+                       return processPowerKeyUpEvent();
+               }
+               return ECORE_CALLBACK_PASS_ON;
+       }
+
+       Eina_Bool Instance::processPowerKeyDownEvent()
+       {
+               m_ignorePowerClick = isInstancePaused(*m_win);
+               if (m_ignorePowerClick) {
+                       DLOG("Ignored. Instance is in pause state");
+                       return ECORE_CALLBACK_PASS_ON;
                }
+
+               m_powerKeyHoldTimout = Timeout::create(
+                               impl::POWER_KEY_HOLD_TIMEOUT,
+                               WEAK_DELEGATE(Instance::onPowerKeyHoldTimeout,
+                                               asWeak(*this)));
+
                return ECORE_CALLBACK_DONE;
        }
 
+       Eina_Bool Instance::processPowerKeyUpEvent()
+       {
+               if (m_ignorePowerClick) {
+                       DLOG("Ignored.");
+                       return ECORE_CALLBACK_PASS_ON;
+               }
+
+               PowerBtnEventInfo eventInfo;
+               m_win->callEvent(WIN_POWER_KEY_UP_EVENT, &eventInfo);
+
+               return ECORE_CALLBACK_DONE;
+       }
+
+       void Instance::onPowerKeyHoldTimeout(Timeout *sender)
+       {
+               m_ignorePowerClick = true;
+               m_powerKeyHoldTimout.reset();
+       }
+
        void Instance::onPageExitRequest(Page &page)
        {
                m_context->exitApp();
index 73ddccec1c1c3e3891d6b6b6fdb340bb81902593..ca3f4a2920873b4c4bbc624f43e89c89045cd185 100644 (file)
@@ -22,6 +22,7 @@
 #include "ucl/appfw/SysEventProvider.h"
 #include "ucl/gui/Theme.h"
 #include "ucl/gui/Naviframe.h"
+#include "ucl/misc/Timeout.h"
 
 #include "call-ui/model/ICallUI.h"
 
@@ -54,7 +55,11 @@ namespace callui {
                void onSysEvent(const ucl::SysEvent sysEvent);
                void onPageExitRequest(Page &page);
 
+               Eina_Bool onKeyDownEventCb(int type, void *event);
                Eina_Bool onKeyUpEventCb(int type, void *event);
+               Eina_Bool processPowerKeyDownEvent();
+               Eina_Bool processPowerKeyUpEvent();
+               void onPowerKeyHoldTimeout(ucl::Timeout *sender);
 
        private:
                ucl::SysEventProvider &m_sysEventProvider;
@@ -69,6 +74,10 @@ namespace callui {
                PageWRef m_page;
 
                Ecore_Event_Handler *m_keyUpEventHandler;
+               Ecore_Event_Handler *m_keyDownEventHandler;
+               ucl::TimeoutSRef m_powerKeyHoldTimout;
+
+               bool m_ignorePowerClick;
        };
 }
 
index 16f8ab09d8faada5cb0d6c8f08dc87960fed1bc5..c515baf3e27bf37133b6638e72d62608c57dd73a 100644 (file)
@@ -26,6 +26,7 @@
 #include "call-ui/view/common.h"
 
 namespace callui {
+
        constexpr auto CALL_VC_TIMER_INTERVAL = 1.5;
        constexpr auto CALL_VC_SCREEN_READER_TIMER_INTERVAL = 5.0;
        constexpr auto VOLUME_LEVEL_MIN = 1;
index 0b463c19ae6afe40f7c7b9eb27212824b64d0aeb..6eeee6753a25d5c206b0ec3db16b6f9de28626e2 100644 (file)
@@ -415,7 +415,7 @@ namespace callui {
        void AccessoryPresenter::onVolumeBtnClicked(Widget &widget, void *eventInfo)
        {
                if (!isActive()) {
-                       ILOG("Presenter is not active. Ignore");
+                       ILOG("Ignored. Presenter is not active");
                        return;
                }
 
@@ -428,7 +428,7 @@ namespace callui {
        void AccessoryPresenter::onMuteBtnClicked(Widget &widget, void *eventInfo)
        {
                if (!isActive()) {
-                       ILOG("Presenter is not active. Ignore");
+                       ILOG("Ignored. Presenter is not active");
                        return;
                }
 
@@ -582,7 +582,7 @@ namespace callui {
        {
                if (!isActive()) {
                        LOG_RETURN_VALUE(RES_OK, EINA_TRUE,
-                                       "Presenter is not active. Ignore");
+                                       "Ignored. Presenter is not active");
                }
 
                if (m_vcTimer) {
@@ -613,11 +613,11 @@ namespace callui {
        void AccessoryPresenter::onVolumeControlEventCb(VolumeControl::Event event)
        {
                if (!isActive()) {
-                       LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore");
+                       LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active");
                }
 
                if (!m_vcTimer) {
-                       DLOG("Ignore as control is hidden");
+                       DLOG("Ignored. Control is hidden");
                        return;
                }
 
index 8d1c13d971aeabe8587b4658e1515d8dd1e4fe4c..98ec77ba9305f51f0e78a6bcde691eae6808eeb5 100644 (file)
@@ -72,8 +72,6 @@ namespace callui {
 
        void AtspiHighlightHelper::registerWidget(ElmWidget &widget)
        {
-               DLOG("this [%p] widget [%p]", this, widget.getEo());
-
                widget.addEventHandler(ATSPI_ON_GESTURE, WEAK_DELEGATE(
                                AtspiHighlightHelper::onAtspiGesture, asWeak(*this)));
        }
@@ -82,16 +80,17 @@ namespace callui {
                        Elm_Interface_Atspi_Accessible *ao,
                        AtspiGestureEventInfo &e)
        {
-               DLOG("this [%p] ao [%p]", this, ao);
+               DLOG("Access object [%p]", ao);
 
                if (e.stopPropagation) {
-                       DLOG("e.stopPropagation");
+                       DLOG("Ignored. Propagation was stopped.");
                        return;
                }
 
                if (!isActive()) {
-                       DLOG("!isActive()");
+                       DLOG("Ignored. Presenter is not active");
                        if (e.gestureInfo.type != ELM_ATSPI_GESTURE_ONE_FINGER_SINGLE_TAP) {
+                               DLOG("Prevent default handler");
                                e.preventDefault = true;
                        }
                        return;
@@ -100,8 +99,8 @@ namespace callui {
                e.stopPropagation = true;
 
                if (m_gestureEventHandler) {
-                       DLOG("m_gestureEventHandler");
                        if (m_gestureEventHandler(ao, e.gestureInfo.type)) {
+                               DLOG("Prevent default handler");
                                e.preventDefault = true;
                                return;
                        }
@@ -110,19 +109,22 @@ namespace callui {
                e.preventDefault = false;
 
                if (!m_relationEventHandler) {
-                       DLOG("!m_relationEventHandler");
+                       DLOG("Relation event handler does not set");
                        return;
                }
 
                const Elm_Atspi_Relation_Type relation = getFlowRelation(e.gestureInfo);
                if (relation == ELM_ATSPI_RELATION_NULL) {
+                       DLOG("Not supported gesture type for processing");
                        return;
                }
 
                const auto relationObj = m_relationEventHandler(ao, relation);
                if (!relationObj) {
+                       DLOG("Relation object is NULL!");
                        return;
                }
+               DLOG("Relation object [%p]", relationObj);
 
                auto &win = getWindow();
                auto atspiHelper = static_cast<Elm_Interface_Atspi_Accessible *>
index 6aa148cbe68938cbe57809d84f19a6698a0aef31..55d24155c1300b6511d059683d85b4aec800a98b 100644 (file)
@@ -136,6 +136,8 @@ namespace callui {
                        sendActivate(*m_widget);
                }
 
+               unregisterPageTransitionCallback();
+
                util::dispose(m_keypad);
        }
 
@@ -157,6 +159,8 @@ namespace callui {
 
                FAIL_RETURN(createAtspiHighlightHelper(), "createAtspiHighlightHelper() failed!");
 
+               registerPageTransitionCallback();
+
                deactivateBy(m_widget.get());
 
                parent.addDeactivatorSource(*m_widget);
@@ -233,6 +237,32 @@ namespace callui {
                return RES_OK;
        }
 
+       void MoreOptionsPresenter::registerPageTransitionCallback()
+       {
+               m_navi->addEventHandler(NAVI_TRANSITION_FINISHED,
+                               WEAK_DELEGATE(
+                                               MoreOptionsPresenter::onPageTransitionFinished,
+                                               asWeak(*this)));
+       }
+
+       void MoreOptionsPresenter::unregisterPageTransitionCallback()
+       {
+               m_navi->delEventHandler(NAVI_TRANSITION_FINISHED,
+                               WEAK_DELEGATE(
+                                               MoreOptionsPresenter::onPageTransitionFinished,
+                                               asWeak(*this)));
+       }
+
+       void MoreOptionsPresenter::onPageTransitionFinished(Widget &widget,
+                       void *eventInfo)
+       {
+               if (const auto keypad = m_keypad.lock()) {
+                       if (keypad->isAtTop()) {
+                               elm_panel_hidden_set(*m_panel, EINA_TRUE);
+                       }
+               }
+       }
+
        void MoreOptionsPresenter::updateSlots()
        {
                unsetPanelContent(impl::PART_SWL_SLOT1);
index f2c4fb51be2f0e826a6ea7dd93b9f3a1b4b4d598..8a599f2d45ef50454beadc59a2272103063a346b 100644 (file)
@@ -83,6 +83,10 @@ namespace callui {
                                const ucl::TString &txt,
                                const ucl::WidgetEventHandler &handler);
 
+               void registerPageTransitionCallback();
+               void unregisterPageTransitionCallback();
+               void onPageTransitionFinished(ucl::Widget &widget, void *eventInfo);
+
                void updateSlots();
                void updateStatusText();
 
index adc682dcaea7af69999ab3ec87f9f96e1f22e3b8..9867516a4e1b7ab4e72ef1023366055ee51d8730 100644 (file)
  * limitations under the License.
  */
 
+#include "ucl/gui/Window.h"
+
 #include "common.h"
 
 namespace callui { namespace { namespace himpl {
 
+       constexpr EoDataKey INSTANCE_PTR {"callui,instance,data,ptr"};
+
        const TString STR_HH_MM_SS_TIME{"%02d:%02d:%02d"};
        const TString STR_MM_SS_TIME{"%02d:%02d"};
 
@@ -27,6 +31,18 @@ namespace callui {
 
        using namespace ucl;
 
+       void setInstancePaused(Window &win, const bool value)
+       {
+               win.setData(himpl::INSTANCE_PTR, reinterpret_cast<void *>(value));
+               win.callEvent((value ? INSTANCE_PAUSED : INSTANCE_RESUMED), nullptr);
+       }
+
+       bool isInstancePaused(const Window &win)
+       {
+               return (reinterpret_cast<intptr_t>(
+                               win.getData(himpl::INSTANCE_PTR)) != 0);
+       }
+
        void replaceSubstringInString(std::string &str,
                        const std::string &from, const std::string &to)
        {
index 9a1c16ba5e55b3dad27d78f130cc9504a33f4ea2..7686b278e34041515d10e1c48a8339fdf3361d28 100644 (file)
 
 namespace callui {
 
+       constexpr ucl::SmartEvent INSTANCE_PAUSED {"callui,instance,paused"};
+       constexpr ucl::SmartEvent INSTANCE_RESUMED {"callui,instance,resumed"};
+
+       void setInstancePaused(ucl::Window &win, bool value);
+       bool isInstancePaused(const ucl::Window &win);
+
        void replaceSubstringInString(std::string &str,
                        const std::string &from, const std::string &to);
 
index 2c06b7528c10d1d1cf5192091d917752ff7f1d21..abbe65c8d123c442f6657079435bbc4bfc47d414 100644 (file)
@@ -16,6 +16,7 @@
 
 #include "KeypadPage.h"
 
+#include "call-ui/presenters/types.h"
 #include "call-ui/resources.h"
 #include "common.h"
 
@@ -81,6 +82,7 @@ namespace callui { namespace { namespace impl {
 }}}
 
 namespace callui {
+
        using namespace ucl;
 
        // KeypadPage::Builder
@@ -151,19 +153,31 @@ namespace callui {
        KeypadPage::~KeypadPage()
        {
                stopDtmf();
+
                stopVCTimer();
+
+               unregisterPowerKeyHandling();
+
                unregisterCallbacks();
+
        }
 
        Result KeypadPage::doPrepare(NaviItem &item)
        {
-               FAIL_RETURN(createWidget(), "createWidget() failed!");
+               FAIL_RETURN(createWidget(),
+                               "createWidget() failed!");
+
+               FAIL_RETURN(createEntry(),
+                               "createEntry() failed!");
 
-               FAIL_RETURN(createEntry(), "createEntry() failed!");
+               FAIL_RETURN(createButtons(),
+                               "createButtons() failed!");
 
-               FAIL_RETURN(createButtons(), "createButtons() failed!");
+               FAIL_RETURN(createVolumeControl(),
+                               "createVolumeControl() failed!");
 
-               FAIL_RETURN(createVolumeControl(), "createVolumeControl() failed!");
+               FAIL_RETURN(registerPowerKeyHandling(),
+                               "registerPowerKeyHandling() failed!");
 
                registerCallbacks();
 
@@ -180,6 +194,40 @@ namespace callui {
                return RES_OK;
        }
 
+       Result KeypadPage::registerPowerKeyHandling()
+       {
+               auto win = m_widget->getWindow();
+               if (!win) {
+                       LOG_RETURN(RES_FAIL, "win is NULL!");
+               }
+
+               win->addEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE(
+                               KeypadPage::onPowerKeyUp, asWeak(*this)));
+
+               return RES_OK;
+       }
+
+       void KeypadPage::unregisterPowerKeyHandling()
+       {
+               auto win = m_widget->getWindow();
+               if (!win) {
+                       LOG_RETURN_VOID(RES_FAIL, "win is NULL!");
+               }
+
+               win->delEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE(
+                               KeypadPage::onPowerKeyUp, asWeak(*this)));
+       }
+
+       void KeypadPage::onPowerKeyUp(Widget &widget, void *eventInfo)
+       {
+               auto info = static_cast<PowerBtnEventInfo *>(eventInfo);
+               if (info) {
+                       info->stopPropagation = true;
+               }
+
+               requestExit();
+       }
+
        void KeypadPage::onBtnPressed(Widget &widget, void *eventInfo)
        {
                impl::ButtonInfo *info =
@@ -366,11 +414,11 @@ namespace callui {
        void KeypadPage::onVolumeControlEventCb(VolumeControl::Event event)
        {
                if (!isActive()) {
-                       LOG_RETURN_VOID(RES_OK, "Presenter is not active. Ignore");
+                       LOG_RETURN_VOID(RES_OK, "Ignored. Presenter is not active");
                }
 
                if (!m_vcTimer) {
-                       DLOG("Ignore as control is hidden");
+                       DLOG("Ignored. Control is hidden");
                        return;
                }
 
@@ -496,11 +544,11 @@ namespace callui {
                if (!isActive()) {
                        LOG_RETURN_VALUE(RES_OK,
                                        EINA_TRUE,
-                                       "Presenter is not active. Ignore");
+                                       "Ignored. Presenter is not active");
                }
 
                if (!m_vcTimer) {
-                       DLOG("Ignore as control is hidden");
+                       DLOG("Ignore .Control is hidden");
                        return EINA_FALSE;
                }
 
index d3c8441f6c24fc1578e4734a2c5c7fabab025b32..351fb27537213b9b8a217f45a7e8bc86d7cc7534 100644 (file)
@@ -55,6 +55,11 @@ namespace callui {
 
                ucl::Result doPrepare(ucl::NaviItem &item);
 
+               ucl::Result registerPowerKeyHandling();
+               void unregisterPowerKeyHandling();
+
+               void onPowerKeyUp(ucl::Widget &widget, void *eventInfo);
+
                void onBtnPressed(ucl::Widget &widget, void *eventInfo);
                void onBtnUnpressed(ucl::Widget &widget, void *eventInfo);
                void onBtnClicked(ucl::Widget &widget, void *eventInfo);
@@ -108,7 +113,6 @@ namespace callui {
 
                VolumeControlSRef m_vc;
                Ecore_Timer *m_vcTimer;
-
                AudioStateType m_audioState;
 
                // Screen Reader
index 3cf0ef33fc3fb447fc6857a7acea70125d854d82..23ed3523d753240733745081c44298363fdb7a10 100644 (file)
 #include "ucl/gui/Widget.h"
 
 #include "call-ui/resources.h"
+#include "call-ui/presenters/types.h"
+
 #include "common.h"
 
 namespace callui { namespace { namespace impl {
 
        using namespace ucl;
 
-       constexpr double CU_RECALL_BTN_SHOW_TIMEOUT = 1.0;
-       constexpr double CU_EXIT_APP_TIMEOUT = 4.0;
+       constexpr auto RECALL_BTN_SHOW_TIMEOUT = 1.0;
+       constexpr auto EXIT_APP_TIMEOUT = 4.0;
 
        constexpr LayoutTheme LAYOUT_MAIN_WIDGET
                        {"layout", "callui", "main"};
@@ -132,44 +134,61 @@ namespace callui {
                }
 
                FAIL_RETURN(createWidget(), "createWidget() failed!");
-               FAIL_RETURN(createIndicatorPresenter(), "createIndicatorPresenter() failed!");
-               FAIL_RETURN(createDisplayPresenter(), "createDisplayPresenter() failed!");
 
+               FAIL_RETURN(createIndicatorPresenter(),
+                               "createIndicatorPresenter() failed!");
+
+               FAIL_RETURN(createDisplayPresenter(),
+                               "createDisplayPresenter() failed!");
+
+               FAIL_RETURN(registerPowerKeyHandling(),
+                               "registerPowerKeyHandling() failed!");
+
+               item = getNaviframe().push(*m_widget);
+               if (!item) {
+                       LOG_RETURN(RES_FAIL, "Naviframe::push() failed!");
+               }
+
+               return RES_OK;
+       }
+
+       Result MainPage::registerPowerKeyHandling()
+       {
                auto win = m_widget->getWindow();
                if (!win) {
                        LOG_RETURN(RES_FAIL, "win is NULL!");
                }
+
                win->addEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE(
                                MainPage::onPowerKeyUp, asWeak(*this)));
 
-               item = getNaviframe().push(*m_widget);
-               if (!item) {
-                       LOG_RETURN(RES_FAIL, "Naviframe::push() failed!");
-               }
-
                return RES_OK;
        }
 
-       void MainPage::processKeyPress()
+       void MainPage::unregisterPowerKeyHandling()
        {
-               switch (m_mode) {
-               case CallMode::INCOMING:
-               {
-                       auto incom = m_cm->getIncomingCall();
-                       if (!incom) {
-                               LOG_RETURN_VOID(RES_FAIL, "incom is NULL");
-                       }
-                       incom->stopAlert();
-                       break;
+               auto win = m_widget->getWindow();
+               if (!win) {
+                       LOG_RETURN_VOID(RES_FAIL, "win is NULL!");
                }
-               case CallMode::END:
+
+               win->delEventHandler(WIN_POWER_KEY_UP_EVENT, WEAK_DELEGATE(
+                               MainPage::onPowerKeyUp, asWeak(*this)));
+       }
+
+       void MainPage::processKeyPress(bool isPowerKey)
+       {
+               if (m_mode == CallMode::END) {
                        requestExit();
-                       break;
-               default:
-                       if (m_accessoryPrs) {
-                               m_accessoryPrs->hideVolumeControls();
+               } else if (m_mode != CallMode::INCOMING) {
+                       if (isPowerKey) {
+                               m_devicePrs->setDisplayState(
+                                               DeviceStatePresenter::DisplayState::OFF);
+                       } else {
+                               if (m_accessoryPrs) {
+                                       m_accessoryPrs->hideVolumeControls();
+                               }
                        }
-                       break;
                }
        }
 
@@ -180,9 +199,12 @@ namespace callui {
 
        void MainPage::onPowerKeyUp(Widget &widget, void *eventInfo)
        {
-               if (isActive()) {
-                       processKeyPress();
+               auto info = static_cast<PowerBtnEventInfo *>(eventInfo);
+               if (info && info->stopPropagation) {
+                       DLOG("Ignored. Propagation was stopped.");
+                       return;
                }
+               processKeyPress(true);
        }
 
        Result MainPage::processIncomingCallMode()
@@ -350,7 +372,7 @@ namespace callui {
                stopEndCallTimer();
 
                m_ecTimer = ecore_timer_add(
-                               impl::CU_RECALL_BTN_SHOW_TIMEOUT,
+                               impl::RECALL_BTN_SHOW_TIMEOUT,
                                CALLBACK_B(MainPage::onEndCallTimerCb),
                                this);
        }
@@ -399,7 +421,7 @@ namespace callui {
                                m_widget->setContent(*m_bottomBtn, impl::PART_SWL_BOTTOM_BTN);
                                show(*m_bottomBtn);
                        }
-                       ecore_timer_interval_set(m_ecTimer, impl::CU_EXIT_APP_TIMEOUT);
+                       ecore_timer_interval_set(m_ecTimer, impl::EXIT_APP_TIMEOUT);
                        m_ecTimerBtnReq = true;
                        return ECORE_CALLBACK_RENEW;
                } else {
index 92c7eed176a614d144a4168b23cfcc7f0707c79a..4a826a9f4851a1da395819754a29cb075929f492 100644 (file)
@@ -23,7 +23,6 @@
 #include "ucl/gui/Layout.h"
 
 #include "call-ui/model/ICallUI.h"
-
 #include "call-ui/presenters/misc/IndicatorPresenter.h"
 #include "call-ui/presenters/misc/AcceptRejectPresenter.h"
 #include "call-ui/presenters/misc/CallInfoPresenter.h"
@@ -62,6 +61,11 @@ namespace callui {
 
                ucl::Result doPrepare(ucl::NaviItem &item);
 
+               ucl::Result registerPowerKeyHandling();
+               void unregisterPowerKeyHandling();
+
+               void processKeyPress(bool isPowerKey = false);
+
                ucl::Result showWindow();
                void updateCallMode();
 
@@ -89,7 +93,6 @@ namespace callui {
                Eina_Bool onEndCallTimerCb();
 
                void onPowerKeyUp(ucl::Widget &widget, void *eventInfo);
-               void processKeyPress();
 
                ucl::Result updateDeviceState(CallMode prevMode, CallMode curMode);
 
index c7beb84dbe98146a281c1a8ddf98dda7aa396eb0..df9dd48f54d2f453268e7c8a1a6a16989f4ea325 100644 (file)
 #include "call-ui/view/types.h"
 #include "call-ui/model/types.h"
 
+namespace callui {
+
+       struct PowerBtnEventInfo {
+               bool stopPropagation = false;
+       };
+}
+
 #endif // __CALL_UI_PRESENTERS_TYPES_H__
index b16d4c93a4b3614c80a7a7cbb5fbb59a45e7a5b2..4b3ed5fe021d95d4312a4adbf185abe3b616a683 100644 (file)
@@ -1207,7 +1207,7 @@ namespace callui {
                        m_isContracting = true;
                        setAcceptUnpressedState();
                } else {
-                       DLOG("Counter is 0. Ignored");
+                       DLOG("Ignored. Counter is 0");
                }
                m_expandTimeout.reset();
        }
@@ -1219,7 +1219,7 @@ namespace callui {
                        m_isContracting = true;
                        setRejectUnpressedState();
                } else {
-                       DLOG("Counter is 0. Ignored");
+                       DLOG("Ignored. Counter is 0");
                }
                m_expandTimeout.reset();
        }
@@ -1293,7 +1293,7 @@ namespace callui {
                m_expandTimeout.reset();
 
                if (m_isContracting) {
-                       DLOG("Contracting. Ignore");
+                       DLOG("Ignored. Contracting state");
                        return EINA_TRUE;
                }
 
index 1e9dd3d6e7b929f66a1d9d6abef22e068080dc2d..cd9bfc4ef46c1e25f2ddae921fa102defe542661 100644 (file)
 
 group { "elm/layout/callui/main";
        parts {
+               rect { "bg";
+                       scale;
+                       desc { "default";
+                               min: CU_WIN_W CU_WIN_H;
+                               max: CU_WIN_W CU_WIN_H;
+                               color: 0 0 0 0;
+                       }
+               }
                swallow { "swl.call_info";
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
                swallow { "swl.indicator";
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
                swallow { "swl.rm"
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
                swallow { "swl.accept_reject";
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
                swallow { "swl.bottom_btn";
                        scale;
                        desc { "default";
-                               rel1.relative: 0.0 1.0;
-                               rel2.relative: 1.0 1.0;
+                               rel1 { relative: 0.0 1.0; to: "bg"; }
+                               rel2 { relative: 1.0 1.0; to: "bg"; }
                                align: 0.5 1.0;
                                fixed: 0 1;
                        }
@@ -48,11 +64,15 @@ group { "elm/layout/callui/main";
                swallow { "swl.overlay";
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
                swallow { "swl.more_option";
                        scale;
                        desc { "default";
+                               rel1.to: "bg";
+                               rel2.to: "bg";
                        }
                }
        }