M module-apps/application-desktop/ApplicationDesktop.cpp => module-apps/application-desktop/ApplicationDesktop.cpp +2 -4
@@ 68,14 68,12 @@ namespace app
});
addActionReceiver(app::manager::actions::SystemBrownout, [this](auto &&data) {
- setSystemCloseInProgress();
- switchWindow(app::window::name::dead_battery, std::move(data));
+ requestShutdownWindow(app::window::name::dead_battery);
return actionHandled();
});
addActionReceiver(app::manager::actions::DisplayLogoAtExit, [this](auto &&data) {
- switchWindow(app::window::name::closing_window, std::move(data));
- setSystemCloseInProgress();
+ requestShutdownWindow(app::window::name::closing_window);
return actionHandled();
});
}
M module-apps/apps-common/ApplicationCommon.cpp => module-apps/apps-common/ApplicationCommon.cpp +43 -6
@@ 125,6 125,8 @@ namespace app
connect(typeid(AppRefreshMessage),
[this](sys::Message *msg) -> sys::MessagePointer { return handleAppRefresh(msg); });
+ connect(typeid(AppShutdownRefreshMessage),
+ [this](sys::Message *msg) -> sys::MessagePointer { return handleAppShutdownRefresh(msg); });
connect(sevm::BatteryStatusChangeMessage(), [&](sys::Message *) { return handleBatteryStatusChange(); });
connect(typeid(app::manager::DOMRequest),
[&](sys::Message *msg) -> sys::MessagePointer { return handleGetDOM(msg); });
@@ 135,14 137,14 @@ namespace app
addActionReceiver(app::manager::actions::PhoneModeChanged, [this](auto &¶ms) {
if (params != nullptr) {
- auto modeParams = static_cast<gui::PhoneModeParams *>(params.get());
+ auto modeParams = static_cast<gui::PhoneModeParams *>(params.get());
this->statusIndicators.phoneMode = modeParams->getPhoneMode();
}
return actionHandled();
});
addActionReceiver(app::manager::actions::BluetoothModeChanged, [this](auto &¶ms) {
if (params != nullptr) {
- auto modeParams = static_cast<gui::BluetoothModeParams *>(params.get());
+ auto modeParams = static_cast<gui::BluetoothModeParams *>(params.get());
this->statusIndicators.bluetoothMode = modeParams->getBluetoothMode();
refreshWindow(gui::RefreshModes::GUI_REFRESH_FAST);
}
@@ 223,10 225,7 @@ namespace app
auto message = std::make_shared<service::gui::DrawMessage>(window->buildDrawList(), mode);
- if (systemCloseInProgress) {
- message->setCommandType(service::gui::DrawMessage::Type::SHUTDOWN);
- }
- else if (suspendInProgress) {
+ if (suspendInProgress) {
message->setCommandType(service::gui::DrawMessage::Type::SUSPEND);
}
@@ 650,6 649,33 @@ namespace app
return sys::msgHandled();
}
+ sys::MessagePointer ApplicationCommon::handleAppShutdownRefresh(sys::Message *msgl)
+ {
+ auto *msg = static_cast<AppShutdownRefreshMessage *>(msgl);
+ assert(msg);
+
+ if (not windowsFactory.isRegistered(msg->getWindowName())) {
+ LOG_ERROR("Cannot find window %s windowsFactory in application: %s",
+ msg->getWindowName().c_str(),
+ GetName().c_str());
+ return sys::msgHandled();
+ }
+
+ setActiveWindow(msg->getWindowName());
+ auto window = getWindow(msg->getWindowName());
+
+ if (not window) {
+ LOG_ERROR("Cannot find window %s in application %s", msg->getWindowName().c_str(), GetName().c_str());
+ return sys::msgHandled();
+ }
+
+ auto message = std::make_shared<service::gui::DrawMessage>(window->buildDrawList(), msg->getMode());
+ message->setCommandType(service::gui::DrawMessage::Type::SHUTDOWN);
+ bus.sendUnicast(std::move(message), service::name::gui);
+
+ return sys::msgHandled();
+ }
+
sys::MessagePointer ApplicationCommon::handleGetDOM(sys::Message *msgl)
{
if (windowsStack.isEmpty()) {
@@ 948,6 974,17 @@ namespace app
return true;
}
+ void ApplicationCommon::requestShutdownWindow(std::string windowName)
+ {
+#if DEBUG_APPLICATION_MANAGEMENT == 1
+ LOG_INFO("switching [%s] to shutdown window: %s",
+ GetName().c_str(),
+ windowName.length() ? windowName.c_str() : default_window.c_str());
+#endif
+ auto msg = std::make_shared<AppShutdownRefreshMessage>(windowName);
+ bus.sendUnicast(msg, this->GetName());
+ }
+
bool ApplicationCommon::popToWindow(const std::string &window)
{
if (window == gui::name::window::no_window) {
M module-apps/apps-common/ApplicationCommon.hpp => module-apps/apps-common/ApplicationCommon.hpp +3 -7
@@ 197,6 197,7 @@ namespace app
sys::MessagePointer handleUpdateWindow(sys::Message *msgl);
sys::MessagePointer handleAppRebuild(sys::Message *msgl);
sys::MessagePointer handleAppRefresh(sys::Message *msgl);
+ sys::MessagePointer handleAppShutdownRefresh(sys::Message *msgl);
sys::MessagePointer handleGetDOM(sys::Message *msgl);
sys::MessagePointer handleSimStateUpdateMessage(sys::Message *msgl);
@@ 300,12 301,6 @@ namespace app
suspendInProgress = val;
};
- // Latching close system in progress flag
- virtual void setSystemCloseInProgress()
- {
- systemCloseInProgress = true;
- }
-
bool adjustCurrentVolume(const int step);
bool increaseCurrentVolume(const audio::Volume step = audio::defaultVolumeStep)
{
@@ 368,6 363,8 @@ namespace app
virtual void showPopup(gui::popup::ID id, const gui::PopupRequestParams *params);
void abortPopup(gui::popup::ID id);
+ void requestShutdownWindow(std::string windowName);
+
public:
/// @ingrup AppWindowStack
/// get to the first time we entered this &window
@@ 405,7 402,6 @@ namespace app
/// services if last rendering mesage will be processed.
bool suspendInProgress = false;
- bool systemCloseInProgress = false;
/// Storage for asynchronous tasks callbacks.
std::unique_ptr<CallbackStorage> callbackStorage;
void checkBlockingRequests();
M module-apps/apps-common/messages/AppMessage.hpp => module-apps/apps-common/messages/AppMessage.hpp +7 -0
@@ 110,6 110,13 @@ namespace app
}
};
+ class AppShutdownRefreshMessage : public AppRefreshMessage
+ {
+ public:
+ AppShutdownRefreshMessage(std::string window_name)
+ : AppRefreshMessage(gui::RefreshModes::GUI_REFRESH_DEEP, window_name){};
+ };
+
class AppSwitchWindowMessage : public AppMessage
{
protected:
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +2 -4
@@ 43,14 43,12 @@ namespace app
});
addActionReceiver(app::manager::actions::DisplayLogoAtExit, [this](auto &&data) {
- setSystemCloseInProgress();
- switchWindow(gui::BellWelcomeWindow::defaultName);
+ requestShutdownWindow(gui::BellWelcomeWindow::defaultName);
return actionHandled();
});
addActionReceiver(app::manager::actions::SystemBrownout, [this](auto &&data) {
- setSystemCloseInProgress();
- switchWindow(gui::window::name::bell_battery_shutdown, std::move(data));
+ requestShutdownWindow(gui::window::name::bell_battery_shutdown);
return actionHandled();
});