summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Filip Gruszczynski <gruszczy@google.com> 2016-01-06 14:34:00 -0800
committer Filip Gruszczynski <gruszczy@google.com> 2016-01-06 14:34:00 -0800
commitf4bdaeb38d7e9889216472284f9547f9726b7aa4 (patch)
treed0a73d97aac27049cbfd5f2ff46ad78ab5c763ea
parent028d6906d5671bcc8239ead2496f9eb10e4a142b (diff)
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
-rw-r--r--core/java/com/android/internal/policy/PhoneWindow.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java
index fafe3d1a7506..2f951ccb8bbe 100644
--- a/core/java/com/android/internal/policy/PhoneWindow.java
+++ b/core/java/com/android/internal/policy/PhoneWindow.java
@@ -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