Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f4bdaeb3 authored by Filip Gruszczynski's avatar Filip Gruszczynski
Browse files

Don't depend on mContentParent to determine if content was set.

mContentParent might be set due to window preservation, rather than due
to client setting the content view. We should mark the content view as
set only when it's explicitly done.

Bug: 26345798
Change-Id: I749de9def8ff708592fa20abdb7da366ec52f24d
parent 028d6906
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -146,6 +146,9 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
    // This is the view in which the window contents are placed. It is either
    // mDecor itself, or a child of mDecor where the contents go.
    ViewGroup mContentParent;
    // Whether the client has explicitly set the content view. If false and mContentParent is not
    // null, then the content parent was set due to window preservation.
    private boolean mContentParentExplicitlySet = false;

    Callback2 mTakeSurfaceCallback;

@@ -315,7 +318,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {

    @Override
    public boolean requestFeature(int featureId) {
        if (mContentParent != null) {
        if (mContentParentExplicitlySet) {
            throw new AndroidRuntimeException("requestFeature() must be called before adding content");
        }
        final int features = getFeatures();
@@ -399,6 +402,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        if (cb != null && !isDestroyed()) {
            cb.onContentChanged();
        }
        mContentParentExplicitlySet = true;
    }

    @Override
@@ -429,6 +433,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
        if (cb != null && !isDestroyed()) {
            cb.onContentChanged();
        }
        mContentParentExplicitlySet = true;
    }

    @Override