Loading core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -11468,7 +11468,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, outLocalInsets.setEmpty(); return in; } Pair<Insets, WindowInsets> result = listener.onContentApplyWindowInsets(in); Pair<Insets, WindowInsets> result = listener.onContentApplyWindowInsets(this, in); outLocalInsets.set(result.first.toRect()); return result.second; } else { core/java/android/view/Window.java +2 −1 Original line number Diff line number Diff line Loading @@ -712,13 +712,14 @@ public abstract class Window { * {@link View#setOnApplyWindowInsetsListener(OnApplyWindowInsetsListener)} through the view * hierarchy. * * @param view The view for which to apply insets. Must not be directly modified. * @param insets The root level insets that are about to be dispatched * @return A pair, with the first element containing the insets to apply as margin to the * root-level content views, and the second element determining what should be * dispatched to the content view. */ @NonNull Pair<Insets, WindowInsets> onContentApplyWindowInsets( Pair<Insets, WindowInsets> onContentApplyWindowInsets(@NonNull View view, @NonNull WindowInsets insets); } Loading core/java/com/android/internal/policy/PhoneWindow.java +26 −24 Original line number Diff line number Diff line Loading @@ -135,6 +135,29 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private final static String TAG = "PhoneWindow"; /** * @see Window#setDecorFitsSystemWindows */ private static final OnContentApplyWindowInsetsListener sDefaultContentInsetsApplier = (view, insets) -> { if ((view.getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) != 0) { return new Pair<>(Insets.NONE, insets); } boolean includeIme = (view.getViewRootImpl().mWindowAttributes.softInputMode & SOFT_INPUT_MASK_ADJUST) == SOFT_INPUT_ADJUST_RESIZE; Insets insetsToApply; if (ViewRootImpl.sNewInsetsMode == 0) { insetsToApply = insets.getSystemWindowInsets(); } else { insetsToApply = insets.getInsets(systemBars() | (includeIme ? ime() : 0)); } insets = insets.inset(insetsToApply); return new Pair<>(insetsToApply, insets.inset(insetsToApply).consumeSystemWindowInsets()); }; /* If true, shadows drawn around the window will be rendered by the system compositor. If * false, shadows will be drawn by the client by setting an elevation on the root view and * the contents will be inset by the shadow radius. */ Loading Loading @@ -320,8 +343,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { /** @see ViewRootImpl#mActivityConfigCallback */ private ActivityConfigCallback mActivityConfigCallback; private OnContentApplyWindowInsetsListener mPendingOnContentApplyWindowInsetsListener = createDefaultContentWindowInsetsListener(); private OnContentApplyWindowInsetsListener mPendingOnContentApplyWindowInsetsListener = sDefaultContentInsetsApplier; static class WindowManagerHolder { static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( Loading Loading @@ -2120,27 +2143,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { mPendingOnContentApplyWindowInsetsListener = null; } private OnContentApplyWindowInsetsListener createDefaultContentWindowInsetsListener() { return insets -> { if ((getDecorView().getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) != 0) { return new Pair<>(Insets.NONE, insets); } boolean includeIme = (getViewRootImpl().mWindowAttributes.softInputMode & SOFT_INPUT_MASK_ADJUST) == SOFT_INPUT_ADJUST_RESIZE; Insets insetsToApply; if (ViewRootImpl.sNewInsetsMode == 0) { insetsToApply = insets.getSystemWindowInsets(); } else { insetsToApply = insets.getInsets(systemBars() | (includeIme ? ime() : 0)); } insets = insets.inset(insetsToApply); return new Pair<>(insetsToApply, insets.inset(insetsToApply).consumeSystemWindowInsets()); }; } static private final String FOCUSED_ID_TAG = "android:focusedViewId"; static private final String VIEWS_TAG = "android:views"; static private final String PANELS_TAG = "android:Panels"; Loading Loading @@ -3907,7 +3909,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { public void setDecorFitsSystemWindows(boolean decorFitsSystemWindows) { ViewRootImpl impl = getViewRootImplOrNull(); OnContentApplyWindowInsetsListener listener = decorFitsSystemWindows ? createDefaultContentWindowInsetsListener() ? sDefaultContentInsetsApplier : null; if (impl != null) { impl.setOnContentApplyWindowInsetsListener(listener); Loading Loading
core/java/android/view/View.java +1 −1 Original line number Diff line number Diff line Loading @@ -11468,7 +11468,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, outLocalInsets.setEmpty(); return in; } Pair<Insets, WindowInsets> result = listener.onContentApplyWindowInsets(in); Pair<Insets, WindowInsets> result = listener.onContentApplyWindowInsets(this, in); outLocalInsets.set(result.first.toRect()); return result.second; } else {
core/java/android/view/Window.java +2 −1 Original line number Diff line number Diff line Loading @@ -712,13 +712,14 @@ public abstract class Window { * {@link View#setOnApplyWindowInsetsListener(OnApplyWindowInsetsListener)} through the view * hierarchy. * * @param view The view for which to apply insets. Must not be directly modified. * @param insets The root level insets that are about to be dispatched * @return A pair, with the first element containing the insets to apply as margin to the * root-level content views, and the second element determining what should be * dispatched to the content view. */ @NonNull Pair<Insets, WindowInsets> onContentApplyWindowInsets( Pair<Insets, WindowInsets> onContentApplyWindowInsets(@NonNull View view, @NonNull WindowInsets insets); } Loading
core/java/com/android/internal/policy/PhoneWindow.java +26 −24 Original line number Diff line number Diff line Loading @@ -135,6 +135,29 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { private final static String TAG = "PhoneWindow"; /** * @see Window#setDecorFitsSystemWindows */ private static final OnContentApplyWindowInsetsListener sDefaultContentInsetsApplier = (view, insets) -> { if ((view.getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) != 0) { return new Pair<>(Insets.NONE, insets); } boolean includeIme = (view.getViewRootImpl().mWindowAttributes.softInputMode & SOFT_INPUT_MASK_ADJUST) == SOFT_INPUT_ADJUST_RESIZE; Insets insetsToApply; if (ViewRootImpl.sNewInsetsMode == 0) { insetsToApply = insets.getSystemWindowInsets(); } else { insetsToApply = insets.getInsets(systemBars() | (includeIme ? ime() : 0)); } insets = insets.inset(insetsToApply); return new Pair<>(insetsToApply, insets.inset(insetsToApply).consumeSystemWindowInsets()); }; /* If true, shadows drawn around the window will be rendered by the system compositor. If * false, shadows will be drawn by the client by setting an elevation on the root view and * the contents will be inset by the shadow radius. */ Loading Loading @@ -320,8 +343,8 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { /** @see ViewRootImpl#mActivityConfigCallback */ private ActivityConfigCallback mActivityConfigCallback; private OnContentApplyWindowInsetsListener mPendingOnContentApplyWindowInsetsListener = createDefaultContentWindowInsetsListener(); private OnContentApplyWindowInsetsListener mPendingOnContentApplyWindowInsetsListener = sDefaultContentInsetsApplier; static class WindowManagerHolder { static final IWindowManager sWindowManager = IWindowManager.Stub.asInterface( Loading Loading @@ -2120,27 +2143,6 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { mPendingOnContentApplyWindowInsetsListener = null; } private OnContentApplyWindowInsetsListener createDefaultContentWindowInsetsListener() { return insets -> { if ((getDecorView().getWindowSystemUiVisibility() & SYSTEM_UI_LAYOUT_FLAGS) != 0) { return new Pair<>(Insets.NONE, insets); } boolean includeIme = (getViewRootImpl().mWindowAttributes.softInputMode & SOFT_INPUT_MASK_ADJUST) == SOFT_INPUT_ADJUST_RESIZE; Insets insetsToApply; if (ViewRootImpl.sNewInsetsMode == 0) { insetsToApply = insets.getSystemWindowInsets(); } else { insetsToApply = insets.getInsets(systemBars() | (includeIme ? ime() : 0)); } insets = insets.inset(insetsToApply); return new Pair<>(insetsToApply, insets.inset(insetsToApply).consumeSystemWindowInsets()); }; } static private final String FOCUSED_ID_TAG = "android:focusedViewId"; static private final String VIEWS_TAG = "android:views"; static private final String PANELS_TAG = "android:Panels"; Loading Loading @@ -3907,7 +3909,7 @@ public class PhoneWindow extends Window implements MenuBuilder.Callback { public void setDecorFitsSystemWindows(boolean decorFitsSystemWindows) { ViewRootImpl impl = getViewRootImplOrNull(); OnContentApplyWindowInsetsListener listener = decorFitsSystemWindows ? createDefaultContentWindowInsetsListener() ? sDefaultContentInsetsApplier : null; if (impl != null) { impl.setOnContentApplyWindowInsetsListener(listener); Loading