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