Add datacontrol.consumer privilege to DataControl
[platform/framework/native/appfw.git] / src / app / FApp_AppImpl.cpp
index 3286d92..e41f92a 100644 (file)
@@ -82,6 +82,9 @@ namespace Tizen { namespace App
 
 _AppImpl* _AppImpl::__pAppImpl = null;
 bool _AppImpl::__isTerminationRequested = false;
+
+static const char TIZEN_APPCONTROL_DATA_MULTI_WINDOW[] = "http://tizen.org/appcontrol/data/multiwindow";
+
 #if 0
 static const int _DATACONTROL_PACKET_INDEX_APPID = 0;
 static const int _DATACONTROL_PACKET_INDEX_REQUESTTYPE = 1;
@@ -307,6 +310,19 @@ _AppImpl::OnService(service_s* service, void* user_data)
                        _AppInfo::SetParentWindowHandle(winId);
                        SysLog(NID_APP, "Saving window handle 0x%x.", winId);
                }
+
+               // set an appinfo value for multi-window mode
+               char* pBuf = null;
+               int errVal = service_get_extra_data(service, TIZEN_APPCONTROL_DATA_MULTI_WINDOW, &pBuf);
+               if (errVal == SERVICE_ERROR_NONE)
+               {
+                       if (!strcmp(pBuf, "on"))
+                       {
+                               _AppInfo::SetMultiWindow(true);
+                       }
+                       free(pBuf);
+               }
+
                // call for callbacks
                // ptr to member function
                SysLogTag(NID_APP, "LAUNCH","[%ls:<RequestHandler and OnAppInitialized>:start]", _AppInfo::GetAppExecutableName().GetPointer());
@@ -495,7 +511,11 @@ _AppImpl::RegisterAppRequest(service_s* service, int& req, _AppHandler& handler)
        SysTryReturnResult(NID_APP, pManager != null, E_SYSTEM, "Wrong system state.");
 
        result r = pManager->RegisterRequest(service, req, handler);
-       SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagating.", GetErrorMessage(r));
+       if (IsFailed(r))
+       {
+               SysPropagate(NID_APP, r);
+               return r;
+       }
 
        int providerType = _AppInfo::GetAppHandlerType();
        providerType |= (_APP_HANDLER_LAUNCH_NORMAL | _APP_HANDLER_LAUNCH_COND);