Merge "Revert "Don't consider resources < 0 as invalid"" into pi-dev

am: 2557f34102

Change-Id: Iff2cbb469b137cbc7cbb258d001d3330451f2221
This commit is contained in:
Jorim Jaggi
2018-04-19 08:28:16 -07:00
committed by android-build-merger

View File

@@ -82,7 +82,6 @@ import android.app.ActivityManager;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.Context; import android.content.Context;
import android.content.res.Configuration; import android.content.res.Configuration;
import android.content.res.ResourceId;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color; import android.graphics.Color;
@@ -556,16 +555,16 @@ public class AppTransition implements Dump {
} }
Animation loadAnimationAttr(LayoutParams lp, int animAttr) { Animation loadAnimationAttr(LayoutParams lp, int animAttr) {
int anim = ResourceId.ID_NULL; int anim = 0;
Context context = mContext; Context context = mContext;
if (ResourceId.isValid(animAttr)) { if (animAttr >= 0) {
AttributeCache.Entry ent = getCachedAnimations(lp); AttributeCache.Entry ent = getCachedAnimations(lp);
if (ent != null) { if (ent != null) {
context = ent.context; context = ent.context;
anim = ent.array.getResourceId(animAttr, 0); anim = ent.array.getResourceId(animAttr, 0);
} }
} }
if (ResourceId.isValid(anim)) { if (anim != 0) {
return AnimationUtils.loadAnimation(context, anim); return AnimationUtils.loadAnimation(context, anim);
} }
return null; return null;
@@ -573,7 +572,7 @@ public class AppTransition implements Dump {
Animation loadAnimationRes(LayoutParams lp, int resId) { Animation loadAnimationRes(LayoutParams lp, int resId) {
Context context = mContext; Context context = mContext;
if (ResourceId.isValid(resId)) { if (resId >= 0) {
AttributeCache.Entry ent = getCachedAnimations(lp); AttributeCache.Entry ent = getCachedAnimations(lp);
if (ent != null) { if (ent != null) {
context = ent.context; context = ent.context;
@@ -584,16 +583,16 @@ public class AppTransition implements Dump {
} }
private Animation loadAnimationRes(String packageName, int resId) { private Animation loadAnimationRes(String packageName, int resId) {
int anim = ResourceId.ID_NULL; int anim = 0;
Context context = mContext; Context context = mContext;
if (ResourceId.isValid(resId)) { if (resId >= 0) {
AttributeCache.Entry ent = getCachedAnimations(packageName, resId); AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
if (ent != null) { if (ent != null) {
context = ent.context; context = ent.context;
anim = resId; anim = resId;
} }
} }
if (ResourceId.isValid(anim)) { if (anim != 0) {
return AnimationUtils.loadAnimation(context, anim); return AnimationUtils.loadAnimation(context, anim);
} }
return null; return null;