From 3887c43ca51732e2c32b2ce35215e2bba11645d4 Mon Sep 17 00:00:00 2001 From: Lefucjusz Date: Thu, 1 Dec 2022 13:05:09 +0100 Subject: [PATCH] [CP-1734] Create factory reset reboot UI Create window that will be shown when the device turns off first time after factory reset request made from PureOS. --- image/system_a/data/lang/Deutsch.json | 3 +- image/system_a/data/lang/English.json | 3 +- image/system_a/data/lang/Espanol.json | 3 +- image/system_a/data/lang/Francais.json | 3 +- image/system_a/data/lang/Polski.json | 3 +- image/system_a/data/lang/Svenska.json | 3 +- .../windows/ClosingWindow.hpp | 2 +- .../ApplicationSettings.cpp | 11 +++++- .../application-settings/CMakeLists.txt | 2 ++ .../ApplicationSettings.hpp | 3 +- .../windows/WindowNames.hpp | 1 + .../system/FactoryResetInProgressWindow.cpp | 36 +++++++++++++++++++ .../system/FactoryResetInProgressWindow.hpp | 20 +++++++++++ .../include/service-appmgr/Actions.hpp | 1 + .../model/ApplicationManagerCommon.cpp | 7 ++-- products/PurePhone/PurePhoneMain.cpp | 2 +- 16 files changed, 90 insertions(+), 13 deletions(-) create mode 100644 module-apps/application-settings/windows/system/FactoryResetInProgressWindow.cpp create mode 100644 module-apps/application-settings/windows/system/FactoryResetInProgressWindow.hpp diff --git a/image/system_a/data/lang/Deutsch.json b/image/system_a/data/lang/Deutsch.json index 5d7297a75b1c31bf3334f77dc36668cebb944adb..ae00a0c9fcc34d0847b80c6e2e315af0e7a65053 100644 --- a/image/system_a/data/lang/Deutsch.json +++ b/image/system_a/data/lang/Deutsch.json @@ -452,7 +452,8 @@ "app_settings_security": "Sicherheit", "app_settings_language": "Sprache", "app_settings_factory_reset": "Auf Werkseinstellung zurücksetzen", - "app_settings_display_factory_reset_confirmation": "Sie müssen Ihren Pure neu starten \num den Werksreset abzuschließen.\n Handy jetzt ausschalten?", + "app_settings_display_factory_reset_confirmation": "Dadurch wird dein Pure ausgeschaltet. Schalte es wieder ein, um mit dem Prozess fortzufahren.\nTelefon jetzt ausschalten?", + "app_settings_factory_reset_in_progress": "Die Werkseinstellungen wurden noch nicht vollständig wiederhergestellt. Schalte dein Pure wieder ein, um fortzufahren.", "app_settings_about_your_pure": "Über Ihr Pure", "app_settings_technical_information": "Technische Informationen", "app_settings_tech_info_model": "Modell", diff --git a/image/system_a/data/lang/English.json b/image/system_a/data/lang/English.json index f17f218b6216a1cc6d54b94ac9aa22174eef1206..ab92cee5f162d27c582a8e584bcdfc260d668d64 100644 --- a/image/system_a/data/lang/English.json +++ b/image/system_a/data/lang/English.json @@ -409,7 +409,8 @@ "app_settings_security": "Security", "app_settings_language": "Language", "app_settings_factory_reset": "Factory reset", - "app_settings_display_factory_reset_confirmation": "You need to restart your Pure \nto finalize factory reset.\n Turn off the phone now?", + "app_settings_display_factory_reset_confirmation": "Your Pure will turn off. Turn it on manually to continue the process.\nTurn off the phone now?", + "app_settings_factory_reset_in_progress": "The factory reset process is not\ncompleted yet, turn on your Pure\nto continue.", "app_settings_about_your_pure": "About your Pure", "app_settings_technical_information": "Technical Information", "app_settings_tech_info_model": "Model", diff --git a/image/system_a/data/lang/Espanol.json b/image/system_a/data/lang/Espanol.json index 2fcc7a58eaeb83cc90e1ea80700b12762995d48b..21ed121de81ffcd534cebcc2583b50cd7e05f2ee 100644 --- a/image/system_a/data/lang/Espanol.json +++ b/image/system_a/data/lang/Espanol.json @@ -452,7 +452,8 @@ "app_settings_security": "Seguridad", "app_settings_language": "Idioma", "app_settings_factory_reset": "Configuración de fábrica", - "app_settings_display_factory_reset_confirmation": "Necesita reiniciar su Pure \npara finalizar el reinicio de fábrica.\n ¿Apagar el teléfono ahora?", + "app_settings_display_factory_reset_confirmation": "Tu Pure se va a apagar. Enciéndelo manualmente para continuar.\n¿Quieres apagar el teléfono ahora?", + "app_settings_factory_reset_in_progress": "Aún no se han restablecido los valores de fábrica, enciende tu dispositivo Pure para continuar.", "app_settings_about_your_pure": "Mi dispositivo Pure", "app_settings_technical_information": "Información técnica", "app_settings_tech_info_model": "Modelo", diff --git a/image/system_a/data/lang/Francais.json b/image/system_a/data/lang/Francais.json index c2572c05d792acafae8e4e2c5fdbc4d909cf0720..fd7372a1864f002500fdf75cc897aa4882da1221 100644 --- a/image/system_a/data/lang/Francais.json +++ b/image/system_a/data/lang/Francais.json @@ -420,7 +420,8 @@ "app_settings_security": "Sécurité", "app_settings_language": "Langues", "app_settings_factory_reset": "Retour aux paramètres d'usine", - "app_settings_display_factory_reset_confirmation": "Il faut redémarrer votre Pure\npour finaliser la réinitialisation d'usine.\nÉteindre le téléphone maintenant?", + "app_settings_display_factory_reset_confirmation": "Votre Pure va s'éteindre. Allumez-la manuellement pour continuer.\nÉteindre le téléphone?", + "app_settings_factory_reset_in_progress": "La ré-initialisation de l'usine n'est pas encore terminée, allumez votre Pure pour continuer.", "app_settings_about_your_pure": "À propos de votre Pure", "app_settings_technical_information": "Informations techniques", "app_settings_tech_info_model": "Modèle", diff --git a/image/system_a/data/lang/Polski.json b/image/system_a/data/lang/Polski.json index 7ffa83c1b5857b255358fdd67da3605b4a76d75f..65b6a1f8859abd35e531ea981fb2f14ffbe64c07 100644 --- a/image/system_a/data/lang/Polski.json +++ b/image/system_a/data/lang/Polski.json @@ -463,7 +463,8 @@ "app_settings_security": "Bezpieczeństwo", "app_settings_language": "Język", "app_settings_factory_reset": "Ustawienia fabryczne", - "app_settings_display_factory_reset_confirmation": "Musisz ponownie uruchomić Pure \naby przywrócić ustawieia fabryczne.\nWyłączyć telefon?", + "app_settings_display_factory_reset_confirmation": "Pure zostanie teraz wyłączony. Aby rozpocząć proces, włącz go ponownie.\nWyłączyć telefon?", + "app_settings_factory_reset_in_progress": "Proces przywracania ustawień fabrycznych nie został jeszcze zakończony.\nUruchom telefon aby kontynuować.", "app_settings_about_your_pure": "Dane telefonu", "app_settings_technical_information": "Informacje techniczne", "app_settings_tech_info_model": "Model", diff --git a/image/system_a/data/lang/Svenska.json b/image/system_a/data/lang/Svenska.json index 256e33b92ba577d552b6f71f9dcd5a18a5983270..3ff3323d31c9c6e39b9e5f4564a9a77c24efab83 100644 --- a/image/system_a/data/lang/Svenska.json +++ b/image/system_a/data/lang/Svenska.json @@ -363,7 +363,8 @@ "app_settings_security": "Säkerhet", "app_settings_language": "Språk", "app_settings_factory_reset": "Fabriksinställningar", - "app_settings_display_factory_reset_confirmation": "Du måste starta om din Pure\nslutföra fabriksåterställningen.\nStänga av telefonen nu?", + "app_settings_display_factory_reset_confirmation": "Din Pure stängs av. Sätt på den manuellt för att fortsätta.\nStäng av telefonen nu?", + "app_settings_factory_reset_in_progress": "Fabriksåterställningen är inte klar än. Sätt på din Pure för att fortsätta.", "app_settings_about_your_pure": "Om din Pure", "app_settings_technical_information": "Teknisk information", "app_settings_tech_info_model": "Model", diff --git a/module-apps/application-desktop/windows/ClosingWindow.hpp b/module-apps/application-desktop/windows/ClosingWindow.hpp index e5451b6c229753c78a680e577b6c1a3866d36d1f..76228c5cfdef9862bbb3c885204ca447a7195795 100644 --- a/module-apps/application-desktop/windows/ClosingWindow.hpp +++ b/module-apps/application-desktop/windows/ClosingWindow.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #pragma once diff --git a/module-apps/application-settings/ApplicationSettings.cpp b/module-apps/application-settings/ApplicationSettings.cpp index 567adbf4e5558a9c4af1e6be2b85701096f2dcfb..1ec952b55ba7efd8a88040141429688d6dc3a05e 100644 --- a/module-apps/application-settings/ApplicationSettings.cpp +++ b/module-apps/application-settings/ApplicationSettings.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -329,6 +330,11 @@ namespace app connect(typeid(cellular::VolteStateNotification), [&](sys::Message *msg) -> sys::MessagePointer { return handleVolteState(msg); }); + addActionReceiver(app::manager::actions::DisplayFactoryResetInProgressScreen, [this](auto &&data) { + requestShutdownWindow(gui::window::name::factory_reset_in_progress); + return actionHandled(); + }); + createUserInterface(); settings->registerValueChange(settings::operators_on, @@ -557,7 +563,6 @@ namespace app windowsFactory.attach(gui::window::name::factory_reset, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app, name); }); - windowsFactory.attach(gui::window::name::dialog_settings, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app, name); }); @@ -567,6 +572,10 @@ namespace app windowsFactory.attach(gui::window::name::dialog_retry, [](ApplicationCommon *app, const std::string &name) { return std::make_unique(app, name); }); + windowsFactory.attach(gui::window::name::factory_reset_in_progress, + [](ApplicationCommon *app, const std::string &name) { + return std::make_unique(app); + }); attachPopups({gui::popup::ID::Volume, gui::popup::ID::Tethering, diff --git a/module-apps/application-settings/CMakeLists.txt b/module-apps/application-settings/CMakeLists.txt index fe571fd81e9cd5080939fb4d078565e13cbe34aa..f28b8bcdde7c6939f941e85d86efea788779791c 100644 --- a/module-apps/application-settings/CMakeLists.txt +++ b/module-apps/application-settings/CMakeLists.txt @@ -94,6 +94,7 @@ target_sources(application-settings windows/system/SARInfoWindow.cpp windows/system/SystemMainWindow.cpp windows/system/TechnicalInformationWindow.cpp + windows/system/FactoryResetInProgressWindow.cpp PRIVATE models/advanced/ColorTestModel.hpp widgets/SettingsStyle.hpp @@ -128,6 +129,7 @@ target_sources(application-settings windows/system/LanguagesWindow.hpp windows/system/SystemMainWindow.hpp windows/system/TechnicalInformationWindow.hpp + windows/system/FactoryResetInProgressWindow.hpp PUBLIC include/application-settings/ApplicationSettings.hpp ) diff --git a/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp b/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp index 17a8ea8a43d3944ee03fe7d5d3cdebda794efc08..1304f8b93e74e0606838ca56b7f0c80e148d0017 100644 --- a/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp +++ b/module-apps/application-settings/include/application-settings/ApplicationSettings.hpp @@ -217,7 +217,8 @@ namespace app return {{manager::actions::Launch, manager::actions::PhoneModeChanged, manager::actions::BluetoothModeChanged, - manager::actions::AlarmClockStatusChanged}}; + manager::actions::AlarmClockStatusChanged, + manager::actions::DisplayFactoryResetInProgressScreen}}; } }; } /* namespace app */ diff --git a/module-apps/application-settings/windows/WindowNames.hpp b/module-apps/application-settings/windows/WindowNames.hpp index 893132748ee263ce9aff5f1f348e79ec8b543250..cde0ba28b155b067fcae6c77da2c3ac057cee96c 100644 --- a/module-apps/application-settings/windows/WindowNames.hpp +++ b/module-apps/application-settings/windows/WindowNames.hpp @@ -65,6 +65,7 @@ namespace gui::window::name inline constexpr auto certification = "Certification"; inline constexpr auto sar = "Sar"; inline constexpr auto factory_reset = "FactoryReset"; + inline constexpr auto factory_reset_in_progress = "FactoryResetInProgress"; inline constexpr auto dialog_settings = "DialogSettings"; } // namespace gui::window::name diff --git a/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.cpp b/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0e423bffaefde9e423a3ded54e3e0f1bd1823a33 --- /dev/null +++ b/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.cpp @@ -0,0 +1,36 @@ +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "FactoryResetInProgressWindow.hpp" +#include + +#include + +namespace gui +{ + FactoryResetInProgressWindow::FactoryResetInProgressWindow(app::ApplicationCommon *app) + : AppWindow(app, gui::window::name::factory_reset_in_progress) + { + buildInterface(); + } + + void FactoryResetInProgressWindow::buildInterface() + { + AppWindow::buildInterface(); + + statusBar->setVisible(false); + navBar->setVisible(false); + + infoIcon = new gui::Icon(this, + style::window::default_left_margin, + style::window::default_vertical_pos, + style::window::default_body_width, + style::window::default_body_height, + "", + utils::translate("")); + infoIcon->setAlignment(Alignment::Horizontal::Center); + infoIcon->image->set("progress_128px_W_G"); + infoIcon->text->setText(utils::translate("app_settings_factory_reset_in_progress")); + } + +} /* namespace gui */ diff --git a/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.hpp b/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88472a8adab894e689c9c4e9df0b9c2c910f54a0 --- /dev/null +++ b/module-apps/application-settings/windows/system/FactoryResetInProgressWindow.hpp @@ -0,0 +1,20 @@ +// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once + +#include +#include + +namespace gui +{ + class FactoryResetInProgressWindow : public AppWindow + { + private: + Icon *infoIcon = nullptr; + + public: + explicit FactoryResetInProgressWindow(app::ApplicationCommon *app); + void buildInterface() override; + }; +} /* namespace gui */ diff --git a/module-services/service-appmgr/include/service-appmgr/Actions.hpp b/module-services/service-appmgr/include/service-appmgr/Actions.hpp index cc563590bfeec3920429dbd093fa4a07da37504b..9ce6af9288ef513087bc7d50d2b10f6176c7ecd1 100644 --- a/module-services/service-appmgr/include/service-appmgr/Actions.hpp +++ b/module-services/service-appmgr/include/service-appmgr/Actions.hpp @@ -52,6 +52,7 @@ namespace app::manager DisplayLowBatteryScreen, SystemBrownout, DisplayLogoAtExit, + DisplayFactoryResetInProgressScreen, SMSRejectedByOfflineNotification, CallRejectedByOfflineNotification, PhoneModeChanged, diff --git a/module-services/service-appmgr/model/ApplicationManagerCommon.cpp b/module-services/service-appmgr/model/ApplicationManagerCommon.cpp index 2bbd06e3806859c95c93787264d6465d95f9ddba..beee00ebaca0f91bf360888a363bf9101cf698ae 100644 --- a/module-services/service-appmgr/model/ApplicationManagerCommon.cpp +++ b/module-services/service-appmgr/model/ApplicationManagerCommon.cpp @@ -21,11 +21,9 @@ #include #include #include -#include #include #include #include -#include #include #include @@ -38,7 +36,8 @@ namespace app::manager bool checkIfCloseableAction(const actions::Action action) { - return action == app::manager::actions::DisplayLogoAtExit or + return action == app::manager::actions::DisplayFactoryResetInProgressScreen || + action == app::manager::actions::DisplayLogoAtExit || action == app::manager::actions::SystemBrownout; } @@ -48,6 +47,8 @@ namespace app::manager case sys::CloseReason::SystemBrownout: case sys::CloseReason::LowBattery: return ActionRequest{senderName, app::manager::actions::SystemBrownout, nullptr}; + case sys::CloseReason::RebootToRecovery: + return ActionRequest{senderName, app::manager::actions::DisplayFactoryResetInProgressScreen, nullptr}; default: return ActionRequest{senderName, app::manager::actions::DisplayLogoAtExit, nullptr}; } diff --git a/products/PurePhone/PurePhoneMain.cpp b/products/PurePhone/PurePhoneMain.cpp index 85425644dd850bb4636d2ab487eaaaf4b85314b8..4731111b5ce3a9532fbe13326308c6ef9fe5d944 100644 --- a/products/PurePhone/PurePhoneMain.cpp +++ b/products/PurePhone/PurePhoneMain.cpp @@ -185,7 +185,7 @@ int main() systemServices.emplace_back(sys::CreatorFor(std::make_shared())); #endif #ifdef ENABLE_SERVICE_EINK - systemServices.emplace_back(sys::CreatorFor()); + systemServices.emplace_back(sys::CreatorFor(service::eink::ExitAction::None)); #endif #ifdef ENABLE_SERVICE_GUI systemServices.emplace_back(