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

Commit 71ec0a9b authored by Alan Viverette's avatar Alan Viverette
Browse files

Always assume layout params changed if app targets <= M

Previously we were lax about whether an app needed to call
setLayoutParams() when changing layout param (ex. height), but now
failing to call set will break layout.

Bug: 25801251
Bug: 25836190
Change-Id: I4431526ab38b9e3cbdf3553e41db6251d2a7fbc3
parent c0c73271
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -806,6 +806,12 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     */
    private static boolean sAlwaysRemeasureExactly = false;
    /**
     * Relax constraints around whether setLayoutParams() must be called after
     * modifying the layout params.
     */
    private static boolean sLayoutParamsAlwaysChanged = false;
    /**
     * This view does not want keystrokes. Use with TAKES_FOCUS_MASK when
     * calling setFlags.
@@ -3975,6 +3981,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
            // modes, so we always need to run an additional EXACTLY pass.
            sAlwaysRemeasureExactly = targetSdkVersion <= M;
            // Prior to N, layout params could change without requiring a
            // subsequent call to setLayoutParams() and they would usually
            // work. Partial layout breaks this assumption.
            sLayoutParamsAlwaysChanged = targetSdkVersion <= M;
            sCompatibilityDone = true;
        }
    }
@@ -16904,6 +16915,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @return true if this view's LayoutParams changed since last layout.
     */
    public final boolean didLayoutParamsChange() {
        if (sLayoutParamsAlwaysChanged) {
            return true;
        }
        return (mPrivateFlags3 & PFLAG3_LAYOUT_PARAMS_CHANGED) == PFLAG3_LAYOUT_PARAMS_CHANGED;
    }