diff options
author | Adrian Roos <roosa@google.com> | 2014-06-20 16:10:14 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2014-07-02 12:34:05 +0000 |
commit | fa10423fa00f3495e451016acba9b6848eb995c9 (patch) | |
tree | dacb609ee12c80b7110960811a97abaf9bfd4304 /policy/src/com | |
parent | f29131f7013dc0d6994556b95e74db608c89beb8 (diff) | |
download | frameworks_base-fa10423fa00f3495e451016acba9b6848eb995c9.zip frameworks_base-fa10423fa00f3495e451016acba9b6848eb995c9.tar.gz frameworks_base-fa10423fa00f3495e451016acba9b6848eb995c9.tar.bz2 |
Add stable insets for stable system windows
Adds a new kind of inset that only accounts for stable system
windows like the system or navigation bar.
Bug: 15457292
Change-Id: I681b711f6f40a94c25b7acd3a44eb3539486afab
Diffstat (limited to 'policy/src/com')
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindow.java | 28 | ||||
-rw-r--r-- | policy/src/com/android/internal/policy/impl/PhoneWindowManager.java | 18 |
2 files changed, 29 insertions, 17 deletions
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindow.java b/policy/src/com/android/internal/policy/impl/PhoneWindow.java index abe9076..0b9964b 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindow.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindow.java @@ -2650,21 +2650,23 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { return false; } - private void updateColorViews(WindowInsets insets) { - if (mIsFloating || !ActivityManager.isHighEndGfx()) { - // No colors on floating windows or low end devices :( - return; + private WindowInsets updateColorViews(WindowInsets insets) { + if (!mIsFloating && ActivityManager.isHighEndGfx()) { + if (insets != null) { + mLastTopInset = insets.getStableInsetTop(); + mLastBottomInset = insets.getStableInsetBottom(); + } + mStatusColorView = updateColorViewInt(mStatusColorView, + SYSTEM_UI_FLAG_FULLSCREEN, FLAG_TRANSLUCENT_STATUS, + mStatusBarColor, mLastTopInset, Gravity.TOP); + mNavigationColorView = updateColorViewInt(mNavigationColorView, + SYSTEM_UI_FLAG_HIDE_NAVIGATION, FLAG_TRANSLUCENT_NAVIGATION, + mNavigationBarColor, mLastBottomInset, Gravity.BOTTOM); } if (insets != null) { - mLastTopInset = insets.getSystemWindowInsetTop(); - mLastBottomInset = insets.getSystemWindowInsetBottom(); - } - mStatusColorView = updateColorViewInt(mStatusColorView, - SYSTEM_UI_FLAG_FULLSCREEN, FLAG_TRANSLUCENT_STATUS, - mStatusBarColor, mLastTopInset, Gravity.TOP); - mNavigationColorView = updateColorViewInt(mNavigationColorView, - SYSTEM_UI_FLAG_HIDE_NAVIGATION, FLAG_TRANSLUCENT_NAVIGATION, - mNavigationBarColor, mLastBottomInset, Gravity.BOTTOM); + insets = insets.consumeStableInsets(); + } + return insets; } private View updateColorViewInt(View view, int systemUiHideFlag, int translucentFlag, diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java index 728e781..ac53d0d 100644 --- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java +++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java @@ -409,6 +409,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { static final Rect mTmpContentFrame = new Rect(); static final Rect mTmpVisibleFrame = new Rect(); static final Rect mTmpDecorFrame = new Rect(); + static final Rect mTmpStableFrame = new Rect(); static final Rect mTmpNavigationFrame = new Rect(); WindowState mTopFullscreenOpaqueWindowState; @@ -2973,7 +2974,8 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBarLayer = mNavigationBar.getSurfaceLayer(); // And compute the final frame. mNavigationBar.computeFrameLw(mTmpNavigationFrame, mTmpNavigationFrame, - mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, dcf); + mTmpNavigationFrame, mTmpNavigationFrame, mTmpNavigationFrame, dcf, + mTmpNavigationFrame); if (DEBUG_LAYOUT) Slog.i(TAG, "mNavigationBar frame: " + mTmpNavigationFrame); if (mNavigationBarController.checkHiddenLw()) { updateSysUiVisibility = true; @@ -2998,7 +3000,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { mStatusBarLayer = mStatusBar.getSurfaceLayer(); // Let the status bar determine its size. - mStatusBar.computeFrameLw(pf, df, vf, vf, vf, dcf); + mStatusBar.computeFrameLw(pf, df, vf, vf, vf, dcf, vf); // For layout, the status bar is always at the top with our fixed height. mStableTop = mUnrestrictedScreenTop + mStatusBarHeight; @@ -3158,6 +3160,7 @@ public class PhoneWindowManager implements WindowManagerPolicy { final Rect cf = mTmpContentFrame; final Rect vf = mTmpVisibleFrame; final Rect dcf = mTmpDecorFrame; + final Rect sf = mTmpStableFrame; dcf.setEmpty(); final boolean hasNavBar = (isDefaultDisplay && mHasNavigationBar @@ -3165,6 +3168,12 @@ public class PhoneWindowManager implements WindowManagerPolicy { final int adjust = sim & SOFT_INPUT_MASK_ADJUST; + if (isDefaultDisplay) { + sf.set(mStableLeft, mStableTop, mStableRight, mStableBottom); + } else { + sf.set(mOverscanLeft, mOverscanTop, mOverscanRight, mOverscanBottom); + } + if (!isDefaultDisplay) { if (attached != null) { // If this window is attached to another, our display @@ -3527,9 +3536,10 @@ public class PhoneWindowManager implements WindowManagerPolicy { + " pf=" + pf.toShortString() + " df=" + df.toShortString() + " of=" + of.toShortString() + " cf=" + cf.toShortString() + " vf=" + vf.toShortString() - + " dcf=" + dcf.toShortString()); + + " dcf=" + dcf.toShortString() + + " sf=" + sf.toShortString()); - win.computeFrameLw(pf, df, of, cf, vf, dcf); + win.computeFrameLw(pf, df, of, cf, vf, dcf, sf); // Dock windows carve out the bottom of the screen, so normal windows // can't appear underneath them. |