Animate drawables if possible

If the ConnectionService provides an animated drawable for the call
state icon, animate it.

Bug: 18745128
Change-Id: I2e688549e7f34445db49726c4eb986d5dd60efdc
diff --git a/src/com/android/incallui/CallCardFragment.java b/src/com/android/incallui/CallCardFragment.java
index 6ecf62e..7af0269 100644
--- a/src/com/android/incallui/CallCardFragment.java
+++ b/src/com/android/incallui/CallCardFragment.java
@@ -25,6 +25,7 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.graphics.Point;
+import android.graphics.drawable.AnimationDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.telecom.DisconnectCause;
@@ -522,7 +523,12 @@
                     || TextUtils.isEmpty(callStateLabel)) {
                 mCallStateIcon.clearAnimation();
             } else {
-                mCallStateIcon.startAnimation(mPulseAnimation);
+                if (callStateIcon instanceof AnimationDrawable) {
+                    // Animate the drawable instead of the view
+                    ((AnimationDrawable) callStateIcon).start();
+                } else {
+                    mCallStateIcon.startAnimation(mPulseAnimation);
+                }
             }
         } else {
             Animation callStateIconAnimation = mCallStateIcon.getAnimation();