Loading api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -34147,6 +34147,7 @@ package android.view { method protected float getRightFadingEdgeStrength(); method protected int getRightPaddingOffset(); method public android.view.View getRootView(); method public android.view.WindowInsets getRootWindowInsets(); method public float getRotation(); method public float getRotationX(); method public float getRotationY(); api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36315,6 +36315,7 @@ package android.view { method protected float getRightFadingEdgeStrength(); method protected int getRightPaddingOffset(); method public android.view.View getRootView(); method public android.view.WindowInsets getRootWindowInsets(); method public float getRotation(); method public float getRotationX(); method public float getRotationY(); core/java/android/view/View.java +13 −0 Original line number Diff line number Diff line Loading @@ -6563,6 +6563,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** * Provide original WindowInsets that are dispatched to the view hierarchy. The insets are * only available if the view is attached. * * @return WindowInsets from the top of the view hierarchy or null if View is detached */ public WindowInsets getRootWindowInsets() { if (mAttachInfo != null) { return mAttachInfo.mViewRootImpl.getWindowInsets(false /* forceConstruct */); } return null; } /** * @hide Compute the insets that should be consumed by this view and the ones * that should propagate to those under it. Loading core/java/android/view/ViewRootImpl.java +29 −6 Original line number Diff line number Diff line Loading @@ -265,6 +265,8 @@ public final class ViewRootImpl implements ViewParent, final Rect mDispatchContentInsets = new Rect(); final Rect mDispatchStableInsets = new Rect(); private WindowInsets mLastWindowInsets; final Configuration mLastConfiguration = new Configuration(); final Configuration mPendingConfiguration = new Configuration(); Loading Loading @@ -550,6 +552,11 @@ public final class ViewRootImpl implements ViewParent, mPendingContentInsets.set(mAttachInfo.mContentInsets); mPendingStableInsets.set(mAttachInfo.mStableInsets); mPendingVisibleInsets.set(0, 0, 0, 0); try { relayoutWindow(attrs, getHostVisibility(), false); } catch (RemoteException e) { if (DEBUG_LAYOUT) Log.e(TAG, "failed to relayoutWindow", e); } if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow); if (res < WindowManagerGlobal.ADD_OKAY) { mAttachInfo.mRootView = null; Loading Loading @@ -1227,13 +1234,29 @@ public final class ViewRootImpl implements ViewParent, m.postTranslate(-mAttachInfo.mWindowLeft, -mAttachInfo.mWindowTop); } void dispatchApplyInsets(View host) { /* package */ WindowInsets getWindowInsets(boolean forceConstruct) { if (mLastWindowInsets == null || forceConstruct) { mDispatchContentInsets.set(mAttachInfo.mContentInsets); mDispatchStableInsets.set(mAttachInfo.mStableInsets); Rect contentInsets = mDispatchContentInsets; Rect stableInsets = mDispatchStableInsets; // For dispatch we preserve old logic, but for direct requests from Views we allow to // immediately use pending insets. if (!forceConstruct && (!mPendingContentInsets.equals(contentInsets) || !mPendingStableInsets.equals(stableInsets))) { contentInsets = mPendingContentInsets; stableInsets = mPendingStableInsets; } final boolean isRound = (mIsEmulator && mIsCircularEmulator) || mWindowIsRound; host.dispatchApplyWindowInsets(new WindowInsets( mDispatchContentInsets, null /* windowDecorInsets */, mDispatchStableInsets, isRound)); mLastWindowInsets = new WindowInsets(contentInsets, null /* windowDecorInsets */, stableInsets, isRound); } return mLastWindowInsets; } void dispatchApplyInsets(View host) { host.dispatchApplyWindowInsets(getWindowInsets(true /* forceConstruct */)); } private void performTraversals() { Loading Loading
api/current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -34147,6 +34147,7 @@ package android.view { method protected float getRightFadingEdgeStrength(); method protected int getRightPaddingOffset(); method public android.view.View getRootView(); method public android.view.WindowInsets getRootWindowInsets(); method public float getRotation(); method public float getRotationX(); method public float getRotationY();
api/system-current.txt +1 −0 Original line number Diff line number Diff line Loading @@ -36315,6 +36315,7 @@ package android.view { method protected float getRightFadingEdgeStrength(); method protected int getRightPaddingOffset(); method public android.view.View getRootView(); method public android.view.WindowInsets getRootWindowInsets(); method public float getRotation(); method public float getRotationX(); method public float getRotationY();
core/java/android/view/View.java +13 −0 Original line number Diff line number Diff line Loading @@ -6563,6 +6563,19 @@ public class View implements Drawable.Callback, KeyEvent.Callback, } } /** * Provide original WindowInsets that are dispatched to the view hierarchy. The insets are * only available if the view is attached. * * @return WindowInsets from the top of the view hierarchy or null if View is detached */ public WindowInsets getRootWindowInsets() { if (mAttachInfo != null) { return mAttachInfo.mViewRootImpl.getWindowInsets(false /* forceConstruct */); } return null; } /** * @hide Compute the insets that should be consumed by this view and the ones * that should propagate to those under it. Loading
core/java/android/view/ViewRootImpl.java +29 −6 Original line number Diff line number Diff line Loading @@ -265,6 +265,8 @@ public final class ViewRootImpl implements ViewParent, final Rect mDispatchContentInsets = new Rect(); final Rect mDispatchStableInsets = new Rect(); private WindowInsets mLastWindowInsets; final Configuration mLastConfiguration = new Configuration(); final Configuration mPendingConfiguration = new Configuration(); Loading Loading @@ -550,6 +552,11 @@ public final class ViewRootImpl implements ViewParent, mPendingContentInsets.set(mAttachInfo.mContentInsets); mPendingStableInsets.set(mAttachInfo.mStableInsets); mPendingVisibleInsets.set(0, 0, 0, 0); try { relayoutWindow(attrs, getHostVisibility(), false); } catch (RemoteException e) { if (DEBUG_LAYOUT) Log.e(TAG, "failed to relayoutWindow", e); } if (DEBUG_LAYOUT) Log.v(TAG, "Added window " + mWindow); if (res < WindowManagerGlobal.ADD_OKAY) { mAttachInfo.mRootView = null; Loading Loading @@ -1227,13 +1234,29 @@ public final class ViewRootImpl implements ViewParent, m.postTranslate(-mAttachInfo.mWindowLeft, -mAttachInfo.mWindowTop); } void dispatchApplyInsets(View host) { /* package */ WindowInsets getWindowInsets(boolean forceConstruct) { if (mLastWindowInsets == null || forceConstruct) { mDispatchContentInsets.set(mAttachInfo.mContentInsets); mDispatchStableInsets.set(mAttachInfo.mStableInsets); Rect contentInsets = mDispatchContentInsets; Rect stableInsets = mDispatchStableInsets; // For dispatch we preserve old logic, but for direct requests from Views we allow to // immediately use pending insets. if (!forceConstruct && (!mPendingContentInsets.equals(contentInsets) || !mPendingStableInsets.equals(stableInsets))) { contentInsets = mPendingContentInsets; stableInsets = mPendingStableInsets; } final boolean isRound = (mIsEmulator && mIsCircularEmulator) || mWindowIsRound; host.dispatchApplyWindowInsets(new WindowInsets( mDispatchContentInsets, null /* windowDecorInsets */, mDispatchStableInsets, isRound)); mLastWindowInsets = new WindowInsets(contentInsets, null /* windowDecorInsets */, stableInsets, isRound); } return mLastWindowInsets; } void dispatchApplyInsets(View host) { host.dispatchApplyWindowInsets(getWindowInsets(true /* forceConstruct */)); } private void performTraversals() { Loading