Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e1ac39a authored by Jorim Jaggi's avatar Jorim Jaggi Committed by Android (Google) Code Review
Browse files

Merge "Replace OnContentApplyWindowInsetsListener with simple boolean"

parents 6e50bae6 1f08f649
Loading
Loading
Loading
Loading
+1 −9
Original line number Diff line number Diff line
@@ -54806,7 +54806,6 @@ package android.view {
    method public final void removeOnFrameMetricsAvailableListener(android.view.Window.OnFrameMetricsAvailableListener);
    method public boolean requestFeature(int);
    method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
    method public void resetOnContentApplyWindowInsetsListener();
    method public abstract void restoreHierarchyState(android.os.Bundle);
    method public abstract android.os.Bundle saveHierarchyState();
    method public void setAllowEnterTransitionOverlap(boolean);
@@ -54824,6 +54823,7 @@ package android.view {
    method public abstract void setContentView(android.view.View);
    method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
    method public abstract void setDecorCaptionShade(int);
    method public void setDecorFitsSystemWindows(boolean);
    method protected void setDefaultWindowFormat(int);
    method public void setDimAmount(float);
    method public void setElevation(float);
@@ -54845,7 +54845,6 @@ package android.view {
    method public abstract void setNavigationBarColor(@ColorInt int);
    method public void setNavigationBarContrastEnforced(boolean);
    method public void setNavigationBarDividerColor(@ColorInt int);
    method public void setOnContentApplyWindowInsetsListener(@Nullable android.view.Window.OnContentApplyWindowInsetsListener);
    method public void setPreferMinimalPostProcessing(boolean);
    method public void setReenterTransition(android.transition.Transition);
    method public abstract void setResizingCaptionDrawable(android.graphics.drawable.Drawable);
@@ -54940,10 +54939,6 @@ package android.view {
    method @Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
  }
  public static interface Window.OnContentApplyWindowInsetsListener {
    method @NonNull public android.util.Pair<android.graphics.Insets,android.view.WindowInsets> onContentApplyWindowInsets(@NonNull android.view.WindowInsets);
  }
  public static interface Window.OnFrameMetricsAvailableListener {
    method public void onFrameMetricsAvailable(android.view.Window, android.view.FrameMetrics, int);
  }
@@ -55094,16 +55089,13 @@ package android.view {
  }
  public interface WindowInsetsController {
    method public default void controlInputMethodAnimation(long, @Nullable android.view.animation.Interpolator, @NonNull android.view.WindowInsetsAnimationControlListener);
    method public void controlWindowInsetsAnimation(int, long, @Nullable android.view.animation.Interpolator, @NonNull android.view.WindowInsetsAnimationControlListener);
    method public int getSystemBarsAppearance();
    method public int getSystemBarsBehavior();
    method public void hide(int);
    method public default void hideInputMethod();
    method public void setSystemBarsAppearance(int, int);
    method public void setSystemBarsBehavior(int);
    method public void show(int);
    method public default void showInputMethod();
    field public static final int APPEARANCE_LIGHT_NAVIGATION_BARS = 16; // 0x10
    field public static final int APPEARANCE_LIGHT_STATUS_BARS = 8; // 0x8
    field public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; // 0x1
+11 −6
Original line number Diff line number Diff line
@@ -3654,8 +3654,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @deprecated For floating windows, use {@link LayoutParams#setFitInsetsTypes(int)} with
     * {@link Type#navigationBars()}. For non-floating windows that fill the screen, call
     * {@link Window#setOnContentApplyWindowInsetsListener} with {@code null} or a listener that
     * doesn't fit the navigation bar on the window content level.
     * {@link Window#setDecorFitsSystemWindows(boolean)} with {@code false}.
     */
    public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 0x00000200;
@@ -3683,8 +3682,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     *
     * @deprecated For floating windows, use {@link LayoutParams#setFitInsetsTypes(int)} with
     * {@link Type#statusBars()} ()}. For non-floating windows that fill the screen, call
     * {@link Window#setOnContentApplyWindowInsetsListener} with {@code null} or a listener that
     * doesn't fit the status bar on the window content level.
     * {@link Window#setDecorFitsSystemWindows(boolean)} with {@code false}.
     */
    @Deprecated
    public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 0x00000400;
@@ -4673,7 +4671,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        private ArrayList<OnUnhandledKeyEventListener> mUnhandledKeyListeners;
        private WindowInsetsAnimationCallback mWindowInsetsAnimationCallback;
        WindowInsetsAnimationCallback mWindowInsetsAnimationCallback;
        /**
         * This lives here since it's only valid for interactive views.
@@ -11537,13 +11535,20 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    /**
     * @see #PFLAG4_OPTIONAL_FITS_SYSTEM_WINDOWS
     * @see #PFLAG4_FRAMEWORK_OPTIONAL_FITS_SYSTEM_WINDOWS
     * @hide
     */
    public void makeFrameworkOptionalFitsSystemWindows() {
        mPrivateFlags4 |= PFLAG4_FRAMEWORK_OPTIONAL_FITS_SYSTEM_WINDOWS;
    }
    /**
     * @hide
     */
    public boolean isFrameworkOptionalFitsSystemWindows() {
        return (mPrivateFlags4 & PFLAG4_FRAMEWORK_OPTIONAL_FITS_SYSTEM_WINDOWS) != 0;
    }
    /**
     * Returns the visibility status for this view.
     *
+12 −0
Original line number Diff line number Diff line
@@ -7239,6 +7239,18 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
    public void dispatchWindowInsetsAnimationPrepare(
            @NonNull InsetsAnimation animation) {
        super.dispatchWindowInsetsAnimationPrepare(animation);

        // If we are root-level content view that fits insets, set dispatch mode to stop to imitate
        // consume behavior.
        boolean isOptionalFitSystemWindows = (mViewFlags & OPTIONAL_FITS_SYSTEM_WINDOWS) != 0
                || isFrameworkOptionalFitsSystemWindows();
        if (isOptionalFitSystemWindows && mAttachInfo != null
                && getListenerInfo().mWindowInsetsAnimationCallback == null
                && mAttachInfo.mContentOnApplyWindowInsetsListener != null) {
            mInsetsAnimationDispatchMode = DISPATCH_MODE_STOP;
            return;
        }

        if (mInsetsAnimationDispatchMode == DISPATCH_MODE_STOP) {
            return;
        }
+18 −30
Original line number Diff line number Diff line
@@ -697,12 +697,10 @@ public abstract class Window {
    }

    /**
     * Listener for applying window insets on the content of a window in a custom way.
     * Listener for applying window insets on the content of a window. Used only by the framework to
     * fit content according to legacy SystemUI flags.
     *
     * <p>Apps may choose to implement this interface if they want to apply custom policy
     * to the way that window insets are treated for fitting root-level content views.
     *
     * @see Window#setOnContentApplyWindowInsetsListener(OnContentApplyWindowInsetsListener)
     * @hide
     */
    public interface OnContentApplyWindowInsetsListener {

@@ -719,10 +717,12 @@ public abstract class Window {
         * root-level content views, and the second element determining what should be
         * dispatched to the content view.
         */
        @NonNull Pair<Insets, WindowInsets> onContentApplyWindowInsets(
        @NonNull
        Pair<Insets, WindowInsets> onContentApplyWindowInsets(
                @NonNull WindowInsets insets);
    }


    public Window(Context context) {
        mContext = context;
        mFeatures = mLocalFeatures = getDefaultFeatures(context);
@@ -1311,33 +1311,21 @@ public abstract class Window {
    }

    /**
     * Sets the listener to be invoked when fitting root-level content views.
     * Sets whether the decor view should fit root-level content views for {@link WindowInsets}.
     * <p>
     * By default, a listener that inspects the now deprecated {@link View#SYSTEM_UI_LAYOUT_FLAGS}
     * as well the {@link WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE} flag is installed and
     * fits content according to these flags.
     * If set to {@code true}, the framework will inspect the now deprecated
     * {@link View#SYSTEM_UI_LAYOUT_FLAGS} as well the
     * {@link WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE} flag and fits content according
     * to these flags.
     * </p>
     * @param contentOnApplyWindowInsetsListener The listener to use for fitting root-level content
     *                                           views, or {@code null} to disable any kind of
     *                                           content fitting on the window level and letting the
     *                                           {@link WindowInsets} pass through to the content
     *                                           view.
     * @see OnContentApplyWindowInsetsListener
     */
    public void setOnContentApplyWindowInsetsListener(
            @Nullable OnContentApplyWindowInsetsListener contentOnApplyWindowInsetsListener) {
    }

    /**
     * Resets the listener set via {@link #setOnContentApplyWindowInsetsListener} to the default
     * state.
     * <p>
     * By default, a listener that inspects the now deprecated {@link View#SYSTEM_UI_LAYOUT_FLAGS}
     * as well the {@link WindowManager.LayoutParams#SOFT_INPUT_ADJUST_RESIZE} flag is installed and
     * fits content according to these flags.
     * If set to {@code false}, the framework will not fit the content view to the insets and will
     * just pass through the {@link WindowInsets} to the content view.
     * </p>
     * @param decorFitsSystemWindows Whether the decor view should fit root-level content views for
     *                               insets.
     */
    public void resetOnContentApplyWindowInsetsListener() {
    public void setDecorFitsSystemWindows(boolean decorFitsSystemWindows) {
    }

    /**
+6 −6
Original line number Diff line number Diff line
@@ -86,9 +86,9 @@ public interface WindowInsetsAnimationCallback {
     * following:
     * <p>
     * <ul>
     *     <li>Application calls {@link WindowInsetsController#hideInputMethod()},
     *     {@link WindowInsetsController#showInputMethod()},
     *     {@link WindowInsetsController#controlInputMethodAnimation}</li>
     *     <li>Application calls {@link WindowInsetsController#hide(int)},
     *     {@link WindowInsetsController#show(int)},
     *     {@link WindowInsetsController#controlWindowInsetsAnimation}</li>
     *     <li>onPrepare is called on the view hierarchy listeners</li>
     *     <li>{@link View#onApplyWindowInsets} will be called with the end state of the
     *     animation</li>
@@ -106,12 +106,12 @@ public interface WindowInsetsAnimationCallback {
     * related methods.
     * <p>
     * Note: If the animation is application controlled by using
     * {@link WindowInsetsController#controlInputMethodAnimation}, the end state of the animation
     * {@link WindowInsetsController#controlWindowInsetsAnimation}, the end state of the animation
     * is undefined as the application may decide on the end state only by passing in the
     * {@code shown} parameter when calling {@link WindowInsetsAnimationController#finish}. In this
     * situation, the system will dispatch the insets in the opposite visibility state before the
     * animation starts. Example: When controlling the input method with
     * {@link WindowInsetsController#controlInputMethodAnimation} and the input method is currently
     * {@link WindowInsetsController#controlWindowInsetsAnimation} and the input method is currently
     * showing, {@link View#onApplyWindowInsets} will receive a {@link WindowInsets} instance for
     * which {@link WindowInsets#isVisible} will return {@code false} for {@link Type#ime}.
     *
@@ -246,7 +246,7 @@ public interface WindowInsetsAnimationCallback {
         * be the same as the application passed into
         * {@link WindowInsetsAnimationController#setInsetsAndAlpha(Insets, float, float)},
         * interpolated with the interpolator passed into
         * {@link WindowInsetsController#controlInputMethodAnimation}.
         * {@link WindowInsetsController#controlWindowInsetsAnimation}.
         * </p>
         * <p>
         * Note: For system-initiated animations, this will always return a valid value between 0
Loading