summaryrefslogtreecommitdiff
path: root/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src
diff options
context:
space:
mode:
authorConlain Kelly <conlain.k@gmail.com>2018-08-08 16:53:51 -0400
committerConlain Kelly <conlain.k@gmail.com>2018-08-08 16:53:51 -0400
commit5644f2bfaabd31861a0a3b454ff8438be3f21d12 (patch)
treedf619697f98494f67b12ef79005d421b4595d529 /src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src
parenta93b4d8ebfa0e5ca3b5a0ec864827ff5f489d927 (diff)
downloadsdl_core-5644f2bfaabd31861a0a3b454ff8438be3f21d12.tar.gz
send full_app_id_supported for external_proprietary as well
Diffstat (limited to 'src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src')
-rw-r--r--src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
index 8f8e0ba096..d449203825 100644
--- a/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/rpc_plugins/sdl_rpc_plugin/src/commands/mobile/on_system_request_notification.cc
@@ -118,8 +118,14 @@ void OnSystemRequestNotification::Run() {
BinaryMessage binary_data;
file_system::ReadBinaryFile(filename, binary_data);
#if defined(PROPRIETARY_MODE)
+// Make the policy table the body of the request and add a header
AddHeader(binary_data,
application_manager_.get_settings().use_full_app_id());
+#elif defined(EXTERNAL_PROPRIETARY_MODE)
+ // add the full_app_id_supported flag to the policy table snapshot
+ std::string policy_table_string = std::string(binary_data.begin(), binary_data.end());
+ AttachFullAppIdSupport(policy_table_string, application_manager_.get_settings().use_full_app_id());
+ binary_data.assign(policy_table_string.begin(), policy_table_string.end());
#endif // PROPRIETARY_MODE
#if defined(PROPRIETARY_MODE) || defined(EXTERNAL_PROPRIETARY_MODE)
@@ -138,6 +144,31 @@ void OnSystemRequestNotification::Run() {
SendNotification();
}
+void OnSystemRequestNotification::AttachFullAppIdSupport(std::string& policy_table_string, bool useFullAppID) const {
+ Json::Reader reader;
+ Json::Value policy_table_json;
+ if (!reader.parse(policy_table_string.c_str(), policy_table_json)) {
+ LOG4CXX_FATAL(
+ logger_,
+ "PT snapshot is corrupted: " << reader.getFormattedErrorMessages());
+ }
+
+ if (policy_table_json.isMember("policy_table") && policy_table_json["policy_table"].isMember("module_config")) {
+ policy_table_json["policy_table"]["module_config"]
+ ["full_app_id_supported"] = useFullAppID;
+ LOG4CXX_DEBUG(logger_, "Successfully annotated full_app_id_supported!\n");
+ Json::FastWriter writer;
+
+ // Write back modified snapshot
+ policy_table_string = writer.write(policy_table_json);
+
+ } else {
+ LOG4CXX_FATAL(
+ logger_,
+ "PT snapshot is missing [\"policy_table\"][\"module_config\"] field");
+ }
+}
+
#ifdef PROPRIETARY_MODE
void OnSystemRequestNotification::AddHeader(BinaryMessage& message,
bool useFullAppID) const {
@@ -157,26 +188,9 @@ void OnSystemRequestNotification::AddHeader(BinaryMessage& message,
}
std::string policy_table_string = std::string(message.begin(), message.end());
-
- Json::Reader reader;
- Json::Value policy_table_json;
- if (!reader.parse(policy_table_string.c_str(), policy_table_json)) {
- LOG4CXX_FATAL(
- logger_,
- "PT snapshot is corrupted: " << reader.getFormattedErrorMessages());
- }
-
- if (policy_table_json.isMember("policy_table")) {
- if (policy_table_json["policy_table"].isMember("module_config")) {
- policy_table_json["policy_table"]["module_config"]
- ["full_app_id_supported"] = useFullAppID;
- LOG4CXX_DEBUG(logger_, "Successfully annotated full_App_id_supported!\n");
- Json::FastWriter writer;
-
- // Write back modified snapshot
- policy_table_string = writer.write(policy_table_json);
- }
- }
+
+ // add the full_app_id_supported flag to the policy table snapshot string
+ AttachFullAppIdSupport(policy_table_string, useFullAppID);
/* The Content-Length to be sent in the HTTP Request header should be
calculated before additional escape characters are added to the