fix AppControl result handling
[platform/framework/native/appfw.git] / src / app / FApp_AppControlImpl.cpp
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_AppControlImpl.cpp
19  * @brief               This is the implementation for the Application Control class.
20  */
21
22 #include <new>
23 #include <typeinfo>
24 #include <unique_ptr.h>
25
26 #include <appsvc/appsvc.h>
27
28 #include <FBaseColHashMap.h>
29 #include <FBaseSysLog.h>
30 #include <FAppAppControl.h>
31 #include <FAppAppManager.h>
32 #include <FAppPkgPackageAppInfo.h>
33 #include <FAppIAppControlEventListener.h>
34 #include <FAppIAppControlResponseListener.h>
35
36 #include "FApp_AppControlImpl.h"
37 #include "FApp_AppControlManager.h"
38 #include "FApp_IAppControlPluginProvider.h"
39 #include "FApp_AppArg.h"
40 #include "FApp_AppControlRegistry.h"
41 #include "FApp_AppMessageImpl.h"
42 #include "FApp_AppInfo.h"
43 #include "FAppPkg_PackageManagerImpl.h"
44 #include "FApp_Aul.h"
45 #include "FApp_AppControlEventArg.h"
46 #include "FApp_AppControlResponseEvent.h"
47 #include "FBaseRt_ThreadImpl.h"
48
49 using namespace Tizen::Base;
50 using namespace Tizen::Base::Collection;
51 using namespace Tizen::Base::Runtime;
52 using namespace Tizen::App;
53 using namespace Tizen::App::Package;
54 using namespace Tizen::Io;
55
56 namespace
57 {
58
59 static const int _REQ_ID_INVALID = -1;
60 const wchar_t ACTL_IMPLICIT_PLUGIN[] = L"libosp-ac-implicit.so";
61
62 }
63
64 namespace Tizen { namespace App
65 {
66
67 _AppControlImpl::_AppControlImpl(const AppControl& value)
68         : _appControl(value)
69         , _reqId(_REQ_ID_INVALID)
70         , _property(_APPCONTROL_PROPERTY_NONE)
71         , _processId(_REQ_ID_INVALID)
72 {
73         __appControlResponseEventList.Construct();
74 }
75
76 _AppControlImpl::~_AppControlImpl(void)
77 {
78         IEnumeratorT<int>* pEnum = __appControlResponseEventList.GetEnumeratorN();
79         IMapT<int, _AppControlResponseEvent*>* pResponseEventContainer = null;
80         if(pEnum != null)
81         {
82                 pResponseEventContainer = _AppControlManager::GetInstance()->GetAppControlResponseEventContainer();
83         }
84
85         while(pEnum->MoveNext() == E_SUCCESS)
86         {
87                 int reqId;
88                 pEnum->GetCurrent(reqId);
89                 if (pResponseEventContainer != null)
90                 {
91                         _AppControlResponseEvent* pResponseEvent = null;
92                         pResponseEventContainer->GetValue(reqId, pResponseEvent);
93                         delete pResponseEvent;
94
95                         pResponseEventContainer->Remove(reqId);
96                         SysLog(NID_APP, "pResponseEvent gets deleted. reqId(%d)", reqId);
97                 }
98         }
99         delete pEnum;
100 }
101
102 AppControl*
103 _AppControlImpl::CreateN(const String& path, const String& aId, const String& oId, int prop)
104 {
105         SysTryReturn(NID_APP, !path.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Path is empty.");
106         SysTryReturn(NID_APP, !aId.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Provider Id is empty.");
107         SysTryReturn(NID_APP, !oId.IsEmpty(), null, E_INVALID_ARG, "[E_INVALID_ARG] Operation Id is empty.");
108
109         const AppId& actualAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(aId);
110         const bool isInstalled = _Aul::IsInstalled(actualAppId);
111         SysTryReturn(NID_APP, isInstalled, null, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] %ls not installed.", actualAppId.GetPointer());
112
113
114         AppControl* pAc = new (std::nothrow) AppControl;
115         SysTryReturn(NID_APP, pAc != null, null, E_OUT_OF_MEMORY, "AppControl allocation failure.");
116
117         _AppControlImpl* pImpl = pAc->__pAppControlImpl;
118         SysTryReturn(NID_APP, pImpl != null, null, E_OUT_OF_MEMORY, "AppControlImpl instance must not be null.");
119
120         pImpl->_path = path;
121         pImpl->_appId = aId;
122         pImpl->_opId = oId;
123         pImpl->_property = prop;
124
125         return pAc;
126 }
127
128
129 const _AppControlImpl*
130 _AppControlImpl::GetInstance(const AppControl& ac)
131 {
132         return ac.__pAppControlImpl;
133 }
134
135 _AppControlImpl*
136 _AppControlImpl::GetInstance(AppControl& ac)
137 {
138         return ac.__pAppControlImpl;
139 }
140
141 _IAppControlPluginProvider*
142 _AppControlImpl::GetAppControlPluginProvider(const String& path)
143 {
144         _LibraryImpl lib;
145         lib.Construct(path, _LIBRARY_OPTION);
146
147         APP_CONTROL_PROVIDER_GET_FN pProvider = reinterpret_cast<APP_CONTROL_PROVIDER_GET_FN>(lib.GetProcAddress(L"GetAppControlProviderPlugin"));
148
149         if (!pProvider)
150         {
151                 SysLogException(NID_APP, E_SYSTEM, "Cannot load plugin properly for %ls.", path.GetPointer());
152                 return null;
153         }
154
155         return (*pProvider)();
156 }
157
158
159 result
160 _AppControlImpl::FindAndStart(const String& operationId, const String* pUriPattern, const String* pDataType, const String* pCategory, const IMap* pExtraData, IAppControlResponseListener* pListener)
161 {
162         // [FIXME] valid argument size checking required
163         SysLog(NID_APP, "Enter");
164
165         std::unique_ptr<bundle, BundleDeleter> pBundle(bundle_create());
166         SysTryReturnResult(NID_APP, pBundle.get(), E_OUT_OF_MEMORY, "Bundle creation failure.");
167
168         _AppMessageImpl::SetOperation(pBundle.get(), operationId);
169
170         if (pUriPattern)
171         {
172                 _AppMessageImpl::SetUri(pBundle.get(), *pUriPattern);
173         }
174
175         if (pDataType)
176         {
177                 String mimeType = *pDataType;
178
179                 if ((*pDataType)[0] == L'.')
180                 {
181                         SysLog(NID_APP, "Extension to MIME conversion for %ls", pDataType->GetPointer());
182
183 #if 0
184                         String ext;
185                         pDataType->SubString(1, ext);
186
187                         result r = _AppControlManager::GetMimeFromExt(ext, mimeType);
188
189                         SysTryReturn(NID_APP, !IsFailed(r), null, r, "[%s] MIME type conversion failure for %ls.", GetErrorMessage(r), ext.GetPointer());
190
191                         pMimeType = &mimeType;
192
193                         SysLog(NID_APP, "Conversion : %ls -> %ls.", pDataType->GetPointer(), pMimeType->GetPointer());
194 #endif
195                 }
196
197                 _AppMessageImpl::SetMime(pBundle.get(), mimeType);
198         }
199
200         if (pCategory)
201         {
202                 _AppMessageImpl::SetCategory(pBundle.get(), *pCategory);
203         }
204
205         return StartImplicit(pBundle.get(), pExtraData, pListener);
206 }
207
208
209 result
210 _AppControlImpl::StartImplicit(const _AppMessageImpl& msg, IEventListener* pListener, bool isLegacy)
211 {
212         SysLog(NID_APP, "Enter");
213         int req = _REQ_ID_INVALID;
214
215         _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(ACTL_IMPLICIT_PLUGIN);
216         if (pProvider == null)
217         {
218                 SysPropagate(NID_APP, E_OBJ_NOT_FOUND);
219                 return E_OBJ_NOT_FOUND;
220         }
221
222         if (pListener)
223         {
224                 _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(isLegacy, pProvider, pListener);
225                 if (pItem)
226                 {
227                         req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
228                 }
229         }
230
231         result r = InvokeStartAppControl(pProvider, req, L"", msg);
232
233         if (pListener == null)
234         {
235                 pProvider->Release();
236         }
237
238         // after acquring request number, pLib should be managed from the list, not CATCH
239         if (IsFailed(r))
240         {
241                 _AppControlManager::GetInstance()->__inAppManager.RemoveItem(req);
242                 SysLog(NID_APP, "[%s] A system error has occurred.", GetErrorMessage(r));
243
244                 return r;
245         }
246
247         SysLog(NID_APP, "Exit %d", req);
248         return E_SUCCESS;
249 }
250
251
252 result
253 _AppControlImpl::StartImplicit(bundle* pBundle, const IList* pDataList, IAppControlEventListener* pListener)
254 {
255         _AppMessageImpl msg(pBundle);
256         msg.AddData(pDataList);
257
258         return StartImplicit(msg, pListener, true);
259 }
260
261
262 result
263 _AppControlImpl::StartImplicit(bundle* pBundle, const IMap* pData, IAppControlResponseListener* pListener)
264 {
265         _AppMessageImpl msg(pBundle);
266         _AppArg::AddStrMap(msg.GetBundle(), pData);
267
268         return StartImplicit(msg, pListener, false);
269 }
270
271
272 result
273 _AppControlImpl::Start(const IList* pDataList, IAppControlEventListener* pListener)
274 {
275         SysLog(NID_APP, "Enter");
276         _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
277         SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
278
279         int req = _REQ_ID_INVALID;
280
281         _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
282         if (pProvider == null)
283         {
284                 SysPropagate(NID_APP, E_OBJ_NOT_FOUND);
285                 return E_OBJ_NOT_FOUND;
286         }
287
288         if (pListener)
289         {
290                 _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_appId, _opId, _property, true, pProvider, pListener);
291                 if (pItem)
292                 {
293                         req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
294                 }
295         }
296
297         result r = InvokeStartAppControl(pProvider, req, _appId, _opId, pDataList);
298
299         if (pListener == null)
300         {
301                 pProvider->Release();
302         }
303
304         if (IsFailed(r))
305         {
306                 _AppControlManager::GetInstance()->__inAppManager.RemoveItem(req);
307                 SysLog(NID_APP, "[%s] A system error has occurred.", GetErrorMessage(r));
308
309                 return r;
310         }
311
312         _reqId = req;
313
314         SysLog(NID_APP, "Exit %d", req);
315         return E_SUCCESS;
316 }
317
318 result
319 _AppControlImpl::Start(const String* pUriData, const String* pMimeType, const IMap* pDataList, IAppControlResponseListener* pListener)
320 {
321         SysLog(NID_APP, "Enter");
322         _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
323         SysTryReturnResult(NID_APP, pInfo == null, E_IN_PROGRESS, "Request ID %d is already in progress.", _reqId);
324
325         int req = _REQ_ID_INVALID;
326         result r = E_SUCCESS;
327
328         _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
329         if (pProvider == null)
330         {
331                 SysPropagate(NID_APP, E_OBJ_NOT_FOUND);
332                 return E_OBJ_NOT_FOUND;
333         }
334
335         if (pListener)
336         {
337                 _InProcessInfo* pItem = new (std::nothrow) _InProcessInfo(_appId, _opId, _property, false, pProvider, pListener);
338                 if (pItem)
339                 {
340                         req = _AppControlManager::GetInstance()->__inAppManager.InsertItem(pItem);
341                 }
342
343                 if (_ThreadImpl::GetCurrentThreadImpl()->GetThreadType() == THREAD_TYPE_EVENT_DRIVEN)
344                 {
345                         _AppControlResponseEvent* pAppControlResponseEvent = new (std::nothrow) _AppControlResponseEvent();
346
347                         if (pAppControlResponseEvent != null)
348                         {
349                                 r = pAppControlResponseEvent->Construct();
350                                 SysTryLog(NID_APP, r == E_SUCCESS, "[%s]_AppControlResponseEvent::Construct() is failed", GetErrorMessage(r));
351
352                                 r = pAppControlResponseEvent->AddListener(*this, true);
353                                 SysTryLog(NID_APP, r == E_SUCCESS, "[%s]_AppControlResponseEvent::AddListener() is failed", GetErrorMessage(r));
354
355                                 IMapT<int, _AppControlResponseEvent*>* pResponseEventContainer = _AppControlManager::GetInstance()->GetAppControlResponseEventContainer();
356                                 if (pResponseEventContainer != null)
357                                 {
358                                         int responseEventRequestId = RESPONSE_EVENT_REQID_MAGIC + req;
359                                         pResponseEventContainer->Add(responseEventRequestId, pAppControlResponseEvent);
360                                         __appControlResponseEventList.Add(responseEventRequestId);
361                                         SysLog(NID_APP, "pResponseEvent gets added. reqId(%d)", responseEventRequestId);
362                                 }
363                         }
364                 }
365         }
366         r = InvokeStartAppControl(pProvider, req, _appId, _opId, pUriData, pMimeType, pDataList);
367
368         if (pListener == null)
369         {
370                 pProvider->Release();
371         }
372
373         if (IsFailed(r))
374         {
375                 _AppControlManager::GetInstance()->__inAppManager.RemoveItem(req);
376                 SysLog(NID_APP, "[%s] A system error has occurred.", GetErrorMessage(r));
377
378                 return r;
379         }
380
381         _reqId = req;
382         SysLog(NID_APP, "Exit %d", req);
383
384         return E_SUCCESS;
385 }
386
387 result
388 _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const String& oId, const IList* pList)
389 {
390         SysLog(NID_APP, "Legacy stuff for converting argument");
391
392         HashMap map(SingleObjectDeleter);
393         HashMap* pMap = null;
394         if (pList)
395         {
396                 map.Construct();
397
398                 _AppArg::FillMapFromList(&map, pList);
399
400                 pMap = &map;
401         }
402
403         return InvokeStartAppControl(pProvider, req, appId, oId, null, null, pMap);
404 }
405
406
407 result
408 _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const String& oId, const String* pUri, const String* pMime, const IMap* pMap)
409 {
410         _AppMessageImpl msg(appId, oId, pUri, pMime, pMap);
411
412         return InvokeStartAppControl(pProvider, req, appId, msg);
413 }
414
415
416 result
417 _AppControlImpl::InvokeStartAppControl(_IAppControlPluginProvider* pProvider, int req, const String& appId, const _AppMessageImpl& message)
418 {
419         SysTryReturnResult(NID_APP, pProvider != null, E_SYSTEM, "Wrong AppControl provider plugin for %ls(%d).", appId.GetPointer(), req);
420
421         return pProvider->StartAppControlPlugin(req, appId, message, null);
422 }
423
424
425 static bool
426 IsValidAppControl(const String& appcontrolID)
427 {
428         return ((appcontrolID == L"osp.appcontrol.provider.audio")
429                 || (appcontrolID == L"osp.appcontrol.provider.bluetooth")
430                 || (appcontrolID == L"osp.appcontrol.provider.calendar")
431                 || (appcontrolID == L"osp.appcontrol.provider.camera")
432                 || (appcontrolID == L"osp.appcontrol.provider.contact")
433                 || (appcontrolID == L"osp.appcontrol.provider.certificatemanager")
434                 || (appcontrolID == L"osp.appcontrol.provider.email")
435                 || (appcontrolID == L"osp.appcontrol.provider.image")
436                 || (appcontrolID == L"osp.appcontrol.provider.media")
437                 || (appcontrolID == L"osp.appcontrol.provider.message")
438                 || (appcontrolID == L"osp.appcontrol.provider.video")
439                 || (appcontrolID == L"osp.appcontrol.provider.imageeditor")
440                 || (appcontrolID == L"osp.appcontrol.provider.allshare")
441                 || (appcontrolID == L"tizen.filemanager")
442                 || (appcontrolID == L"tizen.camera")
443                 || (appcontrolID == L"tizen.gallery")
444                 || (appcontrolID == L"tizen.imageviewer")
445                 || (appcontrolID == L"tizen.videoplayer")
446                 || (appcontrolID == L"tizen.memo")
447                 || (appcontrolID == L"tizen.contacts")
448                 || (appcontrolID == L"tizen.calendar")
449                 || (appcontrolID == L"tizen.todo")
450                 || (appcontrolID == L"tizen.email")
451                 || (appcontrolID == L"tizen.settings")
452                 || (appcontrolID == L"tizen.messages")
453                 || (appcontrolID == L"tizen.musicplayer")
454                 || (appcontrolID == L"tizen.bluetooth")
455                 || (appcontrolID == L"samsung.snote")
456                 || (appcontrolID == L"0pnxz8hbsr.MyFiles")
457                 || (appcontrolID == L"hdufar9ycj.Camera")
458                 || (appcontrolID == L"ijudt7w61q.Gallery")
459                 || (appcontrolID == L"jysyv9o1dc.ImageViewer")
460                 || (appcontrolID == L"npwf0scb88.VideoPlayer")
461                 || (appcontrolID == L"zunqjlsnce.Memo")
462                 || (appcontrolID == L"f9uev8hsyo.Contacts")
463                 || (appcontrolID == L"ph1vq2phrp.Calendar")
464                 || (appcontrolID == L"vxqbrefica.Email")
465                 || (appcontrolID == L"kto5jikgul.Settings")
466                 || (appcontrolID == L"8r4r5ddzzn.Messages")
467                 || (appcontrolID == L"dhrul6qzj3.MusicPlayer")
468                 || (appcontrolID == L"smemo-efl"));
469 }
470
471 result
472 _AppControlImpl::Stop(void)
473 {
474         const String appcontrolID(GetAppControlProviderId());
475         SysTryReturnResult(NID_APP, IsValidAppControl(appcontrolID), E_INVALID_OPERATION, "Invalid appcontrolID(%ls)", appcontrolID.GetPointer());
476
477         result (*pStop)(int req) = null;
478
479         if (_reqId != _REQ_ID_INVALID)
480         {
481                 _InProcessInfo* pInfo = _AppControlManager::GetInstance()->__inAppManager.FindItem(_reqId);
482                 SysTryReturnResult(NID_APP, pInfo != null, E_INVALID_OPERATION, "Request ID %d is not found.", _reqId);
483
484                 if (pInfo->pProvider)
485                 {
486                         pInfo->pProvider->StopAppControlPlugin(_reqId);
487                 }
488
489                 _AppControlManager::GetInstance()->__inAppManager.RemoveItem(_reqId);
490
491                 _reqId = _REQ_ID_INVALID;
492         }
493         else
494         {
495                 _IAppControlPluginProvider* pProvider = GetAppControlPluginProvider(_path);
496                 if (pProvider)
497                 {
498                         pProvider->StopAppControlPlugin(-1);
499                         SysLog(NID_APP, "Request is stopped.");
500
501                         pProvider->Release();
502                 }
503         }
504
505         return E_SUCCESS;
506 }
507
508 String
509 _AppControlImpl::GetAppName(void)
510 {
511         if (_appName.IsEmpty())
512         {
513                 AppId appId = GetAppId();
514                 AppId aliasAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
515                 if (!aliasAppId.IsEmpty())
516                 {
517                         appId = aliasAppId;
518                 }
519
520                 std::unique_ptr<PackageAppInfo> pInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(appId));
521                 if (pInfo.get())
522                 {
523                         SysLog(NID_APP, "PackageInfo of appId(%ls) exists", appId.GetPointer());
524                         const String& name = pInfo->GetAppName();
525                         if (name == L"_AppControl")
526                         {
527                                 // workaround for special case: requery with actual appId
528                                 const PackageId& packageId = _PackageManagerImpl::GetPackageIdByAppId(appId);
529                                 const String& defaultName = _PackageManagerImpl::GetInstance()->GetDefaultAppExecutableName(packageId);
530
531                                 const String& convertedAppId = packageId + L'.' + defaultName;
532
533                                 std::unique_ptr<PackageAppInfo> pNewInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(convertedAppId));
534
535                                 if (pNewInfo.get())
536                                 {
537                                         _appName = pNewInfo->GetAppDisplayName();
538                                 }
539                                 else
540                                 {
541                                         SysLog(NID_APP, "No default applicaiton information, possible database error.");
542                                 }
543                         }
544                         else
545                         {
546                                 _appName = pInfo->GetAppDisplayName();
547                         }
548                 }
549                 else
550                 {
551                         SysLog(NID_APP, "PackageInfo of appId(%ls) does not exist", appId.GetPointer());
552                 }
553         }
554
555         return _appName;
556 }
557
558 String
559 _AppControlImpl::GetAppId(void) const
560 {
561         return _appId;
562 }
563
564 const String&
565 _AppControlImpl::GetAppControlProviderId(void) const
566 {
567         return _appId;
568 }
569
570 const String&
571 _AppControlImpl::GetOperationId(void) const
572 {
573         return _opId;
574 }
575
576 IList*
577 _AppControlImpl::GetCategoryListN(void) const
578 {
579         AppId appId = GetAppId();
580         SysTryReturn(NID_APP, !appId.IsEmpty(), null, E_SYSTEM, "[E_SYSTEM] Empty appId.");
581
582         AppId aliasAppId = _AppControlRegistry::GetInstance()->GetAliasAppId(appId);
583         if (!aliasAppId.IsEmpty())
584         {
585                 appId = aliasAppId;
586         }
587
588         SysLog(NID_APP, "Acquiring category for app %ls.", appId.GetPointer());
589
590         std::unique_ptr<PackageAppInfo> pAppInfo(_PackageManagerImpl::GetInstance()->GetPackageAppInfoN(appId));
591         SysTryReturn(NID_APP, pAppInfo.get() != null, null, E_SYSTEM, "[E_SYSTEM] Getting PackageAppInfo failed.");
592
593         return pAppInfo->GetAppCategoryListN();
594 }
595
596 void
597 _AppControlImpl::StopAppControlResponseListener(IAppControlResponseListener* pListener)
598 {
599         _AppControlManager::GetInstance()->StopAppControlResponseListener(pListener);
600 }
601
602 void
603 _AppControlImpl::OnAppControlResponseEventReceivedN(const Tizen::Base::Runtime::IEventArg* arg)
604 {
605         const _AppControlResponseEventArg* pEventArg = dynamic_cast<const _AppControlResponseEventArg*>(arg);
606
607         if (pEventArg != null)
608         {
609                 IAppControlResponseListener* pResponseListener = pEventArg->GetListener();
610
611                 if(pResponseListener != null)
612                 {
613                         if(pEventArg->GetType() == _APPCONTROL_RESPONSETYPE_COMPLETE)
614                         {
615                                 _AppControlManager::InvokeAppControlCompleteListener(*pResponseListener, pEventArg->GetAppId(), pEventArg->GetOperationId(), pEventArg->GetAppControlResult(), pEventArg->GetExtraData(), pEventArg->IsSubMode());
616
617                                 _AppControlResponseEvent* pResponseEvent = null;
618                                 _AppControlManager::GetInstance()->GetAppControlResponseEventContainer()->GetValue(pEventArg->GetRequestId(), pResponseEvent);
619                                 _AppControlManager::GetInstance()->GetAppControlResponseEventContainer()->Remove(pEventArg->GetRequestId());
620                                 delete pResponseEvent;
621                                 SysLog(NID_APP, "pResponseEvent gets deleted, reqId(%d)", pEventArg->GetRequestId());
622                         }
623                         else
624                         {
625                                 SysLog(NID_APP, "Unexpected AppControlResponseType(%d)", pEventArg->GetType());
626                         }
627                 }
628                 else
629                 {
630                         SysLog(NID_APP, "Invalid ResponseListener");
631                 }
632         }
633         else
634         {
635                 SysLog(NID_APP, "Invalid AppControl arguments : arg(0x%x)", &arg);
636         }
637
638 }
639 }}    //Tizen::App