Merge "Fix duplicated alarms." into tizen_2.2
authorHokwon Song <hokwon.song@samsung.com>
Thu, 17 Oct 2013 08:02:32 +0000 (08:02 +0000)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Thu, 17 Oct 2013 08:02:32 +0000 (08:02 +0000)
19 files changed:
inc/FBaseColArrayList.h
inc/FBaseColHashMap.h
inc/FBaseColLinkedList.h
inc/FBaseColMultiHashMap.h
packaging/osp-appfw.spec
src/app/FApp_AppControlImpl.cpp
src/app/FApp_AppControlManager.cpp
src/app/FApp_AppControlRegistry.cpp
src/app/FApp_AppManagerImpl.cpp
src/app/FApp_Aul.cpp
src/app/inc/FApp_AppControlImpl.h
src/app/inc/FApp_AppControlManager.h
src/app/inc/FApp_Types.h
src/security/cert/FSecCert_Base64.cpp
src/security/cert/FSecCert_X509CertificateStoreImpl.cpp
src/security/inc/FSec_AccessControlTypes.h
src/server/app/FApp_AulServer.cpp [changed mode: 0755->0644]
src/server/inc/FApp_AulServer.h [changed mode: 0755->0644]
src/system/FSys_EnvironmentImpl.cpp

index a789693..9734cc9 100644 (file)
@@ -114,7 +114,7 @@ public:
         * @since 2.0
         *
         * @param[in]   deleter The function pointer to type of the element deleter
-        * @remarks             To create an owing collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
+        * @remarks             To create an owning collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
         *                              On the other hand, to create a non-owning collection, you do not need to set the element deleter value, as @c NoOpDeleter is the default element deleter.
         *                              It means that you do not transfer the ownership of elements to the collection.
         * @remarks             After creating an instance of the %ArrayList class, one of the Construct() methods must be called explicitly to initialize this instance.
index ef32231..d7b99c2 100644 (file)
@@ -105,7 +105,7 @@ public:
         * @since 2.0
         *
         * @param[in]   deleter The function pointer to type of the element deleter
-        * @remarks     To create an owing collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
+        * @remarks     To create an owning collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
         *                      On the other hand, to create a non-owning collection, you do not need to set the element deleter value, as @c NoOpDeleter is the default element deleter.
         *                      It means that you do not transfer the ownership of elements to the collection.
         * @see         NoOpDeleter()
index 32afbd5..e6a24c6 100644 (file)
@@ -108,7 +108,7 @@ public:
         * @since 2.0
         *
         * @param[in]   deleter The function pointer to type of the element deleter
-        * @remarks     To create an owing collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
+        * @remarks     To create an owning collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
         *                      On the other hand, to create a non-owning collection, you do not need to set the element deleter value, as @c NoOpDeleter is the default element deleter.
         *                      It means that you do not transfer the ownership of elements to the collection.
         * @see         NoOpDeleter()
index 25ac0d2..78e728b 100644 (file)
@@ -115,7 +115,7 @@ public:
         * @since 2.0
         *
         * @param[in]   deleter The function pointer to type of the element deleter
-        * @remarks     To create an owing collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
+        * @remarks     To create an owning collection, set the element deleter value as @c SingleObjectDeleter. This gives the collection the ownership of elements and the collection will destroy elements. @n
         *                      On the other hand, to create a non-owning collection, you do not need to set the element deleter value, as @c NoOpDeleter is the default element deleter.
         *                      It means that you do not transfer the ownership of elements to the collection.
         * @see         NoOpDeleter()
index 9518ba0..3221bd0 100644 (file)
@@ -99,7 +99,6 @@ The App Framework library of OSP
 
 %package devel
 Summary:    The App Framework library of OSP (Development)
-Group:      TO_BE/FILLED_IN
 Requires:   %{name} = %{version}-%{release}
 Requires: boost-devel
 Requires: pkgconfig(pkgmgr-info)
@@ -108,8 +107,7 @@ Requires: pkgconfig(pkgmgr-info)
 The  App Framework library of OSP (DEV)
 
 %package internal-devel
-Summary:    osp app framework internel (Internal)
-Group:      TO_BE/FILLED_IN
+Summary:    OSP app framework internal (Internal)
 Requires:   %{name} = %{version}-%{release}
 Requires:   %{name}-devel
 
@@ -118,7 +116,6 @@ The App Framework library of OSP (Internal-DEV)
 
 %package debug
 Summary:    The App Framework library of OSP (Development)
-Group:      TO_BE/FILLED_IN
 Requires:   %{name} = %{version}-%{release}
 
 %description debug
index 8c0126e..172c876 100644 (file)
@@ -56,8 +56,8 @@ using namespace Tizen::Io;
 namespace
 {
 
-static const int _REQ_ID_INVALID = -1;
 const wchar_t ACTL_IMPLICIT_PLUGIN[] = L"libosp-ac-implicit.so";
+const wchar_t TIZEN_ALIAS_APPID_PREFIX[] = L"tizen.";
 
 }
 
@@ -66,9 +66,9 @@ namespace Tizen { namespace App
 
 _AppControlImpl::_AppControlImpl(const AppControl& value)
        : _appControl(value)
-       , _reqId(_REQ_ID_INVALID)
+       , _reqId(APPCONTROL_REQUEST_ID_INVALID)
        , _property(_APPCONTROL_PROPERTY_NONE)
-       , _processId(_REQ_ID_INVALID)
+       , _processId(APPCONTROL_REQUEST_ID_INVALID)
 {
        __appControlResponseEventList.Construct();
 }
@@ -104,9 +104,14 @@ _AppControlImpl::CreateN(const String& path, const String& aId, const String& oI
 {
        SysTryReturn(NID_APP, !path.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Path is empty.");
        SysTryReturn(NID_APP, !aId.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Provider Id is empty.");
-       SysTryReturn(NID_APP, !oId.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Operation Id is empty.");
 
-       const AppId& actualAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(aId);
+       String actualAppId = aId;
+       if (aId.StartsWith(TIZEN_ALIAS_APPID_PREFIX, 0))
+       {
+               // little bit of performance tweak
+               actualAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(aId);
+       }
+
        const bool isInstalled = _Aul::IsInstalled(actualAppId);
        SysTryReturn(NID_APP, isInstalled, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] %ls not installed.", actualAppId.GetPointer());
 
@@ -119,25 +124,13 @@ _AppControlImpl::CreateN(const String& path, const String& aId, const String& oI
 
        pImpl->_path = path;
        pImpl->_appId = aId;
-       pImpl->_opId = oId;
+       pImpl->_opId = (oId.IsEmpty()) ? TIZEN_OPERATION_MAIN : oId;
        pImpl->_property = prop;
 
        return pAc;
 }
 
 
-const _AppControlImpl*
-_AppControlImpl::GetInstance(const AppControl& ac)
-{
-       return ac.__pAppControlImpl;
-}
-
-_AppControlImpl*
-_AppControlImpl::GetInstance(AppControl& ac)
-{
-       return ac.__pAppControlImpl;
-}
-
 _IAppControlPluginProvider*
 _AppControlImpl::GetAppControlPluginProvider(const String& path)
 {
@@ -174,25 +167,7 @@ _AppControlImpl::FindAndStart(const String& operationId, const String* pUriPatte
 
        if (pDataType)
        {
-               String mimeType = *pDataType;
-
-               if ((*pDataType)[0] == L'.')
-               {
-                       SysLog(NID_APP, "Extension to MIME conversion for %ls", pDataType->GetPointer());
-
-#if 0
-                       String ext;
-                       pDataType->SubString(1, ext);
-
-                       result r = _AppControlManager::GetMimeFromExt(ext, mimeType);
-
-                       SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] MIME type conversion failure for %ls.", GetErrorMessage(r), ext.GetPointer());
-
-                       pMimeType = &mimeType;
-
-                       SysLog(NID_APP, "Conversion : %ls -> %ls.", pDataType->GetPointer(), pMimeType->GetPointer());
-#endif
-               }
+               const String& mimeType = _AppControlManager::GetMimeTypeFromDataType(*pDataType);
 
                _AppMessageImpl::SetMime(pBundle.get(), mimeType);
        }
@@ -210,7 +185,7 @@ result
 _AppControlImpl::StartImplicit(const _AppMessageImpl& msg, IEventListener* pListener, bool isLegacy)
 {
        SysLog(NID_APP, "Enter");
-       int req = _REQ_ID_INVALID;
+       int req = APPCONTROL_REQUEST_ID_INVALID;
 
        _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(ACTL_IMPLICIT_PLUGIN);
        if (pProvider == null)
@@ -276,7 +251,7 @@ _AppControlImpl::Start(const IList* pDataList, IAppControlEventListener* pListen
        _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
        SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
 
-       int req = _REQ_ID_INVALID;
+       int req = APPCONTROL_REQUEST_ID_INVALID;
 
        _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
        if (pProvider == null)
@@ -322,7 +297,7 @@ _AppControlImpl::Start(const String* pUriData, const String* pMimeType, const IM
        _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
        SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
 
-       int req = _REQ_ID_INVALID;
+       int req = APPCONTROL_REQUEST_ID_INVALID;
        result r = E_SUCCESS;
 
        _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
@@ -340,7 +315,8 @@ _AppControlImpl::Start(const String* pUriData, const String* pMimeType, const IM
                        req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
                }
 
-               if (_ThreadImpl::GetCurrentThreadImpl()->GetThreadType() == THREAD_TYPE_EVENT_DRIVEN)
+               const _ThreadImpl* pThreadImpl = _ThreadImpl::GetCurrentThreadImpl();
+               if (pThreadImpl && pThreadImpl->GetThreadType() == THREAD_TYPE_EVENT_DRIVEN)
                {
                        _AppControlResponseEvent* pAppControlResponseEvent = new (std::nothrow) _AppControlResponseEvent();
 
@@ -407,7 +383,14 @@ _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, in
 result
 _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
 {
-       _AppMessageImpl msg(appId, oId, pUri, pMime, pMap);
+       String data;
+
+       if (pMime)
+       {
+               data = _AppControlManager::GetMimeTypeFromDataType(*pMime);
+       }
+
+       _AppMessageImpl msg(appId, oId, pUri, &data, pMap);
 
        return InvokeStartAppControl(pProvider, req, appId, msg);
 }
@@ -476,7 +459,7 @@ _AppControlImpl::Stop(void)
 
        result (*pStop)(int req) = null;
 
-       if (_reqId != _REQ_ID_INVALID)
+       if (_reqId != APPCONTROL_REQUEST_ID_INVALID)
        {
                _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
                SysTryReturnResult(NID_APP, pInfo != null, E_INVALID_OPERATION, "Request ID %d is not found.", _reqId);
@@ -488,7 +471,7 @@ _AppControlImpl::Stop(void)
 
                _AppControlManager::GetInstance()->__inAppManager.RemoveItem(_reqId);
 
-               _reqId = _REQ_ID_INVALID;
+               _reqId = APPCONTROL_REQUEST_ID_INVALID;
        }
        else
        {
@@ -506,7 +489,7 @@ _AppControlImpl::Stop(void)
 }
 
 String
-_AppControlImpl::GetAppName(void)
+_AppControlImpl::GetAppName(void) const
 {
        if (_appName.IsEmpty())
        {
@@ -522,7 +505,7 @@ _AppControlImpl::GetAppName(void)
                {
                        SysLog(NID_APP, "PackageInfo of appId(%ls) exists", appId.GetPointer());
                        const String& name = pInfo->GetAppName();
-                       if (name == L"_AppControl")
+                       if (name == String(SUBMODE_NAME))
                        {
                                // workaround for special case: requery with actual appId
                                const PackageId& packageId = _PackageManagerImpl::GetPackageIdByAppId(appId);
@@ -555,23 +538,6 @@ _AppControlImpl::GetAppName(void)
        return _appName;
 }
 
-String
-_AppControlImpl::GetAppId(void) const
-{
-       return _appId;
-}
-
-const String&
-_AppControlImpl::GetAppControlProviderId(void) const
-{
-       return _appId;
-}
-
-const String&
-_AppControlImpl::GetOperationId(void) const
-{
-       return _opId;
-}
 
 IList*
 _AppControlImpl::GetCategoryListN(void) const
index 9ff5cbc..15180e4 100644 (file)
@@ -43,6 +43,7 @@
 #include <FAppSqlDataControl.h>
 #include <FAppMapDataControl.h>
 #include <FAppPkgPackageInfo.h>
+#include <FAppPkgPackageAppInfo.h>
 #include <FBaseSysLog.h>
 
 #include <FBase_StringConverter.h>
@@ -143,6 +144,30 @@ _AppControlManager::GetMimeFromExt(const String& ext, String& out)
        return E_SUCCESS;
 }
 
+
+String
+_AppControlManager::GetMimeTypeFromDataType(const String& data)
+{
+       // Data type is either MIME type or .[extension]
+
+       if (data.IsEmpty() || data[0] != L'.')
+       {
+               return data;
+       }
+
+       // .[extension]
+       String ext;
+       data.SubString(1, ext);
+
+       String res;
+       result r = _AppControlManager::GetMimeFromExt(ext, res);
+       SysTryReturn(NID_APP, !IsFailed(r), L"", r, "[%s] MIME type conversion failed for %ls.", GetErrorMessage(r), ext.GetPointer());
+
+       SysLog(NID_APP, "Conversion from %ls into %ls.", data.GetPointer(), res.GetPointer());
+       return res;
+}
+
+
 void
 _AppControlManager::OnAppControlEventReceivedN(int reqId, _AppArg* pAppArg, int res)
 {
@@ -351,15 +376,6 @@ _AppControlManager::OnAppControlPluginEventReceivedN(int reqId, int res, const A
                SysLogException(NID_APP, E_SYSTEM, "Invalid AppControl listener.");
        }
 
-#if 0
-       // [FIXME] following logic is not needed.
-       // call TerminateAppControl
-       if (pInfo->pProvider)
-       {
-               pInfo->pProvider->StopAppControlPlugin(pInfo->reqId);
-               SysLog(NID_APP, "AppControl stopped for req %d.", pInfo->reqId);
-       }
-#endif
 
        // remove from list and unload dll
        __inAppManager.RemoveItem(reqId);
@@ -621,25 +637,34 @@ _AppControlManager::LaunchApp(const AppId& appId, _AppArg* pArg, int req)
 
        int pid = -1;
        bundle* kb = NULL;
-       String tempId;
-       actualAppId.SubString(0, 10, tempId);
-       tempId += L'.';
-       tempId += L"_AppControl";
 
-       // [INFO] Ugly solution for submode support
-       pArg->UpdateAppId(tempId);
-       kb = pArg->GetBundle();
-       
-       pid = appsvc_run_service(kb, req, LaunchResultCb, this);
-       if (pid >= 0)
-       {
-               SysLog(NID_APP, "Submode launch successful");
-               return E_SUCCESS;
-       }
-       else if (pid == APPSVC_RET_EINVAL)
+       std::unique_ptr< PackageAppInfo > pAppInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(appId));
+       SysTryReturn(NID_APP, pAppInfo != null, E_SYSTEM, GetLastResult(), "[%s] Getting AppInfo failed.", GetErrorMessage(GetLastResult()));
+       _PackageAppInfoImpl* pAppInfoImpl = _PackageAppInfoImpl::GetInstance(pAppInfo.get());
+       SysTryReturnResult(NID_APP, pAppInfoImpl != null , E_SYSTEM, "Severe system error");
+
+       if (pAppInfoImpl->IsServiceApp() == false)
        {
-               SysLog(NID_APP, "Argument overflow");
-               return E_MAX_EXCEEDED;
+               String tempId;
+               actualAppId.SubString(0, 10, tempId);
+               tempId += L'.';
+               tempId += String(SUBMODE_NAME);
+
+               // [INFO] Ugly solution for submode support
+               pArg->UpdateAppId(tempId);
+               kb = pArg->GetBundle();
+
+               pid = appsvc_run_service(kb, req, LaunchResultCb, this);
+               if (pid >= 0)
+               {
+                       SysLog(NID_APP, "Submode launch successful");
+                       return E_SUCCESS;
+               }
+               else if (pid == APPSVC_RET_EINVAL)
+               {
+                       SysLog(NID_APP, "Argument overflow");
+                       return E_MAX_EXCEEDED;
+               }
        }
 
        pArg->UpdateAppId(actualAppId);
@@ -754,7 +779,7 @@ _AppControlManager::Launch(const AppId& appId, _AppArg* pArg, AppSvcResFn pCb, v
        if ((!(type & _APP_TYPE_SERVICE_APP)) && _IsDefaultApplication(tempId, appId))
        {
                tempId += L'.';
-               tempId += L"_AppControl";
+               tempId += String(SUBMODE_NAME);
 
                // [INFO] Ugly solution for submode support
                pArg->UpdateAppId(tempId);
index a4c7c03..2775ba4 100644 (file)
@@ -52,12 +52,9 @@ const wchar_t ACTL_DEFAULT_FILE[] = L"/usr/etc/app-control-info.ini";
 const wchar_t ACTL_LEGACY_FILE[] = L"/usr/etc/app-control-alias.ini";
 const wchar_t ACTL_DEFAULT_PLUGIN[] = L"libosp-ac-platform.so";
 
-const wchar_t TIZEN_ALIAS_APPID_PREFIX[] = L"tizen.";
-
 const String ACTL_REGISTRY_PATH = L"Path";
 const String ACTL_REGISTRY_ALIAS_PROVIDER = L"PROVIDER_ALIAS";
 
-const int PKG_APPID_LEN = 256;
 const int REG_VALUE_BUFFER_LEN = 256;
 
 }
index 5c95d58..1931781 100644 (file)
@@ -214,21 +214,7 @@ _AppManagerImpl::FindAppControlsN(const String* pOperationId, const String* pCat
 
        if (pDataType)
        {
-               if ((*pDataType)[0] == L'.')
-               {
-                       SysLog(NID_APP, "Extension to MIME conversion for %ls", pDataType->GetPointer());
-
-                       String ext;
-                       pDataType->SubString(1, ext);
-
-                       result r = _AppControlManager::GetMimeFromExt(ext, mimeType);
-
-                       SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] MIME type conversion failure for %ls.", GetErrorMessage(r), ext.GetPointer());
-
-                       pMimeType = &mimeType;
-
-                       SysLog(NID_APP, "Conversion : %ls -> %ls.", pDataType->GetPointer(), pMimeType->GetPointer());
-               }
+               mimeType = _AppControlManager::GetMimeTypeFromDataType(*pDataType);
        }
 
        if (pUriScheme)
@@ -295,25 +281,7 @@ _AppManagerImpl::StartAppControl(const String* pOperationId, const String* pCate
 
        if (pDataType)
        {
-               String mimeType = *pDataType;
-
-               if ((*pDataType)[0] == L'.')
-               {
-                       SysLog(NID_APP, "Extension to MIME conversion for %ls", pDataType->GetPointer());
-
-#if 0
-                       String ext;
-                       pDataType->SubString(1, ext);
-
-                       result r = _AppControlManager::GetMimeFromExt(ext, mimeType);
-
-                       SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] MIME type conversion failure for %ls.", GetErrorMessage(r), ext.GetPointer());
-
-                       pMimeType = &mimeType;
-
-                       SysLog(NID_APP, "Conversion : %ls -> %ls.", pDataType->GetPointer(), pMimeType->GetPointer());
-#endif
-               }
+               const String& mimeType = _AppControlManager::GetMimeTypeFromDataType(*pDataType);
 
                _AppMessageImpl::SetMime(pBundle.get(), mimeType);
        }
index 104b4e0..d5cf730 100644 (file)
@@ -288,7 +288,7 @@ _Aul::GetRealAppId(const AppId& appId)
        String temp;
        // [INFO] ugly code for submode callee
        appId.SubString(11, temp);
-       if (temp == L"_AppControl")
+       if (temp == String(SUBMODE_NAME))
        {
                String id;
                appId.SubString(0, 10, id);
index 98ea6f7..8d9e59e 100644 (file)
@@ -71,12 +71,18 @@ public:
        /**
         * Internal GetImpl() method.
         */
-       static const _AppControlImpl* GetInstance(const AppControl& ac);
+       static const _AppControlImpl* GetInstance(const AppControl& ac)
+       {
+               return ac.__pAppControlImpl;
+       }
 
        /**
         * Internal GetImpl() method.
         */
-       static _AppControlImpl* GetInstance(AppControl& ac);
+       static _AppControlImpl* GetInstance(AppControl& ac)
+       {
+               return ac.__pAppControlImpl;
+       }
 
        /**
         * Starts the resolved application control. @n
@@ -136,28 +142,37 @@ public:
         *
         * @return              The name of the application providing this %_AppControlImpl instance
         */
-       Tizen::Base::String GetAppName(void);
+       Tizen::Base::String GetAppName(void) const;
 
        /**
         * Gets the associated application ID. @n
         *
         * @return              The application control ID
         */
-       Tizen::Base::String GetAppId(void) const;
+       Tizen::Base::String GetAppId(void) const
+       {
+               return _appId;
+       }
 
        /**
         * Gets the associated application control provider ID. @n
         *
         * @return              The application control provider ID
         */
-       const Tizen::Base::String& GetAppControlProviderId(void) const;
+       const Tizen::Base::String& GetAppControlProviderId(void) const
+       {
+               return _appId;
+       }
 
        /**
         * Gets the associated operation ID. @n
         *
         * @return              The operation ID
         */
-       const Tizen::Base::String& GetOperationId(void) const;
+       const Tizen::Base::String& GetOperationId(void) const
+       {
+               return _opId;
+       }
 
        /**
         * Returns the associated application control categories.
@@ -230,7 +245,7 @@ public:
 
        virtual void OnAppControlResponseEventReceivedN(const Tizen::Base::Runtime::IEventArg* arg);
 private:
-       _AppControlImpl(const AppControl& value);
+       explicit _AppControlImpl(const AppControl& value);
 
        /**
         * This is the default constructor for this class.
@@ -262,7 +277,7 @@ protected:
        Tizen::Base::String _path;
        Tizen::Base::String _appId;
        Tizen::Base::String _opId;
-       Tizen::Base::String _appName;
+       mutable Tizen::Base::String _appName;
        int     _reqId;
        int     _property;
        int _processId;
index c651314..1976db8 100644 (file)
@@ -159,6 +159,8 @@ public:
 
        result SendAppControlStartResponse(int req, const char* pValue, const char* pOp);
 
+       _OSP_LOCAL_ static Tizen::Base::String GetMimeTypeFromDataType(const Tizen::Base::String& dataType);
+
        static result GetMimeFromExt(const Tizen::Base::String& ext, Tizen::Base::String& out);
 
        void RemoveLaunchRequest(int req);
index 8245989..cc12c86 100644 (file)
@@ -104,6 +104,7 @@ const int APPSVC_OSP_RES_FAIL = -13;
 const int APPSVC_OSP_RES_TERMINATE = -14;
 
 const int LAUNCH_ARG_META_COUNT = 3;
+const int APPCONTROL_REQUEST_ID_INVALID = -1;
 
 _OSP_LOCAL_ extern const wchar_t LEGACY_LAUNCH_REASON_NORMAL[];
 _OSP_LOCAL_ extern const wchar_t LEGACY_LAUNCH_REASON_CONDITIONAL[];
@@ -111,6 +112,7 @@ _OSP_LOCAL_ extern const wchar_t LEGACY_OPERATION_MAIN[];
 _OSP_LOCAL_ extern const wchar_t TIZEN_OPERATION_MAIN[];
 _OSP_EXPORT_ extern const wchar_t TIZEN_OPERATION_PICK[];
 _OSP_LOCAL_ extern const char TIZEN_NOTIFICATION_DATA[];
+_OSP_LOCAL_ extern const char SUBMODE_NAME[];
 
 _OSP_EXPORT_ extern const char IPC_SERVER_NAME[];
 _OSP_EXPORT_ extern const char CONDITION_MANAGER_IPC_NAME[];
index 275b279..340351f 100644 (file)
@@ -69,8 +69,6 @@ _Base64::Decode(char* pIn, int inSize, byte* pOut, int& outSize)
        }
 
        std::unique_ptr< ByteBuffer > pDecodedBuffer(Tizen::Base::Utility::StringUtil::DecodeBase64StringN(encodedStr));
-       result r = GetLastResult();
-       SysTryReturn(NID_SEC_CERT, r == E_SUCCESS, -1 , E_SYSTEM, "[%s] Failed to DecodeBase64StringN.", GetErrorMessage(r));
        SysTryReturn(NID_SEC_CERT, pDecodedBuffer != null, -1, E_SYSTEM, "[E_SYSTEM] Failed to perform base64 decoding.");
 
        if (outSize > pDecodedBuffer->GetRemaining())
index 1df2b3b..fdfe3a8 100644 (file)
@@ -381,7 +381,7 @@ _X509CertificateStoreImpl::Update(CertificateType certificateType, const Tizen::
        oldBufferLen = pOldEncodedData->GetRemaining();
        SysTryReturnResult(NID_SEC_CERT, oldBufferLen > 0, E_INVALID_ARG, "Input old certificate length is not positive.");
 
-       pOldEncodedData.reset(null);
+       //pOldEncodedData.reset(null);
 
        std::unique_ptr< ByteBuffer > pNewEncodedData(newCert.GetEncodedDataN());
        SysTryReturnResult(NID_SEC_CERT, pNewEncodedData != null, E_INVALID_ARG, "Failed to get encoded data on new input certificate.");
index 3df87bc..61119fe 100644 (file)
@@ -472,8 +472,8 @@ const static bool privacyListTable[_MAX_PRIVILEGE_ENUM] =
        true,   // calendar.read
        true,   // calendar.write
        false,  // callforward
-       false,  // callhistory.read
-       false,  // callhistory.write
+       true,   // callhistory.read
+       true,   // callhistory.write
        false,  // camera
        false,  // cellbroadcast
        false,  // certificate.read
old mode 100755 (executable)
new mode 100644 (file)
index fd37fc9..d6ef48b
 #include "FApp_AulServer.h"
 #include "FApp_TemplateUtil.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-extern int aul_listen_app_dead_signal(int (* func)(int, void*), void* data);
-#ifdef __cplusplus
-}
-#endif
 
 using namespace Tizen::App::Package;
 using namespace Tizen::Base;
@@ -61,12 +54,6 @@ using namespace Tizen::Base::Utility;
 namespace
 {
 
-const char _DESKTOP_FILE_PATH[] = "/opt/share/applications";
-const char _DESKTOP_FILE_PATH_FORMAT[] = "%s/%s.desktop";
-
-const char _X_TIZEN_SVC[] = "x-tizen-svc"; //X-TIZEN-SVC=[operation1] | [URI1] | [MIME1] ; [operation2] | [URI2] | [MIME2]
-const int _MAX_TIZEN_SVC_DESC_LEN = 1024;
-
 const int _MAX_CATEGORY = 12;
 const int _MAX_PACKAGE_ID_LENGTH = 10;
 
@@ -159,6 +146,35 @@ _AulServer::IsRunning(const String& packageName)
 }
 
 
+result
+_AulServer::Launch(const String& appId)
+{
+       std::unique_ptr<char[]> pPackageName(_StringConverter::CopyToCharArrayN(appId));
+
+       int ret = aul_launch_app(pPackageName.get(), NULL);
+       if (ret < 0)
+       {
+               result r = E_SYSTEM;
+               switch (ret)
+               {
+               case AUL_R_EILLACC:
+                       r = E_ILLEGAL_ACCESS;
+                       break;
+               case AUL_R_EINVAL:
+                       r = E_MAX_EXCEEDED;
+                       break;
+               default:
+                       break;
+               }
+
+               SysLogException(NID_APP, r, "[%s] Error occurred.", GetErrorMessage(r));
+               return r;
+       }
+
+       return E_SUCCESS;
+}
+
+
 void
 _AulServer::SetOnAppTerminatedCb(int (* pf_app_dead_handler)(int pid, void* pData), void* pData)
 {
@@ -170,7 +186,7 @@ _AulServer::SetOnAppTerminatedCb(int (* pf_app_dead_handler)(int pid, void* pDat
 result
 _AulServer::TerminateApplicationByPid(int pid)
 {
-       int ret_aul = aul_subapp_terminate_request_pid(pid);
+       int ret_aul = aul_terminate_pid(pid);
        result r = E_SUCCESS;
 
        switch (ret_aul)
@@ -355,294 +371,4 @@ _AulServer::ClearUserPreferenceForAppControlResolution(const AppId& appId)
        return E_SUCCESS;
 }
 
-result
-_AulServer::_DesktopFile::MakePath(const AppId& appId, const String* pExeName, char* path, int size)
-{
-       SysTryReturnResult(NID_APP, path != null, E_INVALID_ARG, "");
-
-       char packageName[MAX_SLP_PACKAGE_ID] = {0, };
-       result r = E_SUCCESS;
-       _PackageManagerImpl* pPackageManagerImpl = _PackageManagerImpl::GetInstance();
-       SysTryReturnResult(NID_APP, pPackageManagerImpl, E_INVALID_STATE, "Invalid package manager instance.");
-
-       r = pPackageManagerImpl->GetPackageName(appId, pExeName, packageName, MAX_SLP_PACKAGE_ID);
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "%s", GetErrorMessage(r));
-
-       snprintf(path, size, _DESKTOP_FILE_PATH_FORMAT, _DESKTOP_FILE_PATH, packageName);
-
-       return r;
-}
-
-result
-_AulServer::_DesktopFile::UpdateService(const AppId& appId, const char* value)
-{
-       char path[FILENAME_MAX] = {0, };
-       MakePath(appId, null, path, FILENAME_MAX);
-
-       return UpdateField(path, _X_TIZEN_SVC, value);
-}
-
-
-result
-_AulServer::_DesktopFile::RemoveService(const AppId& appId, const char* operationOnlyValue)
-{
-       char path[FILENAME_MAX] = {0, };
-       MakePath(appId, null, path, FILENAME_MAX);
-
-       return UpdateField(path, _X_TIZEN_SVC, operationOnlyValue, true);
-}
-
-
-//
-// Update value of specified field.
-// currently only "x-slp-svc" field is supported.
-//
-#define BUFFER_SIZE 1024
-result
-_AulServer::_DesktopFile::UpdateField(const char* path, const char* fieldName, const char* value, bool isRemove)
-{
-       SysTryReturnResult(NID_APP, path != null, E_INVALID_ARG, "path should not be null.");
-       SysTryReturnResult(NID_APP, fieldName != null, E_INVALID_ARG, "fieldName should not be null.");
-       SysTryReturnResult(NID_APP, value != null, E_INVALID_ARG, "value should not be null.");
-
-       FILE* fp = fopen(path, "r+");
-       SysTryReturnResult(NID_APP, fp != null, E_SYSTEM, "falied to open '%s' due to %s", path, strerror(errno));
-
-       char buffer[BUFFER_SIZE] = {0, };
-       bool found = false;
-       int len = 0;
-       int pos = 0;
-       int foundpos = 0;
-       result r = E_SUCCESS;
-       int remains = 0;
-
-       ArrayListT<char*> buffers;
-       buffers.Construct();
-
-       char* pCurrent = null;
-
-       while (fgets(buffer, BUFFER_SIZE, fp) != NULL)
-       {
-               len = strlen(buffer);
-               SysTryCatch(NID_APP, len < BUFFER_SIZE, , r = E_INVALID_ARG, "strlen returns invalid value. (%d)", len );
-
-               if (found)
-               {
-                       pCurrent = new (std::nothrow) char[len + 1];
-                       SysTryCatch(NID_APP, pCurrent != null, , r = E_OUT_OF_MEMORY, "failed to allocate mem pCurrent");
-
-                       strncpy(pCurrent, buffer, len);
-                       buffers.Add(pCurrent);
-               }
-               else
-               {
-                       if (strncmp(buffer, fieldName, len) == 0)
-                       {
-                               int fieldNameLen = strlen(fieldName);
-                               SysTryCatch(NID_APP, len > fieldNameLen, , E_INVALID_ARG, "[E_INVALID_ARG] fieldName(%s)", fieldName);
-
-                               pCurrent = UpdateServiceValueN(buffer + fieldNameLen, value, isRemove);
-                               SysTryCatch(NID_APP, pCurrent != null, , r = GetLastResult(), "[%s] UpdateServiceValue failed", GetErrorMessage(GetLastResult()));
-
-                               buffers.Add(pCurrent);
-
-                               foundpos = pos;
-                               found = true;
-                       }
-               }
-
-               pos += len;
-       }
-
-       if (found)
-       {
-               fsetpos(fp, (fpos_t*) &foundpos);
-
-               remains = buffers.GetCount();   // prevent infinite loop
-               while (buffers.GetCount() > 0 && remains-- > 0)
-               {
-                       pCurrent = null;
-                       buffers.GetAt(0, pCurrent);
-                       buffers.RemoveAt(0);
-                       SysTryCatch(NID_APP, pCurrent != null, , r = E_INVALID_STATE, "");
-
-                       fputs(pCurrent, fp);
-                       len = strlen(pCurrent);
-                       pos += len;
-                       delete[] pCurrent;
-               }
-
-               int ret = truncate(path, pos);
-               SysTryLog(NID_APP, ret == 0, "Truncate failure (%s).", strerror(errno));
-       }
-       else
-       {
-               char svctext[_MAX_TIZEN_SVC_DESC_LEN] = {0, };
-               snprintf(svctext, _MAX_TIZEN_SVC_DESC_LEN, "%s=%s\n", fieldName, value);
-               fputs(svctext, fp);
-       }
-       fclose(fp);
-
-       return E_SUCCESS;
-
-CATCH:
-
-       remains = buffers.GetCount();   // prevent infinite loop
-       while (buffers.GetCount() > 0 && remains-- > 0)
-       {
-               pCurrent = null;
-               buffers.GetAt(0, pCurrent);
-               buffers.RemoveAt(0);
-               if (pCurrent != null)
-               {
-                       delete[] pCurrent;
-               }
-       }
-
-       fclose(fp);
-
-       return r;
-}
-
-//
-//     Tizen service string example
-//     X-TIZEN-SVC= http://tizen.org/appcontrol/operation/pick|NULL|image/jpge; http://tizen.org/appcontrol/operation/pick|NULL|video/mp4; http://tizen.org/appcontrol/operation/pick|NULL|NULL; http://tizen.org/appcontrol/operation/pview|NULL|NULL
-//
-char*
-_AulServer::_DesktopFile::UpdateServiceValueN(char* buffer, const char* newValue, bool isRemove)
-{
-       SysTryReturn(NID_APP, buffer != null, null, E_INVALID_ARG, "");
-       SysTryReturn(NID_APP, newValue != null, null, E_INVALID_ARG, "");
-
-       SysLog(NID_APP, "current(%s), new(%s), isRemove(%s)", buffer, newValue, (isRemove) ? "true" : "false");
-
-       String buf(buffer);
-       bool found = false;
-
-       const String& servicePattern(L"([A-Za-z&=:/\\.\\-]*);?");
-
-       ArrayList services;
-       String resultString;
-
-       Utility::RegularExpression regex;
-       result r = regex.Construct(servicePattern);
-       SysTryReturn(NID_APP, !IsFailed(r), null, r, "");
-
-       String newOperation;
-       String newUrl;
-       String newMimeType;
-       String newService(newValue);
-
-       if (isRemove == false)
-       {
-               ParseService(newService, newOperation, newUrl, newMimeType);
-       }
-       else
-       {
-               newOperation = newValue;
-       }
-
-       services.Construct();
-
-       while (regex.Consume(buf, &services) == true)
-       {
-               String* pCurrentService = (String*) services.GetAt(1);
-               services.RemoveAll(false);
-
-               String operation;
-               String url;
-               String mimeType;
-
-               ParseService(*pCurrentService, operation, url, mimeType);
-
-               if (operation == newOperation)
-               {
-                       if (isRemove == true)
-                       {
-                               SysLog(NID_APP, "opreration '%ls' will be removed", operation.GetPointer());
-                       }
-                       else
-                       {
-                               SysAssertf(found == false, "It's assumed that service doesn't have duplicated operation in tizen desktop file. But it isn't, so now we have to check this case.");
-                               // replace operation.
-                               if (found == false) // ( if duplicated operation is already exist, It will be keeped.
-                               {
-                                       // update value
-                                       AppendServiceValueToString(resultString, newService);
-                                       SysLog(NID_APP, "opreration '%ls;%ls;%ls' will be updated to ;%ls;%ls", operation.GetPointer(), url.GetPointer(), mimeType.GetPointer(), newUrl.GetPointer(), mimeType.GetPointer());
-                               }
-                       }
-                       found = true;
-               }
-               else
-               {
-                       // add not specified service.
-                       AppendServiceValueToString(resultString, *pCurrentService);
-               }
-
-               delete pCurrentService;
-       }
-
-       if (found == false && isRemove == false)
-       {
-               AppendServiceValueToString(resultString, newService);
-               SysLog(NID_APP, "opreration '%ls;%ls;%ls' will be added", newOperation.GetPointer(), newUrl.GetPointer(), newMimeType.GetPointer());
-       }
-
-       SysLog(NID_APP, "updated string is '%ls'", resultString.GetPointer());
-       return _StringConverter::CopyToCharArrayN(resultString);
-}
-
-
-void
-_AulServer::_DesktopFile::AppendServiceValueToString(String& serviceString, const String& newVaue)
-{
-       if (serviceString.GetLength() > 0)
-       {
-               serviceString += ";";
-       }
-
-       serviceString += newVaue;
-}
-
-
-result
-_AulServer::_DesktopFile::ParseService(const String& service, String& operation, String& url, String& mimeType)
-{
-       SysLog(NID_APP, "service(%ls)", service.GetPointer());
-
-       const String& serviceDetailPattern(L"([A-Za-z&=/\\.\\-]*):(.*://[A-Za-z&=/\\.\\-]*|[A-Za-z&=/\\.\\-]*):([A-Za-z&=/\\.\\-]*)");
-
-       Utility::RegularExpression regexDetail;
-       result r = regexDetail.Construct(serviceDetailPattern);
-       SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] RegularExpression::Construct(L\"%ls\") failed.", GetErrorMessage(r), serviceDetailPattern.GetPointer());
-
-       ArrayList matchedItems;
-       matchedItems.Construct();
-       regexDetail.Match(service, true, &matchedItems);
-
-       int matchedCount = matchedItems.GetCount();
-       SysTryLog(NID_APP, matchedCount == 4, "It's assumed that x-slp-svc value always have operation:url:mime in tizen desktop file. But it isn't or our parser is invalid. so now we have to check this case. %d", matchedItems.GetCount());
-
-       if (matchedCount > 1)
-       {
-               operation = *(String*) matchedItems.GetAt(1);
-       }
-
-       if (matchedCount > 2)
-       {
-               url = *(String*) matchedItems.GetAt(2);
-       }
-
-       if (matchedCount > 3)
-       {
-               mimeType = *(String*) matchedItems.GetAt(3);
-       }
-
-       SysLog(NID_APP, "matched(%d) : (%ls;%ls;%ls)", matchedItems.GetCount(), operation.GetPointer(), url.GetPointer(), mimeType.GetPointer());
-       matchedItems.RemoveAll(true);
-
-       return E_SUCCESS;
-}
-
 } } // Tizen::App
old mode 100755 (executable)
new mode 100644 (file)
index 22c34dc..ccda307
@@ -49,6 +49,8 @@ public:
 
        static bool IsRunning(const Tizen::Base::String& packageName);
 
+       static result Launch(const Tizen::Base::String& appId);
+
        static void SetOnAppTerminatedCb(int (* pf_app_dead_handler)(int pid, void* pData), void* pData);
 
        static result SetOomAdj(int pid, int adj);
@@ -64,55 +66,6 @@ public:
        static result ClearUserPreferenceForAppControlResolution(const AppId& appId);
 
 public:
-       /**
-        * This is static helper class for desktop file.
-        */
-       class _DesktopFile
-       {
-       public:
-               /**
-                * Updates the service value
-                * @param[in]   appId                   The application's ID to be executed
-                * @param[in]   value                   value to be added or updated.
-                *
-                * @remark              If operations is new, it will be appended.
-                *              but, if same operation is already exist, 'url' and 'mimeType' will be updated.
-                */
-               static result UpdateService(const AppId& appId, const char* value);
-
-               /**
-                * Removes the service value by operation
-                * @param[in]   appId   The application's ID to be executed
-                * @param[in]   operationOnlyValue      operationId of service to be removed
-                */
-               static result RemoveService(const AppId& appId, const char* operationOnlyValue);
-
-       private:
-               /**
-                * Updates value of specified field
-                */
-               static result UpdateField(const char* path, const char* key, const char* value, bool isRemove = false);
-
-               /**
-                * Makes desktop file path from appId (retrives appName using _PackageMamagerImpl)
-                */
-               static result MakePath(const AppId& appId, const Tizen::Base::String* pExeName, char* path, int size);
-
-               /**
-                * Update service value of input buffer with specified value
-                */
-               static char* UpdateServiceValueN(char* buffer, const char* newValue, bool isRemove = false);
-
-               /**
-                * Extracts each informations from one service string.
-                */
-               static result ParseService(const Tizen::Base::String& service, Tizen::Base::String& operation, Tizen::Base::String& url, Tizen::Base::String& mimeType);
-
-               static void AppendServiceValueToString(Tizen::Base::String& string, const Tizen::Base::String& newVaue);
-
-               friend class UTs_AulServer;
-       }; // _DesktopFile
-
        friend class UTs_AulServer;
 }; // _AulServer
 
index 3bd668d..b964525 100644 (file)
@@ -43,7 +43,7 @@ static const wchar_t _EXTERNAL_MMC_VIDEOS_PATH[] = L"/opt/storage/sdcard/Videos/
 static const wchar_t _EXTERNAL_MMC_CAMERA_PATH[] = L"/opt/storage/sdcard/Camera/";
 static const wchar_t _EXTERNAL_MMC_DOWNLOADS_PATH[] = L"/opt/storage/sdcard/Downloads/";
 static const wchar_t _EXTERNAL_MMC_OTHERS_PATH[] = L"/opt/storage/sdcard/Others/";
-static const wchar_t _RINGTONE_PATH[] = L"/opt/share/settings/Ringtones";
+static const wchar_t _RINGTONE_PATH[] = L"/opt/share/settings/Ringtones/";
 
 static const wchar_t _APPLICATIONS_PATH[] = L"/opt/usr/apps/";
 static const wchar_t _EXTERNAL_APPLICATIONS_PATH[] = L"/opt/storage/sdcard/app2sd/";