From 6a30bfaeceb5eaf8e7911664820fb9f94b1b58a6 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Tue, 20 Jun 2017 07:40:34 +0200 Subject: [PATCH] Create correct application manager based on if we're single window or not --- src/anbox/cmds/session_manager.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/anbox/cmds/session_manager.cpp b/src/anbox/cmds/session_manager.cpp index 946a370..23ba1ae 100644 --- a/src/anbox/cmds/session_manager.cpp +++ b/src/anbox/cmds/session_manager.cpp @@ -163,15 +163,6 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory) auto android_api_stub = std::make_shared(); - auto app_manager = std::static_pointer_cast(android_api_stub); - if (!single_window_) { - // When we're not running single window mode we need to restrict ourself to - // only launch applications in freeform mode as otherwise the window tracking - // doesn't work. - app_manager = std::make_shared( - android_api_stub, wm::Stack::Id::Freeform); - } - auto display_frame = graphics::Rect::Invalid; if (single_window_) display_frame = window_size_; @@ -186,10 +177,13 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory) auto app_db = std::make_shared(); std::shared_ptr window_manager; + bool using_single_window = false; if (platform->supports_multi_window() && !single_window_) window_manager = std::make_shared(platform, android_api_stub, app_db); - else + else { window_manager = std::make_shared(platform, display_frame, app_db); + using_single_window = true; + } auto gl_server = std::make_shared( graphics::GLRendererServer::Config{gles_driver_, single_window_}, window_manager); @@ -199,6 +193,15 @@ anbox::cmds::SessionManager::SessionManager(const BusFactory &bus_factory) window_manager->setup(); + auto app_manager = std::static_pointer_cast(android_api_stub); + if (!using_single_window) { + // When we're not running single window mode we need to restrict ourself to + // only launch applications in freeform mode as otherwise the window tracking + // doesn't work. + app_manager = std::make_shared( + android_api_stub, wm::Stack::Id::Freeform); + } + auto audio_server = std::make_shared(rt, platform); const auto socket_path = SystemConfiguration::instance().socket_dir();