From 35a803beec9ce508fd53ab7e4111f2f9f87296c1 Mon Sep 17 00:00:00 2001 From: Filip Gruszczynski Date: Wed, 27 May 2015 15:38:29 -0700 Subject: Only use outsets for full screen windows. Change-Id: I1d89c314b0f9944dfa417ce066c397073d51466e --- .../internal/policy/impl/PhoneWindowManager.java | 9 +++++---- .../core/java/com/android/server/wm/WindowState.java | 17 ++++++++++++----- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 9a6802059621..6e6db3b50fc9 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -3641,7 +3641,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect vf = mTmpVisibleFrame; final Rect dcf = mTmpDecorFrame; final Rect sf = mTmpStableFrame; - final Rect osf = mTmpOutsetFrame; + Rect osf = null; dcf.setEmpty(); final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar @@ -3654,7 +3654,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { } else { sf.set(mOverscanLeft, mOverscanTop, mOverscanRight, mOverscanBottom); } - osf.set(mStableLeft, mStableTop, mStableRight, mStableBottom); if (!isDefaultDisplay) { if (attached != null) { @@ -4029,7 +4028,9 @@ public class PhoneWindowManager implements WindowManagerPolicy { // If the device has a chin (e.g. some watches), a dead area at the bottom of the screen we // need to provide information to the clients that want to pretend that you can draw there. - if (isDefaultDisplay) { + if (isDefaultDisplay && (fl & WindowManager.LayoutParams.FLAG_FULLSCREEN) != 0) { + osf = mTmpOutsetFrame; + osf.set(cf.left, cf.top, cf.right, cf.bottom); int outset = ScreenShapeHelper.getWindowOutsetBottomPx(mContext.getResources()); if (outset > 0) { int rotation = Surface.ROTATION_0; @@ -4060,7 +4061,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " cf=" + cf.toShortString() + " vf=" + vf.toShortString() + " dcf=" + dcf.toShortString() + " sf=" + sf.toShortString() - + " osf=" + osf.toShortString()); + + " osf=" + (osf == null ? "null" : osf.toShortString())); win.computeFrameLw(pf, df, of, cf, vf, dcf, sf, osf); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index e0d26739e0d6..9b3bc6c8fc5f 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -598,7 +598,10 @@ final class WindowState implements WindowManagerPolicy.WindowState { mVisibleFrame.set(vf); mDecorFrame.set(dcf); mStableFrame.set(sf); - mOutsetFrame.set(osf); + final boolean hasOutsets = osf != null; + if (hasOutsets) { + mOutsetFrame.set(osf); + } final int fw = mFrame.width(); final int fh = mFrame.height(); @@ -661,10 +664,14 @@ final class WindowState implements WindowManagerPolicy.WindowState { Math.max(mFrame.right - mStableFrame.right, 0), Math.max(mFrame.bottom - mStableFrame.bottom, 0)); - mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left, 0), - Math.max(mContentFrame.top - mOutsetFrame.top, 0), - Math.max(mOutsetFrame.right - mContentFrame.right, 0), - Math.max(mOutsetFrame.bottom - mContentFrame.bottom, 0)); + if (hasOutsets) { + mOutsets.set(Math.max(mContentFrame.left - mOutsetFrame.left, 0), + Math.max(mContentFrame.top - mOutsetFrame.top, 0), + Math.max(mOutsetFrame.right - mContentFrame.right, 0), + Math.max(mOutsetFrame.bottom - mContentFrame.bottom, 0)); + } else { + mOutsets.set(0, 0, 0, 0); + } mCompatFrame.set(mFrame); if (mEnforceSizeCompat) { -- cgit v1.2.3-59-g8ed1b