diff options
author | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2018-03-26 23:56:09 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@automotivelinux.org> | 2018-03-26 23:56:09 +0000 |
commit | 33ee7d8a99c540749dd9691362f109c5b884e588 (patch) | |
tree | bc7635634ba2ef2c20850ebd687ad9634d48b69e | |
parent | a0a00ddd1a5d01566ffd145765a813814e20ae20 (diff) | |
parent | f4226050e1c02c9f792e74b35b56bb7727d0f26d (diff) |
-rw-r--r-- | layers.json | 2 | ||||
-rw-r--r-- | layers.json.split | 2 | ||||
-rw-r--r-- | src/app.cpp | 19 |
3 files changed, 18 insertions, 5 deletions
diff --git a/layers.json b/layers.json index 8a04d7b..cf7ed34 100644 --- a/layers.json +++ b/layers.json @@ -22,7 +22,7 @@ "comment": "Single layer map for the HomeScreen" }, { - "role": "Music|Video|WebBrowser|MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer", + "role": "Music|Video|WebBrowser|MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer|Fallback", "name": "apps", "layer_id": 1001, "area": { "type": "rect", "rect": { "x": 0, "y": 218, "width": -1, "height": -433 } }, diff --git a/layers.json.split b/layers.json.split index 91e563d..ec20b33 100644 --- a/layers.json.split +++ b/layers.json.split @@ -22,7 +22,7 @@ "comment": "Single layer map for the HomeScreen" }, { - "role": "Music|Video|WebBrowser|MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer", + "role": "Music|Video|WebBrowser|MediaPlayer|Radio|Phone|Navigation|HVAC|Settings|Dashboard|POI|Mixer|Fallback", "name": "apps", "layer_id": 1001, "area": { "type": "rect", "rect": { "x": 0, "y": 218, "width": -1, "height": -433 } }, diff --git a/src/app.cpp b/src/app.cpp index 8806850..e9d79f5 100644 --- a/src/app.cpp +++ b/src/app.cpp @@ -712,8 +712,14 @@ void App::emit_visible(char const *label) { return emit_visible(label, true); } result<int> App::api_request_surface(char const *drawing_name) { auto lid = this->layers.get_layer_id(std::string(drawing_name)); if (!lid) { - // TODO: Do we need to put these applications on the App layer? - return Err<int>("Drawing name does not match any role"); + /** + * register drawing_name as fallback and make it displayed. + */ + lid = this->layers.get_layer_id(std::string("Fallback")); + HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", drawing_name); + if(!lid){ + return Err<int>("Drawing name does not match any role, Fallback is disabled"); + } } auto rname = this->lookup_id(drawing_name); @@ -744,7 +750,14 @@ char const *App::api_request_surface(char const *drawing_name, unsigned sid = std::stol(ivi_id); if (!lid) { - return "Drawing name does not match any role"; + /** + * register drawing_name as fallback and make it displayed. + */ + lid = this->layers.get_layer_id(std::string("Fallback")); + HMI_DEBUG("wm", "%s is not registered in layers.json, then fallback as normal app", drawing_name); + if(!lid){ + return "Drawing name does not match any role, Fallback is disabled"; + } } auto rname = this->lookup_id(drawing_name); |