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

Commit 48eb8bc8 authored by Chet Haase's avatar Chet Haase Committed by The Android Automerger
Browse files

Fix TechChange's assumption about TextView targets

Some of the code in the TextChange transition assumed that the
start values for a transition were for a TextView object. This may
not be the case, and we should return early (without creating an
animator) when it is not.

Issue #10725388 Frequent Framework crashes across apps

Change-Id: I6999eb2288f107f4b93ddb5b77cd068069d831ed
parent d8d798a5
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -137,14 +137,17 @@ public class TextChange extends Transition {
    @Override
    public Animator createAnimator(ViewGroup sceneRoot, TransitionValues startValues,
            TransitionValues endValues) {
        if (startValues == null || endValues == null || !(endValues.view instanceof TextView)) {
        if (startValues == null || endValues == null ||
                !(startValues.view instanceof TextView) || !(endValues.view instanceof TextView)) {
            return null;
        }
        final TextView view = (TextView) endValues.view;
        Map<String, Object> startVals = startValues.values;
        Map<String, Object> endVals = endValues.values;
        final CharSequence startText = (CharSequence) startVals.get(PROPNAME_TEXT);
        final CharSequence endText = (CharSequence) endVals.get(PROPNAME_TEXT);
        final CharSequence startText = startVals.get(PROPNAME_TEXT) != null ?
                (CharSequence) startVals.get(PROPNAME_TEXT) : "";
        final CharSequence endText = endVals.get(PROPNAME_TEXT) != null ?
                (CharSequence) endVals.get(PROPNAME_TEXT) : "";
        if (!startText.equals(endText)) {
            view.setText(startText);
            Animator anim;