From 41607d5a2b8cc4a3fde4a2f75e33a00e8d957b1d Mon Sep 17 00:00:00 2001 From: Adam Powell Date: Wed, 17 Jun 2015 13:37:06 -0700 Subject: [PATCH] Request application of WindowInsets when setting a content view For both PhoneWindow and VoiceInteractionSession, call requestApplyInsets when the content view(s) change. This is generally what the developer expects if the new view tree responds to insets in any way. Bug 21620924 Change-Id: I60a88af55bf85217c3587aa37f03fdc3fdce686d --- core/java/android/service/voice/VoiceInteractionSession.java | 2 +- core/java/com/android/internal/policy/PhoneWindow.java | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/android/service/voice/VoiceInteractionSession.java b/core/java/android/service/voice/VoiceInteractionSession.java index d5ee7e7304cc..d54d1a9d4449 100644 --- a/core/java/android/service/voice/VoiceInteractionSession.java +++ b/core/java/android/service/voice/VoiceInteractionSession.java @@ -1143,7 +1143,7 @@ public class VoiceInteractionSession implements KeyEvent.Callback, ComponentCall mContentFrame.addView(view, new FrameLayout.LayoutParams( ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - + mContentFrame.requestApplyInsets(); } /** @hide */ diff --git a/core/java/com/android/internal/policy/PhoneWindow.java b/core/java/com/android/internal/policy/PhoneWindow.java index 294e4ba3f37e..66f6079b47e9 100644 --- a/core/java/com/android/internal/policy/PhoneWindow.java +++ b/core/java/com/android/internal/policy/PhoneWindow.java @@ -390,6 +390,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } else { mLayoutInflater.inflate(layoutResID, mContentParent); } + mContentParent.requestApplyInsets(); final Callback cb = getCallback(); if (cb != null && !isDestroyed()) { cb.onContentChanged(); @@ -419,6 +420,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { } else { mContentParent.addView(view, params); } + mContentParent.requestApplyInsets(); final Callback cb = getCallback(); if (cb != null && !isDestroyed()) { cb.onContentChanged(); @@ -435,6 +437,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { Log.v(TAG, "addContentView does not support content transitions"); } mContentParent.addView(view, params); + mContentParent.requestApplyInsets(); final Callback cb = getCallback(); if (cb != null && !isDestroyed()) { cb.onContentChanged(); -- 2.11.0