Merge "Don't consider resources < 0 as invalid" into pi-dev am: 39b3e46607
am: ba5d387092

Change-Id: I2f8654b285f46384b31885153ec92e6f587034b3
diff --git a/services/core/java/com/android/server/wm/AppTransition.java b/services/core/java/com/android/server/wm/AppTransition.java
index 762d4e5..c761754 100644
--- a/services/core/java/com/android/server/wm/AppTransition.java
+++ b/services/core/java/com/android/server/wm/AppTransition.java
@@ -82,6 +82,7 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.res.Configuration;
+import android.content.res.ResourceId;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -538,25 +539,25 @@
     }
 
     Animation loadAnimationAttr(LayoutParams lp, int animAttr, int transit) {
-        int anim = 0;
+        int resId = ResourceId.ID_NULL;
         Context context = mContext;
         if (animAttr >= 0) {
             AttributeCache.Entry ent = getCachedAnimations(lp);
             if (ent != null) {
                 context = ent.context;
-                anim = ent.array.getResourceId(animAttr, 0);
+                resId = ent.array.getResourceId(animAttr, 0);
             }
         }
-        anim = updateToTranslucentAnimIfNeeded(anim, transit);
-        if (anim != 0) {
-            return AnimationUtils.loadAnimation(context, anim);
+        resId = updateToTranslucentAnimIfNeeded(resId, transit);
+        if (ResourceId.isValid(resId)) {
+            return AnimationUtils.loadAnimation(context, resId);
         }
         return null;
     }
 
     Animation loadAnimationRes(LayoutParams lp, int resId) {
         Context context = mContext;
-        if (resId >= 0) {
+        if (ResourceId.isValid(resId)) {
             AttributeCache.Entry ent = getCachedAnimations(lp);
             if (ent != null) {
                 context = ent.context;
@@ -567,18 +568,12 @@
     }
 
     private Animation loadAnimationRes(String packageName, int resId) {
-        int anim = 0;
-        Context context = mContext;
-        if (resId >= 0) {
+        if (ResourceId.isValid(resId)) {
             AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
             if (ent != null) {
-                context = ent.context;
-                anim = resId;
+                return AnimationUtils.loadAnimation(ent.context, resId);
             }
         }
-        if (anim != 0) {
-            return AnimationUtils.loadAnimation(context, anim);
-        }
         return null;
     }