Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELIA-66647: Solicited Maintenance waits for onDeviceInitializationContextUpdate Event [25Q1] #5973

Merged
merged 6 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions MaintenanceManager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file.

* For more details, refer to [versioning](https://github.com/rdkcentral/rdkservices#versioning) section under Main README.

## [1.0.40] - 2025-01-09
### Removed
- Changed Maintenance Manager Task execution thread to honour WhoAmI only in Unsolicited Maintenance.

## [1.0.39] - 2024-12-18
### Removed
- remove irmgr reference from rdkservices.
Expand Down
101 changes: 50 additions & 51 deletions MaintenanceManager/MaintenanceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
#include "UtilscRunScript.h"
#include "UtilsfileExists.h"

enum eRetval { E_NOK = -1,
E_OK };

#if defined(USE_IARMBUS) || defined(USE_IARM_BUS)
#include "libIARM.h"

Expand All @@ -68,7 +65,7 @@ using namespace std;

#define API_VERSION_NUMBER_MAJOR 1
#define API_VERSION_NUMBER_MINOR 0
#define API_VERSION_NUMBER_PATCH 39
#define API_VERSION_NUMBER_PATCH 40
#define SERVER_DETAILS "127.0.0.1:9998"


Expand Down Expand Up @@ -292,6 +289,7 @@ namespace WPEFramework {
string cmd="";
bool internetConnectStatus=false;
bool delayMaintenanceStarted = false;
bool exitOnNoNetwork = false;

std::unique_lock<std::mutex> wailck(m_waiMutex);
LOGINFO("Executing Maintenance tasks");
Expand All @@ -317,46 +315,56 @@ namespace WPEFramework {
#if defined(SUPPRESS_MAINTENANCE) && !defined(ENABLE_WHOAMI)
bool activationStatus=false;
bool skipFirmwareCheck=false;
activationStatus = getActivatedStatus(skipFirmwareCheck); /* Activation Check */

/* Activation check */
activationStatus = getActivatedStatus(skipFirmwareCheck);

/* we proceed with network check only if
* "activation-connect", "activation-ready"
* "not-activated", "activated" */
/* we proceed with network check only if activationStatus is
* "activation-connect",
* "activation-ready",
* "not-activated",
* "activated" */
if(activationStatus){
/* Network check */
internetConnectStatus = isDeviceOnline();
internetConnectStatus = isDeviceOnline(); /* Network Check */
}
#else /* WhoAmI */
internetConnectStatus = isDeviceOnline();
#else
internetConnectStatus = isDeviceOnline(); /* Network Check */
#endif

#if defined(ENABLE_WHOAMI)
string activation_status = checkActivatedStatus();
bool whoAmIStatus = false;
if (UNSOLICITED_MAINTENANCE == g_maintenance_type) {
/* WhoAmI check*/
whoAmIStatus = knowWhoAmI(activation_status);
if (whoAmIStatus) {
LOGINFO("knowWhoAmI() returned successfully");
}
else {
LOGINFO("knowWhoAmI() returned false");
}
}

if (false == whoAmIStatus && activation_status != "activated") {
LOGINFO("knowWhoAmI() returned false and Device is not already Activated");
g_listen_to_deviceContextUpdate = true;
LOGINFO("Waiting for onDeviceInitializationContextUpdate event");
task_thread.wait(wailck);
}
else if ( false == internetConnectStatus && activation_status == "activated" ) {
LOGINFO("Device is not connected to the Internet and Device is already Activated");
#else /* WhoAmI */
if ( false == internetConnectStatus ) {
if (UNSOLICITED_MAINTENANCE == g_maintenance_type)
{
string activation_status = checkActivatedStatus(); /* Device Activation Status Check */
bool whoAmIStatus = knowWhoAmI(activation_status); /* WhoAmI Response & Set Status Check */
whoAmIStatus = knowWhoAmI(activation_status);
LOGINFO("knowWhoAmI() returned %s", (whoAmIStatus) ? "successfully" : "false");

if (!whoAmIStatus && activation_status != "activated")
{
LOGINFO("knowWhoAmI() returned false and Device is not already Activated");
g_listen_to_deviceContextUpdate = true;
LOGINFO("Waiting for onDeviceInitializationContextUpdate event");
task_thread.wait(wailck);
}
else if (!internetConnectStatus && activation_status == "activated")
{
LOGINFO("Device is not connected to the Internet and Device is already Activated");
exitOnNoNetwork = true;
}
}
else /* UNSOLICITED in WHOAMI */
{
if(!internetConnectStatus)
{
exitOnNoNetwork = true;
}
}
#else
if(!internetConnectStatus)
{
exitOnNoNetwork = true;
}
#endif
if(exitOnNoNetwork)
{
m_statusMutex.lock();
MaintenanceManager::_instance->onMaintenanceStatusChange(MAINTENANCE_ERROR);
m_statusMutex.unlock();
Expand All @@ -375,22 +383,14 @@ namespace WPEFramework {
}

LOGINFO("Reboot_Pending :%s",g_is_reboot_pending.c_str());

if (UNSOLICITED_MAINTENANCE == g_maintenance_type){
LOGINFO("---------------UNSOLICITED_MAINTENANCE--------------");
}
else if( SOLICITED_MAINTENANCE == g_maintenance_type){
LOGINFO("=============SOLICITED_MAINTENANCE===============");
}
LOGINFO("%s", UNSOLICITED_MAINTENANCE == g_maintenance_type ? "---------------UNSOLICITED_MAINTENANCE--------------" : "=============SOLICITED_MAINTENANCE===============");
#if defined(SUPPRESS_MAINTENANCE) && !defined(ENABLE_WHOAMI)
/* decide which all tasks are needed based on the activation status */
if (activationStatus){
if(skipFirmwareCheck){
/* set the task status of swupdate */
if(skipFirmwareCheck)
{
/* set the task status of Firmware Download */
SET_STATUS(g_task_status,DIFD_SUCCESS);
SET_STATUS(g_task_status,DIFD_COMPLETE);

/* Add tasks */
/* Skip Firmware Download Task and add other tasks */
tasks.push_back(task_names_foreground[0].c_str());
tasks.push_back(task_names_foreground[2].c_str());
}
Expand All @@ -400,7 +400,6 @@ namespace WPEFramework {
tasks.push_back(task_names_foreground[1].c_str());
tasks.push_back(task_names_foreground[2].c_str());
}
}
#else
tasks.push_back(task_names_foreground[0].c_str());
tasks.push_back(task_names_foreground[1].c_str());
Expand Down
Loading