Skip to content

Commit

Permalink
Revert "Avoid a full screen overlay within virtual displays (#9343)" (#…
Browse files Browse the repository at this point in the history
…9581)

This reverts commit 0c874c6.
  • Loading branch information
amirh committed Jun 28, 2019
1 parent 140b2ae commit fc1d86b
Showing 1 changed file with 16 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@
*
* The view hierarchy for the presentation is as following:
*
* rootView
* |
* state.fakeWindowViewGroup
* / \
* state.container [other popup views]
* |
* EmbeddedView
* rootView
* / \
* / \
* / \
* container state.fakeWindowViewGroup
* |
* EmbeddedView
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
class SingleViewPresentation extends Presentation {
Expand All @@ -55,9 +55,6 @@ static class PresentationState {

// Contains views that were added directly to the window manager (e.g android.widget.PopupWindow).
private FakeWindowViewGroup fakeWindowViewGroup;

// Contains the embedded platform view (platformView.getView()) when it is attached to the presentation.
private FrameLayout container;
}

private final PlatformViewFactory viewFactory;
Expand All @@ -75,13 +72,13 @@ static class PresentationState {
// so when we create the platform view we can tell it its view id.
private Object createParams;

// The root view for the presentation, it has a single child called fakeWindowViewGroup which contains
// views that were added directly to the presentation's window manager. fakeWindowViewGroup's first
// child is the state.container which contains the embedded view. So all other views are drawn on-top but
// the embedded view itself is not obscured directly by the fakeWindowViewGroup.
//
// The root view for the presentation, it has 2 childs: container which contains the embedded view, and
// fakeWindowViewGroup which contains views that were added directly to the presentation's window manager.
private AccessibilityDelegatingFrameLayout rootView;

// Contains the embedded platform view (platformView.getView()) when it is attached to the presentation.
private FrameLayout container;

private PresentationState state;

private boolean startFocused = false;
Expand Down Expand Up @@ -145,26 +142,22 @@ protected void onCreate(Bundle savedInstanceState) {
if (state.fakeWindowViewGroup == null) {
state.fakeWindowViewGroup = new FakeWindowViewGroup(getContext());
}
if (state.container == null) {
state.container = new FrameLayout(getContext());
final WindowManager.LayoutParams params = new WindowManager.LayoutParams();
params.gravity = Gravity.FILL;
state.fakeWindowViewGroup.addView(state.container, params);
}
if (state.windowManagerHandler == null) {
WindowManager windowManagerDelegate = (WindowManager) getContext().getSystemService(WINDOW_SERVICE);
state.windowManagerHandler = new WindowManagerHandler(windowManagerDelegate, state.fakeWindowViewGroup);
}

container = new FrameLayout(getContext());
PresentationContext context = new PresentationContext(getContext(), state.windowManagerHandler);

if (state.platformView == null) {
state.platformView = viewFactory.create(context, viewId, createParams);
}

View embeddedView = state.platformView.getView();
state.container.addView(embeddedView);
container.addView(embeddedView);
rootView = new AccessibilityDelegatingFrameLayout(getContext(), accessibilityEventsDelegate, embeddedView);
rootView.addView(container);
rootView.addView(state.fakeWindowViewGroup);

embeddedView.setOnFocusChangeListener(focusChangeListener);
Expand All @@ -178,7 +171,7 @@ protected void onCreate(Bundle savedInstanceState) {
}

public PresentationState detachState() {
state.container.removeAllViews();
container.removeAllViews();
rootView.removeAllViews();
return state;
}
Expand Down

0 comments on commit fc1d86b

Please sign in to comment.