2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 * @brief This is the header file of the _Aul class.
22 #ifndef _FAPP_INTERNAL_AUL_H_
23 #define _FAPP_INTERNAL_AUL_H_
25 #include <appsvc/appsvc.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
30 #define MAX_SLP_PACKAGE_ID 128
32 namespace Tizen { namespace App
37 * @brief SysDep class for AppManager
39 * @final This class it not intended for extension.
41 class _OSP_EXPORT_ _Aul
44 static result GetConvertedResult(const int aul_ret, const char* pFunctionName);
46 static result TerminateApplication(const AppId& appId);
48 static result TerminateApplicationByPid(int pid);
50 static result SendResult(bundle* b, appsvc_result_val res);
52 static bool IsRunning(const AppId& appId, const Tizen::Base::String& exeName);
54 static bool IsRunning(const Tizen::Base::String& packageName);
56 static void SetOnAppTerminatedCb(int (* pf_app_dead_handler)(int pid, void* pData), void* pData);
58 static result SetOomAdj(int pid, int adj);
60 static result SetPowerOffNotiListener(void (*powerOffCb)(void *pData), void *pData);
62 static int GetAppType(const Tizen::Base::String& category);
64 static bool IsInstalled(const AppId& appId);
66 _OSP_LOCAL_ static AppId GetRealAppId(const AppId& appId);
70 * This is static helper class for desktop file.
76 * Updates the service value
77 * @param[in] appId The application's ID to be executed
78 * @param[in] value value to be added or updated.
80 * @remark If operations is new, it will be appended.
81 * but, if same operation is already exist, 'url' and 'mimeType' will be updated.
83 static result UpdateService(const AppId& appId, const char* value);
86 * Removes the service value by operation
87 * @param[in] appId The application's ID to be executed
88 * @param[in] operationOnlyValue operationId of service to be removed
90 static result RemoveService(const AppId& appId, const char* operationOnlyValue);
94 * Updates value of specified field
96 static result UpdateField(const char* path, const char* key, const char* value, bool isRemove = false);
99 * Makes desktop file path from appId (retrives appName using _PackageMamagerImpl)
101 static result MakePath(const AppId& appId, char* path, int size);
104 * Update service value of input buffer with specified value
106 static char* UpdateServiceValueN(char* buffer, const char* newValue, bool isRemove = false);
109 * Extracts each informations from one service string.
111 static result ParseService(const Tizen::Base::String& service, Tizen::Base::String& operation, Tizen::Base::String& url, Tizen::Base::String& mimeType);
113 static void AppendServiceValueToString(Tizen::Base::String& string, const Tizen::Base::String& newVaue);
115 friend class UTs_Aul;
118 friend class UTs_Aul;
123 #endif // _FAPP_INTERNAL_AUL_H_