aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-07-05 11:44:23 +0900
committerTadao Tanikawa <tanikawa.tadao@jp.panasonic.com>2017-07-05 11:44:54 +0900
commit94869392c6cca52f9a2e7366f3cdbf9094ddfa5a (patch)
tree2312285a396bd1ef295f8a89f5dec27a943103c8
parentc1e525621d49621421f79bc2134a9cb00b4cf2cb (diff)
Revert "Revert "Fix issue of app's unexpected stop while background""
This reverts commit c1e525621d49621421f79bc2134a9cb00b4cf2cb. The commit f95ec0 depends on the change of apps/homescreen. (https://gerrit.automotivelinux.org/gerrit/#/c/9829/). Change-Id: Iff48e71a902823e17d032c55ecfc431429151f49 Signed-off-by: Tadao Tanikawa <tanikawa.tadao@jp.panasonic.com>
-rw-r--r--interfaces/windowmanager.xml1
-rw-r--r--windowmanager/src/windowmanager.cpp171
-rw-r--r--windowmanager/src/windowmanager.hpp7
3 files changed, 94 insertions, 85 deletions
diff --git a/interfaces/windowmanager.xml b/interfaces/windowmanager.xml
index e3c6df3..f288b32 100644
--- a/interfaces/windowmanager.xml
+++ b/interfaces/windowmanager.xml
@@ -191,6 +191,7 @@
Show layer for application .
-->
<method name="showAppLayer">
+ <arg name="name" type="s" direction="in"/>
<arg name="pid" type="i" direction="in"/>
</method>
<!--
diff --git a/windowmanager/src/windowmanager.cpp b/windowmanager/src/windowmanager.cpp
index 08dac72..6510b74 100644
--- a/windowmanager/src/windowmanager.cpp
+++ b/windowmanager/src/windowmanager.cpp
@@ -60,6 +60,8 @@ WindowManager::WindowManager(int displayId, QObject *parent) :
,
m_appSurfaces(),
m_appLayers(),
+ m_keepApps(),
+ m_bgApps(),
m_pending_to_show(-1)
#endif
{
@@ -71,6 +73,8 @@ WindowManager::WindowManager(int displayId, QObject *parent) :
m_showLayers[2] = 0; /* APPLICATIONS is not shown by default */
m_showLayers[3] = WINDOWMANAGER_LAYER_HOMESCREEN; /* HOMESCREEN is shwon by default */
+ m_keepApps.append(QString("mediaplayer@"));
+ m_keepApps.append(QString("navigation@"));
#endif
qDebug("-=[WindowManager]=-");
}
@@ -120,26 +124,46 @@ WindowManager::~WindowManager()
}
#ifdef HAVE_IVI_LAYERMANAGEMENT_API
-int WindowManager::getLayerRenderOrder(t_ilm_layer id_array[])
+t_ilm_layer* WindowManager::getLayerRenderOrder(int& num_layers)
{
- int i, j;
+ int i, j, n_bg = m_bgApps.size();
- for (i = WINDOWMANAGER_LAYER_NUM - 1, j = 0; i >= 0; i--) {
+ t_ilm_layer* id_array = new t_ilm_layer[n_bg + WINDOWMANAGER_LAYER_NUM];
+
+ qDebug("Layer render order (ivi-layer-id), %d bgApps: ", n_bg);
+
+ num_layers = 0;
+ for (i = 0; i < n_bg; i++) {
+ if (m_bgApps[i] != 0) {
+ QMap<pid_t, t_ilm_layer>::const_iterator i_layers;
+ i_layers = m_appLayers.find(m_bgApps[i]);
+ /* m_showLayers[2] means layer for apps */
+ if (i_layers != m_appLayers.end() && i_layers.value() != 0
+ && i_layers.value() != m_showLayers[2]) {
+ qDebug(" m_bgApps[%d]=%d", i, i_layers.value());
+ id_array[num_layers++] = i_layers.value();
+ }
+ }
+ }
+
+ for (i = WINDOWMANAGER_LAYER_NUM - 1, j = 0; i >= 0; i--,j++) {
if (m_showLayers[i] != 0) {
- id_array[j++] = m_showLayers[i];
+ qDebug(" m_showLayers[%d]=%d", i, m_showLayers[i]);
+ id_array[num_layers++] = m_showLayers[i];
}
}
- return j;
+ return id_array;
}
void WindowManager::renderLayers()
{
- t_ilm_layer renderOrder[WINDOWMANAGER_LAYER_NUM];
- int num_layers = getLayerRenderOrder(renderOrder);
- qDebug("Screen render order %d, %d layers", m_screenId, num_layers);
- ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers);
- ilm_commitChanges();
+ int num_layers;
+ t_ilm_layer* renderOrder = getLayerRenderOrder(num_layers);
+
+ qDebug("Screen render order %d, %d layers", m_screenId, num_layers);
+ ilm_displaySetRenderOrder(m_screenId, renderOrder, num_layers);
+ ilm_commitChanges();
}
#endif
@@ -343,82 +367,13 @@ void WindowManager::updateScreen()
{
qDebug("-=[updateScreen]=-");
-#if 0
-//#ifdef HAVE_IVI_LAYERMANAGEMENT_API
- if (-1 != m_currentLayout)
- {
- // hide all surfaces
- for (int i = 0; i < m_appSurfaces.size(); ++i)
- {
- ilm_layerRemoveSurface(WINDOWMANAGER_LAYER_APPLICATIONS, m_appSurfaces.at(i));
- //ilm_surfaceSetVisibility(m_appSurfaces.at(i), ILM_FALSE);
- //ilm_surfaceSetOpacity(m_appSurfaces.at(i), 0.0);
- ilm_commitChanges();
- }
-
- // find the current used layout
- QList<Layout>::const_iterator ci = m_layouts.begin();
-
- Layout currentLayout;
- while (ci != m_layouts.constEnd())
- {
- if (ci->id == m_currentLayout)
- {
- currentLayout = *ci;
- }
-
- ++ci;
- }
-
- qDebug("show %d apps", mp_layoutAreaToSurfaceIdAssignment->size());
- for (int j = 0; j < mp_layoutAreaToSurfaceIdAssignment->size(); ++j)
- {
- int surfaceToShow = mp_layoutAreaToSurfaceIdAssignment->find(j).value();
- qDebug(" surface no. %d: %d", j, surfaceToShow);
-
- addSurfaceToLayer(surfaceToShow, WINDOWMANAGER_LAYER_APPLICATIONS);
-
- ilm_surfaceSetVisibility(surfaceToShow, ILM_TRUE);
- ilm_surfaceSetOpacity(surfaceToShow, 1.0);
-
- qDebug(" layout area %d", j);
- qDebug(" x: %d", currentLayout.layoutAreas[j].x);
- qDebug(" y: %d", currentLayout.layoutAreas[j].y);
- qDebug(" w: %d", currentLayout.layoutAreas[j].width);
- qDebug(" h: %d", currentLayout.layoutAreas[j].height);
-
- ilm_surfaceSetDestinationRectangle(surfaceToShow,
- currentLayout.layoutAreas[j].x,
- currentLayout.layoutAreas[j].y,
- currentLayout.layoutAreas[j].width,
- currentLayout.layoutAreas[j].height);
- ilm_commitChanges();
- }
- }
-
- // layer surface render order
- t_ilm_int length;
- t_ilm_surface* pArray;
- ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN, &length, &pArray);
- ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN, pArray, length);
- ilm_commitChanges();
- ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_APPLICATIONS, &length, &pArray);
- ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_APPLICATIONS, pArray, length);
- ilm_commitChanges();
- ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, &length, &pArray);
- ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_HOMESCREEN_OVERLAY, pArray, length);
- ilm_commitChanges();
- ilm_getSurfaceIDsOnLayer(WINDOWMANAGER_LAYER_POPUP, &length, &pArray);
- ilm_layerSetRenderOrder(WINDOWMANAGER_LAYER_POPUP, pArray, length);
- ilm_commitChanges();
-#endif
#ifdef HAVE_IVI_LAYERMANAGEMENT_API
if (m_pending_to_show != -1) {
qDebug("show pending app (%d)", m_pending_to_show);
showAppLayer(m_pending_to_show);
} else {
// display layer render order
- renderLayers();
+ renderLayers();
}
#endif
}
@@ -711,7 +666,7 @@ void WindowManager::hideLayer(int layer)
/* clear pending flag */
m_pending_to_show = -1;
}
- renderLayers();
+ renderLayers();
}
#endif
}
@@ -786,7 +741,7 @@ void WindowManager::showLayer(int layer)
m_showLayers[layer] = layer_id_array[layer];
- renderLayers();
+ renderLayers();
}
#endif
}
@@ -806,17 +761,65 @@ void WindowManager::showAppLayer(int pid)
/* search layer id for application to show */
QMap<pid_t, t_ilm_layer>::const_iterator i = m_appLayers.find(pid);
- QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid);
if (i != m_appLayers.end()) {
+ qDebug("Found layer(%d) to show for app(pid=%d)", m_showLayers[2], pid);
m_showLayers[2] = i.value();
+ } else {
+ QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid);
+ /* check if this app is registered */
+ if (j == m_appSurfaces.end()) {
+ qDebug("New app %d", pid);
+ m_appSurfaces.insert(pid, 0); /* register pid only so far */
+ } /* check app is required keep running while background */
+
+ /* Probably app layer hasn't been made yet */
+ m_pending_to_show = pid;
+ /* hide current app once, back to default screen */
+ m_showLayers[2] = 0;
+ qDebug("No layer to show for app(pid=%d)", pid);
+ }
+ renderLayers();
+#endif
+}
+
+void WindowManager::showAppLayer(const QString &app_id, int pid)
+{
+ qDebug("-=[showAppLayer]=-");
+ qDebug() << "id=" << app_id << ", pid=" << pid;
+
+ if (pid == -1) {
+ /* nothing to show */
+ return;
+ }
+#ifdef HAVE_IVI_LAYERMANAGEMENT_API
+ /* clear pending flag */
+ m_pending_to_show = -1;
+
+ /* search layer id for application to show */
+ QMap<pid_t, t_ilm_layer>::const_iterator i = m_appLayers.find(pid);
+
+ if (i != m_appLayers.end()) {
qDebug("Found layer(%d) to show for app(pid=%d)", m_showLayers[2], pid);
+ m_showLayers[2] = i.value();
} else {
+ QMap<pid_t, t_ilm_surface>::const_iterator j = m_appSurfaces.find(pid);
/* check if this app is registered */
if (j == m_appSurfaces.end()) {
qDebug("New app %d", pid);
m_appSurfaces.insert(pid, 0); /* register pid only so far */
- }
+
+ /* check if rendering is always required */
+ /* QML apps should be always rendered if */
+ for (int k = 0; k != m_keepApps.size(); k++) {
+ if (app_id.indexOf(m_keepApps[k]) == 0) {
+ int idx = m_bgApps.indexOf(pid);
+ if (idx == -1) {
+ m_bgApps.append(pid);
+ }
+ }
+ }
+ } /* check app is required keep running while background */
/* Probably app layer hasn't been made yet */
m_pending_to_show = pid;
diff --git a/windowmanager/src/windowmanager.hpp b/windowmanager/src/windowmanager.hpp
index 7a9b297..0826627 100644
--- a/windowmanager/src/windowmanager.hpp
+++ b/windowmanager/src/windowmanager.hpp
@@ -52,7 +52,11 @@ private:
t_ilm_layer* m_showLayers;
QMap<pid_t, t_ilm_surface> m_appSurfaces;
QMap<pid_t, t_ilm_layer> m_appLayers;
- int getLayerRenderOrder(t_ilm_layer* id_array);
+
+ QList<QString> m_keepApps; /* Apps needs to keep rendering */
+ QList<pid_t> m_bgApps;
+
+ t_ilm_layer* getLayerRenderOrder(int& num_layers);
void createNewLayer(const int layerId);
@@ -124,6 +128,7 @@ public Q_SLOTS: // METHODS
int setSurfaceToLayoutArea(int surfaceId, int layoutAreaId);
void showLayer(int layer);
void showAppLayer(int pid);
+ void showAppLayer(const QString &app_id, int pid);
Q_SIGNALS: // SIGNALS
void surfaceVisibilityChanged(int surfaceId, bool visible);