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.
18 * @file FApp_AppInfo.h
19 * @brief This is the header file of the _AppInfo class.
22 #ifndef _FAPP_INTERNAL_APP_INFO_H_
23 #define _FAPP_INTERNAL_APP_INFO_H_
25 #include <FBaseObject.h>
26 #include <FOspConfig.h>
27 #include <FAppTypes.h>
29 #include <FBaseInternalTypes.h>
31 #include "FApp_Types.h"
33 namespace Tizen { namespace Base { class String; } }
35 namespace Tizen { namespace App
41 class _OSP_EXPORT_ _AppInfo
45 * Retrieves class instance.
47 * @return A pointer to the %_AppInfo instance, @n
48 * else @c null if it fails
50 _OSP_LOCAL_ static _AppInfo* GetInstance(void);
53 * Gets the Api version of current application.
55 * @return The Api version
57 static Tizen::Base::_ApiVersion GetApiVersion(void);
60 * Checkes whether the compatibility mode is on or not.
62 * @return @true if the compatibility mode is on else false
64 static bool IsOspCompat(void);
66 static bool IsVirtualRoot(void);
69 * Sets the Api version of current application.
71 * @return An error code
72 * @param[in] apiVersion Api version
73 * @exception E_SUCCESS The method is successful.
74 * @exception E_SYSTEM A system error has occurred.
76 static result SetApiVersion(Tizen::Base::_ApiVersion apiVersion);
79 * Gets the current process Id.
81 * @return The process Id
83 static int GetProcessId(void);
86 * Gets the directory file descriptor of application's root directory where the application is installed.
88 * @return The file descriptor of the application's root directory
89 * @remarks This file descriptor is read only.
91 static int GetAppRootDirFd(void);
94 * Gets the application's Id.
96 * @return The application Id
98 static AppId GetApplicationId(void);
101 * Gets the application's Id.
103 * @return The application Id
105 static AppId GetPackageId(void);
108 * Gets the application executable name.
111 static Tizen::Base::String GetAppExecutableName(void);
114 * Checkes whether the application is submode or not.
116 * @return @true if the compatibility mode is on else false
118 static bool IsSubMode(void);
121 // This method is for internal use only.
122 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
124 // Gets the path of application's root directory where the application is installed.
126 // @return The path of the application's root directory
128 static Tizen::Base::String GetAppRootPath(void);
131 * Gets the application's name.
133 * @return The application name
135 static Tizen::Base::String GetAppName(void);
138 * Gets the application's version.
140 * @return The application version
142 static Tizen::Base::String GetAppVersion(void);
145 * Gets the current state of the application.
147 * @return The current state of the application
149 static AppState GetAppState(void);
152 * Sets the current state of the application.
154 * @param appState The current state of the application
156 static void SetAppState(AppState appState);
159 * Gets the current type of the application.
161 * @return The current type of the application
163 static int GetAppType(void);
166 * Sets the current type of the application.
168 * @param appType The current type of the application
170 static void SetAppType(_AppType appType);
173 * Gets the application handler type.
175 * @return appHandlerType
177 _OSP_LOCAL_ static int GetAppHandlerType(void);
180 * Sets the application handler type.
182 * @param appHandlerType
184 _OSP_LOCAL_ static void SetAppHandlerType(int appHandlerType);
187 * Gets the parent window handle.
189 * @return window handle
191 static unsigned int GetParentWindowHandle(void);
194 * Sets the parent window handle.
196 static void SetParentWindowHandle(unsigned int handle);
199 * Update package info
201 static void UpdatePackageInfo(bool update);
204 * Checkes whether the application is a multi-window mode or not.
206 * @return @true if the multi-window mode is on else false
208 static bool IsMultiWindow(void);
211 * Sets the multi-window mode.
213 static void SetMultiWindow(bool enable);
215 _OSP_LOCAL_ result Construct(void);
217 _OSP_LOCAL_ result Construct(const char* appId, const char* appRoot, _AppType type = _APP_TYPE_UI_APP);
220 _OSP_LOCAL_ _AppInfo(void);
222 _OSP_LOCAL_ ~_AppInfo(void);
224 _AppInfo(const _AppInfo& value);
226 _AppInfo& operator =(const _AppInfo& source);
228 _OSP_LOCAL_ result UpdateAppInfoFromPackageInfo(const PackageId& packageId);
235 int __appHandlerType;
236 int __parentWindowHandle;
237 Tizen::Base::String __appRootPath;
238 Tizen::Base::String* __pAppName;
239 Tizen::Base::String* __pAppVersion;
240 bool __isPackageInfoInitialized;
242 bool __isVirtualRoot;
243 bool __isMultiWindow;
248 #endif //_FAPP_INTERNAL_APP_INFO_H_