Implement single window mode option in parallel to multi-window support

For debugging and development purposes it's sometimes useful to run the
full Android system in a single and statically sized window. This is not
going to be a widely used mode but can be helpful at times.

Also makes our window/layer management a bit more modular to allow easy
additions of new strategies/impementations.
This commit is contained in:
Simon Fels 2017-01-27 19:48:29 +01:00
commit 9e6909c65a
25 changed files with 699 additions and 233 deletions

View file

@ -22,10 +22,11 @@
#include "anbox/application/database.h"
#include "anbox/platform/default_policy.h"
#include "anbox/wm/manager.h"
#include "anbox/wm/multi_window_manager.h"
#include "anbox/wm/window_state.h"
#include "anbox/graphics/layer_composer.h"
#include "anbox/graphics/multi_window_composer_strategy.h"
using namespace ::testing;
@ -46,7 +47,7 @@ TEST(LayerComposer, FindsNoSuitableWindowForLayer) {
// from the manager.
auto platform_policy = std::make_shared<platform::DefaultPolicy>();
auto app_db = std::make_shared<application::Database>();
auto wm = std::make_shared<wm::Manager>(platform_policy, app_db);
auto wm = std::make_shared<wm::MultiWindowManager>(platform_policy, nullptr, app_db);
auto single_window = wm::WindowState{
wm::Display::Id{1},
@ -59,7 +60,7 @@ TEST(LayerComposer, FindsNoSuitableWindowForLayer) {
wm->apply_window_state_update({single_window}, {});
LayerComposer composer(renderer, wm);
LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));
// A single renderable which has a different task id then the window we know
// about
@ -80,7 +81,7 @@ TEST(LayerComposer, MapsLayersToWindows) {
// from the manager.
auto platform_policy = std::make_shared<platform::DefaultPolicy>();
auto app_db = std::make_shared<application::Database>();
auto wm = std::make_shared<wm::Manager>(platform_policy, app_db);
auto wm = std::make_shared<wm::MultiWindowManager>(platform_policy, nullptr, app_db);
auto first_window = wm::WindowState{
wm::Display::Id{1},
@ -102,7 +103,7 @@ TEST(LayerComposer, MapsLayersToWindows) {
wm->apply_window_state_update({first_window, second_window}, {});
LayerComposer composer(renderer, wm);
LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));
// A single renderable which has a different task id then the window we know
// about
@ -140,7 +141,7 @@ TEST(LayerComposer, WindowPartiallyOffscreen) {
// from the manager.
auto platform_policy = std::make_shared<platform::DefaultPolicy>();
auto app_db = std::make_shared<application::Database>();
auto wm = std::make_shared<wm::Manager>(platform_policy, app_db);
auto wm = std::make_shared<wm::MultiWindowManager>(platform_policy, nullptr, app_db);
auto window = wm::WindowState{
wm::Display::Id{1},
@ -153,7 +154,7 @@ TEST(LayerComposer, WindowPartiallyOffscreen) {
wm->apply_window_state_update({window}, {});
LayerComposer composer(renderer, wm);
LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));
// Window is build out of two layers where one is placed inside the other
// but the layer covering the whole window is placed with its top left
@ -185,7 +186,7 @@ TEST(LayerComposer, PopupShouldNotCauseWindowLayerOffset) {
// from the manager.
auto platform_policy = std::make_shared<platform::DefaultPolicy>();
auto app_db = std::make_shared<application::Database>();
auto wm = std::make_shared<wm::Manager>(platform_policy, app_db);
auto wm = std::make_shared<wm::MultiWindowManager>(platform_policy, nullptr, app_db);
auto window = wm::WindowState{
wm::Display::Id{1},
@ -198,7 +199,7 @@ TEST(LayerComposer, PopupShouldNotCauseWindowLayerOffset) {
wm->apply_window_state_update({window}, {});
LayerComposer composer(renderer, wm);
LayerComposer composer(renderer, std::make_shared<MultiWindowComposerStrategy>(wm));
// Having two renderables where the second smaller one overlaps the bigger
// one and goes a bit offscreen. This should be still placed correctly and