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

Commit fb81703a authored by Gilles Debunne's avatar Gilles Debunne
Browse files

fix for cts DuplicateParentStateEnabled bug with TextViews.

Bug 3347206

Do not add an extra slot in the drawable state for multiline if it
is not needed.

Updated setDuplicateParentStateEnabled documentation.

Change-Id: I95f74284721e25b483e12e9b861e810a55c260b6
parent a6cbd728
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ import android.util.PoolableManager;
import android.util.Pools;
import android.util.SparseArray;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.MeasureSpec;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityEventSource;
import android.view.accessibility.AccessibilityManager;
@@ -7823,6 +7824,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
     * <p>Note: if this view's parent addStateFromChildren property is enabled and this
     * property is enabled, an exception will be thrown.</p>
     * 
     * <p>Note: if the child view uses and updates additionnal states which are unknown to the
     * parent, these states should not be affected by this method.</p>
     *
     * @param enabled True to enable duplication of the parent's drawable state, false
     *                to disable it.
     *
+5 −2
Original line number Diff line number Diff line
@@ -4135,9 +4135,12 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener

    @Override
    protected int[] onCreateDrawableState(int extraSpace) {
        final int[] drawableState = super.onCreateDrawableState(extraSpace + 1);
        final int[] drawableState;

        if (!mSingleLine) {
        if (mSingleLine) {
            drawableState = super.onCreateDrawableState(extraSpace);
        } else {
            drawableState = super.onCreateDrawableState(extraSpace + 1);
            mergeDrawableStates(drawableState, MULTILINE_STATE_SET);
        }