2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://floralicense.org/license/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an AS IS BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 #include <FBaseSysLog.h>
19 #include <FUiSystemUtil.h>
20 #include <FUi_SystemUtilImpl.h>
21 #include <FGrpPoint.h>
22 #include <FGrpBitmap.h>
23 #include <FAppAppManager.h>
24 #include "FSec_AccessController.h"
25 #include "FApp_AppInfo.h"
26 #include "FUi_UiKeyEvent.h"
28 using namespace Tizen::Security;
29 using namespace Tizen::Graphics;
30 using namespace Tizen::Base;
32 namespace Tizen { namespace Ui
35 SystemUtil::SystemUtil(void)
39 SystemUtil::~SystemUtil(void)
44 SystemUtil::GenerateKeyEvent(KeyEventType KeyEvent, KeyCode keyCode)
48 const String& packageId = Tizen::App::_AppInfo::GetPackageId();
50 r = _AccessController::CheckSystemPrivilege(packageId, _PRV_INPUTMANAGER);
52 SysTryReturn(NID_UI, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
54 r = _SystemUtilImpl::GenerateKeyEvent(KeyEvent, static_cast<Tizen::Ui::_KeyCode>(keyCode));
56 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
61 SystemUtil::GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::Point& point)
64 const String& packageId = Tizen::App::_AppInfo::GetPackageId();
66 r = _AccessController::CheckSystemPrivilege(packageId, _PRV_INPUTMANAGER);
68 SysTryReturn(NID_UI, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
70 r = _SystemUtilImpl::GenerateTouchEvent(touchEvent, point);
72 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
77 SystemUtil::GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::FloatPoint& point)
80 const String& packageId = Tizen::App::_AppInfo::GetPackageId();
82 r = _AccessController::CheckSystemPrivilege(packageId, _PRV_INPUTMANAGER);
84 SysTryReturn(NID_UI, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, ("[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method."));
86 r = _SystemUtilImpl::GenerateTouchEvent(touchEvent, point);
88 SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
92 Tizen::Graphics::Bitmap*
93 SystemUtil::CaptureScreenN(void)
96 const String& packageId = Tizen::App::_AppInfo::GetPackageId();
98 r = _AccessController::CheckSystemPrivilege(packageId, _PRV_INPUTMANAGER);
100 SysTryReturn(NID_UI, r == E_SUCCESS, null, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] The application does not have the privilege to call this method.");
102 return _SystemUtilImpl::CaptureScreenN();