Skip to content

Commit e684e16

Browse files
authored
DELIA-67834 : Removed privacyMode related code from SystemServices. (rdkcentral#6275)
* DELIA-67834 : Removed privacyMode related code from SystemServices. Changed onPrivacyModeChanged handler to use UserSettings instead of SystemServices Removed PrivacyModeChanged rbus event emission from UserSettings. * Disabled Telemetry tests since IUserSettings isn't available. * Telemetry plugin is enabled/disabled in yml. * Removed privacyMode calls from header. * Added T2 notification about privacy mode to Initialize() * Updated version and changelog. * Updated docs. * Updated docs. * Updated docs.
1 parent d1be707 commit e684e16

21 files changed

+249
-347
lines changed

.github/workflows/L1-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ jobs:
271271
-DPLUGIN_DEVICEIDENTIFICATION=ON
272272
-DPLUGIN_FRAMERATE=ON
273273
-DPLUGIN_AVINPUT=ON
274-
-DPLUGIN_TELEMETRY=ON
274+
-DPLUGIN_TELEMETRY=OFF
275275
-DPLUGIN_SCREENCAPTURE=ON
276276
-DPLUGIN_USBACCESS=ON
277277
-DPLUGIN_LOGGINGPREFERENCES=ON

.github/workflows/L2-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ jobs:
229229
-DCMAKE_DISABLE_FIND_PACKAGE_RFC=ON
230230
-DCMAKE_DISABLE_FIND_PACKAGE_RBus=ON
231231
-DPLUGIN_SYSTEMSERVICES=ON
232-
-DPLUGIN_TELEMETRY=ON
232+
-DPLUGIN_TELEMETRY=OFF
233233
-DPLUGIN_WAREHOUSE=ON
234234
-DPLUGIN_HDCPPROFILE=ON
235235
-DPLUGIN_TEXTTOSPEECH=ON

SystemServices/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file.
1616

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

19+
## [3.5.0] - 2025-06-10
20+
### Removed
21+
- Removed Privacy Mode calls.
22+
1923
## [3.4.5] - 2025-06-02
2024
### Updated
2125
- Updated setDeepSleepTimer to accept timeout only for 10 days max sec

SystemServices/System.json

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,35 +1985,6 @@
19851985
]
19861986
}
19871987
},
1988-
"setPrivacyMode": {
1989-
"summary": "Setting Privacy Mode.",
1990-
"events": {
1991-
"onPrivacyModeChanged" : "Triggered when the Privacy Mode changes."
1992-
},
1993-
"params": {
1994-
"type": "object",
1995-
"properties": {
1996-
"privacyMode": {
1997-
"summary": "New Privacy Mode",
1998-
"type": "string",
1999-
"example": "DO_NOT_SHARE"
2000-
}
2001-
}
2002-
},
2003-
"result": {
2004-
"summary": "On success null will be returned",
2005-
"type": "string",
2006-
"example": "null"
2007-
}
2008-
},
2009-
"getPrivacyMode":{
2010-
"summary": "Getting Privacy Mode",
2011-
"result": {
2012-
"summary": "Current Privacy Mode",
2013-
"type": "string",
2014-
"example": "DO_NOT_SHARE"
2015-
}
2016-
},
20171988
"getBootTypeInfo":{
20181989
"summary": "Getting Boot Type",
20191990
"result": {
@@ -2418,22 +2389,6 @@
24182389
]
24192390
}
24202391
},
2421-
"onPrivacyModeChanged": {
2422-
"summary": "Triggered after the Privacy Mode changes (see `SetPrivacyMode`)",
2423-
"params": {
2424-
"type": "object",
2425-
"properties": {
2426-
"privacyMode":{
2427-
"summary": "Receive Privacy Mode changes",
2428-
"type": "string",
2429-
"example": "DO_NOT_SHARE"
2430-
}
2431-
},
2432-
"required": [
2433-
"privacyMode"
2434-
]
2435-
}
2436-
},
24372392
"onBlocklistChanged":{
24382393
"summary": "Triggers when the blocklist flag is modified",
24392394
"params": {

SystemServices/SystemServices.cpp

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
using namespace std;
6767

6868
#define API_VERSION_NUMBER_MAJOR 3
69-
#define API_VERSION_NUMBER_MINOR 4
70-
#define API_VERSION_NUMBER_PATCH 5
69+
#define API_VERSION_NUMBER_MINOR 5
70+
#define API_VERSION_NUMBER_PATCH 0
7171

7272
#define MAX_REBOOT_DELAY 86400 /* 24Hr = 86400 sec */
7373
#define TR181_FW_DELAY_REBOOT "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.Feature.AutoReboot.fwDelayReboot"
@@ -98,7 +98,6 @@ using namespace std;
9898
#define LOG_UPLOAD_STATUS_FAILURE "UPLOAD_FAILURE"
9999
#define LOG_UPLOAD_STATUS_ABORTED "UPLOAD_ABORTED"
100100

101-
#define PRIVACY_MODE_FILE "/opt/secure/persistent/System/privacymode.txt"
102101
#define BOOTVERSION "/opt/.bootversion"
103102

104103
/**
@@ -496,8 +495,6 @@ namespace WPEFramework {
496495
registerMethod("setFSRFlag", &SystemServices::setFSRFlag, this);
497496
registerMethod("getFSRFlag", &SystemServices::getFSRFlag, this);
498497

499-
registerMethod("setPrivacyMode", &SystemServices::setPrivacyMode, this);
500-
registerMethod("getPrivacyMode", &SystemServices::getPrivacyMode, this);
501498
registerMethod("getBootTypeInfo", &SystemServices::getBootTypeInfo, this);
502499

503500
}
@@ -4756,58 +4753,6 @@ namespace WPEFramework {
47564753
returnResponse(true);
47574754
}
47584755

4759-
uint32_t SystemServices::setPrivacyMode(const JsonObject& parameters, JsonObject& response)
4760-
{
4761-
LOGINFOMETHOD();
4762-
4763-
string privacyMode = parameters["privacyMode"].String();
4764-
4765-
if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE")
4766-
{
4767-
LOGERR("Wrong privacyMode value: '%s'", privacyMode.c_str());
4768-
returnResponse(false);
4769-
}
4770-
4771-
makePersistentDir();
4772-
4773-
ofstream optfile;
4774-
4775-
optfile.open(PRIVACY_MODE_FILE, ios::out);
4776-
if (optfile)
4777-
{
4778-
optfile << privacyMode;
4779-
optfile.close();
4780-
}
4781-
4782-
JsonObject params;
4783-
params["privacyMode"] = privacyMode;
4784-
sendNotify(EVT_ONPRIVACYMODECHANGED, params);
4785-
4786-
returnResponse(true);
4787-
}
4788-
4789-
uint32_t SystemServices::getPrivacyMode(const JsonObject& parameters, JsonObject& response)
4790-
{
4791-
LOGINFOMETHOD();
4792-
4793-
string privacyMode = "";
4794-
4795-
string optOutStatus;
4796-
4797-
getFileContent(PRIVACY_MODE_FILE, privacyMode);
4798-
if (privacyMode != "SHARE" && privacyMode != "DO_NOT_SHARE")
4799-
{
4800-
LOGWARN("Wrong privacyMode value: '%s', returning default", privacyMode.c_str());
4801-
privacyMode = "SHARE";
4802-
}
4803-
4804-
response["privacyMode"] = privacyMode;
4805-
4806-
returnResponse(true);
4807-
}
4808-
4809-
4810-
48114756
/***
48124757
* @brief : To set the fsr flag into the emmc raw area.
48134758
* @param1[in] : {"params":{"fsrFlag":<bool>}

SystemServices/SystemServices.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ using std::ofstream;
7070
#define EVT_FRIENDLYNAMECHANGED "onFriendlyNameChanged"
7171
#define EVT_ONLOGUPLOAD "onLogUpload"
7272
#define EVT_ONDEVICEMGTUPDATERECEIVED "onDeviceMgtUpdateReceived"
73-
#define EVT_ONPRIVACYMODECHANGED "onPrivacyModeChanged"
7473
#define TERRITORYFILE "/opt/secure/persistent/System/Territory.txt"
7574

7675

@@ -304,8 +303,6 @@ namespace WPEFramework {
304303
uint32_t getWakeupSrcConfiguration(const JsonObject& parameters, JsonObject& response);
305304
uint32_t getPlatformConfiguration(const JsonObject& parameters, PlatformCaps& response);
306305
uint32_t getThunderStartReason(const JsonObject& parameters, JsonObject& response);
307-
uint32_t setPrivacyMode(const JsonObject& parameters, JsonObject& response);
308-
uint32_t getPrivacyMode(const JsonObject& parameters, JsonObject& response);
309306
uint32_t setFSRFlag(const JsonObject& parameters, JsonObject& response);
310307
uint32_t getFSRFlag(const JsonObject& parameters, JsonObject& response);
311308
uint32_t getBootTypeInfo(const JsonObject& parameters, JsonObject& response);

Telemetry/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ All notable changes to this RDK Service will be documented in this file.
1616

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

19+
## [1.4.0] - 2025-6-10
20+
### Changed
21+
- Changed to use UserSettings plugin instead of SystemServices to get Privacy Mode.
22+
1923
## [1.3.0] - 2024-10-3
2024
### Added
2125
- Added notifications for Telemetry component about changes in PrivacyMode.

Telemetry/Telemetry.cpp

Lines changed: 23 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@
5454
#define T2_PERSISTENT_FOLDER "/opt/.t2reportprofiles/"
5555
#define DEFAULT_PROFILES_FILE "/etc/t2profiles/default.json"
5656

57-
#define SYSTEMSERVICES_CALLSIGN "org.rdk.System"
57+
#define USERSETTINGS_CALLSIGN "org.rdk.UserSettings"
5858

5959
#define API_VERSION_NUMBER_MAJOR 1
60-
#define API_VERSION_NUMBER_MINOR 3
60+
#define API_VERSION_NUMBER_MINOR 4
6161
#define API_VERSION_NUMBER_PATCH 0
6262

6363
#ifdef HAS_RBUS
@@ -96,6 +96,10 @@ namespace WPEFramework
9696

9797
Telemetry::Telemetry()
9898
: PluginHost::JSONRPC()
99+
#ifdef HAS_RBUS
100+
, _userSettingsPlugin(nullptr)
101+
, _userSettingsNotification(*this)
102+
#endif
99103
{
100104
Telemetry::_instance = this;
101105

@@ -117,43 +121,22 @@ namespace WPEFramework
117121

118122
#ifdef HAS_RBUS
119123
PluginHost::IShell::state state;
120-
if ((Utils::getServiceState(service, SYSTEMSERVICES_CALLSIGN, state) == Core::ERROR_NONE) && (state != PluginHost::IShell::state::ACTIVATED))
121-
Utils::activatePlugin(service, SYSTEMSERVICES_CALLSIGN);
122124

123-
if ((Utils::getServiceState(service, SYSTEMSERVICES_CALLSIGN, state) == Core::ERROR_NONE) && (state == PluginHost::IShell::state::ACTIVATED))
125+
if ((Utils::getServiceState(service, USERSETTINGS_CALLSIGN, state) == Core::ERROR_NONE) && (state != PluginHost::IShell::state::ACTIVATED))
126+
Utils::activatePlugin(service, USERSETTINGS_CALLSIGN);
127+
128+
if ((Utils::getServiceState(service, USERSETTINGS_CALLSIGN, state) == Core::ERROR_NONE) && (state == PluginHost::IShell::state::ACTIVATED))
124129
{
125-
m_systemServiceConnection = Utils::getThunderControllerClient(SYSTEMSERVICES_CALLSIGN);
130+
ASSERT(service != nullptr);
126131

127-
if (!m_systemServiceConnection)
128-
{
129-
LOGERR("%s plugin initialisation failed", SYSTEMSERVICES_CALLSIGN);
130-
}
131-
else
132+
_userSettingsPlugin = service->QueryInterfaceByCallsign<WPEFramework::Exchange::IUserSettings>(USERSETTINGS_CALLSIGN);
133+
if (_userSettingsPlugin)
132134
{
133-
uint32_t err = m_systemServiceConnection->Subscribe<JsonObject>(2000, "onPrivacyModeChanged", [this](const JsonObject& parameters) {
134-
135-
if (parameters.HasLabel("privacyMode"))
136-
{
137-
std::string privacyMode = parameters["privacyMode"].String();
138-
notifyT2PrivacyMode(privacyMode);
139-
}
140-
else
141-
{
142-
LOGERR("No 'privacyMode' parameter");
143-
}
144-
});
145-
146-
if (err != Core::ERROR_NONE)
147-
{
148-
LOGERR("Failed to subscribe to onPrivacyModeChanged: %d", err);
149-
}
135+
_userSettingsPlugin->Register(&_userSettingsNotification);
150136

151-
JsonObject params;
152-
JsonObject res;
153-
m_systemServiceConnection->Invoke<JsonObject, JsonObject>(2000, "getPrivacyMode", params, res);
154-
if (res["success"].Boolean())
137+
std::string privacyMode;
138+
if (_userSettingsPlugin->GetPrivacyMode(privacyMode) == Core::ERROR_NONE)
155139
{
156-
std::string privacyMode = res["privacyMode"].String();
157140
notifyT2PrivacyMode(privacyMode);
158141
}
159142
else
@@ -164,7 +147,7 @@ namespace WPEFramework
164147
}
165148
else
166149
{
167-
LOGERR("%s plugin is not activated", SYSTEMSERVICES_CALLSIGN);
150+
LOGERR("Failed to activate %s", USERSETTINGS_CALLSIGN);
168151
}
169152
#endif
170153

@@ -258,6 +241,12 @@ namespace WPEFramework
258241
rbus_close(rbusHandle);
259242
rbusHandleStatus = RBUS_ERROR_NOT_INITIALIZED;
260243
}
244+
245+
if (_userSettingsPlugin) {
246+
_userSettingsPlugin->Unregister(&_userSettingsNotification);
247+
_userSettingsPlugin->Release();
248+
_userSettingsPlugin = nullptr;
249+
}
261250
#endif
262251
}
263252

Telemetry/Telemetry.h

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121

2222
#include "Module.h"
2323

24+
#ifdef HAS_RBUS
25+
#include <interfaces/IUserSettings.h>
26+
#endif
27+
2428
namespace WPEFramework {
2529

2630
namespace Plugin {
@@ -41,6 +45,33 @@ namespace WPEFramework {
4145
class Telemetry : public PluginHost::IPlugin, public PluginHost::JSONRPC {
4246
private:
4347

48+
#ifdef HAS_RBUS
49+
class UserSettingsNotification : public Exchange::IUserSettings::INotification {
50+
private:
51+
UserSettingsNotification(const UserSettingsNotification&) = delete;
52+
UserSettingsNotification& operator=(const UserSettingsNotification&) = delete;
53+
54+
public:
55+
explicit UserSettingsNotification(Telemetry& parent)
56+
: _parent(parent)
57+
{
58+
}
59+
60+
~UserSettingsNotification() override = default;
61+
62+
void OnPrivacyModeChanged(const string& privacyMode)
63+
{
64+
_parent.notifyT2PrivacyMode(privacyMode);
65+
}
66+
67+
BEGIN_INTERFACE_MAP(UserSettingsNotification)
68+
INTERFACE_ENTRY(Exchange::IUserSettings::INotification)
69+
END_INTERFACE_MAP
70+
71+
private:
72+
Telemetry& _parent;
73+
};
74+
#endif
4475
// We do not allow this plugin to be copied !!
4576
Telemetry(const Telemetry&) = delete;
4677
Telemetry& operator=(const Telemetry&) = delete;
@@ -79,7 +110,10 @@ namespace WPEFramework {
79110
public:
80111
static Telemetry* _instance;
81112
private:
82-
std::shared_ptr<WPEFramework::JSONRPC::LinkType<WPEFramework::Core::JSON::IElement>> m_systemServiceConnection;
113+
#ifdef HAS_RBUS
114+
Exchange::IUserSettings* _userSettingsPlugin;
115+
Core::Sink<UserSettingsNotification> _userSettingsNotification;
116+
#endif
83117
};
84118
} // namespace Plugin
85119
} // namespace WPEFramework

Tests/L1Tests/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ add_executable(${PROJECT_NAME}
3535
../mocks/Iarm.cpp
3636
../mocks/RBus.cpp
3737
../mocks/MotionDetection.cpp
38-
../mocks/Telemetry.cpp
3938
../mocks/Udev.cpp
4039
../mocks/devicesettings.cpp
4140
../mocks/HdmiCec.cpp
@@ -66,7 +65,6 @@ include_directories(../../LocationSync
6665
../../DeviceDiagnostics
6766
../../FrameRate
6867
../../AVInput
69-
../../Telemetry
7068
../../ScreenCapture
7169
../../DataCapture
7270
../../UsbAccess
@@ -108,7 +106,6 @@ link_directories(../../LocationSync
108106
../../DeviceDiagnostics
109107
../../FrameRate
110108
../../AVInput
111-
../../Telemetry
112109
../../ScreenCapture
113110
../../DataCapture
114111
../../UsbAccess
@@ -151,7 +148,6 @@ target_link_libraries(${PROJECT_NAME}
151148
${NAMESPACE}FrameRate
152149
${NAMESPACE}AVInput
153150
${NAMESPACE}ScreenCapture
154-
${NAMESPACE}Telemetry
155151
${NAMESPACE}UsbAccess
156152
${NAMESPACE}Timer
157153
${NAMESPACE}LoggingPreferences

0 commit comments

Comments
 (0)