Merge "InsetsAnimation: Fix crash if disabling decor fitting before view is attached"
This commit is contained in:
@@ -1821,15 +1821,20 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
}
|
||||
|
||||
private ViewRootImpl getViewRootImpl() {
|
||||
if (mDecor != null) {
|
||||
ViewRootImpl viewRootImpl = mDecor.getViewRootImpl();
|
||||
if (viewRootImpl != null) {
|
||||
return viewRootImpl;
|
||||
}
|
||||
ViewRootImpl viewRootImpl = getViewRootImplOrNull();
|
||||
if (viewRootImpl != null) {
|
||||
return viewRootImpl;
|
||||
}
|
||||
throw new IllegalStateException("view not added");
|
||||
}
|
||||
|
||||
private ViewRootImpl getViewRootImplOrNull() {
|
||||
if (mDecor == null) {
|
||||
return null;
|
||||
}
|
||||
return mDecor.getViewRootImpl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Request that key events come to this activity. Use this if your activity
|
||||
* has no views with focus, but the activity still wants a chance to process
|
||||
@@ -3900,7 +3905,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback {
|
||||
|
||||
@Override
|
||||
public void setDecorFitsSystemWindows(boolean decorFitsSystemWindows) {
|
||||
ViewRootImpl impl = getViewRootImpl();
|
||||
ViewRootImpl impl = getViewRootImplOrNull();
|
||||
OnContentApplyWindowInsetsListener listener = decorFitsSystemWindows
|
||||
? createDefaultContentWindowInsetsListener()
|
||||
: null;
|
||||
|
||||
Reference in New Issue
Block a user