Merge "Don't consider resources < 0 as invalid" into pi-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6fc7e38bbe
@@ -82,6 +82,7 @@ import android.app.ActivityManager;
|
||||
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;
|
||||
@@ -555,16 +556,16 @@ public class AppTransition implements Dump {
|
||||
}
|
||||
|
||||
Animation loadAnimationAttr(LayoutParams lp, int animAttr) {
|
||||
int anim = 0;
|
||||
int anim = ResourceId.ID_NULL;
|
||||
Context context = mContext;
|
||||
if (animAttr >= 0) {
|
||||
if (ResourceId.isValid(animAttr)) {
|
||||
AttributeCache.Entry ent = getCachedAnimations(lp);
|
||||
if (ent != null) {
|
||||
context = ent.context;
|
||||
anim = ent.array.getResourceId(animAttr, 0);
|
||||
}
|
||||
}
|
||||
if (anim != 0) {
|
||||
if (ResourceId.isValid(anim)) {
|
||||
return AnimationUtils.loadAnimation(context, anim);
|
||||
}
|
||||
return null;
|
||||
@@ -572,7 +573,7 @@ public class AppTransition implements Dump {
|
||||
|
||||
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;
|
||||
@@ -583,16 +584,16 @@ public class AppTransition implements Dump {
|
||||
}
|
||||
|
||||
private Animation loadAnimationRes(String packageName, int resId) {
|
||||
int anim = 0;
|
||||
int anim = ResourceId.ID_NULL;
|
||||
Context context = mContext;
|
||||
if (resId >= 0) {
|
||||
if (ResourceId.isValid(resId)) {
|
||||
AttributeCache.Entry ent = getCachedAnimations(packageName, resId);
|
||||
if (ent != null) {
|
||||
context = ent.context;
|
||||
anim = resId;
|
||||
}
|
||||
}
|
||||
if (anim != 0) {
|
||||
if (ResourceId.isValid(anim)) {
|
||||
return AnimationUtils.loadAnimation(context, anim);
|
||||
}
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user