summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Chet Haase <chet@google.com> 2013-09-12 11:19:32 -0700
committer The Android Automerger <android-build@android.com> 2013-09-12 15:08:35 -0700
commit48eb8bc8fa5bb8ec383b871a9de739062806acfc (patch)
tree5e28ad36a5107eb08e80fd85245829a6ef0c8b2c
parentd8d798a5b1b3d068a37956ee8b6d2c051cd8a3e4 (diff)
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
-rw-r--r--core/java/android/transition/TextChange.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/core/java/android/transition/TextChange.java b/core/java/android/transition/TextChange.java
index 4f14d462675d..0b1e4e1373e8 100644
--- a/core/java/android/transition/TextChange.java
+++ b/core/java/android/transition/TextChange.java
@@ -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;