Skip to content

Commit 711ff81

Browse files
authored
RDK-56276: Add user settings inspector interface to user settings plugin. (rdkcentral#6131)
* RDK-56276: Add user settings inspector interface to user settings plugin * Update UserSettingsImplementation.cpp
1 parent 39a782b commit 711ff81

7 files changed

+272
-74
lines changed

Tests/L2Tests/patches/0001-Add-IAnalytics-interface-R4.4.patch

100644100755
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,20 +55,18 @@ index 0000000..c33d8e0
5555
+}
5656
+}
5757
diff --git a/interfaces/Ids.h b/interfaces/Ids.h
58-
index 7d53320..0296d66 100644
58+
index 5128382..350d806 100644
5959
--- a/interfaces/Ids.h
6060
+++ b/interfaces/Ids.h
61-
@@ -368,7 +368,9 @@ namespace Exchange {
62-
ID_DEVICE_OPTIMIZE_STATE_ACTIVATOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510,
61+
@@ -370,9 +370,9 @@ namespace Exchange {
6362

63+
ID_DEVICE_OPTIMIZE_STATE_ACTIVATOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510,
6464
ID_SYSTEM_MODE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x520,
6565
- ID_SYSTEM_MODE_NOTIFICATION = ID_SYSTEM_MODE + 1
66+
-
6667
+ ID_SYSTEM_MODE_NOTIFICATION = ID_SYSTEM_MODE + 1,
67-
+
68-
+ ID_ANALYTICS = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x530,
68+
69+
+ ID_ANALYTICS = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x530
70+
6971
};
7072
}
71-
}
72-
--
73-
2.25.1
74-

Tests/L2Tests/patches/RDK-51362-System-Mode-Thunder-Plugin.patch

100644100755
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -122,20 +122,19 @@ index 0000000..2c33b6d
122122
+} // namespace Exchange
123123
+} // namespace WPEFramework
124124
diff --git a/interfaces/Ids.h b/interfaces/Ids.h
125-
index e66cb22..7d53320 100644
125+
index 9f28fe0..5128382 100644
126126
--- a/interfaces/Ids.h
127127
+++ b/interfaces/Ids.h
128-
@@ -363,7 +363,12 @@ namespace Exchange {
129-
ID_TEXT_TO_SPEECH_NOTIFICATION = ID_TEXT_TO_SPEECH + 1,
128+
@@ -368,6 +368,12 @@ namespace Exchange {
129+
ID_USER_SETTINGS_MIGRATION_STATE_ITERATOR = ID_USER_SETTINGS + 3,
130+
130131

131-
ID_USER_SETTINGS = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4D0,
132-
- ID_USER_SETTINGS_NOTIFICATION = ID_USER_SETTINGS + 1
133-
+ ID_USER_SETTINGS_NOTIFICATION = ID_USER_SETTINGS + 1,
134-
+
135132
+ ID_DEVICE_OPTIMIZE_STATE_ACTIVATOR = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x510,
136-
+
137133
+ ID_SYSTEM_MODE = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x520,
138134
+ ID_SYSTEM_MODE_NOTIFICATION = ID_SYSTEM_MODE + 1
135+
+
136+
+
137+
+
139138
};
140139
}
141140
}

Tests/L2Tests/patches/RDKV-48604-User-Settings-Thunder-Plugin.patch

Lines changed: 101 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Date: Fri Sep 6 12:49:05 2024 +0530
66

77
diff --git a/interfaces/IUserSettings.h b/interfaces/IUserSettings.h
88
new file mode 100755
9-
index 0000000..4adda17
9+
index 0000000..bd7ea1f
1010
--- /dev/null
1111
+++ b/interfaces/IUserSettings.h
12-
@@ -0,0 +1,353 @@
12+
@@ -0,0 +1,414 @@
1313
+/*
1414
+ * If not stated otherwise in this file or this component's LICENSE file the
1515
+ * following copyright and licenses apply:
@@ -33,57 +33,58 @@ index 0000000..4adda17
3333
+
3434
+#include "Module.h"
3535
+
36+
+// @stubgen:include <com/IIteratorType.h>
3637
+namespace WPEFramework {
3738
+namespace Exchange {
3839
+
39-
+ // @json @text:keep
40+
+// @json @text:keep
4041
+struct EXTERNAL IUserSettings : virtual public Core::IUnknown
4142
+{
42-
+ enum { ID = ID_USER_SETTINGS };
43+
+ enum { ID = ID_USER_SETTINGS };
4344
+
44-
+ // @event
45+
+ // @event
4546
+ struct EXTERNAL INotification : virtual public Core::IUnknown
4647
+ {
47-
+ enum { ID = ID_USER_SETTINGS_NOTIFICATION };
48+
+ enum { ID = ID_USER_SETTINGS_NOTIFICATION };
4849
+
49-
+ // Constructor
50-
+ INotification() {};
50+
+ // Constructor
51+
+ INotification() {};
5152
+
52-
+ // Destructor
53-
+ virtual ~INotification() {};
53+
+ // Destructor
54+
+ virtual ~INotification() {};
5455
+
55-
+ // copy constructor
56-
+ INotification & operator=(const INotification &) = delete;
56+
+ // copy constructor
57+
+ INotification & operator=(const INotification &) = delete;
5758
+
58-
+ // @text onAudioDescriptionChanged
59-
+ // @brief The AudioDescription setting has changed.
60-
+ // @param enabled: Enabled/Disabled.
59+
+ // @text onAudioDescriptionChanged
60+
+ // @brief The AudioDescription setting has changed.
61+
+ // @param enabled: audioDescription enabled or not
6162
+ virtual void OnAudioDescriptionChanged(const bool enabled) {};
6263
+
63-
+ // @text onPreferredAudioLanguagesChanged
64-
+ // @brief The preferredLanguages setting has changed.
65-
+ // @param preferredLanguages: PreferredLanguages.
64+
+ // @text onPreferredAudioLanguagesChanged
65+
+ // @brief The preferredLanguages setting has changed.
66+
+ // @param preferredLanguages: the changed preferredLanguages.
6667
+ virtual void OnPreferredAudioLanguagesChanged(const string& preferredLanguages /* @text preferredLanguages */) {};
6768
+
68-
+ // @text onPresentationLanguageChanged
69-
+ // @brief The PresentationLanguages setting has changed.
70-
+ // @param presentationLanguage: PresentationLanguage.
69+
+ // @text onPresentationLanguageChanged
70+
+ // @brief The PresentationLanguages setting has changed.
71+
+ // @param presentationLanguage: the changed presentationLanguage.
7172
+ virtual void OnPresentationLanguageChanged(const string& presentationLanguage /* @text presentationLanguage */) {};
7273
+
73-
+ // @text onCaptionsChanged
74-
+ // @brief The Captions setting has changed.
75-
+ // @param enabled: Enabled/Disabled.
74+
+ // @text onCaptionsChanged
75+
+ // @brief The Captions setting has changed.
76+
+ // @param enabled: Captions enabled or not.
7677
+ virtual void OnCaptionsChanged(const bool enabled) {};
7778
+
78-
+ // @text onPreferredCaptionsLanguagesChanged
79-
+ // @brief The PreferredCaptionsLanguages setting has changed.
80-
+ // @param preferredLanguages: PreferredLanguages.
79+
+ // @text onPreferredCaptionsLanguagesChanged
80+
+ // @brief The PreferredCaptionsLanguages setting has changed.
81+
+ // @param preferredLanguages: the changed preferredLanguages.
8182
+ virtual void OnPreferredCaptionsLanguagesChanged(const string& preferredLanguages /* @text preferredLanguages */) {};
8283
+
83-
+ // @text onPreferredClosedCaptionServiceChanged
84+
+ // @text onPreferredClosedCaptionServiceChanged
8485
+ // @brief The PreferredClosedCaptionService setting has changed.Eg: "CC[1-4]", "TEXT[1-4]", "SERVICE[1-64]".
8586
+ // @param service: the changed preferredClosedCaptionService.
86-
+ virtual void OnPreferredClosedCaptionServiceChanged(const string& service) {};
87+
+ virtual void OnPreferredClosedCaptionServiceChanged(const string& service) {};
8788
+
8889
+ // @text onPrivacyModeChanged
8990
+ // @brief The PrivacyMode setting has changed.
@@ -193,7 +194,7 @@ index 0000000..4adda17
193194
+ // of this state while a playback is active.
194195
+ // When media players start playback, they should also call the GetCaptions method to retrieve the current enabled state.
195196
+ // This holds true for media players that utilize TextTrack render sessions for text track decode-display and also for media
196-
+ // players or apps that decode-display internally
197+
+ // players or apps that decode-display internally
197198
+ // @param enabled: Sets the state
198199
+ virtual uint32_t SetCaptions(const bool enabled /* @in */) = 0;
199200
+
@@ -208,7 +209,7 @@ index 0000000..4adda17
208209
+ // expressed as a comma separated lists of languages of zero of more elements.
209210
+ // The players will pick the subtitle track that has the best match compared with
210211
+ // this list. In the absence of a matching track, the player should by best
211-
+ // effort select the preferred subtitle track.
212+
+ // effort select the preferred subtitle track.
212213
+ // @param preferredLanguages: Is the list to set (e.g. "eng,fra")
213214
+ virtual uint32_t SetPreferredCaptionsLanguages(const string& preferredLanguages /* @in @text preferredLanguages */) = 0;
214215
+
@@ -220,7 +221,7 @@ index 0000000..4adda17
220221
+ // @text setPreferredClosedCaptionService
221222
+ // @brief Sets the PreferredClosedCaptionService.
222223
+ // @details The setting should be honored by the player. The behaviour of AUTO may be player specific.
223-
+ // Valid input for service is "CC[1-4]", "TEXT[1-4]", "SERVICE[1-64]"
224+
+ // Valid input for service is "CC[1-4]", "TEXT[1-4]", "SERVICE[1-64]"
224225
+ // @param service: Identifies the service to display e.g. "CC3".
225226
+ virtual uint32_t SetPreferredClosedCaptionService(const string& service /* @in */) = 0;
226227
+
@@ -268,7 +269,7 @@ index 0000000..4adda17
268269
+ // restrictions are to be applied, if applicable for the project
269270
+ // @param viewingRestrictionsWindow: A project-specific representation of the time interval.Eg: "ALWAYS"
270271
+ virtual uint32_t SetViewingRestrictionsWindow(const string &viewingRestrictionsWindow /* @in @text viewingRestrictionsWindow */) = 0;
271-
+
272+
+
272273
+ // @text getViewingRestrictionsWindow
273274
+ // @brief Gets the current ViewingRestrictionsWindow.
274275
+ // @param viewingRestrictionsWindow: A project-specific representation of the time interval.Eg: "ALWAYS"
@@ -360,22 +361,86 @@ index 0000000..4adda17
360361
+
361362
+};
362363
+
364+
+/**
365+
+ * If a setting was owned by an other component prior to being migrated into UserSettings,
366+
+ * we require the ability to detect when this migration has completed.
367+
+ * The component which was the previous owner of a given setting has the responsibility
368+
+ * to always set the setting on UserSettings interface (During migration AND during first time install).
369+
+ * Until this is done the setting is not considered valid, meaning the the MigrationState will contain requiresMigration=true
370+
+ * All settings not requiring migration would immediately be valid.
371+
+ */
372+
+
373+
+/* @json 1.0.0 @text:keep */
374+
+struct EXTERNAL IUserSettingsInspector : virtual public Core::IUnknown
375+
+{
376+
+ enum { ID = ID_USER_SETTINGS_INSPECTOR };
377+
+
378+
+ ~IUserSettingsInspector() override = default;
379+
+
380+
+ enum SettingsKey : uint32_t
381+
+ {
382+
+ PREFERRED_AUDIO_LANGUAGES = 1,
383+
+ AUDIO_DESCRIPTION = 2,
384+
+ CAPTIONS = 3,
385+
+ PREFERRED_CAPTIONS_LANGUAGES = 4,
386+
+ PREFERRED_CLOSED_CAPTION_SERVICE = 5,
387+
+ PRESENTATION_LANGUAGE = 6,
388+
+ HIGH_CONTRAST = 7,
389+
+ PIN_CONTROL = 8,
390+
+ VIEWING_RESTRICTIONS = 9,
391+
+ VIEWING_RESTRICTIONS_WINDOW = 10,
392+
+ LIVE_WATERSHED = 11,
393+
+ PLAYBACK_WATERSHED = 12,
394+
+ BLOCK_NOT_RATED_CONTENT = 13,
395+
+ PIN_ON_PURCHASE = 14,
396+
+ VOICE_GUIDANCE = 15,
397+
+ VOICE_GUIDANCE_RATE = 16,
398+
+ VOICE_GUIDANCE_HINTS = 17
399+
+ };
400+
+
401+
+ struct SettingsMigrationState
402+
+ {
403+
+ SettingsKey key /* @text key which needs the migration information */ ;
404+
+ bool requiresMigration /* @text whether the key requires migration or not */;
405+
+ };
406+
+
407+
+ using IUserSettingsMigrationStateIterator = RPC::IIteratorType<SettingsMigrationState, ID_USER_SETTINGS_MIGRATION_STATE_ITERATOR>;
408+
+
409+
+ /** Get the migration state of the respective key */
410+
+ // @text getMigrationState
411+
+ // @brief Get the migration state of the respective key
412+
+ // @param key: one of UserSettingsKey
413+
+ // @param migrationState: key and it's migration state.
414+
+ virtual Core::hresult GetMigrationState(const SettingsKey key, bool &requiresMigration /* @out */) const = 0;
415+
+
416+
+ /** Get the migration state of all the defined keys */
417+
+ // @text getMigrationStates
418+
+ // @brief Get the migration state of all the defined keys
419+
+ // @param states: array of migration status.
420+
+ virtual Core::hresult GetMigrationStates(IUserSettingsMigrationStateIterator*& states /* @out */) const = 0;
421+
+
422+
+};
423+
+
363424
+} // namespace Exchange
364425
+} // namespace WPEFramework
365426
+
366427
diff --git a/interfaces/Ids.h b/interfaces/Ids.h
367-
index a37db24..293dd73 100644
428+
index 64151cf..9f28fe0 100644
368429
--- a/interfaces/Ids.h
369430
+++ b/interfaces/Ids.h
370-
@@ -354,7 +354,10 @@ namespace Exchange {
431+
@@ -360,7 +360,14 @@ namespace Exchange {
371432
ID_SCRIPT_ENGINE_NOTIFICATION = ID_SCRIPT_ENGINE + 1,
372433

373434
ID_TEXT_TO_SPEECH = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4C0,
374435
- ID_TEXT_TO_SPEECH_NOTIFICATION = ID_TEXT_TO_SPEECH + 1
375436
+ ID_TEXT_TO_SPEECH_NOTIFICATION = ID_TEXT_TO_SPEECH + 1,
376437
+
377438
+ ID_USER_SETTINGS = RPC::IDS::ID_EXTERNAL_INTERFACE_OFFSET + 0x4D0,
378-
+ ID_USER_SETTINGS_NOTIFICATION = ID_USER_SETTINGS + 1
439+
+ ID_USER_SETTINGS_NOTIFICATION = ID_USER_SETTINGS + 1,
440+
+ ID_USER_SETTINGS_INSPECTOR = ID_USER_SETTINGS + 2,
441+
+ ID_USER_SETTINGS_MIGRATION_STATE_ITERATOR = ID_USER_SETTINGS + 3,
442+
+
443+
+
379444
};
380445
}
381446
}

UserSettings/UserSettings.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ namespace WPEFramework
4848
**/
4949
SERVICE_REGISTRATION(UserSettings, API_VERSION_NUMBER_MAJOR, API_VERSION_NUMBER_MINOR, API_VERSION_NUMBER_PATCH);
5050

51-
UserSettings::UserSettings() : _service(nullptr), _connectionId(0), _userSetting(nullptr), _usersettingsNotification(this)
51+
UserSettings::UserSettings() : _service(nullptr), _connectionId(0), _userSetting(nullptr), _userSettingsInspector(nullptr), _usersettingsNotification(this)
5252
{
5353
SYSLOG(Logging::Startup, (_T("UserSettings Constructor")));
5454
}
@@ -95,6 +95,16 @@ namespace WPEFramework
9595
_userSetting->Register(&_usersettingsNotification);
9696
// Invoking Plugin API register to wpeframework
9797
Exchange::JUserSettings::Register(*this, _userSetting);
98+
99+
_userSettingsInspector = _userSetting->QueryInterface<Exchange::IUserSettingsInspector>();
100+
if (_userSettingsInspector != nullptr)
101+
{
102+
Exchange::JUserSettingsInspector::Register(*this, _userSettingsInspector);
103+
}
104+
else
105+
{
106+
message = _T("UserSettings implementation did not provide a IUserSettingsInspector interface");
107+
}
98108
}
99109
else
100110
{
@@ -123,8 +133,13 @@ namespace WPEFramework
123133
{
124134
_userSetting->Unregister(&_usersettingsNotification);
125135
Exchange::JUserSettings::Unregister(*this);
136+
Exchange::JUserSettingsInspector::Unregister(*this);
126137

127138
configure->Release();
139+
_userSettingsInspector->Release();
140+
141+
configure = nullptr;
142+
_userSettingsInspector = nullptr;
128143

129144
// Stop processing:
130145
RPC::IRemoteConnection* connection = service->RemoteConnection(_connectionId);

UserSettings/UserSettings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "Module.h"
2323
#include <interfaces/json/JsonData_UserSettings.h>
2424
#include <interfaces/json/JUserSettings.h>
25+
#include <interfaces/json/JUserSettingsInspector.h>
26+
#include <interfaces/json/JsonData_UserSettingsInspector.h>
2527
#include <interfaces/IUserSettings.h>
2628
#include <interfaces/IConfiguration.h>
2729
#include "UtilsLogging.h"
@@ -194,6 +196,7 @@ namespace Plugin {
194196
INTERFACE_ENTRY(PluginHost::IPlugin)
195197
INTERFACE_ENTRY(PluginHost::IDispatcher)
196198
INTERFACE_AGGREGATE(Exchange::IUserSettings, _userSetting)
199+
INTERFACE_AGGREGATE(Exchange::IUserSettingsInspector, _userSettingsInspector)
197200
END_INTERFACE_MAP
198201

199202
// IPlugin methods
@@ -209,6 +212,7 @@ namespace Plugin {
209212
PluginHost::IShell* _service{};
210213
uint32_t _connectionId{};
211214
Exchange::IUserSettings* _userSetting{};
215+
Exchange::IUserSettingsInspector* _userSettingsInspector{};
212216
Core::Sink<Notification> _usersettingsNotification;
213217
Exchange::IConfiguration* configure;
214218
};

0 commit comments

Comments
 (0)