Change HomeScreen API function renderSurfaceToAreaAllowed to renderAppToAreaAllowed.
authorBocklage, Jens <Jens_Bocklage@mentor.com>
Wed, 16 Nov 2016 02:56:12 +0000 (03:56 +0100)
committerBocklage, Jens <Jens_Bocklage@mentor.com>
Wed, 16 Nov 2016 02:56:12 +0000 (03:56 +0100)
Background is that an application wants to know if it is allowed to be rendered before it creates its own surface.
If it is not allowed, it does not need to allocate resources.

Signed-off-by: Bocklage, Jens <Jens_Bocklage@mentor.com>
HomeScreen/src/homescreencontrolinterface.cpp
HomeScreen/src/homescreencontrolinterface.h
SampleHomeScreenInterfaceApp/src/sampleclass.cpp
SampleHomeScreenInterfaceApp/src/sampleclass.hpp
interfaces/homescreen.xml
libhomescreen/include/libhomescreen.hpp
libhomescreen/src/libhomescreen.cpp

index 0c35b1c..1977957 100644 (file)
@@ -66,10 +66,10 @@ void HomeScreenControlInterface::renderSurfaceToArea(int surfaceId, int layoutAr
     newRequestRenderSurfaceToArea(surfaceId, layoutArea);
 }
 
-bool HomeScreenControlInterface::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+bool HomeScreenControlInterface::renderAppToAreaAllowed(int appCategory, int layoutArea)
 {
-    qDebug("renderSurfaceToAreaAllowed %d %d", surfaceId, layoutArea);
-    return renderSurfaceToAreaAllowed(surfaceId, layoutArea);
+    qDebug("renderAppToAreaAllowed %d %d", appCategory, layoutArea);
+    return true; //TODO: ask policy manager
 }
 
 void HomeScreenControlInterface::requestSurfaceIdToFullScreen(int surfaceId)
index b202dc9..04e47cb 100644 (file)
@@ -29,7 +29,7 @@ public Q_SLOTS: // METHODS
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, int layoutArea);
-    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
+    bool renderAppToAreaAllowed(int appCategory, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
 private:
     HomescreenAdaptor *mp_homeScreenAdaptor;
index 86b5943..b2a6f7b 100644 (file)
@@ -31,9 +31,9 @@ void SampleClass::renderSurfaceToArea(int surfaceId, int layoutArea)
     mp_libHomeScreen->renderSurfaceToArea(surfaceId, layoutArea);
 }
 
-bool SampleClass::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+bool SampleClass::renderAppToAreaAllowed(int appCategory, int layoutArea)
 {
-    return mp_libHomeScreen->renderSurfaceToAreaAllowed(surfaceId, layoutArea);
+    return mp_libHomeScreen->renderAppToAreaAllowed(appCategory, layoutArea);
 }
 
 void SampleClass::requestSurfaceIdToFullScreen(int surfaceId)
index 3e80117..44a88a2 100644 (file)
@@ -14,7 +14,7 @@ public:
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, int layoutArea);
-    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
+    bool renderAppToAreaAllowed(int appCategory, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
 
 private:
index fe0ea30..e9cad83 100644 (file)
                        <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;int&gt;"/>
                </method>
                <!--
-               renderSurfaceToAreaAllowed:
-               @surfaceId: The surface that is requested.
-               @layoutArea: The layout area where the surface shall be rendered.
-               @allowed: Returns true, if the surface is allowed to be rendered in the area
+               renderAppToAreaAllowed:
+               @appCategory: The application category that is requested. Use enum AppCategory for this!
+               @layoutArea: The layout area where the application shall be rendered. Find the layoutArea ids in the layout definition!
+               @allowed: Returns true, if the application is allowed to be rendered in the area
 
-               This function can be used to request, if it is allowed to render a surface in a layout area in preparation
-               of the real renderSurfaceToArea command. This call will not change anything, it is only a request.
+               This function can be used to request, if it is allowed to render an application of a specific category
+               in a layout area. The idea is to decide from an application point of view to allocate recources or not.
+               Example: an application will decide to render video based on this call. This call will not change anything, it is only a request.
                -->
-               <method name="renderSurfaceToAreaAllowed">
-                       <arg name="surfaceId" type="i" direction="in"/>
+               <method name="renderAppToAreaAllowed">
+                       <arg name="appCategory" type="i" direction="in"/>
                        <arg name="layoutArea" type="i" direction="in"/>
                        <arg name="allowed" type="b" direction="out"/>
                </method>
                <!--
                renderSurfaceToArea:
                @surfaceId: The surface that is requested.
-               @layoutArea: The layout area where the surface shall be rendered.
+               @layoutArea: The layout area where the surface shall be rendered. Find the layoutArea ids in the layout definition!
 
                This is a special case. In the normal use case, one layout area is always filled completely
                with the first surface, that the process creates (more precise: the surface with the lowest id).
index 6ec843f..841196b 100644 (file)
@@ -26,7 +26,7 @@ public:
     int getSurfaceStatus(int surfaceId);
     void hardKeyPressed(int key);
     void renderSurfaceToArea(int surfaceId, int layoutArea);
-    bool renderSurfaceToAreaAllowed(int surfaceId, int layoutArea);
+    bool renderAppToAreaAllowed(int appCategory, int layoutArea);
     void requestSurfaceIdToFullScreen(int surfaceId);
 private:
     LibHomeScreenHomescreen *mp_libHomeScreenHomescreen_Proxy;
index 03c4baf..5cdabc9 100644 (file)
@@ -122,14 +122,14 @@ void LibHomeScreen::renderSurfaceToArea(int surfaceId, int layoutArea)
     }
 }
 
-bool LibHomeScreen::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
+bool LibHomeScreen::renderAppToAreaAllowed(int appCategory, int layoutArea)
 {
     gboolean result = true;
     GError *err = NULL;
 
-    lib_home_screen_homescreen_call_render_surface_to_area_allowed_sync(
+    lib_home_screen_homescreen_call_render_app_to_area_allowed_sync(
                 mp_libHomeScreenHomescreen_Proxy,
-                surfaceId,
+                appCategory,
                 layoutArea,
                 &result,
                 NULL,
@@ -137,7 +137,7 @@ bool LibHomeScreen::renderSurfaceToAreaAllowed(int surfaceId, int layoutArea)
 
     if (NULL != err)
     {
-        fprintf(stderr, "Unable to call renderSurfaceToArea: %s\n", err->message);
+        fprintf(stderr, "Unable to call renderAppToAreaAllowed: %s\n", err->message);
     }
 
     return result;