Applied sizeof operator on fixed sized array to calculate size.
[platform/framework/native/appfw.git] / src / server / inc / FApp_AulServer.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
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
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
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.
15 //
16
17 /**
18  * @file        FApp_AulServer.h
19  * @brief       This is the header file of the _AulServer class.
20  */
21
22 #ifndef _FAPP_INTERNAL_AulServer_H_
23 #define _FAPP_INTERNAL_AulServer_H_
24
25 #include <appsvc/appsvc.h>
26 #include <bundle.h>
27 #include <FOspConfig.h>
28 #include <FAppTypes.h>
29
30 #define MAX_SLP_PACKAGE_ID 128
31
32 namespace Tizen { namespace App
33 {
34
35 /**
36 * @class        _AulServer
37 * @brief        SysDep class for AppManager
38 * @since 2.1
39 * @final        This class it not intended for extension.
40 */
41 class _OSP_EXPORT_ _AulServer
42 {
43 public:
44         static result TerminateApplicationByPid(int pid);
45
46         static result SendResult(bundle* b, appsvc_result_val res);
47
48         static bool IsRunning(const AppId& appId, const Tizen::Base::String& exeName);
49
50         static bool IsRunning(const Tizen::Base::String& packageName);
51
52         static void SetOnAppTerminatedCb(int (* pf_app_dead_handler)(int pid, void* pData), void* pData);
53
54         static result SetOomAdj(int pid, int adj);
55
56         static int GetAppType(const Tizen::Base::String& category);
57
58         static bool IsInstalled(const AppId& appId);
59
60         static int CreateProcess(const Tizen::Base::String& appId);
61
62         static bool IsUserPreferredAppForAppControlResolution(const AppId& appId);
63         
64         static result ClearUserPreferenceForAppControlResolution(const AppId& appId);
65
66 public:
67         /**
68          * This is static helper class for desktop file.
69          */
70         class _DesktopFile
71         {
72         public:
73                 /**
74                  * Updates the service value
75                  * @param[in]   appId                   The application's ID to be executed
76                  * @param[in]   value                   value to be added or updated.
77                  *
78                  * @remark              If operations is new, it will be appended.
79                  *              but, if same operation is already exist, 'url' and 'mimeType' will be updated.
80                  */
81                 static result UpdateService(const AppId& appId, const char* value);
82
83                 /**
84                  * Removes the service value by operation
85                  * @param[in]   appId   The application's ID to be executed
86                  * @param[in]   operationOnlyValue      operationId of service to be removed
87                  */
88                 static result RemoveService(const AppId& appId, const char* operationOnlyValue);
89
90         private:
91                 /**
92                  * Updates value of specified field
93                  */
94                 static result UpdateField(const char* path, const char* key, const char* value, bool isRemove = false);
95
96                 /**
97                  * Makes desktop file path from appId (retrives appName using _PackageMamagerImpl)
98                  */
99                 static result MakePath(const AppId& appId, const Tizen::Base::String* pExeName, char* path, int size);
100
101                 /**
102                  * Update service value of input buffer with specified value
103                  */
104                 static char* UpdateServiceValueN(char* buffer, const char* newValue, bool isRemove = false);
105
106                 /**
107                  * Extracts each informations from one service string.
108                  */
109                 static result ParseService(const Tizen::Base::String& service, Tizen::Base::String& operation, Tizen::Base::String& url, Tizen::Base::String& mimeType);
110
111                 static void AppendServiceValueToString(Tizen::Base::String& string, const Tizen::Base::String& newVaue);
112
113                 friend class UTs_AulServer;
114         }; // _DesktopFile
115
116         friend class UTs_AulServer;
117 }; // _AulServer
118
119 } } // Tizen::App
120
121 #endif // _FAPP_INTERNAL_AulServer_H_