diff options
author | Dianne Hackborn <hackbod@google.com> | 2013-02-23 03:15:35 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-02-23 03:15:35 +0000 |
commit | bd0dc13cb870e4dc0c3dfbbeba83a9e03ab481e9 (patch) | |
tree | 280c6eb956bc3499b9d027cac432953de815566a /core/java/android/view/View.java | |
parent | 460fdd427cf7ee97dfa02f20174b6d941a09c6db (diff) | |
parent | c4aad01cbbb69c916ef323693e1fd0560b0eccba (diff) | |
download | frameworks_base-bd0dc13cb870e4dc0c3dfbbeba83a9e03ab481e9.zip frameworks_base-bd0dc13cb870e4dc0c3dfbbeba83a9e03ab481e9.tar.gz frameworks_base-bd0dc13cb870e4dc0c3dfbbeba83a9e03ab481e9.tar.bz2 |
Merge "Formalize overscan metrics."
Diffstat (limited to 'core/java/android/view/View.java')
-rw-r--r-- | core/java/android/view/View.java | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index dcf51e4..ab8f934 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5679,20 +5679,45 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if ((mViewFlags & FITS_SYSTEM_WINDOWS) == FITS_SYSTEM_WINDOWS) { mUserPaddingStart = UNDEFINED_PADDING; mUserPaddingEnd = UNDEFINED_PADDING; - if ((mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) == 0 - || mAttachInfo == null - || (mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0) { - internalSetPadding(insets.left, insets.top, insets.right, insets.bottom); - return true; - } else { - internalSetPadding(0, 0, 0, 0); - return false; + Rect localInsets = sThreadLocal.get(); + if (localInsets == null) { + localInsets = new Rect(); + sThreadLocal.set(localInsets); } + boolean res = computeFitSystemWindows(insets, localInsets); + internalSetPadding(localInsets.left, localInsets.top, + localInsets.right, localInsets.bottom); + return res; } return false; } /** + * @hide Compute the insets that should be consumed by this view and the ones + * that should propagate to those under it. + */ + protected boolean computeFitSystemWindows(Rect inoutInsets, Rect outLocalInsets) { + if ((mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) == 0 + || mAttachInfo == null + || ((mAttachInfo.mSystemUiVisibility & SYSTEM_UI_LAYOUT_FLAGS) == 0 + && !mAttachInfo.mOverscanRequested)) { + outLocalInsets.set(inoutInsets); + inoutInsets.set(0, 0, 0, 0); + return true; + } else { + // The application wants to take care of fitting system window for + // the content... however we still need to take care of any overscan here. + final Rect overscan = mAttachInfo.mOverscanInsets; + outLocalInsets.set(overscan); + inoutInsets.left -= overscan.left; + inoutInsets.top -= overscan.top; + inoutInsets.right -= overscan.right; + inoutInsets.bottom -= overscan.bottom; + return false; + } + } + + /** * Sets whether or not this view should account for system screen decorations * such as the status bar and inset its content; that is, controlling whether * the default implementation of {@link #fitSystemWindows(Rect)} will be @@ -17919,6 +17944,13 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * For windows that are full-screen but using insets to layout inside + * of the screen areas, these are the current insets to appear inside + * the overscan area of the display. + */ + final Rect mOverscanInsets = new Rect(); + + /** + * For windows that are full-screen but using insets to layout inside * of the screen decorations, these are the current insets for the * content of the window. */ @@ -18020,6 +18052,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback, boolean mHasSystemUiListeners; /** + * Set if the window has requested to extend into the overscan region + * via WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN. + */ + boolean mOverscanRequested; + + /** * Set if the visibility of any views has changed. */ boolean mViewVisibilityChanged; |