Skip to content

Commit 74af88b

Browse files
authored
Make the virtual display's window translucent (flutter#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#33756
1 parent bf91bdb commit 74af88b

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

shell/platform/android/io/flutter/plugin/platform/SingleViewPresentation.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ public SingleViewPresentation(
9696
Object createParams,
9797
OnFocusChangeListener focusChangeListener
9898
) {
99-
super(outerContext, display);
99+
// By default alpha is not preserved for the VD's contents.
100+
// We make the window translucent as a side effect of doing so is preserving alpha.
101+
// There should not be extra performance cost for setting the window to be translucent as
102+
// there is only a single window within the VD.
103+
super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
100104
this.viewFactory = viewFactory;
101105
this.accessibilityEventsDelegate = accessibilityEventsDelegate;
102106
this.viewId = viewId;
@@ -109,6 +113,7 @@ public SingleViewPresentation(
109113
);
110114
}
111115

116+
112117
/**
113118
* Creates a presentation that will attach an already existing view as
114119
* its root view.
@@ -124,7 +129,11 @@ public SingleViewPresentation(
124129
OnFocusChangeListener focusChangeListener,
125130
boolean startFocused
126131
) {
127-
super(outerContext, display);
132+
// By default alpha is not preserved for the VD's contents.
133+
// We make the window translucent as a side effect of doing so is preserving alpha.
134+
// There should not be extra performance cost for setting the window to be translucent as
135+
// there is only a single window within the VD.
136+
super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
128137
this.accessibilityEventsDelegate = accessibilityEventsDelegate;
129138
viewFactory = null;
130139
this.state = state;

0 commit comments

Comments
 (0)