diff options
| author | 2017-01-05 12:44:50 -0500 | |
|---|---|---|
| committer | 2017-01-05 13:52:59 -0500 | |
| commit | 9b32a35aa7d47d39da919e777e2fe271cc83fa1c (patch) | |
| tree | b3825abb8cbf398924417431ffcbcbfd03e64e6b | |
| parent | b60eb1a85406e74b3e920dba41ebb63d5be3e2c0 (diff) | |
Omit NavigationGuard if the input method uses FLAG_LAYOUT_IN_OVERSCAN
In some cases (e.g. Android Wear) SystemWindowInsets can be non-zero
due to overscan layout hints even when no SystemUI is present.
This change resepects the overscan flag on input method windows
allowing an IME to opt-out of the navigation bar guard and receive
full-height content view.
BUG: 32700226
Change-Id: Ic38f204a892bf34e8dae65990d5aa8c95af555d8
| -rw-r--r-- | core/java/com/android/internal/policy/DecorView.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/core/java/com/android/internal/policy/DecorView.java b/core/java/com/android/internal/policy/DecorView.java index 92ab3246e354..8dfdc6a815a1 100644 --- a/core/java/com/android/internal/policy/DecorView.java +++ b/core/java/com/android/internal/policy/DecorView.java @@ -96,6 +96,7 @@ import static android.view.Window.DECOR_CAPTION_SHADE_LIGHT; import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.FLAG_FULLSCREEN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR; +import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN; import static android.view.WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN; import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION; import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; @@ -969,7 +970,7 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mFrameOffsets.set(insets.getSystemWindowInsets()); insets = updateColorViews(insets, true /* animate */); insets = updateStatusGuard(insets); - updateNavigationGuard(insets); + insets = updateNavigationGuard(insets); if (getForeground() != null) { drawableChanged(); } @@ -1329,9 +1330,11 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind return insets; } - private void updateNavigationGuard(WindowInsets insets) { - // IMEs lay out below the nav bar, but the content view must not (for back compat) - if (mWindow.getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD) { + private WindowInsets updateNavigationGuard(WindowInsets insets) { + // IME windows lay out below the nav bar, but the content view must not (for back compat) + // Only make this adjustment if the window is not requesting layout in overscan + if (mWindow.getAttributes().type == WindowManager.LayoutParams.TYPE_INPUT_METHOD + && (mWindow.getAttributes().flags & FLAG_LAYOUT_IN_OVERSCAN) == 0) { // prevent the content view from including the nav bar height if (mWindow.mContentParent != null) { if (mWindow.mContentParent.getLayoutParams() instanceof MarginLayoutParams) { @@ -1356,7 +1359,10 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind mNavigationGuard.setLayoutParams(lp); } updateNavigationGuardColor(); + insets = insets.consumeSystemWindowInsets( + false, false, false, true /* bottom */); } + return insets; } void updateNavigationGuardColor() { |