M image/user/db/settings_v2_002-devel.sql => image/user/db/settings_v2_002-devel.sql +1 -1
@@ 21,7 21,7 @@ INSERT OR IGNORE INTO settings_tab (path, value) VALUES
('gs_lock_screen_passcode_is_on', '1'),
('gs_display_language', 'English'),
('gs_input_language', 'English'),
- ('gs_eula_accepted', '0'),
+ ('gs_eula_accepted', '1'),
('\ApplicationManager\\gs_onboarding_done', '1'),
('gs_usb_security', '1'),
('gs_os_update_version', '0.00.0'),
M module-apps/application-onboarding/ApplicationOnBoarding.cpp => module-apps/application-onboarding/ApplicationOnBoarding.cpp +3 -0
@@ 70,6 70,9 @@ namespace app
createUserInterface();
+ settings->setValue(
+ settings::SystemProperties::eulaAccepted, utils::to_string(false), settings::SettingsScope::Global);
+
connect(typeid(manager::GetCurrentDisplayLanguageResponse), [&](sys::Message *msg) {
if (gui::name::window::main_window == getCurrentWindow()->getName()) {
switchWindow(gui::window::name::onBoarding_eula, nullptr);
M module-services/service-desktop/USBSecurityModel.cpp => module-services/service-desktop/USBSecurityModel.cpp +13 -4
@@ 44,13 44,22 @@ namespace sdesktop
return isPasscodeEnabled() && isPhoneLocked();
}
- auto USBSecurityModel::getEndpointSecurity() const -> EndpointSecurity
+ auto USBSecurityModel::isEulaAccepted() const -> bool
{
- if (isSecurityEnabled()) {
- return EndpointSecurity::Block;
+ return utils::getNumericValue<bool>(
+ settings->getValue(settings::SystemProperties::eulaAccepted, settings::SettingsScope::Global));
+ }
+
+ auto USBSecurityModel::getEndpointSecurity() const -> endpointSecurity_t
+ {
+ if (!isEulaAccepted()) {
+ return {EndpointSecurity::Block, BlockReason::EulaNotAccepted};
+ }
+ else if (isSecurityEnabled()) {
+ return {EndpointSecurity::Block, BlockReason::DeviceLocked};
}
else {
- return EndpointSecurity::Allow;
+ return {EndpointSecurity::Allow, BlockReason::NoReason};
}
}
M module-services/service-desktop/WorkerDesktop.cpp => module-services/service-desktop/WorkerDesktop.cpp +1 -1
@@ 149,7 149,7 @@ bool WorkerDesktop::handleReceiveQueueMessage(std::shared_ptr<sys::WorkerQueue>
}
using namespace sdesktop::endpoints;
- auto factory = EndpointFactory::create(securityModel.getEndpointSecurity());
+ auto factory = EndpointFactory::create(securityModel.getEndpointSecurity().access);
auto handler = std::make_unique<MessageHandler>(ownerService, messageProcessedCallback, std::move(factory));
parser.setMessageHandler(std::move(handler));
M module-services/service-desktop/endpoints/include/endpoints/Endpoint.hpp => module-services/service-desktop/endpoints/include/endpoints/Endpoint.hpp +8 -1
@@ 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
@@ 16,6 16,13 @@ namespace sdesktop::endpoints
Block
};
+ enum class BlockReason
+ {
+ NoReason,
+ DeviceLocked,
+ EulaNotAccepted
+ };
+
class Endpoint
{
public:
M module-services/service-desktop/endpoints/include/endpoints/HttpEnums.hpp => module-services/service-desktop/endpoints/include/endpoints/HttpEnums.hpp +1 -0
@@ 22,6 22,7 @@ namespace sdesktop::endpoints::http
NotAcceptable = 406,
Conflict = 409,
UnprocessableEntity = 422,
+ Locked = 423,
InternalServerError = 500,
NotImplemented = 501,
InsufficientStorage = 507
M module-services/service-desktop/endpoints/security/SecurityEndpointHelper.cpp => module-services/service-desktop/endpoints/security/SecurityEndpointHelper.cpp +15 -3
@@ 50,14 50,26 @@ namespace sdesktop::endpoints
auto SecurityEndpointHelper::processStatus(Context & /*context*/) -> http::Code
{
+ auto result = http::Code::NoContent;
auto desktopService = dynamic_cast<ServiceDesktop *>(owner);
auto security = desktopService->getSecurity()->getEndpointSecurity();
- if (security == EndpointSecurity::Allow) {
+ if (security.access == EndpointSecurity::Allow) {
preventBlockingDevice();
+ result = http::Code::NoContent;
}
-
- return security == EndpointSecurity::Allow ? http::Code::NoContent : http::Code::Forbidden;
+ else {
+ switch (security.reason) {
+ case BlockReason::NoReason:
+ case BlockReason::DeviceLocked:
+ result = http::Code::Forbidden;
+ break;
+ case BlockReason::EulaNotAccepted:
+ result = http::Code::Locked;
+ break;
+ }
+ }
+ return result;
}
auto SecurityEndpointHelper::getPhoneLockTime(Context & /*context*/) -> time_t
M module-services/service-desktop/include/service-desktop/USBSecurityModel.hpp => module-services/service-desktop/include/service-desktop/USBSecurityModel.hpp +14 -4
@@ 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
@@ 17,6 17,7 @@ namespace sys
namespace sdesktop
{
+ using endpoints::BlockReason;
using endpoints::EndpointSecurity;
class USBSecurityModel
@@ 27,17 28,26 @@ namespace sdesktop
Unlocked = false,
Locked
};
+ typedef struct
+ {
+ EndpointSecurity access;
+ BlockReason reason;
+ } endpointSecurity_t;
+
explicit USBSecurityModel(sys::Service *ownerSrv, settings::Settings *srvSettings);
- auto isPasscodeEnabled() const -> bool;
+
auto setPhoneLocked() -> void;
auto setPhoneUnlocked() -> void;
- auto isPhoneLocked() const -> bool;
auto isSecurityEnabled() const -> bool;
- auto getEndpointSecurity() const -> EndpointSecurity;
+ auto getEndpointSecurity() const -> endpointSecurity_t;
auto updatePhoneLockTime(const time_t newPhoneLockTime) -> void;
auto getPhoneLockTime() const -> time_t;
private:
+ auto isPasscodeEnabled() const -> bool;
+ auto isPhoneLocked() const -> bool;
+ auto isEulaAccepted() const -> bool;
+
PhoneLockState phoneLocked;
settings::Settings *settings;
time_t phoneLockTime = 0;
M pure_changelog.md => pure_changelog.md +1 -0
@@ 9,6 9,7 @@
* Made windows flow in SIM cards settings more robust
### Fixed
+* Fixed access to the phone before going onboarding
* Fixed receiving an empty SMS message
* Fixed issue with inability to send SMS
* Fixed mixed SMS messages