ADD_SUBDIRECTORY(src/call-app-control osp-ac-call)
ADD_SUBDIRECTORY(src/camera-app-control osp-ac-camera)
ADD_SUBDIRECTORY(src/contact-app-control osp-ac-contact)
+ADD_SUBDIRECTORY(src/filemanager-app-control osp-ac-filemanager)
ADD_SUBDIRECTORY(src/media-app-control osp-ac-media)
+ADD_SUBDIRECTORY(src/image-app-control osp-ac-image)
ADD_SUBDIRECTORY(src/message-app-control osp-ac-message)
ADD_SUBDIRECTORY(src/setting-app-control osp-ac-setting)
ADD_SUBDIRECTORY(src/nfc-push-ui-app-control osp-ac-nfc-push-ui)
Name: osp-app-controls
Summary: osp application controls library
Version: 1.2.1.0
-Release: 1
+Release: 2
Group: System/Libraries
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
static int __req = -1;
static int __processId = -1;
-static const wchar_t __allowedAppControlTable[][2][64] =
+static const char __allowedAppControlTable[][2][96] =
{
- {L"osp.appcontrol.BT", L"osp.appcontrol.operation.PICK"},
- {L"osp.appcontrol.provider.bluetooth", L"osp.appcontrol.operation.pick"},
- {L"http://tizen.org/appcontrol/provider/bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
- {L"tizen.bluetooth", L"http://tizen.org/appcontrol/operation/pick"},
- {L"tizen.bluetooth", L"http://tizen.org/appcontrol/operation/bluetooth/pick"},
+ {"osp.appcontrol.BT", "osp.appcontrol.operation.PICK"},
+ {"osp.appcontrol.provider.bluetooth", "osp.appcontrol.operation.pick"},
+ {"tizen.bluetooth", "http://tizen.org/appcontrol/operation/pick"},
+ {"tizen.bluetooth", "http://tizen.org/appcontrol/operation/bluetooth/pick"},
};
r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"http://tizen.org/feature/network.bluetooth", isBtSupported);
SysTryReturnResult(NID_APP, (r == E_SUCCESS) && (isBtSupported == true), E_SYSTEM, "[%s] Bluetooth is not supported.", GetErrorMessage(r));
- const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 5, aId, oId);
+ const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
SysLog(NID_APP, "Bluetooth AppControl.");
msg.AddData(pMap);
msg.AddData(L"launch-type", L"pick");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pUri, pMime, OnAppControlResult, 0);
SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Bluetooth AppControl is failed.");
SysLog(NID_APP, "Launching Bluetooth AppControl succeeded.");
result _OSP_EXPORT_ TerminateAppControl(int req);
-static const wchar_t __allowedAppControlTable[][2][64] =
+static const char __allowedAppControlTable[][2][96] =
{
- {L"osp.appcontrol.BROWSER", L"osp.appcontrol.operation.DEFAULT"},
- {L"osp.appcontrol.provider.browser", L"osp.appcontrol.operation.view"},
- {L"http://tizen.org/appcontrol/provider/browser", L"http://tizen.org/appcontrol/operation/view"},
- {L"tizen.internet", L"http://tizen.org/appcontrol/operation/view"},
+ {"osp.appcontrol.BROWSER", "osp.appcontrol.operation.DEFAULT"},
+ {"osp.appcontrol.provider.browser", "osp.appcontrol.operation.view"},
+ {"tizen.internet", "http://tizen.org/appcontrol/operation/view"},
};
result
{
SysLog(NID_APP, "StartAppControl: Entry to Browser AppControl");
- const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
+ const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 3, aId, oId);
SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
_AppMessageImpl msg;
- char* pUriLiteral = null;
+ const String* pActualUri = pUri;
+ String tmp;
+
if (pMap)
{
msg.AddData(pMap);
if (pUri == null)
{
// if there is not pUri, then search for "url" key.
- const String* pUriData = static_cast<const String*>(pMap->GetValue(String(L"url")));
- if (pUriData)
+ const String* pData = static_cast<const String*>(pMap->GetValue(String(L"url")));
+ if (pData)
{
- pUriLiteral = _StringConverter::CopyToCharArrayN(*pUriData);
+ tmp = *pData;
+ pActualUri = &tmp;
}
}
}
- result r = _AppControlManager::GetInstance()->LaunchPkg(msg, "org.tizen.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
- if (IsFailed(r))
- {
- r = _AppControlManager::GetInstance()->LaunchPkg(msg, "com.samsung.browser", SERVICE_OPERATION_VIEW, NULL, pUriLiteral, NULL, 0);
- }
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
- delete [] pUriLiteral;
+ int pid = _AppControlManager::GetInstance()->LaunchPkg(msg, package, String(SERVICE_OPERATION_VIEW), pActualUri, pMime, NULL, 0);
- SysTryLog(NID_APP, !IsFailed(r), "[%s] System error.", GetErrorMessage(r));
+ result r = E_SUCCESS;
+ if (pid <= 0)
+ {
+ r = GetLastResult();
+ SysLog(NID_APP, "[%s] System error.", GetErrorMessage(r));
+ }
SysLog(NID_APP, "StartAppControl: Launching Browser AppControl succeeded");
#include <FApp_AppControlManager.h>
#include <FApp_AppMessageImpl.h>
#include <FApp_Aul.h>
+#include <FApp_AppArg.h>
using namespace Tizen::App;
extern "C" {
#endif
+static const wchar_t CALENDAR_ITEM_TYPE[] = L"http://tizen.org/appcontrol/data/social/item_type";
+static const wchar_t CALENDAR_RESULT_TYPE[] = L"http://tizen.org/appcontrol/data/social/result_type";
+static const wchar_t CALENDAR_ITEM_ID[] = L"http://tizen.org/appcontrol/data/social/item_id";
+
result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
result _OSP_EXPORT_ TerminateAppControl(int req);
void OnAppControlResult(void*, int, service_result_e, void*);
+void OnAppControlResultTizen(void*, int, service_result_e, void*);
static int __req = -1;
static int __processId = -1;
-static const wchar_t __allowedAppControlPickTable[][2][64] =
+static const char __allowedAppControlPickTable[][2][96] =
+{
+ {"osp.appcontrol.CALENDAR", "osp.appcontrol.operation.PICK"},
+ {"osp.appcontrol.provider.calendar", "osp.appcontrol.operation.pick"},
+ {"tizen.calendar", "http://tizen.org/appcontrol/operation/pick"},
+ {"tizen.calendar", "http://tizen.org/appcontrol/operation/social/pick"},
+};
+
+static const char __allowedAppControlViewTable[][2][96] =
{
- {L"osp.appcontrol.CALENDAR", L"osp.appcontrol.operation.PICK"},
- {L"osp.appcontrol.provider.calendar", L"osp.appcontrol.operation.pick"},
- {L"http://tizen.org/appcontrol/provider/calendar", L"http://tizen.org/appcontrol/operation/pick"},
- {L"tizen.calendar", L"http://tizen.org/appcontrol/operation/pick"},
+ {"osp.appcontrol.CALENDAR", "osp.appcontrol.operation.VIEW"},
+ {"osp.appcontrol.provider.calendar", "osp.appcontrol.operation.view"},
+ {"tizen.calendar", "http://tizen.org/appcontrol/operation/social/view"},
};
-static const wchar_t __allowedAppControlViewTable[][2][64] =
+static const char __allowedAppControlEditTable[][2][96] =
{
- {L"osp.appcontrol.CALENDAR", L"osp.appcontrol.operation.VIEW"},
- {L"osp.appcontrol.provider.calendar", L"osp.appcontrol.operation.view"},
- {L"http://tizen.org/appcontrol/provider/calendar", L"http://tizen.org/appcontrol/operation/view"},
- {L"tizen.calendar", L"http://tizen.org/appcontrol/operation/social/view"},
+ {"tizen.calendar", "http://tizen.org/appcontrol/operation/social/edit"},
};
-static const wchar_t __allowedAppControlVcsViewTable[][2][64] =
+static const char __allowedAppControlVcsViewTable[][2][96] =
{
- {L"tizen.calendar", L"http://tizen.org/appcontrol/operation/view"},
+ {"tizen.calendar", "http://tizen.org/appcontrol/operation/view"},
};
result
__req = req;
const bool isCalendarVcsView = _AppControlManager::IsAllowedAppControl(__allowedAppControlVcsViewTable, 1, aId, oId);
- const bool isCalendarView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 4, aId, oId);
+ const bool isCalendarView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 3, aId, oId);
const bool isCalendarPick = _AppControlManager::IsAllowedAppControl(__allowedAppControlPickTable, 4, aId, oId);
+ const bool isCalendarEdit = _AppControlManager::IsAllowedAppControl(__allowedAppControlEditTable, 1, aId, oId);
+
+ SysTryReturnResult(NID_APP, isCalendarPick || isCalendarEdit || isCalendarView || isCalendarVcsView, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+ _AppMessageImpl msg;
+ msg.AddData(pMap);
+
+ AppSvcResFn pCb = NULL;
+
+ String package;
+ String operation;
+ String uri;
+ const String* pActualUri = pUri;
if (isCalendarPick)
{
hasOutput = true;
+#if 0
const String* pItemTypeValue = static_cast<const String*>(pMap->GetValue(String(L"itemType")));
if (pItemTypeValue == null || (*pItemTypeValue != L"event" && *pItemTypeValue != L"todo"))
{
r = E_SUCCESS;
goto CATCH;
}
+#endif
+
+ pCb = OnAppControlResultTizen;
+ operation = L"http://tizen.org/appcontrol/operation/social/pick";
+
+ msg.AddData(CALENDAR_ITEM_TYPE, L"event");
- _AppMessageImpl msg;
- if (pMap != null)
+ const String& tmp = msg.GetValue(L"itemType");
+ if (!tmp.IsEmpty())
{
- msg.AddData(pMap);
+ msg.AddData(CALENDAR_RESULT_TYPE, tmp);
}
-
- __processId = _AppControlManager::GetInstance()->Launch(msg, "calendar-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
- SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded.");
}
- else if (isCalendarVcsView)
+ else if (isCalendarEdit)
{
- SysLog(NID_APP, "Calendar AppControl : VIEW operation (vcs).");
+ SysLog(NID_APP, "Calendar AppControl : EDIT operation.");
+
+ hasOutput = true;
+ pCb = OnAppControlResultTizen;
+ operation = L"http://tizen.org/appcontrol/operation/social/edit";
- std::unique_ptr<char[]> pConvertedUri;
- if (pUri)
+ msg.AddData(CALENDAR_ITEM_TYPE, L"event");
+ }
+ else if (isCalendarVcsView || isCalendarView)
+ {
+ if (pUri == null)
{
- pConvertedUri.reset(_StringConverter::CopyToCharArrayN(*pUri));
+ const String& path = msg.GetValue(L"path");
+ if (!path.IsEmpty())
+ {
+ uri = path;
+ pActualUri = &uri;
+ }
}
- std::unique_ptr<char[]> pConvertedMime;
- if (pMime)
+ if (pActualUri)
{
- pConvertedMime.reset(_StringConverter::CopyToCharArrayN(*pMime));
+ SysLog(NID_APP, "Calendar AppControl : VIEW operation (vcs).");
+ operation = L"http://tizen.org/appcontrol/operation/view";
}
-
- _AppMessageImpl msg;
- if (pMap != null)
+ else
{
- msg.AddData(pMap);
- }
+ SysLog(NID_APP, "Calendar AppControl : VIEW operation.");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "calendar-detail-efl", APPSVC_OPERATION_VIEW, pConvertedMime.get(), pConvertedUri.get(), NULL, 0);
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
- SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl(vcs) succeeded.");
- }
- else if (isCalendarView)
- {
- SysLog(NID_APP, "Calendar AppControl : VIEW operation.");
+ operation = L"http://tizen.org/appcontrol/operation/social/view";
- _AppMessageImpl msg;
- if (pMap != null)
- {
- msg.AddData(pMap);
+ msg.AddData(CALENDAR_ITEM_TYPE, L"event");
- const String* pViewTypeValue = static_cast<const String*>(pMap->GetValue(String(L"viewType")));
- if (pViewTypeValue == null)
- {
- SysLog(NID_APP, "viewType is invalid.");
- r = E_SUCCESS;
- goto CATCH;
- }
-
- if (*pViewTypeValue == L"vcs")
- {
- const String* pPathValue = static_cast<const String*>(pMap->GetValue(String(L"path")));
- if (pPathValue == null || pPathValue->GetLength() == 0)
- {
- SysLog(NID_APP, "path is invalid.");
- r = E_SUCCESS;
- goto CATCH;
- }
- }
- else if (*pViewTypeValue == L"event")
+ const String& tmp = msg.GetValue(L"eventId");
+ if (!tmp.IsEmpty())
{
- const String* pEventIdValue = static_cast<const String*>(pMap->GetValue(String(L"eventId")));
- if (pEventIdValue == null || pEventIdValue->GetLength() == 0)
- {
- SysLog(NID_APP, "eventId is invalid.");
- r = E_SUCCESS;
- goto CATCH;
- }
- }
- else if (*pViewTypeValue == L"todo")
- {
- const String* pTodoIdValue = static_cast<const String*>(pMap->GetValue(String(L"todoId")));
- if (pTodoIdValue == null || pTodoIdValue->GetLength() == 0)
- {
- SysLog(NID_APP, "todoId is invalid.");
- r = E_SUCCESS;
- goto CATCH;
- }
- }
- else
- {
- SysLog(NID_APP, "viewType is invalid.");
- r = E_SUCCESS;
- goto CATCH;
+ msg.AddData(CALENDAR_ITEM_ID, tmp);
}
}
+ }
+ else
+ {
+ operation = oId;
+ }
- const String& tmp = msg.GetValue(L"viewType");
- if (!tmp.IsEmpty())
- {
- msg.AddData(L"itemType", tmp);
- }
+ package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
- __processId = _AppControlManager::GetInstance()->Launch(msg, "calendar-detail-efl", APPSVC_OPERATION_VIEW, NULL, NULL, NULL, 0);
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
- SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded.");
- }
+ __req = req;
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, operation, pActualUri, pMime, pCb, 0);
+
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Calendar AppControl is failed.");
+
+ SysLog(NID_APP, "StartAppControl: Launching Calendar AppControl succeeded");
return E_SUCCESS;
}
+void
+OnAppControlResultTizen(void* b, int requestCode, service_result_e res, void* userData)
+{
+ result r = E_SYSTEM;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
#ifdef __cplusplus
}
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file AppControlDllEntry.cpp
- * @brief This is the implementation for the AppControlDllEntry.cpp class.
- */
-
-#include <appsvc/appsvc.h>
-
-#include <FBaseSysLog.h>
-#include <FAppAppControl.h>
-
-#include <FBase_StringConverter.h>
-#include <FApp_AppControlManager.h>
-#include <FApp_AppMessageImpl.h>
-
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
-result _OSP_EXPORT_ TerminateAppControl(int req);
-
-static const wchar_t __allowedAppControlCallTable[][2][64] =
-{
- {L"osp.appcontrol.CALL", L"osp.appcontrol.operation.DEFAULT"},
- {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.call"},
- {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/call"},
- {L"tizen.phone", L"http://tizen.org/appcontrol/operation/call"},
-};
-
-static const wchar_t __allowedAppControlDialTable[][2][64] =
-{
- {L"osp.appcontrol.DIAL", L"osp.appcontrol.operation.DEFAULT"},
- {L"osp.appcontrol.provider.call", L"osp.appcontrol.operation.dial"},
- {L"http://tizen.org/appcontrol/provider/call", L"http://tizen.org/appcontrol/operation/dial"},
- {L"tizen.phone", L"http://tizen.org/appcontrol/operation/dial"},
-};
-
-
-result
-StartAppControl(int req, const String& providerId, const String& operationId, const String* pUri, const String* pMime, const IMap* pMap)
-{
- SysLog(NID_APP, "StartAppControl: Entry to Call AppControl");
-
- result r = E_SUCCESS;
- const char* pParam = null;
- bool callMode = true;
-
- static const char CALL_PKG_NAME[] = "org.tizen.call";
- static const char DIAL_PKG_NAME[] = "org.tizen.phone";
- static const char CALL_PKG_NAME_COMMERCIAL[] = "com.samsung.call";
- static const char DIAL_PKG_NAME_COMMERCIAL[] = "com.samsung.phone";
-
- const bool isCall = _AppControlManager::IsAllowedAppControl(__allowedAppControlCallTable, 4, providerId, operationId);
- const bool isDial = _AppControlManager::IsAllowedAppControl(__allowedAppControlDialTable, 4, providerId, operationId);
-
- SysTryReturnResult(NID_APP, isCall || isDial, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", providerId.GetPointer(), operationId.GetPointer());
-
- callMode = isCall;
-
- if (pMap)
- {
- _AppMessageImpl msg;
- msg.AddData(pMap);
-
- String phoneNumber = appsvc_get_data(msg.GetBundle(), "tel");
- if (!phoneNumber.IsEmpty())
- {
- phoneNumber.Insert(L"tel:", 0);
-
- pParam = _StringConverter::CopyToCharArrayN(phoneNumber);
- SysTryCatch(NID_APP, pParam != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] String conversion failure.");
-
- if (callMode)
- {
- r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
- if (IsFailed(r))
- {
- r = _AppControlManager::GetInstance()->LaunchPkg(CALL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_CALL, NULL, pParam, NULL, 0);
- }
- }
- else
- {
- r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
- if (IsFailed(r))
- {
- r = _AppControlManager::GetInstance()->LaunchPkg(DIAL_PKG_NAME_COMMERCIAL, APPSVC_OPERATION_DIAL, NULL, pParam, NULL, 0);
- }
- }
-
- SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] System error.", GetErrorMessage(r));
-
- SysLog(NID_APP, "StartAppControl: Launching Call AppControl succeeded");
- }
- }
-CATCH:
- delete[] pParam;
-
- return r;
-}
-
-result
-TerminateAppControl(int req)
-{
- return E_SUCCESS;
-}
-
-
-#ifdef __cplusplus
-}
-#endif
)
SET (${this_target}_SOURCE_FILES
- AppControlDLLEntry.cpp
+ PhoneAppControlDllEntry.cpp
)
## SET EXTRA COMPILER FLAGS
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file AppControlDllEntry.cpp
+ * @brief This is the implementation for the AppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+
+static const char __allowedAppControlCallTable[][2][96] =
+{
+ {"osp.appcontrol.CALL", "osp.appcontrol.operation.DEFAULT"},
+ {"osp.appcontrol.provider.call", "osp.appcontrol.operation.call"},
+ {"tizen.phone", "http://tizen.org/appcontrol/operation/call"},
+ {"tizen.call", "http://tizen.org/appcontrol/operation/call"},
+};
+
+static const char __allowedAppControlDialTable[][2][96] =
+{
+ {"osp.appcontrol.DIAL", "osp.appcontrol.operation.DEFAULT"},
+ {"osp.appcontrol.provider.call", "osp.appcontrol.operation.dial"},
+ {"tizen.phone", "http://tizen.org/appcontrol/operation/dial"},
+};
+
+
+result
+StartAppControl(int req, const String& aId, const String& operationId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+ SysLog(NID_APP, "StartAppControl: Entry to Call AppControl");
+
+ result r = E_SUCCESS;
+
+ const bool isCall = _AppControlManager::IsAllowedAppControl(__allowedAppControlCallTable, 4, aId, operationId);
+ const bool isDial = _AppControlManager::IsAllowedAppControl(__allowedAppControlDialTable, 3, aId, operationId);
+
+ SysTryReturnResult(NID_APP, isCall || isDial, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), operationId.GetPointer());
+
+ _AppMessageImpl msg;
+
+ const String* pActualUri = pUri;
+ String tmp;
+
+ msg.AddData(pMap);
+
+ if (pUri == null)
+ {
+ // if there is not pUri, then search for "url" key.
+ String data = msg.GetValue(L"tel");
+ if (!data.IsEmpty())
+ {
+ tmp = L"tel:" + data;
+ pActualUri = &tmp;
+
+ msg.RemoveData(L"tel");
+ }
+
+ data = msg.GetValue(L"type");
+ if (!data.IsEmpty())
+ {
+ msg.AddData(L"http://tizen.org/appcontrol/data/call/type", data);
+ msg.RemoveData(L"type");
+ }
+ }
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ int pid = _AppControlManager::GetInstance()->LaunchPkg(msg, package, operationId, pActualUri, pMime, NULL, 0);
+ if (pid <= 0)
+ {
+ r = GetLastResult();
+ SysLog(NID_APP, "[%s] System error.", GetErrorMessage(r));
+ }
+
+ SysLog(NID_APP, "StartAppControl: Launching Call AppControl succeeded");
+
+ return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+ return E_SUCCESS;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
* @brief This is the implementation for the CameraAppControlDllEntry.cpp class.
*/
+#include <bundle.h>
#include <appsvc/appsvc.h>
#include <FBaseSysLog.h>
#include <FApp_AppControlManager.h>
#include <FApp_AppMessageImpl.h>
#include <FApp_Aul.h>
+#include <FApp_AppArg.h>
+#include <FApp_AppMessageImpl.h>
+
using namespace Tizen::App;
using namespace Tizen::Base;
SysLog(NID_APP, "StartAppControl: Entry to Camera AppControl");
if (aId == "osp.appcontrol.CAMERA"
- || aId == L"osp.appcontrol.provider.camera"
- || aId == L"tizen.camera"
- || aId == L"http://tizen.org/appcontrol/provider/camera")
+ || aId == "osp.appcontrol.provider.camera"
+ || aId == "tizen.camera")
{
SysLog(NID_APP, "oId : %ls", oId.GetPointer());
+ _AppMessageImpl msg;
+
+ const String* pActualMime = pMime;
+ String tmp;
+
if (pMap)
{
- char buffer[10] = {0, };
-
- _AppMessageImpl msg;
msg.AddData(pMap);
- const String& str = msg.GetValue(L"type");
- if (str == L"camcorder")
- {
- strncpy(buffer, "video/3gp", 9);
- }
- else
+ if (pMime == null)
{
- strncpy(buffer, "image/jpg", 9);
+ const String& str = msg.GetValue(L"type");
+ if (str == L"camcorder")
+ {
+ tmp = L"video/3gp";
+ }
+ else
+ {
+ tmp = L"image/jpg";
+ }
+
+ msg.RemoveData(L"type");
+ pActualMime = &tmp;
}
-
- __req = req;
- __processId = _AppControlManager::GetInstance()->Launch(msg, "camera-efl", APPSVC_OPERATION_CREATE_CONTENT, buffer, NULL, OnAppControlResult, 0);
}
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ __req = req;
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, String(APPSVC_OPERATION_CREATE_CONTENT), pUri, pActualMime, OnAppControlResult, 0);
+
SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Camera AppControl is failed.");
r = E_SUCCESS;
void
OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
{
+ SysLog(NID_APP, "Camera AppControl result");
+
result r = E_SYSTEM;
+ int type = BUNDLE_TYPE_NONE;
bundle* pBundle = static_cast<bundle*>(b);
HashMap* pResult = new (std::nothrow) HashMap();
r = pResult->Construct();
- switch (res)
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ type = bundle_get_type(pBundle, SERVICE_DATA_SELECTED);
+ switch (type)
{
- case SERVICE_RESULT_SUCCEEDED:
+ case BUNDLE_TYPE_STR:
{
const char* pFile = appsvc_get_data(pBundle, SERVICE_DATA_SELECTED);
if (pFile)
}
}
break;
- case SERVICE_RESULT_FAILED:
- break;
- case SERVICE_RESULT_CANCELED:
+ case BUNDLE_TYPE_STR_ARRAY:
+ {
+ ArrayList* pArray = _AppMessageImpl::GetValueArrayN(pBundle, SERVICE_DATA_SELECTED);
+ pResult->Add(new (std::nothrow) String(L"path"), pArray);
+ }
break;
+ case BUNDLE_TYPE_NONE:
default:
break;
}
#include <FApp_AppControlManager.h>
#include <FApp_AppMessageImpl.h>
#include <FApp_Aul.h>
+#include <FApp_AppArg.h>
using namespace Tizen::App;
using namespace Tizen::Base;
static char CORE_RESULT_TYPE_KEY_PERSON_LIST[] = "person_id_list";
static char CORE_RESULT_TYPE_KEY_VCARD[] = "vcard";
+static const wchar_t CONTACT_ITEM_TYPE[] = L"http://tizen.org/appcontrol/data/social/item_type";
+static const wchar_t CONTACT_ITEM_ID[] = L"http://tizen.org/appcontrol/data/social/item_id";
+static const wchar_t CONTACT_RESULT_TYPE[] = L"http://tizen.org/appcontrol/data/social/result_type";
+static const wchar_t SELECTION_MODE[] = L"http://tizen.org/appcontrol/data/selection_mode";
+
+
result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
result _OSP_EXPORT_ TerminateAppControl(int req);
void OnAppControlResult(void*, int, service_result_e, void*);
+void OnAppControlResultTizen(void*, int, service_result_e, void*);
static int __req = -1;
static int __processId = -1;
-static const wchar_t __allowedAppControlPickTable[][2][64] =
+static const char __allowedAppControlPickTable[][2][96] =
+{
+ {"osp.appcontrol.CONTACT", "osp.appcontrol.operation.PICK"},
+ {"osp.appcontrol.provider.contact", "osp.appcontrol.operation.pick"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/pick"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/social/pick"},
+};
+
+static const char __allowedAppControlAddTable[][2][96] =
{
- {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.PICK"},
- {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.pick"},
- {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/pick"},
- {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/pick"},
+ {"osp.appcontrol.CONTACT", "osp.appcontrol.operation.ADD"},
+ {"osp.appcontrol.provider.contact", "osp.appcontrol.operation.add"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/add"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/social/add"},
};
-static const wchar_t __allowedAppControlAddTable[][2][64] =
+static const char __allowedAppControlEditTable[][2][96] =
{
- {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.ADD"},
- {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.add"},
- {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/add"},
- {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/add"},
+ {"osp.appcontrol.CONTACT", "osp.appcontrol.operation.EDIT"},
+ {"osp.appcontrol.provider.contact", "osp.appcontrol.operation.edit"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/edit"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/social/edit"},
};
-static const wchar_t __allowedAppControlEditTable[][2][64] =
+static const char __allowedAppControlViewTable[][2][96] =
{
- {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.EDIT"},
- {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.edit"},
- {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/edit"},
- {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/edit"},
+ {"osp.appcontrol.CONTACT", "osp.appcontrol.operation.VIEW"},
+ {"osp.appcontrol.provider.contact", "osp.appcontrol.operation.view"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/view"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/social/view"},
};
-static const wchar_t __allowedAppControlViewTable[][2][64] =
+static const char __allowedAppControlChooseTable[][2][96] =
{
- {L"osp.appcontrol.CONTACT", L"osp.appcontrol.operation.VIEW"},
- {L"osp.appcontrol.provider.contact", L"osp.appcontrol.operation.view"},
- {L"http://tizen.org/appcontrol/provider/contact", L"http://tizen.org/appcontrol/operation/view"},
- {L"tizen.contacts", L"http://tizen.org/appcontrol/operation/view"},
+ {"tizen.contacts", "http://tizen.org/appcontrol/operation/social/choose"},
};
+
class ScopedConnection
{
public:
const bool isContactAdd = _AppControlManager::IsAllowedAppControl(__allowedAppControlAddTable, 4, aId, oId);
const bool isContactEdit = _AppControlManager::IsAllowedAppControl(__allowedAppControlEditTable, 4, aId, oId);
const bool isContactView = _AppControlManager::IsAllowedAppControl(__allowedAppControlViewTable, 4, aId, oId);
+ const bool isContactChoose = _AppControlManager::IsAllowedAppControl(__allowedAppControlChooseTable, 1, aId, oId);
- SysTryReturnResult(NID_APP, isContactPick || isContactAdd || isContactEdit || isContactView, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+ SysTryReturnResult(NID_APP, isContactPick || isContactAdd || isContactEdit || isContactView || isContactChoose, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
SysLog(NID_APP, "Contact AppControl : %ls operation.", oId.GetPointer());
+#ifdef __i386__
+ _AppMessageImpl msg;
+ msg.AddData(pMap);
+
+ AppSvcResFn pCb = NULL;
+
+ String providerAppId;
+ String operation;
+ String uri;
+ const String* pActualUri = pUri;
+
+ if (isContactAdd)
+ {
+ providerAppId = L"tizen.contact_detail";
+ operation = L"http://tizen.org/appcontrol/operation/social/add";
+ pCb = OnAppControlResultTizen;
+
+ msg.AddData(CONTACT_ITEM_TYPE, L"contact");
+ }
+ else if (isContactEdit)
+ {
+ providerAppId = L"tizen.contact_detail";
+ operation = L"http://tizen.org/appcontrol/operation/social/edit";
+ pCb = OnAppControlResultTizen;
+
+ msg.AddData(CONTACT_ITEM_TYPE, L"person");
+ }
+ else if (isContactView)
+ {
+ providerAppId = L"tizen.contact_detail";
+
+ if (pUri == null)
+ {
+ const String& path = msg.GetValue(L"path");
+ if (!path.IsEmpty())
+ {
+ uri = path;
+ pActualUri = &uri;
+ }
+ }
+
+ if (pActualUri)
+ {
+ operation = L"http://tizen.org/appcontrol/operation/view";
+ }
+ else
+ {
+ operation = L"http://tizen.org/appcontrol/operation/social/view";
+
+ msg.AddData(CONTACT_ITEM_TYPE, L"person");
+
+ const String& contactId = msg.GetValue(L"contactId");
+ if (!contactId.IsEmpty())
+ {
+ msg.AddData(CONTACT_ITEM_ID, contactId);
+ msg.RemoveData(L"contactId");
+ }
+ }
+
+ pCb = NULL;
+ }
+ else if (isContactPick)
+ {
+ providerAppId = L"tizen.contact_list";
+ operation = L"http://tizen.org/appcontrol/operation/social/pick";
+ pCb = OnAppControlResultTizen;
+
+ msg.AddData(CONTACT_ITEM_TYPE, L"person");
+
+ const String& mode = msg.GetValue(L"selectionMode");
+ if (!mode.IsEmpty())
+ {
+ msg.AddData(SELECTION_MODE, mode);
+ msg.RemoveData(L"selectionMode");
+ }
+
+ const String& retType = msg.GetValue(L"returnType");
+ if (!retType.IsEmpty())
+ {
+ msg.AddData(CONTACT_RESULT_TYPE, retType);
+ msg.RemoveData(L"returnType");
+ }
+ }
+ else if (isContactChoose)
+ {
+ providerAppId = L"tizen.contact_list";
+ operation = L"http://tizen.org/appcontrol/operation/social/choose";
+ pCb = OnAppControlResultTizen;
+
+ msg.AddData(CONTACT_ITEM_TYPE, L"person");
+ }
+ else
+ {
+ operation = oId;
+ }
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ __req = req;
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, operation, pActualUri, pMime, pCb, 0);
+
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Contact AppControl is failed.");
+
+ r = E_SUCCESS;
+ SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
+#else
if (isContactPick)
{
SysLog(NID_APP, "Contact AppControl : PICK operation.");
SysLog(NID_APP, "StartAppControl: Launching Contact AppControl succeeded");
}
+#endif
return r;
__req = -1;
}
+void
+OnAppControlResultTizen(void* b, int requestCode, service_result_e res, void* userData)
+{
+ result r = E_SYSTEM;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
+
#ifdef __cplusplus
}
#endif
--- /dev/null
+SET (this_target osp-ac-filemanager)
+
+INCLUDE_DIRECTORIES (
+ ${COMMON_INCLUDE_DIRS}
+ )
+
+SET (${this_target}_SOURCE_FILES
+ FileManagerAppControlDllEntry.cpp
+ )
+
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FileManagerAppControlDllEntry.cpp
+ * @brief This is the implementation for the FileManagerAppControlDllEntry.cpp class.
+ */
+
+#include <bundle.h>
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_AppArg.h>
+#include <FApp_Aul.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const char __allowedAppControlMediaTable[][2][96] =
+{
+ {"osp.appcontrol.MEDIA", "osp.appcontrol.operation.PICK"},
+ {"osp.appcontrol.provider.media", "osp.appcontrol.operation.pick"},
+ {"tizen.filemanager", "http://tizen.org/appcontrol/operation/pick"},
+};
+
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUriData, const String* pMime, const IMap* pMap)
+{
+ result r = E_SYSTEM;
+ SysLog(NID_APP, "StartAppControl: Entry to FileManager AppControl");
+
+ const bool isMedia = _AppControlManager::IsAllowedAppControl(__allowedAppControlMediaTable, 3, aId, oId);
+ SysTryReturnResult(NID_APP, isMedia, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+ _AppMessageImpl msg;
+ msg.AddData(pMap);
+
+ const String* pActualMime = pMime;
+
+ const String& mode = msg.GetValue(L"selectionType");
+ if (!mode.IsEmpty())
+ {
+ msg.AddData(L"http://tizen.org/appcontrol/data/selection_mode", mode);
+ msg.RemoveData(L"selectionType");
+ }
+
+ String mime;
+ if (pMime == null)
+ {
+ const String& type = msg.GetValue(L"type");
+
+ if (type == L"all")
+ {
+ mime = L"*/*";
+ }
+ else if (type == L"image")
+ {
+ mime = L"image/*";
+ }
+ else if (type == L"audio")
+ {
+ mime = L"audio/*";
+ }
+ else if (type == L"video")
+ {
+ mime = L"video/*";
+ }
+
+ pActualMime = &mime;
+ }
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ __req = req;
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pUriData, pActualMime, OnAppControlResult, 0);
+
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Image AppControl is failed.");
+ r = E_SUCCESS;
+
+ SysLog(NID_APP, "StartAppControl: Launching ImageViewer AppControl succeeded");
+
+ return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+ if (__processId >= 0)
+ {
+ _Aul::TerminateApplicationByPid(__processId);
+ }
+ return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+ SysLog(NID_APP, "@@@@@@ OnAppControlResult for myfiles");
+
+ result r = E_SYSTEM;
+ int type = BUNDLE_TYPE_NONE;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ type = bundle_get_type(pBundle, SERVICE_DATA_SELECTED);
+ switch (type)
+ {
+ case BUNDLE_TYPE_STR:
+ {
+ const char* pFile = appsvc_get_data(pBundle, SERVICE_DATA_SELECTED);
+ if (pFile)
+ {
+ pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(pFile));
+ }
+ }
+ break;
+ case BUNDLE_TYPE_STR_ARRAY:
+ {
+ ArrayList* pArray = _AppMessageImpl::GetValueArrayN(pBundle, SERVICE_DATA_SELECTED);
+ pResult->Add(new (std::nothrow) String(L"path"), pArray);
+ }
+ break;
+ case BUNDLE_TYPE_NONE:
+ default:
+ break;
+ }
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null
+SET (this_target osp-ac-image)
+
+INCLUDE_DIRECTORIES (
+ ${COMMON_INCLUDE_DIRS}
+ )
+
+SET (${this_target}_SOURCE_FILES
+ ImageAppControlDllEntry.cpp
+ )
+
+## SET EXTRA COMPILER FLAGS
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC -Wall" )
+
+## SET C COMPILER FLAGS
+SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## SET CPP COMPILER FLAGS
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
+SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}")
+
+## Create Library
+ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES})
+
+TARGET_LINK_LIBRARIES(${this_target} osp-appfw)
+
+OSP_STRIP(${this_target})
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file ImageAppControlDllEntry.cpp
+ * @brief This is the implementation for the ImageAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+#include <FApp_AppArg.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+void OnAppControlResult(void*, int, service_result_e, void*);
+
+static int __req = -1;
+static int __processId = -1;
+
+static const char __allowedAppControlImageTable[][2][96] =
+{
+ {"osp.appcontrol.IMAGE", "osp.appcontrol.operation.VIEW"},
+ {"osp.appcontrol.provider.image", "osp.appcontrol.operation.view"},
+ {"http://tizen.org/appcontrol/provider/image", "http://tizen.org/appcontrol/operation/view"},
+ {"tizen.imageviewer", "http://tizen.org/appcontrol/operation/view"},
+};
+
+static const char __allowedAppControlCropTable[][2][96] =
+{
+ {"tizen.imageviewer", "http://tizen.org/appcontrol/operation/image/crop"},
+};
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
+{
+ result r = E_SYSTEM;
+ SysLog(NID_APP, "StartAppControl: Entry to Image AppControl");
+
+ const bool isImage = _AppControlManager::IsAllowedAppControl(__allowedAppControlImageTable, 4, aId, oId);
+ const bool isCrop = _AppControlManager::IsAllowedAppControl(__allowedAppControlCropTable, 1, aId, oId);
+ SysTryReturnResult(NID_APP, isImage || isCrop, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+
+ _AppMessageImpl msg;
+ msg.AddData(pMap);
+
+ String path = msg.GetValue(L"path");
+ const String* pActualUri = pUri;
+
+ if (pUri == null)
+ {
+ if (!path.IsEmpty())
+ {
+ pActualUri = &path;
+ }
+ }
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ if (!isCrop)
+ {
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pActualUri, pMime, NULL, 0);
+ }
+ else
+ {
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pActualUri, pMime, OnAppControlResult, 0);
+ }
+
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Image AppControl is failed.");
+ r = E_SUCCESS;
+
+ SysLog(NID_APP, "StartAppControl: Launching ImageViewer AppControl succeeded");
+
+ return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+ if (__processId >= 0)
+ {
+ _Aul::TerminateApplicationByPid(__processId);
+ }
+ return E_SUCCESS;
+}
+
+void
+OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+ SysLog(NID_APP, "@@@@@@ OnAppControlResult");
+
+ result r = E_SYSTEM;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
+#ifdef __cplusplus
+}
+#endif
)
SET (${this_target}_SOURCE_FILES
- MediaAppControlDLLEntry.cpp
- ParseUtil.cpp
+ MediaAppControlDllEntry.cpp
)
## SET EXTRA COMPILER FLAGS
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file MediaAppControlDllEntry.cpp
- * @brief This is the implementation for the MediaAppControlDllEntry.cpp class.
- */
-
-#include <appsvc/appsvc.h>
-
-#include <FBaseSysLog.h>
-#include <FAppAppControl.h>
-#include <FBaseColHashMap.h>
-
-#include <FBase_StringConverter.h>
-#include <FApp_AppControlManager.h>
-#include <FApp_AppMessageImpl.h>
-#include <FApp_Aul.h>
-
-#include "ParseUtil.h"
-
-using namespace Tizen::App;
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Utility;
-
-#define _DUMMY_APPCONTROL
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
-result _OSP_EXPORT_ TerminateAppControl(int req);
-void OnAppControlResult(void*, int, service_result_e, void*);
-void OnAppControlResultGallery(void*, int, service_result_e, void*);
-
-static int __req = -1;
-static int __processId = -1;
-
-static const wchar_t __allowedAppControlImageTable[][2][64] =
-{
- {L"osp.appcontrol.IMAGE", L"osp.appcontrol.operation.VIEW"},
- {L"osp.appcontrol.provider.image", L"osp.appcontrol.operation.view"},
- {L"http://tizen.org/appcontrol/provider/image", L"http://tizen.org/appcontrol/operation/view"},
- {L"tizen.imageviewer", L"http://tizen.org/appcontrol/operation/view"},
-};
-
-static const wchar_t __allowedAppControlVideoTable[][2][64] =
-{
- {L"osp.appcontrol.VIDEO", L"osp.appcontrol.operation.PLAY"},
- {L"osp.appcontrol.provider.video", L"osp.appcontrol.operation.play"},
- {L"http://tizen.org/appcontrol/provider/video", L"http://tizen.org/appcontrol/operation/play"},
- {L"tizen.videoplayer", L"http://tizen.org/appcontrol/operation/view"},
-};
-
-static const wchar_t __allowedAppControlAudioTable[][2][64] =
-{
- {L"osp.appcontrol.AUDIO", L"osp.appcontrol.operation.PLAY"},
- {L"osp.appcontrol.provider.audio", L"osp.appcontrol.operation.play"},
- {L"http://tizen.org/appcontrol/provider/audio", L"http://tizen.org/appcontrol/operation/play"},
- {L"tizen.musicplayer", L"http://tizen.org/appcontrol/operation/view"},
-};
-
-static const wchar_t __allowedAppControlMediaTable[][2][64] =
-{
- {L"osp.appcontrol.MEDIA", L"osp.appcontrol.operation.PICK"},
- {L"osp.appcontrol.provider.media", L"osp.appcontrol.operation.pick"},
- {L"http://tizen.org/appcontrol/provider/media", L"http://tizen.org/appcontrol/operation/pick"},
- {L"tizen.filemanager", L"http://tizen.org/appcontrol/operation/pick"},
-};
-
-
-result
-StartAppControl(int req, const String& aId, const String& oId, const String* pUriData, const String* pMime, const IMap* pMap)
-{
- result r = E_SYSTEM;
- SysLog(NID_APP, "StartAppControl: Entry to Media AppControl");
-
- const bool isImage = _AppControlManager::IsAllowedAppControl(__allowedAppControlImageTable, 4, aId, oId);
- const bool isVideo = _AppControlManager::IsAllowedAppControl(__allowedAppControlVideoTable, 4, aId, oId);
- const bool isAudio = _AppControlManager::IsAllowedAppControl(__allowedAppControlAudioTable, 4, aId, oId);
- const bool isMedia = _AppControlManager::IsAllowedAppControl(__allowedAppControlMediaTable, 4, aId, oId);
-
- if (isImage)
- {
- char* pPath = null;
- SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
-
- _AppMessageImpl msg;
- msg.AddData(pMap);
-
- const String& type = msg.GetValue(KEY_TYPE);
- String value = msg.GetValue(KEY_PATH);
-
- if (!value.IsEmpty())
- {
- if (!value.StartsWith(L"file://", 0))
- {
- SysLog(NID_APP, "Inserting file scheme for %ls.", value.GetPointer());
- value.Insert(L"file://", 0);
- }
- pPath = _StringConverter::CopyToCharArrayN(value); // Store the path
- }
-
- SysLog(NID_APP, "type(%ls), path(%ls)", type.GetPointer(), value.GetPointer());
-
- __processId = _AppControlManager::GetInstance()->Launch(msg, "image-viewer-efl", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
-
- delete [] pPath;
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Image AppControl is failed.");
- r = E_SUCCESS;
- }
- else if (isAudio)
- {
- char* pPath = null;
- char* pUri = null;
- SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
-
- _AppMessageImpl msg;
- msg.AddData(pMap);
-
- String tmp = msg.GetValue(L"path");
- if (!tmp.IsEmpty())
- {
- if (tmp.StartsWith(L"http://", 0)
- || tmp.StartsWith(L"rtsp://", 0)
- || tmp.StartsWith(L"https://", 0))
- {
- // URI
- pUri = _StringConverter::CopyToCharArrayN(tmp);
- int i = 0;
- r = tmp.LastIndexOf(L'.', tmp.GetLength() - 1, i);
- if (r == E_SUCCESS)
- {
- String extension;
- tmp.SubString(i + 1, extension);
-
- String mime;
- r = _AppControlManager::GetMimeFromExt(extension, mime);
- if (!IsFailed(r))
- {
- if (mime.Equals(L"video/3gpp", true))
- {
- SysLog(NID_APP, "Fix-up for audio appcontrol with [video/3gpp].");
- mime = L"audio/3gpp";
- }
- pPath = _StringConverter::CopyToCharArrayN(mime);
- SysLog(NID_APP, "URI(%s), MIME(%s) for music player", pUri, pPath);
- }
- }
- }
- else
- {
- // normal file path
- pUri = _StringConverter::CopyToCharArrayN(tmp); // Store the path
- }
- }
-
- // Check the exit on back option.
- const String& exit = msg.GetValue(L"ExitOnBack");
- if (!exit.IsEmpty())
- {
- bundle_del(msg.GetBundle(), "__APP_SVC_K_WIN_ID__");
- }
-
- __processId = _AppControlManager::GetInstance()->Launch(msg, "org.tizen.sound-player", APPSVC_OPERATION_VIEW, pPath, pUri, NULL, 0);
- if (__processId <= 0)
- {
- __processId = _AppControlManager::GetInstance()->Launch(msg, "com.samsung.sound-player", APPSVC_OPERATION_VIEW, pPath, pUri, NULL, 0);
- }
-
- delete [] pPath;
- delete [] pUri;
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Audio AppControl is failed.");
- r = E_SUCCESS;
- }
- else if (isVideo)
- {
- char* pPath = null;
- SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
-
- _AppMessageImpl msg;
- msg.AddData(pMap);
-
- String tmp = msg.GetValue(L"path");
- if (!tmp.IsEmpty())
- {
- if (tmp.StartsWith(L"http://", 0)
- || tmp.StartsWith(L"rtsp://", 0)
- || tmp.StartsWith(L"file://", 0)
- || tmp.StartsWith(L"https://", 0))
- {
- SysLog(NID_APP, "URI input");
- }
- else
- {
- // [INFO] path should be absolute path
- tmp.Insert(L"file://", 0);
- }
- pPath = _StringConverter::CopyToCharArrayN(tmp); // Store the path
- }
-
- __processId = _AppControlManager::GetInstance()->Launch(msg, "org.tizen.video-player", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
- if (__processId <= 0)
- {
- __processId = _AppControlManager::GetInstance()->Launch(msg, "com.samsung.video-player", APPSVC_OPERATION_VIEW, NULL, pPath, NULL, 0);
- }
-
- delete [] pPath;
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Video AppControl is failed.");
- r = E_SUCCESS;
- }
- else if (isMedia)
- {
- const int TYPE_ALL = 0;
- const int TYPE_AUDIO = 1;
- const int TYPE_VIDEO = 2;
- const int TYPE_IMAGE = 3;
-
- bool singleSelection = true;
- int type = -1;
-
- SysTryCatch(NID_APP, pMap != null, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] The parameter is empty");
-
- _AppMessageImpl msg;
- msg.AddData(pMap);
-
- const char* pBuf = appsvc_get_data(msg.GetBundle(), "selectionType");
- if (pBuf)
- {
- singleSelection = !(strncmp(pBuf, "multiple", 9) == 0);
- }
-
- pBuf = appsvc_get_data(msg.GetBundle(), "type");
- if (pBuf)
- {
- if (strncmp(pBuf, "all", sizeof("all")) == 0)
- {
- type = TYPE_ALL;
- }
- else if (strncmp(pBuf, "image", sizeof("image")) == 0)
- {
- type = TYPE_IMAGE;
- }
- else if (strncmp(pBuf, "video", sizeof("video")) == 0)
- {
- type = TYPE_VIDEO;
- }
- else if (strncmp(pBuf, "audio", sizeof("audio")) == 0)
- {
- type = TYPE_AUDIO;
- }
- }
-
- switch (type)
- {
- case TYPE_ALL:
- msg.AddData(L"file_type", L"ALL");
-
- msg.AddData(L"select_type", (singleSelection) ? "SINGLE_FILE" : "MULTI_FILE");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "myfile-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
-
- __req = req;
- break;
- case TYPE_AUDIO:
- msg.AddData(L"file_type", L"SOUND");
-
- msg.AddData(L"select_type", (singleSelection) ? "SINGLE_FILE" : "MULTI_FILE");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "myfile-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResult, 0);
-
- __req = req;
- break;
- case TYPE_IMAGE:
- msg.AddData(L"file-type", L"image");
-
- msg.AddData(L"launch-type", (singleSelection) ? "select-one" : "select-multiple");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "gallery-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResultGallery, 0);
-
- __req = req;
- break;
- case TYPE_VIDEO:
- msg.AddData(L"file-type", L"video");
-
- msg.AddData(L"launch-type", (singleSelection) ? "select-one" : "select-multiple");
- __processId = _AppControlManager::GetInstance()->Launch(msg, "gallery-efl", APPSVC_OPERATION_PICK, NULL, NULL, OnAppControlResultGallery, 0);
-
- __req = req;
- break;
- default:
- SysLog(NID_APP, "Wrong type or no type information.");
- break;
- }
-
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Media AppControl is failed.");
- r = E_SUCCESS;
- }
- else if (aId == L"osp.appcontrol.provider.imageeditor")
- {
-#if defined (_DUMMY_APPCONTROL)
- SysLogException(NID_MEDIA, E_SUCCESS, "NOT IMPLEMENTED");
- HashMap* pResult = null;
- pResult = new (std::nothrow) HashMap();
- SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
-
- r = pResult->Construct();
-
- pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(L"/opt/media/Images/image2.jpg"));
- _AppControlManager::GetInstance()->FinishAppControl(req, 0, pResult);
- delete pResult;
- r = E_SUCCESS;
-#endif
- }
-
- return r;
-
-CATCH:
- return r;
-}
-
-result
-TerminateAppControl(int req)
-{
- if (__processId >= 0)
- {
- _Aul::TerminateApplicationByPid(__processId);
- }
- return E_SUCCESS;
-}
-
-void
-OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
-{
- SysLog(NID_APP, "@@@@@@ OnAppControlResult for myfiles");
-
- result r = E_SYSTEM;
- bundle* pBundle = static_cast<bundle*>(b);
-
- HashMap* pResult = new (std::nothrow) HashMap();
- SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
-
- r = pResult->Construct();
-
- switch (res)
- {
- case SERVICE_RESULT_SUCCEEDED:
- {
- const char* const pData = appsvc_get_data(pBundle, "result");
- if (pData)
- {
- SysLog(NID_APP, "Received data is [%s].", pData);
-
- // [INFO] '?' delimiter for multifile files
- String tmp = pData;
- tmp.Replace(L'?', L';');
- SysLog(NID_APP, "Converted string is [%ls].", tmp.GetPointer());
- pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(tmp));
- }
- }
- break;
- case SERVICE_RESULT_FAILED:
- break;
-#if 0
- case SERVICE_RESULT_CANCELED:
- break;
-#endif
- default:
- break;
- }
-
- _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
-
-CATCH:
- __req = -1;
-}
-
-void
-OnAppControlResultGallery(void* b, int requestCode, service_result_e res, void* userData)
-{
- SysLog(NID_APP, "@@@@@@ OnAppControlResult for gallery");
-
- // the result from ug does not follow service protocol
- // success -> ("path", value)
- // cancel -> ("ug-quit", "normal")
-
- result r = E_SYSTEM;
- bundle* pBundle = static_cast<bundle*>(b);
-
- const char* pData = appsvc_get_data(pBundle, "path");
-
- if (pData)
- {
- HashMap* pResult = new (std::nothrow) HashMap();
- SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
-
- r = pResult->Construct();
-
- SysLog(NID_APP, "Received data is [%s].", pData);
- pResult->Add(new (std::nothrow) String(L"path"), new (std::nothrow) String(pData));
- _AppControlManager::GetInstance()->FinishAppControl(__req, APP_CTRL_RESULT_SUCCEEDED, pResult);
- }
- else
- {
- pData = appsvc_get_data(pBundle, "ug-quit");
- SysLog(NID_APP, "The operation cancled or finished (%s)", (pData) ? pData : "no-data");
- _AppControlManager::GetInstance()->FinishAppControl(__req, APP_CTRL_RESULT_CANCELED, null);
- }
-
-CATCH:
- __req = -1;
-}
-
-#ifdef __cplusplus
-}
-#endif
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file MediaAppControlDllEntry.cpp
+ * @brief This is the implementation for the MediaAppControlDllEntry.cpp class.
+ */
+
+#include <appsvc/appsvc.h>
+
+#include <FBaseSysLog.h>
+#include <FAppAppControl.h>
+#include <FBaseColHashMap.h>
+
+#include <FBase_StringConverter.h>
+#include <FApp_AppControlManager.h>
+#include <FApp_AppMessageImpl.h>
+#include <FApp_Aul.h>
+
+
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
+result _OSP_EXPORT_ TerminateAppControl(int req);
+
+static int __processId = -1;
+
+static const char __allowedAppControlVideoTable[][2][96] =
+{
+ {"osp.appcontrol.VIDEO", "osp.appcontrol.operation.PLAY"},
+ {"osp.appcontrol.provider.video", "osp.appcontrol.operation.play"},
+ {"http://tizen.org/appcontrol/provider/video", "http://tizen.org/appcontrol/operation/play"},
+ {"tizen.videoplayer", "http://tizen.org/appcontrol/operation/view"},
+};
+
+static const char __allowedAppControlAudioTable[][2][96] =
+{
+ {"osp.appcontrol.AUDIO", "osp.appcontrol.operation.PLAY"},
+ {"osp.appcontrol.provider.audio", "osp.appcontrol.operation.play"},
+ {"http://tizen.org/appcontrol/provider/audio", "http://tizen.org/appcontrol/operation/play"},
+ {"tizen.musicplayer", "http://tizen.org/appcontrol/operation/view"},
+};
+
+result
+StartAppControl(int req, const String& aId, const String& oId, const String* pUriData, const String* pMime, const IMap* pMap)
+{
+ result r = E_SYSTEM;
+ SysLog(NID_APP, "StartAppControl: Entry to Media AppControl");
+
+ const bool isVideo = _AppControlManager::IsAllowedAppControl(__allowedAppControlVideoTable, 4, aId, oId);
+ const bool isAudio = _AppControlManager::IsAllowedAppControl(__allowedAppControlAudioTable, 4, aId, oId);
+
+ const String* pActualUri = pUriData;
+
+ _AppMessageImpl msg;
+ msg.AddData(pMap);
+
+ String path = msg.GetValue(L"path");
+
+ if (pUriData == null)
+ {
+ if (!path.IsEmpty())
+ {
+ pActualUri = &path;
+ }
+ }
+
+ if (isAudio)
+ {
+ // Check the exit on back option.
+ const String& exit = msg.GetValue(L"ExitOnBack");
+ if (!exit.IsEmpty())
+ {
+ bundle_del(msg.GetBundle(), "__APP_SVC_K_WIN_ID__");
+ }
+ }
+ else if (isVideo)
+ {
+ SysLog(NID_APP, "Video AppControl.");
+ }
+
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
+
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pActualUri, pMime, NULL, 0);
+
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Image AppControl is failed.");
+ r = E_SUCCESS;
+
+ SysLog(NID_APP, "StartAppControl: Launching ImageViewer AppControl succeeded");
+
+ return r;
+}
+
+result
+TerminateAppControl(int req)
+{
+ if (__processId >= 0)
+ {
+ _Aul::TerminateApplicationByPid(__processId);
+ }
+ return E_SUCCESS;
+}
+
+
+#ifdef __cplusplus
+}
+#endif
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <FBaseSysLog.h>
-#include "ParseUtil.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Utility;
-
-result
-ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, int &value)
-{
- result r = E_SUCCESS;
- String token;
-
- StringTokenizer strTok(src, delimeter);
- SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] delimeter:%ls", delimeter.GetPointer());
-
- while (strTok.HasMoreTokens())
- {
- r = strTok.GetNextToken(token);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- if ( key == token )
- {
- String strValue;
- r = strTok.GetNextToken(strValue);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- r = Integer::Parse(strValue, value);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- }
- }
-
-CATCH:
- return r;
-}
-
-result
-ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String &value)
-{
- result r = E_SUCCESS;
- String token;
-
- StringTokenizer strTok(src, delimeter);
- SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
-
- while (strTok.HasMoreTokens())
- {
- r = strTok.GetNextToken(token);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- if ( key == token )
- {
- r = strTok.GetNextToken(value);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- }
- else // In case of additional collon such as path:http://localhost:8080/xxx
- {
- r = value.Append(delimeter);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- r = value.Append(token);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
- }
- }
-
-CATCH:
- return r;
-}
-
-result
-SplitParameters(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key, Tizen::Base::String &value)
-{
- result r = E_SUCCESS;
- String token;
- int i = 0;
-
- StringTokenizer strTok(src, delimeter);
- SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
-
- while (strTok.HasMoreTokens())
- {
- r = strTok.GetNextToken(token);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- switch (i)
- {
- case 0:
- key = token;
- break;
- case 1:
- value = token;
- break;
- default :
- value.Append(delimeter);
- value.Append(token);
- break;
- }
- i++;
- }
-
-CATCH:
- return r;
-}
-
-result
-FindKey(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key)
-{
- result r = E_SUCCESS;
- String token;
-
- StringTokenizer strTok(src, delimeter);
- SysTryCatch(NID_APP, strTok.GetTokenCount()>0, r = E_KEY_NOT_FOUND, E_KEY_NOT_FOUND, "[E_KEY_NOT_FOUND] Propagating.");
-
- while (strTok.HasMoreTokens())
- {
- r = strTok.GetNextToken(token);
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- key = token; // Get the key which occurs first.
- break;
- }
-
-CATCH:
- return r;
-}
-
-result
-FindKeyUnit(const UnitTransMap* pMap, const Tizen::Base::String& srcKey, Tizen::Base::String& dstKey, UnitType &srcType, UnitType &dstType, Tizen::Base::String &conCatStr, int& conCatIndex )
-{
- result r = E_SUCCESS;
- int i = 0;
-
- SysTryCatch(NID_APP, pMap, r = E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Propagating.");
-
- while ( pMap[i].srcKey != null && pMap[i].dstKey != null )
- {
- if ( srcKey.Equals(String(pMap[i].srcKey), true))
- {
- dstKey = String(pMap[i].dstKey);
- srcType = pMap[i].srcType;
- dstType = pMap[i].dstType;
-
- if ( pMap[i].conCatStr )
- {
- conCatStr = String(pMap[i].conCatStr);
- }
- else
- {
- conCatStr = String(L"");
- }
-
- conCatIndex = pMap[i].conCatIndex;
-
-// SysLog(NID_APP, "src:%s, dst:%s, srcType:%d, dstType:%d, conCat:%s, conCatIndex:%d", pMap[i].srcKey,pMap[i].dstKey,pMap[i].srcType,pMap[i].dstType,pMap[i].conCatStr,pMap[i].conCatIndex);
- }
- i++;
- }
-
-CATCH:
- return r;
-}
-
-result
-PeekListValue(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String& value )
-{
- result r = E_SUCCESS;
- String *pNodeData=null;
-
- SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
- SysTryCatch(NID_APP, pList->GetCount() > index , r = E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Propagating..\n");
-
- pNodeData = dynamic_cast<String*>(const_cast<Object*>(pList->GetAt(index)));
- SysTryCatch(NID_APP, pNodeData != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file was not found.\n");
- SysTryCatch(NID_APP, pNodeData->GetLength() > 0 , r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file path is too short.\n");
-
- r = ParseParameter(*pNodeData, key, delimeter, value);
-
-CATCH:
- return r;
-}
-
-result
-FindListKey(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, Tizen::Base::String& key )
-{
- result r = E_SUCCESS;
- String *pNodeData=null;
-
- SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
- SysTryCatch(NID_APP, pList->GetCount() > index , r = E_OUT_OF_RANGE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] Propagating.list count:%d, index:%d", pList->GetCount(), index);
-
- pNodeData = dynamic_cast<String*>(const_cast<Object*>(pList->GetAt(index)));
- SysTryCatch(NID_APP, pNodeData != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file was not found.\n");
- SysTryCatch(NID_APP, pNodeData->GetLength() > 0 , r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The file path is too short.\n");
-
- r = FindKey(*pNodeData, delimeter, key);
-
-CATCH:
- return r;
-}
-
-int
-CountListKey(const Tizen::Base::Collection::IList* pList, const Tizen::Base::String& delimeter, const Tizen::Base::String& key )
-{
- result r = E_SUCCESS;
- int count = 0;
- int matchCount = 0;
- ClearLastResult();
- SysTryCatch(NID_APP, pList != null, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The obj was not found.\n");
-
- count = pList->GetCount();
-
- for (int i = 0; i<count; i++ )
- {
- String value;
- r = FindListKey(pList, i, delimeter, value);
- if ( r == E_SUCCESS && value == key )
- {
- matchCount++;
- }
- }
-
-CATCH:
- SetLastResult(r);
- return matchCount;
-}
-
-
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef _PARSE_UTIL_H_
-#define _PARSE_UTIL_H_
-
-#include <FBase.h>
-
-static const Tizen::Base::String DELIMETER = L":";
-static const Tizen::Base::String KEY_TYPE = L"type";
-static const Tizen::Base::String KEY_PATH = L"path";
-
-static const Tizen::Base::String KEY_IMAGE = L"image";
-static const Tizen::Base::String KEY_AUDIO = L"audio";
-static const Tizen::Base::String KEY_VIDEO = L"video";
-
-enum UnitType
-{
- UNIT_NONE,
- UNIT_MSEC,
- UNIT_KBPS,
- UNIT_HHMMSS,
- UNIT_STRING,
- UNIT_PIXEL,
- UNIT_BYTE,
-};
-
-typedef struct
-{
- wchar_t* srcKey;
- wchar_t* dstKey;
- UnitType srcType;
- UnitType dstType;
- wchar_t* conCatStr; //Concat
- int conCatIndex;
-}UnitTransMap;
-
-result ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, int &value);
-result ParseParameter(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String &value);
-result SplitParameters(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key, Tizen::Base::String &value);
-
-result FindKey(const Tizen::Base::String& src, const Tizen::Base::String& delimeter, Tizen::Base::String& key);
-result FindKeyUnit(const UnitTransMap* pMap, const Tizen::Base::String& srcKey, Tizen::Base::String& dstKey, UnitType &srcType, UnitType &dstType, Tizen::Base::String &conCatStr, int& conCatIndex );
-
-result PeekListValue(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, const Tizen::Base::String& key, Tizen::Base::String& value );
-result FindListKey(const Tizen::Base::Collection::IList* pList, int index, const Tizen::Base::String& delimeter, Tizen::Base::String& key );
-int CountListKey(const Tizen::Base::Collection::IList* pList, const Tizen::Base::String& delimeter, const Tizen::Base::String& key );
-
-#endif
result _OSP_EXPORT_ TerminateAppControl(int req);
static int __processId = -1;
-static const wchar_t __allowedAppControlMessageTable[][2][64] =
+static const char __allowedAppControlMessageTable[][2][96] =
{
- {L"osp.appcontrol.MESSAGE", L"osp.appcontrol.operation.EDIT"},
- {L"osp.appcontrol.provider.message", L"osp.appcontrol.operation.compose"},
- {L"http://tizen.org/appcontrol/provider/message", L"http://tizen.org/appcontrol/operation/compose"},
- {L"tizen.messages", L"http://tizen.org/appcontrol/operation/compose"},
+ {"osp.appcontrol.MESSAGE", "osp.appcontrol.operation.EDIT"},
+ {"osp.appcontrol.provider.message", "osp.appcontrol.operation.compose"},
+ {"tizen.messages", "http://tizen.org/appcontrol/operation/compose"},
+ {"tizen.smsmessages", "http://tizen.org/appcontrol/operation/compose"},
+ {"tizen.mmsmessages", "http://tizen.org/appcontrol/operation/compose"},
};
-static const wchar_t __allowedAppControlEmailTable[][2][64] =
+static const char __allowedAppControlEmailTable[][2][96] =
{
- {L"osp.appcontrol.EMAIL", L"osp.appcontrol.operation.EDIT"},
- {L"osp.appcontrol.provider.email", L"osp.appcontrol.operation.compose"},
- {L"http://tizen.org/appcontrol/provider/email", L"http://tizen.org/appcontrol/operation/compose"},
- {L"tizen.email", L"http://tizen.org/appcontrol/operation/compose"},
+ {"osp.appcontrol.EMAIL", "osp.appcontrol.operation.EDIT"},
+ {"osp.appcontrol.provider.email", "osp.appcontrol.operation.compose"},
+ {"tizen.email", "http://tizen.org/appcontrol/operation/compose"},
};
SysLog(NID_APP, "aId : %ls, oId : %ls", aId.GetPointer(), oId.GetPointer());
- const bool isMessage = _AppControlManager::IsAllowedAppControl(__allowedAppControlMessageTable, 4, aId, oId);
- const bool isEmail = _AppControlManager::IsAllowedAppControl(__allowedAppControlEmailTable, 4, aId, oId);
+ const bool isMessage = _AppControlManager::IsAllowedAppControl(__allowedAppControlMessageTable, 5, aId, oId);
+ const bool isEmail = _AppControlManager::IsAllowedAppControl(__allowedAppControlEmailTable, 3, aId, oId);
SysTryReturnResult(NID_APP, isMessage || isEmail, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
msg.AddData(L"ATTACHFILE", tmpTotal);
}
- __processId = _AppControlManager::GetInstance()->Launch(msg, "msg-composer-efl", APPSVC_OPERATION_SEND, NULL, NULL, NULL, 0);
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pUri, pMime, NULL, 0);
SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Email AppControl is failed.");
SysLog(NID_APP, "StartAppControl: Launching Message AppControl succeeded.");
{
SysLog(NID_APP, "Email AppControl starts..");
- char* pUri = NULL;
_AppMessageImpl msg;
msg.AddData(pMap);
- String attach = msg.GetValue(L"attachments");
- if (!attach.IsEmpty())
- {
- pUri = _StringConverter::CopyToCharArrayN(attach);
- }
-
String tmp = msg.GetValue(L"to");
if (!tmp.IsEmpty())
{
msg.AddData(SERVICE_DATA_TEXT, tmp);
}
- __processId = _AppControlManager::GetInstance()->Launch(msg, "email-composer-efl", APPSVC_OPERATION_SEND, NULL, pUri, NULL, 0);
+#if 0
+ tmp = msg.GetValue(L"attachments");
+ if (!tmp.IsEmpty())
+ {
+ msg.AddData(APPSVC_DATA_PATH, tmp);
+ }
+#endif
- delete [] pUri;
+ const String& package = _AppControlManager::GetAliasAppId(aId);
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, oId, pUri, pMime, NULL, 0);
SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Email AppControl is failed.");
SysLog(NID_APP, "StartAppControl: Launching Email AppControl succeeded.");
#include <FApp_AppMessageImpl.h>
#include <FSys_SystemInfoImpl.h>
#include <FApp_Aul.h>
+#include <FApp_AppArg.h>
using namespace Tizen::App;
const String BLUETOOTH_VISIBILITY_1MIN_ON = L"GPSEnabled";
const String BLUETOOTH_VISIBILITY_2MIN_ON = L"GPSEnabled";
-const String CATEGORY_TV_OUT = L"TvOut";
-const String TV_OUT_ENABLED = L"TVOutEnabled";
-const String TV_OUT_DISABLED = L"TVOutDisabled";
-
-const String CATEGORY_USB = L"USB";
-const String USB_KIES = L"Kies";
-const String USB_MASS_STORAGE = L"MassStorage";
-const String USB_INTERNET_SHARING = L"InternetSharing";
-const String USB_DEBUGGING = L"UsbDebugging";
-
const String CATEGORY_FONT_TYPE = L"FontType";
const String FONT_TYPE_DEFAULT = L"Unknown";
const String FONT_SIZE_MEDIUM = L"Medium";
const String FONT_SIZE_LARGE = L"Large";
-const String CATEGORY_THEME = L"Theme";
-const String THEME_DEFAULT = L"Unknown";
-
static int __req = -1;
#ifdef __cplusplus
result _OSP_EXPORT_ StartAppControl(int req, const String&, const String&, const String*, const String*, const IMap*);
result _OSP_EXPORT_ TerminateAppControl(int req);
-void OnAppControlResult(void*, int, service_result_e, void*);
+void OnLocationAppControlResult(void*, int, service_result_e, void*);
void OnBluetoothAppControlResult(void*, int, service_result_e, void*);
+void OnFontSizeAppControlResult(void*, int, service_result_e, void*);
+void OnFontTypeAppControlResult(void*, int, service_result_e, void*);
+
+static const char __allowedLegacyAppControlTable[][2][96] =
+{
+ {"osp.appcontrol.SETTINGS", "osp.appcontrol.operation.DEFAULT"},
+ {"osp.appcontrol.provider.settings", "osp.appcontrol.operation.configure"},
+ {"tizen.settings", "http://tizen.org/appcontrol/operation/configure"},
+};
+
+static const char __allowedLocationAppControlTable[][2][96] =
+{
+ {"tizen.settings", "http://tizen.org/appcontrol/operation/configure/location"},
+};
+
+static const char __allowedBluetoothAppControlTable[][2][96] =
+{
+ {"tizen.settings", "http://tizen.org/appcontrol/operation/configure/bluetooth/visibility"},
+};
+
+static const char __allowedFontSizeAppControlTable[][2][96] =
+{
+ {"tizen.settings", "http://tizen.org/appcontrol/operation/configure/font/size"},
+};
-static const wchar_t __allowedAppControlTable[][2][64] =
+static const char __allowedFontTypeAppControlTable[][2][96] =
{
- {L"osp.appcontrol.SETTINGS", L"osp.appcontrol.operation.DEFAULT"},
- {L"osp.appcontrol.provider.settings", L"osp.appcontrol.operation.configure"},
- {L"http://tizen.org/appcontrol/provider/settings", L"http://tizen.org/appcontrol/operation/configure"},
- {L"tizen.settings", L"http://tizen.org/appcontrol/operation/configure"},
+ {"tizen.settings", "http://tizen.org/appcontrol/operation/configure/font/type"},
};
+
static int __processId = -1;
+
result
StartAppControl(int req, const String& aId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
{
SysLog(NID_APP, "StartAppControl: Entry to Setting AppControl");
- HashMap resultList;
result r = E_SUCCESS;
- const bool isAllowed = _AppControlManager::IsAllowedAppControl(__allowedAppControlTable, 4, aId, oId);
- SysTryReturnResult(NID_APP, isAllowed, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
+ const bool isLegacy = _AppControlManager::IsAllowedAppControl(__allowedLegacyAppControlTable, 3, aId, oId);
+ bool isLocation = _AppControlManager::IsAllowedAppControl(__allowedLocationAppControlTable, 1, aId, oId);
+ bool isBluetooth = _AppControlManager::IsAllowedAppControl(__allowedBluetoothAppControlTable, 1, aId, oId);
+ bool isFontSize = _AppControlManager::IsAllowedAppControl(__allowedFontSizeAppControlTable, 1, aId, oId);
+ bool isFontType = _AppControlManager::IsAllowedAppControl(__allowedFontTypeAppControlTable, 1, aId, oId);
+ SysTryReturnResult(NID_APP, isLegacy || isLocation || isBluetooth || isFontSize || isFontType, E_SYSTEM, "Invalid AppControl entry for (%ls, %ls).", aId.GetPointer(), oId.GetPointer());
SysLog(NID_APP, "Setting AppControl.");
_AppMessageImpl msg;
msg.AddData(pMap);
- String category = msg.GetValue(L"category");
+ AppSvcResFn pCb = NULL;
- r = resultList.Construct();
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] Propagated.", GetErrorMessage(r));
+ String operation;
- if (category == CATEGORY_LOCATION)
+ if (isLegacy)
{
- __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-location-efl", NULL, NULL, NULL, OnAppControlResult, 0);
-
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Location AppControl is failed.");
-
- SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_LOCATION.GetPointer());
-
- __req = req;
+ String category = msg.GetValue(L"category");
+ if (category == CATEGORY_LOCATION)
+ {
+ operation = L"http://tizen.org/appcontrol/operation/configure/location";
+ isLocation = true;
+ }
+ else if (category == CATEGORY_BLUETOOTH_VISIBILITY)
+ {
+ operation = L"http://tizen.org/appcontrol/operation/configure/bluetooth/visibility";
+ isBluetooth = true;
+ }
+ else if (category == CATEGORY_FONT_TYPE)
+ {
+ operation = L"http://tizen.org/appcontrol/operation/configure/font/type";
+ isFontType = true;
+ }
+ else if (category == CATEGORY_FONT_SIZE)
+ {
+ operation = L"http://tizen.org/appcontrol/operation/configure/font/size";
+ isFontSize = true;
+ }
+ else
+ {
+ SysLog(NID_APP, "Unknown category %ls for legacy AppControl.", category.GetPointer());
+ }
}
- else if (category == CATEGORY_BLUETOOTH_VISIBILITY)
+ else
{
- //String* pArg1 = null;
- //String* pArg2 = null;
- //String* pArg3 = null;
- bool isBtSupported = false;
-
- r = Tizen::System::_SystemInfoImpl::GetSysInfo(L"BluetoothSupported", isBtSupported);
- SysTryCatch(NID_APP, (r == E_SUCCESS) && (isBtSupported == true), r = E_SYSTEM, E_SYSTEM, "[%s] Bluetooth is not supported.", GetErrorMessage(r));
-
- msg.AddData(L"launch-type", L"visibility");
-
- __processId = _AppControlManager::GetInstance()->Launch(msg, "ug-bluetooth-efl", "http://tizen.org/appcontrol/operation/configure/bluetooth/visibility", NULL, NULL, OnBluetoothAppControlResult, 0);
+ operation = oId;
+ }
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Bluetooth Visiblity AppControl is failed.");
- SysLog(NID_APP, "StartAppControl: Launching Bluetooth Visiblity AppControl succeeded.");
+ AppId providerAppId;
- __req = req;
- }
-#if 0
- else if (category == CATEGORY_TV_OUT)
+ if (isLocation)
{
- String* pArg1 = null;
- String* pArg2 = null;
- String* pArg3 = null;
-
- pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
- SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg1);
-
- pArg2 = new (std::nothrow) String(CATEGORY_TV_OUT);
- SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg2);
-
- pArg3 = new (std::nothrow) String(TV_OUT_DISABLED);
- SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg3);
-
- SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
- CATEGORY_TV_OUT.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
- _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
+ pCb = OnLocationAppControlResult;
+ providerAppId = "tizen.setting_location";
}
- else if (category == CATEGORY_USB)
- {
- String* pArg1 = null;
- String* pArg2 = null;
- String* pArg3 = null;
-
- pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
- SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg1);
-
- pArg2 = new (std::nothrow) String(CATEGORY_USB);
- SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg2);
-
- pArg3 = new (std::nothrow) String(USB_KIES);
- SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg3);
-
- SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
- CATEGORY_USB.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
- _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
- }
-#endif
- else if (category == CATEGORY_FONT_TYPE)
+ else if (isBluetooth)
{
- __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-font-efl", NULL, NULL, NULL, OnAppControlResult, 0);
-
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Font AppControl is failed.");
- SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_FONT_TYPE.GetPointer());
+ pCb = OnBluetoothAppControlResult;
+ providerAppId = "tizen.setting_bluetooth";
}
- else if (category == CATEGORY_FONT_SIZE)
+ else if (isFontSize)
{
- __processId = _AppControlManager::GetInstance()->Launch(msg, "setting-font-efl", NULL, NULL, NULL, OnAppControlResult, 0);
-
- SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Setting Accessibility AppControl is failed.");
-
- SysLog(NID_APP, "[%s] %ls Setting AppControl started.", GetErrorMessage(r), CATEGORY_FONT_SIZE.GetPointer());
+ pCb = OnFontSizeAppControlResult;
+ providerAppId = "tizen.setting_font";
}
-#if 0
- else if (category == CATEGORY_THEME)
+ else if (isFontType)
{
- String* pArg1 = null;
- String* pArg2 = null;
- String* pArg3 = null;
-
- pArg1 = new (std::nothrow) String(APPCONTROL_RESULT_SUCCEEDED);
- SysTryCatch(NID_APP, pArg1 != null, r = E_OUT_OF_MEMORY,
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg1);
-
- pArg2 = new (std::nothrow) String(CATEGORY_THEME);
- SysTryCatch(NID_APP, pArg2 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg2);
-
- pArg3 = new (std::nothrow) String(THEME_DEFAULT);
- SysTryCatch(NID_APP, pArg3 != null, r = E_OUT_OF_MEMORY; resultList.RemoveAll(true),
- E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
- resultList.Add(*pArg3);
-
- SysLog(NID_APP, "%ls Setting AppControl finished with result(%ls, %ls, %ls).",
- CATEGORY_THEME.GetPointer(), pArg1->GetPointer(), pArg2->GetPointer(), pArg3->GetPointer());
- _AppControlManager::GetInstance()->FinishAppControl(req, &resultList);
+ pCb = OnFontTypeAppControlResult;
+ providerAppId = "tizen.setting_font";
}
-#endif
else
{
- _AppControlManager::GetInstance()->FinishAppControl(req, APP_CTRL_RESULT_FAILED, null);
+ providerAppId = aId;
}
+
+ const String& package = _AppControlManager::GetAliasAppId(providerAppId);
+ SysLog(NID_APP, "Actual packageId is %ls.", package.GetPointer());
- return r;
+ __req = req;
+ __processId = _AppControlManager::GetInstance()->Launch(msg, package, operation, pUri, pMime, pCb, 0);
-CATCH:
- resultList.RemoveAll(true);
+ SysTryReturnResult(NID_APP, __processId >= 0, E_SYSTEM, "StartAppControl: Launching Camera AppControl is failed.");
+
+ r = E_SUCCESS;
+ SysLog(NID_APP, "StartAppControl: Launching Camera AppControl succeeded");
return r;
}
}
void
-OnAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+OnLocationAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
{
SysLog(NID_APP, "Setting AppControl result received.");
result r = E_SYSTEM;
+ const char* pBuf = NULL;
bundle* pBundle = static_cast<bundle*>(b);
HashMap* pResult = new (std::nothrow) HashMap();
r = pResult->Construct();
- switch (res)
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"Location"));
+
+ pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/location/gps");
+ if (pBuf)
{
- case SERVICE_RESULT_SUCCEEDED:
- {
- const char* pCategory = appsvc_get_data(pBundle, "category");
- if (pCategory)
- {
- pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(pCategory));
- }
-
- const char* pData = appsvc_get_data(pBundle, "State");
- if (pData)
- {
- pResult->Add(new (std::nothrow) String(L"GPS"), new (std::nothrow) String(pData));
- }
-
- pData = appsvc_get_data(pBundle, "FontType");
- if (pData)
- {
- pResult->Add(new (std::nothrow) String(L"type"), new (std::nothrow) String(pData));
- }
-
- pData = appsvc_get_data(pBundle, "FontSize");
- if (pData)
- {
- pResult->Add(new (std::nothrow) String(L"size"), new (std::nothrow) String(pData));
- }
- }
- break;
- case SERVICE_RESULT_FAILED:
- break;
-#if 0
- case SERVICE_RESULT_CANCELED:
- break;
-#endif
- default:
- break;
+ pResult->Add(new (std::nothrow) String(L"GPS"), new (std::nothrow) String(pBuf));
+ }
+
+ pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/location/wps");
+ if (pBuf)
+ {
+ pResult->Add(new (std::nothrow) String(L"WPS"), new (std::nothrow) String(pBuf));
}
_AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
OnBluetoothAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
{
result r = E_SYSTEM;
+ const char* pBuf = NULL;
bundle* pBundle = static_cast<bundle*>(b);
HashMap* pResult = new (std::nothrow) HashMap();
r = pResult->Construct();
- switch (res)
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"Bluetooth.Visibility"));
+
+ pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/visibility");
+ if (pBuf)
{
- case SERVICE_RESULT_SUCCEEDED:
+ switch (*pBuf)
{
- pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"Bluetooth.Visibility"));
-
- const char* pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/bluetooth/visibility");
- if (pBuf)
- {
- switch (*pBuf)
- {
- case '0':
- pBuf = "off";
- break;
- case '1':
- pBuf = "always";
- break;
- case '2':
- pBuf = "time_limited";
- break;
- default:
- pBuf = "off";
- break;
- }
- pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/visibility"), new (std::nothrow) String(pBuf));
- }
+ case '0':
+ pBuf = "off";
+ break;
+ case '1':
+ pBuf = "always";
+ break;
+ case '2':
+ pBuf = "time_limited";
+ break;
+ default:
+ pBuf = "off";
+ break;
}
- break;
- case SERVICE_RESULT_FAILED:
- //fall through
- case SERVICE_RESULT_CANCELED:
- //fall through
- default:
- break;
+ pResult->Add(new (std::nothrow) String(L"http://tizen.org/appcontrol/data/bluetooth/visibility"), new (std::nothrow) String(pBuf));
+ pResult->Add(new (std::nothrow) String(L"visibility"), new (std::nothrow) String(pBuf));
+ }
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
+void
+OnFontSizeAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+ SysLog(NID_APP, "Setting AppControl result received.");
+
+ result r = E_SYSTEM;
+ const char* pBuf = NULL;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"FontSize"));
+
+ pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/font/size");
+ if (pBuf)
+ {
+ pResult->Add(new (std::nothrow) String(L"size"), new (std::nothrow) String(pBuf));
+ }
+
+ _AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);
+
+CATCH:
+ __req = -1;
+}
+
+
+void
+OnFontTypeAppControlResult(void* b, int requestCode, service_result_e res, void* userData)
+{
+ SysLog(NID_APP, "Setting AppControl result received.");
+
+ result r = E_SYSTEM;
+ const char* pBuf = NULL;
+ bundle* pBundle = static_cast<bundle*>(b);
+
+ HashMap* pResult = new (std::nothrow) HashMap();
+ SysTryCatch(NID_APP, pResult != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Allocation failure.");
+
+ r = pResult->Construct();
+
+ _AppArg::SetArgMap(pBundle, pResult);
+
+ pResult->Add(new (std::nothrow) String(L"category"), new (std::nothrow) String(L"FontType"));
+
+ pBuf = appsvc_get_data(pBundle, "http://tizen.org/appcontrol/data/font/type");
+ if (pBuf)
+ {
+ pResult->Add(new (std::nothrow) String(L"type"), new (std::nothrow) String(pBuf));
}
_AppControlManager::GetInstance()->FinishAppControl(__req, res, pResult);