From ca284eab567045b4ba5b027be8c726d7207c0e83 Mon Sep 17 00:00:00 2001 From: Tae-Jeong Lee Date: Tue, 22 Oct 2013 16:34:53 +0900 Subject: [PATCH] Exception handling regarding NFC app-control declaration. *** This is a workaroud patch that should be retained for Tizen 2.2 only *** [Issue#] N/A [Problem] Request from Tizen Device Web API team regarding NFC. [Cause] To support 'GSMA-NFC-Handset-APIs-Requirements' of 'Samsung Wallet', webapi team requested following exception processing from wrt side. When a webapp defined the app-control declaration in config.xml as below, - operation: http://tizen.org/appcontrol/operation/nfc/transaction - uri: nfc://secure/aid/ - mime: NULL Its uri will be diverted based on the following rule. - nfc://secure/aid/ -> nfc://secure//aid/ [Solution] This exception processing should be retained to tizen 2.2 only. Change-Id: I052845742fb57f21f38981bba040b14cf4ed95e1 --- CMakeLists.txt | 5 +++++ src/configuration_parser/widget_parser.cpp | 35 ++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 24143a2..b7c9dd7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,6 +41,7 @@ OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode su OPTION(CSP_SUPPORT "Support for csp policy" ON) OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON) OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF) +OPTION(NFC_APP_CONTROL_EXCEPTION "Enable exception handling for NFC app-control" ON) ############################# compiler flags ################################## @@ -75,6 +76,10 @@ IF(SCHEMA_VALIDATION_SUPPORT) MESSAGE(STATUS "XML Schema validation of installed app enabled") ADD_DEFINITIONS("-DSCHEMA_VALIDATION_ENABLED") ENDIF(SCHEMA_VALIDATION_SUPPORT) +IF(NFC_APP_CONTROL_EXCEPTION) + MESSAGE(STATUS "Exception handling for NFC app-control is enabled") + ADD_DEFINITIONS("-DNFC_EXCEPTION_HANDLING_FOR_TIZEN_2_2_ONLY") +ENDIF(NFC_APP_CONTROL_EXCEPTION) # If supported for the target machine, emit position-independent code,suitable # for dynamic linking and avoiding any limit on the size of the global offset diff --git a/src/configuration_parser/widget_parser.cpp b/src/configuration_parser/widget_parser.cpp index 62a640e..2503c8d 100644 --- a/src/configuration_parser/widget_parser.cpp +++ b/src/configuration_parser/widget_parser.cpp @@ -1177,6 +1177,41 @@ class AppControlParser : public ElementParser ThrowMsg(Exception::ParseError, "service element must be unique"); } +#ifdef NFC_EXCEPTION_HANDLING_FOR_TIZEN_2_2_ONLY + // XXX This feature should be retained to Tizen 2.2 only. + // NFC exception handling which was requested from Tizen Device API team. + + const DPL::String exceptionNfcOperation = + L"http://tizen.org/appcontrol/operation/nfc/transaction"; + const DPL::String exceptionNfcUri = L"nfc://secure/aid/"; + const DPL::String divertingNfcUri1 = L"nfc://secure/SIM1/aid/"; + const DPL::String divertingNfcUri2 = L"nfc://secure/eSE/aid/"; + + if (m_appControl.m_operation == exceptionNfcOperation + && m_appControl.m_mimeList.empty() + && m_appControl.m_uriList.size() == 1 + && (m_appControl.m_uriList.begin())->compare(0, exceptionNfcUri.length(), exceptionNfcUri) == 0) + { + DPL::String originalUri = *m_appControl.m_uriList.begin(); + DPL::String newUri = originalUri; + + newUri.replace(0, exceptionNfcUri.length(), divertingNfcUri1); + m_appControl.m_uriList.erase(m_appControl.m_uriList.begin()); + m_appControl.m_uriList.insert(newUri); + m_data.appControlList.push_back(m_appControl); + _D("NFC exception : %ls -> %ls", originalUri.c_str(), newUri.c_str()); + + newUri = originalUri; + newUri.replace(0, exceptionNfcUri.length(), divertingNfcUri2); + m_appControl.m_uriList.erase(m_appControl.m_uriList.begin()); + m_appControl.m_uriList.insert(newUri); + m_data.appControlList.push_back(m_appControl); + _D("NFC exception : %ls -> %ls", originalUri.c_str(), newUri.c_str()); + + return; + } +#endif // NFC_EXCEPTION_HANDLING_FOR_TIZEN_2_2_ONLY + m_data.appControlList.push_back(m_appControl); } -- 2.7.4