2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file AppControlDllEntry.cpp
20 * @brief This is the implementation for the AppControlDllEntry.cpp class.
23 #include <appsvc/appsvc.h>
25 #include <FBaseSysLog.h>
26 #include <FAppAppControl.h>
28 #include <FBase_StringConverter.h>
29 #include <FApp_AppControlManager.h>
30 #include <FApp_AppMessageImpl.h>
33 using namespace Tizen::App;
34 using namespace Tizen::Base;
35 using namespace Tizen::Base::Collection;
43 result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
44 result _OSP_EXPORT_ TerminateAppControl(int req);
46 static const wchar_t __allowedAppControlCallTable[][2][64] =
48 {L"osp.appcontrol.CALL", L"osp.appcontrol.operation.DEFAULT"},
49 {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.call"},
50 {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/call"},
51 {L"tizen.phone", L"http://tizen.org/appcontrol/operation/call"},
54 static const wchar_t __allowedAppControlDialTable[][2][64] =
56 {L"osp.appcontrol.DIAL", L"osp.appcontrol.operation.DEFAULT"},
57 {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.dial"},
58 {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/dial"},
59 {L"tizen.phone", L"http://tizen.org/appcontrol/operation/dial"},
64 StartAppControl(int req, const String& providerId, const String& operationId, const String* pUri, const String* pMime, const IMap* pMap)
66 SysLog(NID_APP, "StartAppControl: Entry to Call AppControl");
69 const char* pParam = null;
72 static const char CALL_PKG_NAME[] = "org.tizen.call";
73 static const char DIAL_PKG_NAME[] = "org.tizen.phone";
74 static const char CALL_PKG_NAME_COMMERCIAL[] = "com.samsung.call";
75 static const char DIAL_PKG_NAME_COMMERCIAL[] = "com.samsung.phone";
77 const bool isCall = _AppControlManager::IsAllowedAppControl(__allowedAppControlCallTable, 4, providerId, operationId);
78 const bool isDial = _AppControlManager::IsAllowedAppControl(__allowedAppControlDialTable, 4, providerId, operationId);
80 SysTryReturnResult(NID_APP, isCall || isDial, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", providerId.GetPointer(), operationId.GetPointer());
89 String phoneNumber = appsvc_get_data(msg.GetBundle(), "tel");
90 if (!phoneNumber.IsEmpty())
92 phoneNumber.Insert(L"tel:", 0);
94 pParam = _StringConverter::CopyToCharArrayN(phoneNumber);
95 SysTryCatch(NID_APP, pParam != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] String conversion failure.");
99 r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
102 r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
107 r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
110 r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
114 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
116 SysLog(NID_APP, "StartAppControl: Launching Call AppControl succeeded");
126 TerminateAppControl(int req)