From 4a1e7e14be76eda1e6a1af90358c84151a68b2c5 Mon Sep 17 00:00:00 2001 From: Maciej Gibowicz Date: Mon, 20 Dec 2021 13:34:25 +0100 Subject: [PATCH] [EGD-8121] Fix cellular sleep mode enter without SIM Without a SIM card, the modem will be able to enter sleep mode, which will significantly extend the battery life of the phone. --- module-services/service-cellular/ServiceCellular.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 2248c8bc89ce6f8411452904c1ec2912a40479b5..44c3ef516f09bdbb3571d367004803bc26d0e4f8 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -202,7 +202,7 @@ void ServiceCellular::SleepTimerHandler() ? currentTime - lastCommunicationTimestamp : std::numeric_limits::max() - lastCommunicationTimestamp + currentTime; - if (!ongoingCall.isValid() && priv->state->get() == State::ST::Ready && + if (!ongoingCall.isValid() && priv->state->get() >= State::ST::URCReady && timeOfInactivity >= constants::enterSleepModeTime.count()) { cmux->enterSleepMode(); cpuSentinel->ReleaseMinimumFrequency(); @@ -1258,6 +1258,7 @@ bool ServiceCellular::handle_URCReady() ret = ret && channel->cmd(at::AT::ENABLE_NETWORK_REGISTRATION_URC); bus.sendMulticast(cellular::api::ModemState::Ready); + sleepTimer.start(); LOG_DEBUG("%s", priv->state->c_str()); return ret; @@ -1370,7 +1371,6 @@ bool ServiceCellular::handle_ready() { LOG_DEBUG("%s", priv->state->c_str()); - sleepTimer.start(); return true; }