Index: ui/aura/window_tree_host_platform.cc |
diff --git a/ui/aura/window_tree_host_platform.cc b/ui/aura/window_tree_host_platform.cc |
index 10c50132dadf2e9a3013e0b29da5dfae52d2eea8..0f834ebfa276992c0d6ba41209cfb84261755f09 100644 |
--- a/ui/aura/window_tree_host_platform.cc |
+++ b/ui/aura/window_tree_host_platform.cc |
@@ -11,6 +11,7 @@ |
#include "ui/gfx/screen.h" |
#if defined(OS_ANDROID) |
+#include "ui/aura/client/aura_constants.h" |
#include "ui/platform_window/android/platform_window_android.h" |
#endif |
@@ -71,6 +72,15 @@ gfx::AcceleratedWidget WindowTreeHostPlatform::GetAcceleratedWidget() { |
} |
void WindowTreeHostPlatform::ShowImpl() { |
+#if defined(OS_ANDROID) |
+ ui::PlatformWindowAndroid* pwa = |
+ ui::PlatformWindowAndroid::From(window_.get()); |
+ if (!pwa->IsAttachedToActivity()) { |
+ jobject activity = window()->GetProperty( |
+ aura::client::kActivityForRootWindow); |
+ pwa->AttachToActivity(activity); |
+ } |
+#endif |
window_->Show(); |
} |