M module-apps/application-alarm-clock/ApplicationAlarmClock.cpp => module-apps/application-alarm-clock/ApplicationAlarmClock.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ApplicationAlarmClock.hpp"
M module-apps/application-alarm-clock/models/AlarmsRepository.cpp => module-apps/application-alarm-clock/models/AlarmsRepository.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AlarmsRepository.hpp"
M module-apps/application-call/ApplicationCall.cpp => module-apps/application-call/ApplicationCall.cpp +5 -2
@@ 225,8 225,11 @@ namespace app
windowsFactory.attach(app::window::name_dialogConfirm, [](ApplicationCommon *app, const std::string &name) {
return std::make_unique<gui::DialogConfirm>(app, name);
});
- attachPopups(
- {gui::popup::ID::Volume, gui::popup::ID::Tethering, gui::popup::ID::PhoneModes, gui::popup::ID::SimLock});
+ attachPopups({gui::popup::ID::Volume,
+ gui::popup::ID::Tethering,
+ gui::popup::ID::PhoneModes,
+ gui::popup::ID::SimLock,
+ gui::popup::ID::Alarm}); // Alarm pop-up is blocked during phone call - logic is on Alarm side
}
bool ApplicationCall::showNotification(std::function<bool()> action,
M => +1 -1
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AlarmPresenter.hpp"
M module-audio/Audio/AudioCommon.hpp => module-audio/Audio/AudioCommon.hpp +2 -1
@@ 60,7 60,8 @@ namespace audio
None,
Multimedia,
Notifications,
- System = Notifications,
+ System = Notifications,
+ SingleVibration = Notifications,
KeypadSound,
CallRingtone,
TextMessageRingtone,
M module-db/Interface/AlarmEventRecord.cpp => module-db/Interface/AlarmEventRecord.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AlarmEventRecord.hpp"
M module-db/Interface/EventRecord.hpp => module-db/Interface/EventRecord.hpp +8 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 56,8 56,13 @@ struct SingleEventRecord : public Record, public EventInfo
virtual ~SingleEventRecord() = default;
SingleEventRecord() = default;
- SingleEventRecord(std::shared_ptr<EventRecord> parent, TimePoint startDate, TimePoint endDate)
- : EventInfo{startDate, endDate}, parent{parent} {};
+ SingleEventRecord(std::shared_ptr<EventRecord> parent,
+ TimePoint startDate,
+ TimePoint endDate,
+ bool wasHandledDuringCall = false)
+ : EventInfo{startDate, endDate}, parent{parent}, wasHandledDuringPhoneCall(wasHandledDuringCall){};
auto isValid() const -> bool;
+
+ bool wasHandledDuringPhoneCall;
};
M module-db/Tables/AlarmEventsTable.cpp => module-db/Tables/AlarmEventsTable.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AlarmEventsTable.hpp"
M module-services/service-audio/ServiceAudio.cpp => module-services/service-audio/ServiceAudio.cpp +8 -0
@@ 126,6 126,8 @@ ServiceAudio::ServiceAudio()
[this](sys::Message *msg) -> sys::MessagePointer { return handleMultimediaAudioPause(); });
connect(typeid(message::bluetooth::AudioStart),
[this](sys::Message *msg) -> sys::MessagePointer { return handleMultimediaAudioStart(); });
+ connect(typeid(SingleVibrationStart),
+ [this](sys::Message *msg) -> sys::MessagePointer { return handleSingleVibrationStart(); });
}
ServiceAudio::~ServiceAudio()
@@ 898,6 900,12 @@ auto ServiceAudio::handleMultimediaAudioStart() -> sys::MessagePointer
return sys::msgHandled();
}
+auto ServiceAudio::handleSingleVibrationStart() -> sys::MessagePointer
+{
+ VibrationUpdate(audio::PlaybackType::SingleVibration);
+ return sys::msgHandled();
+}
+
void ServiceAudio::notifyAboutNewRoutingIfRouterAvailable()
{
for (auto &input : audioMux.GetAllInputs()) {
M module-services/service-audio/include/service-audio/AudioMessage.hpp => module-services/service-audio/include/service-audio/AudioMessage.hpp +7 -0
@@ 321,3 321,10 @@ class HFPDeviceVolumeChanged : public BluetoothDeviceVolumeChanged
HFPDeviceVolumeChanged(std::uint8_t volume) : BluetoothDeviceVolumeChanged{volume}
{}
};
+
+class SingleVibrationStart : public AudioMessage
+{
+ public:
+ SingleVibrationStart()
+ {}
+};
M module-services/service-audio/include/service-audio/ServiceAudio.hpp => module-services/service-audio/include/service-audio/ServiceAudio.hpp +5 -1
@@ 55,7 55,10 @@ class ServiceAudio : public sys::Service
std::map<VibrationType, std::list<audio::PlaybackType>> vibrationMap = {
{VibrationType::None, {}},
{VibrationType::Continuous, {audio::PlaybackType::CallRingtone, audio::PlaybackType::Alarm}},
- {VibrationType::OneShot, {audio::PlaybackType::Notifications, audio::PlaybackType::TextMessageRingtone}}};
+ {VibrationType::OneShot,
+ {audio::PlaybackType::Notifications,
+ audio::PlaybackType::TextMessageRingtone,
+ audio::PlaybackType::SingleVibration}}};
auto IsVibrationMotorOn()
{
@@ 127,6 130,7 @@ class ServiceAudio : public sys::Service
auto handleHFPVolumeChangedOnBluetoothDevice(sys::Message *msgl) -> sys::MessagePointer;
auto handleMultimediaAudioPause() -> sys::MessagePointer;
auto handleMultimediaAudioStart() -> sys::MessagePointer;
+ auto handleSingleVibrationStart() -> sys::MessagePointer;
void notifyAboutNewRoutingIfRouterAvailable();
};
M module-services/service-cellular/CellularServiceAPI.cpp => module-services/service-cellular/CellularServiceAPI.cpp +16 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "service-cellular/CellularMessage.hpp"
@@ 238,6 238,21 @@ bool CellularServiceAPI::GetAntenna(sys::Service *serv, bsp::cellular::antenna &
return false;
}
+bool CellularServiceAPI::IsCallInProgress(sys::Service *serv, bool &response)
+{
+ auto msg = std::make_shared<cellular::IsCallActive>();
+ auto ret = serv->bus.sendUnicastSync(msg, ServiceCellular::serviceName, 1000);
+ if (ret.first == sys::ReturnCodes::Success) {
+ auto celResponse = std::dynamic_pointer_cast<cellular::IsCallActiveResponse>(ret.second);
+ if ((celResponse != nullptr) && (celResponse->retCode == sys::ReturnCodes::Success)) {
+ LOG_DEBUG("Is Call in progress: %d", celResponse->active);
+ response = celResponse->active;
+ return true;
+ }
+ }
+ return false;
+}
+
bool CellularServiceAPI::TransmitDtmfTones(sys::Service *serv, DTMFCode code)
{
auto msg = std::make_shared<cellular::DtmfRequestMessage>(code);
M module-services/service-cellular/service-cellular/CellularServiceAPI.hpp => module-services/service-cellular/service-cellular/CellularServiceAPI.hpp +2 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 85,6 85,7 @@ namespace CellularServiceAPI
bool GetCREG(sys::Service *serv, std::string &response);
bool GetQNWINFO(sys::Service *serv, std::string &response);
bool GetAntenna(sys::Service *serv, bsp::cellular::antenna &response);
+ bool IsCallInProgress(sys::Service *serv, bool &response);
/**
* @brief Transmits DTMF tone
* @param serv
M module-services/service-evtmgr/api/EventManagerServiceAPI.cpp => module-services/service-evtmgr/api/EventManagerServiceAPI.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <service-evtmgr/EventManagerServiceAPI.hpp>
M module-services/service-time/AlarmOperations.cpp => module-services/service-time/AlarmOperations.cpp +39 -6
@@ 2,6 2,7 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "AlarmOperations.hpp"
+#include "service-evtmgr/EVMessages.hpp"
#include <module-db/Interface/AlarmEventRecord.hpp>
#include <module-db/Interface/EventRecord.hpp>
@@ 167,7 168,6 @@ namespace alarms
callback(false);
return;
}
-
auto newSnoozed = std::make_unique<SnoozedAlarmEventRecord>((*found).get());
if (typeid(*(*found)) == typeid(SnoozedAlarmEventRecord)) {
@@ 193,7 193,9 @@ namespace alarms
newSnoozed->startDate = nextAlarmTime;
snoozedSingleEvents.push_back(std::move(newSnoozed));
- switchAlarmExecution(*(*found), false);
+ if ((*found)->wasHandledDuringPhoneCall == false) {
+ switchAlarmExecution(*(*found), false);
+ }
ongoingSingleEvents.erase(found);
processOngoingEvents();
@@ 292,11 294,32 @@ namespace alarms
void AlarmOperationsCommon::processOngoingEvents()
{
- if (!ongoingSingleEvents.empty()) {
- switchAlarmExecution(*(ongoingSingleEvents.front()), true);
- handleActiveAlarmsCountChange();
- handleSnoozedAlarmsCountChange();
+ if (ongoingSingleEvents.empty()) {
+ return;
+ }
+
+ if (onCheckIfPhoneCallIsOngoingCallback && onCheckIfPhoneCallIsOngoingCallback()) {
+
+ // Handle once during a phone call
+ if (!ongoingSingleEvents.front()->wasHandledDuringPhoneCall && onAlarmDuringPhoneCallCallback) {
+ onAlarmDuringPhoneCallCallback();
+ ongoingSingleEvents.front()->wasHandledDuringPhoneCall = true;
+ }
+
+ // Snooze Alarm during a phone call
+ OnSnoozeRingingAlarm onSnoozeRingingAlarmCallback = [](bool success) {
+ success ? LOG_DEBUG("Alarm snoozed during a phone call ") : LOG_ERROR("Unable to snooze alarm!");
+ };
+ snoozeRingingAlarm(ongoingSingleEvents.front()->parent->ID,
+ std::chrono::floor<std::chrono::minutes>(TimePointNow()) + std::chrono::minutes(1),
+ onSnoozeRingingAlarmCallback);
+ return;
}
+
+ ongoingSingleEvents.front()->wasHandledDuringPhoneCall = false;
+ switchAlarmExecution(*(ongoingSingleEvents.front()), true);
+ handleActiveAlarmsCountChange();
+ handleSnoozedAlarmsCountChange();
}
void AlarmOperationsCommon::addAlarmExecutionHandler(const alarms::AlarmType type,
@@ 477,4 500,14 @@ namespace alarms
return id == event->parent->ID;
});
}
+
+ auto AlarmOperationsCommon::addCheckIfPhoneCallIsOngoingCallback(CheckIfPhoneCallIsOngoing callback) -> void
+ {
+ onCheckIfPhoneCallIsOngoingCallback = callback;
+ }
+
+ auto AlarmOperationsCommon::addAlarmDuringPhoneCallCallback(OnAlarmDuringPhoneCall callback) -> void
+ {
+ onAlarmDuringPhoneCallCallback = callback;
+ }
} // namespace alarms
M module-services/service-time/AlarmOperations.hpp => module-services/service-time/AlarmOperations.hpp +8 -0
@@ 32,6 32,8 @@ namespace alarms
using OnSnoozedAlarmsCountChange = std::function<void(unsigned)>;
using OnActiveAlarmCountChange = std::function<void(bool)>;
using OnToggleAllProcessed = std::function<void(bool)>;
+ using CheckIfPhoneCallIsOngoing = std::function<bool(void)>;
+ using OnAlarmDuringPhoneCall = std::function<void(void)>;
virtual ~IAlarmOperations() noexcept = default;
@@ 66,6 68,8 @@ namespace alarms
virtual void getSnoozedAlarms(OnGetSnoozedAlarms callback) = 0;
virtual void handleCriticalBatteryLevel() = 0;
virtual void handleNormalBatteryLevel() = 0;
+ virtual void addCheckIfPhoneCallIsOngoingCallback(CheckIfPhoneCallIsOngoing) = 0;
+ virtual void addAlarmDuringPhoneCallCallback(OnAlarmDuringPhoneCall) = 0;
};
class IAlarmOperationsFactory
@@ 112,6 116,8 @@ namespace alarms
void getSnoozedAlarms(OnGetSnoozedAlarms callback) override;
void handleCriticalBatteryLevel() override;
void handleNormalBatteryLevel() override;
+ void addCheckIfPhoneCallIsOngoingCallback(CheckIfPhoneCallIsOngoing callback) override;
+ void addAlarmDuringPhoneCallCallback(OnAlarmDuringPhoneCall callback) override;
protected:
std::unique_ptr<AbstractAlarmEventsRepository> alarmEventsRepo;
@@ 132,6 138,8 @@ namespace alarms
GetCurrentTime getCurrentTimeCallback;
OnSnoozedAlarmsCountChange onSnoozedAlarmsCountChangeCallback = nullptr;
OnActiveAlarmCountChange onActiveAlarmCountChangeCallback = nullptr;
+ CheckIfPhoneCallIsOngoing onCheckIfPhoneCallIsOngoingCallback = nullptr;
+ OnAlarmDuringPhoneCall onAlarmDuringPhoneCallCallback = nullptr;
// Max 100 alarms for one minute seems reasonable, next events will be dropped
constexpr static auto getNextSingleEventsOffset = 0;
M module-services/service-time/ServiceTime.cpp => module-services/service-time/ServiceTime.cpp +13 -0
@@ 2,11 2,15 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "ServiceTime.hpp"
+#include "service-evtmgr/Constants.hpp"
+#include "service-evtmgr/EVMessages.hpp"
#include <service-time/internal/StaticData.hpp>
#include <service-time/RTCCommand.hpp>
#include <service-time/TimeMessage.hpp>
#include <service-time/TimeSettings.hpp>
#include <service-time/TimezoneHandler.hpp>
+#include <service-audio/AudioServiceName.hpp>
+#include <service-audio/AudioMessage.hpp>
#include <service-cellular/ServiceCellular.hpp>
#include <time/TimeZone.hpp>
@@ 45,6 49,15 @@ namespace stm
auto alarmEventsRepo = std::make_unique<alarms::AlarmEventsDBRepository>(this);
auto alarmOperations = alarmOperationsFactory->create(this, std::move(alarmEventsRepo), TimePointNow);
alarmOperations->updateEventsCache(TimePointNow());
+ alarmOperations->addCheckIfPhoneCallIsOngoingCallback([this]() -> bool {
+ bool isPhoneCallInProgress = false;
+ if (!CellularServiceAPI::IsCallInProgress(this, isPhoneCallInProgress)) {
+ LOG_ERROR("Unable to check if the Call is in progress");
+ }
+ return isPhoneCallInProgress;
+ });
+ alarmOperations->addAlarmDuringPhoneCallCallback(
+ [this]() { this->bus.sendUnicast(std::make_shared<SingleVibrationStart>(), service::name::audio); });
alarmMessageHandler = std::make_unique<alarms::AlarmMessageHandler>(this, std::move(alarmOperations));
registerMessageHandlers();
return sys::ReturnCodes::Success;
M module-services/service-time/ServiceTime.hpp => module-services/service-time/ServiceTime.hpp +2 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 11,6 11,7 @@
#include "service-time/ServiceTime.hpp"
#include <service-db/DBServiceName.hpp>
+#include <service-cellular/CellularServiceAPI.hpp>
#include <MessageType.hpp>
#include <system/Common.hpp>
M module-services/service-time/SnoozedAlarmEventRecord.hpp => module-services/service-time/SnoozedAlarmEventRecord.hpp +6 -3
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#pragma once
@@ 12,8 12,11 @@ struct SnoozedAlarmEventRecord : public SingleEventRecord
TimePoint snoozeStart = TIME_POINT_INVALID;
explicit SnoozedAlarmEventRecord(SingleEventRecord *singleAlarm)
- : SingleEventRecord(singleAlarm->parent, singleAlarm->startDate, singleAlarm->endDate), snoozeStart{
- TimePointNow()} {};
+ : SingleEventRecord(singleAlarm->parent,
+ singleAlarm->startDate,
+ singleAlarm->endDate,
+ singleAlarm->wasHandledDuringPhoneCall),
+ snoozeStart{TimePointNow()} {};
std::uint32_t snooze() noexcept
{
M module-sys/Service/Service.cpp => module-sys/Service/Service.cpp +1 -1
@@ 1,4 1,4 @@
-// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include <Service/Service.hpp>
M pure_changelog.md => pure_changelog.md +1 -0
@@ 52,6 52,7 @@
* Fixed unsupported character in several quotes
* Fixed marking new message as read in Messages app main window
* Fixed unwanted autolock on template selection window while rejecting call
+* Fixed scenario when Alarm not being handled properly during a phone call
## [1.7.0 2023-03-23]
### Changed / Improved