From a6be960c2fd4741a6c7ebb6e5722e8a261af349d Mon Sep 17 00:00:00 2001 From: Amir Hardon Date: Mon, 15 Jul 2019 16:51:36 -0700 Subject: [PATCH] Make the virtual display's window translucent (flutter/engine#9828) By default alpha is not preserved for the VD's contents. We make the window translucent as a side effect of doing so is preserving alpha. There should not be extra performance cost for setting the window to be translucent as there is only a single window within the VD. Fixes flutter/flutter#33756 --- .../plugin/platform/SingleViewPresentation.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java index 7acd66b3b4..3fd1e04577 100644 --- a/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java +++ b/engine/src/flutter/shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java @@ -96,7 +96,11 @@ class SingleViewPresentation extends Presentation { Object createParams, OnFocusChangeListener focusChangeListener ) { - super(outerContext, display); + // By default alpha is not preserved for the VD's contents. + // We make the window translucent as a side effect of doing so is preserving alpha. + // There should not be extra performance cost for setting the window to be translucent as + // there is only a single window within the VD. + super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); this.viewFactory = viewFactory; this.accessibilityEventsDelegate = accessibilityEventsDelegate; this.viewId = viewId; @@ -109,6 +113,7 @@ class SingleViewPresentation extends Presentation { ); } + /** * Creates a presentation that will attach an already existing view as * its root view. @@ -124,7 +129,11 @@ class SingleViewPresentation extends Presentation { OnFocusChangeListener focusChangeListener, boolean startFocused ) { - super(outerContext, display); + // By default alpha is not preserved for the VD's contents. + // We make the window translucent as a side effect of doing so is preserving alpha. + // There should not be extra performance cost for setting the window to be translucent as + // there is only a single window within the VD. + super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); this.accessibilityEventsDelegate = accessibilityEventsDelegate; viewFactory = null; this.state = state;