Loading core/java/android/view/animation/AnimationUtils.java +34 −55 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.res.XmlResourceParser; import android.os.SystemClock; import android.os.SystemClock; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Xml; import android.util.Xml; import android.view.InflateException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; Loading Loading @@ -137,16 +138,9 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createAnimationFromXml(context, parser); return createAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } Loading @@ -159,8 +153,9 @@ public class AnimationUtils { } } @UnsupportedAppUsage @UnsupportedAppUsage private static Animation createAnimationFromXml(Context c, XmlPullParser parser, private static Animation createAnimationFromXml( AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException { Context c, XmlPullParser parser, AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException, InflateException { Animation anim = null; Animation anim = null; Loading Loading @@ -193,7 +188,7 @@ public class AnimationUtils { } else if (name.equals("extend")) { } else if (name.equals("extend")) { anim = new ExtendAnimation(c, attrs); anim = new ExtendAnimation(c, attrs); } else { } else { throw new RuntimeException("Unknown animation name: " + parser.getName()); throw new InflateException("Unknown animation name: " + parser.getName()); } } if (parent != null) { if (parent != null) { Loading @@ -220,29 +215,24 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createLayoutAnimationFromXml(context, parser); return createLayoutAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } } } private static LayoutAnimationController createLayoutAnimationFromXml(Context c, private static LayoutAnimationController createLayoutAnimationFromXml( XmlPullParser parser) throws XmlPullParserException, IOException { Context c, XmlPullParser parser) throws XmlPullParserException, IOException, InflateException { return createLayoutAnimationFromXml(c, parser, Xml.asAttributeSet(parser)); return createLayoutAnimationFromXml(c, parser, Xml.asAttributeSet(parser)); } } private static LayoutAnimationController createLayoutAnimationFromXml(Context c, private static LayoutAnimationController createLayoutAnimationFromXml( XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException { Context c, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException, InflateException { LayoutAnimationController controller = null; LayoutAnimationController controller = null; Loading @@ -263,7 +253,7 @@ public class AnimationUtils { } else if ("gridLayoutAnimation".equals(name)) { } else if ("gridLayoutAnimation".equals(name)) { controller = new GridLayoutAnimationController(c, attrs); controller = new GridLayoutAnimationController(c, attrs); } else { } else { throw new RuntimeException("Unknown layout animation name: " + name); throw new InflateException("Unknown layout animation name: " + name); } } } } Loading Loading @@ -342,16 +332,9 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createInterpolatorFromXml(context.getResources(), context.getTheme(), parser); return createInterpolatorFromXml(context.getResources(), context.getTheme(), parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } Loading @@ -367,30 +350,26 @@ public class AnimationUtils { * @throws NotFoundException * @throws NotFoundException * @hide * @hide */ */ public static Interpolator loadInterpolator(Resources res, Theme theme, int id) throws NotFoundException { public static Interpolator loadInterpolator(Resources res, Theme theme, int id) throws NotFoundException { XmlResourceParser parser = null; XmlResourceParser parser = null; try { try { parser = res.getAnimation(id); parser = res.getAnimation(id); return createInterpolatorFromXml(res, theme, parser); return createInterpolatorFromXml(res, theme, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) if (parser != null) { parser.close(); parser.close(); } } } } } private static Interpolator createInterpolatorFromXml(Resources res, Theme theme, XmlPullParser parser) private static Interpolator createInterpolatorFromXml( throws XmlPullParserException, IOException { Resources res, Theme theme, XmlPullParser parser) throws XmlPullParserException, IOException, InflateException { BaseInterpolator interpolator = null; BaseInterpolator interpolator = null; Loading Loading @@ -430,7 +409,7 @@ public class AnimationUtils { } else if (name.equals("pathInterpolator")) { } else if (name.equals("pathInterpolator")) { interpolator = new PathInterpolator(res, theme, attrs); interpolator = new PathInterpolator(res, theme, attrs); } else { } else { throw new RuntimeException("Unknown interpolator name: " + parser.getName()); throw new InflateException("Unknown interpolator name: " + parser.getName()); } } } } return interpolator; return interpolator; Loading core/java/com/android/internal/policy/TransitionAnimation.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.media.Image; import android.media.ImageReader; import android.media.ImageReader; import android.os.SystemProperties; import android.os.SystemProperties; import android.util.Slog; import android.util.Slog; import android.view.InflateException; import android.view.SurfaceControl; import android.view.SurfaceControl; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.TransitionOldType; import android.view.WindowManager.TransitionOldType; Loading Loading @@ -1264,7 +1265,7 @@ public class TransitionAnimation { public static Animation loadAnimationSafely(Context context, int resId, String tag) { public static Animation loadAnimationSafely(Context context, int resId, String tag) { try { try { return AnimationUtils.loadAnimation(context, resId); return AnimationUtils.loadAnimation(context, resId); } catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException | InflateException e) { Slog.w(tag, "Unable to load animation resource", e); Slog.w(tag, "Unable to load animation resource", e); return null; return null; } } Loading Loading
core/java/android/view/animation/AnimationUtils.java +34 −55 Original line number Original line Diff line number Diff line Loading @@ -28,6 +28,7 @@ import android.content.res.XmlResourceParser; import android.os.SystemClock; import android.os.SystemClock; import android.util.AttributeSet; import android.util.AttributeSet; import android.util.Xml; import android.util.Xml; import android.view.InflateException; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlPullParserException; Loading Loading @@ -137,16 +138,9 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createAnimationFromXml(context, parser); return createAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } Loading @@ -159,8 +153,9 @@ public class AnimationUtils { } } @UnsupportedAppUsage @UnsupportedAppUsage private static Animation createAnimationFromXml(Context c, XmlPullParser parser, private static Animation createAnimationFromXml( AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException { Context c, XmlPullParser parser, AnimationSet parent, AttributeSet attrs) throws XmlPullParserException, IOException, InflateException { Animation anim = null; Animation anim = null; Loading Loading @@ -193,7 +188,7 @@ public class AnimationUtils { } else if (name.equals("extend")) { } else if (name.equals("extend")) { anim = new ExtendAnimation(c, attrs); anim = new ExtendAnimation(c, attrs); } else { } else { throw new RuntimeException("Unknown animation name: " + parser.getName()); throw new InflateException("Unknown animation name: " + parser.getName()); } } if (parent != null) { if (parent != null) { Loading @@ -220,29 +215,24 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createLayoutAnimationFromXml(context, parser); return createLayoutAnimationFromXml(context, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } } } private static LayoutAnimationController createLayoutAnimationFromXml(Context c, private static LayoutAnimationController createLayoutAnimationFromXml( XmlPullParser parser) throws XmlPullParserException, IOException { Context c, XmlPullParser parser) throws XmlPullParserException, IOException, InflateException { return createLayoutAnimationFromXml(c, parser, Xml.asAttributeSet(parser)); return createLayoutAnimationFromXml(c, parser, Xml.asAttributeSet(parser)); } } private static LayoutAnimationController createLayoutAnimationFromXml(Context c, private static LayoutAnimationController createLayoutAnimationFromXml( XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException { Context c, XmlPullParser parser, AttributeSet attrs) throws XmlPullParserException, IOException, InflateException { LayoutAnimationController controller = null; LayoutAnimationController controller = null; Loading @@ -263,7 +253,7 @@ public class AnimationUtils { } else if ("gridLayoutAnimation".equals(name)) { } else if ("gridLayoutAnimation".equals(name)) { controller = new GridLayoutAnimationController(c, attrs); controller = new GridLayoutAnimationController(c, attrs); } else { } else { throw new RuntimeException("Unknown layout animation name: " + name); throw new InflateException("Unknown layout animation name: " + name); } } } } Loading Loading @@ -342,16 +332,9 @@ public class AnimationUtils { try { try { parser = context.getResources().getAnimation(id); parser = context.getResources().getAnimation(id); return createInterpolatorFromXml(context.getResources(), context.getTheme(), parser); return createInterpolatorFromXml(context.getResources(), context.getTheme(), parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) parser.close(); if (parser != null) parser.close(); } } Loading @@ -367,30 +350,26 @@ public class AnimationUtils { * @throws NotFoundException * @throws NotFoundException * @hide * @hide */ */ public static Interpolator loadInterpolator(Resources res, Theme theme, int id) throws NotFoundException { public static Interpolator loadInterpolator(Resources res, Theme theme, int id) throws NotFoundException { XmlResourceParser parser = null; XmlResourceParser parser = null; try { try { parser = res.getAnimation(id); parser = res.getAnimation(id); return createInterpolatorFromXml(res, theme, parser); return createInterpolatorFromXml(res, theme, parser); } catch (XmlPullParserException ex) { } catch (XmlPullParserException | IOException | InflateException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + throw new NotFoundException( Integer.toHexString(id)); "Can't load animation resource ID #0x" + Integer.toHexString(id), ex); rnf.initCause(ex); throw rnf; } catch (IOException ex) { NotFoundException rnf = new NotFoundException("Can't load animation resource ID #0x" + Integer.toHexString(id)); rnf.initCause(ex); throw rnf; } finally { } finally { if (parser != null) if (parser != null) { parser.close(); parser.close(); } } } } } private static Interpolator createInterpolatorFromXml(Resources res, Theme theme, XmlPullParser parser) private static Interpolator createInterpolatorFromXml( throws XmlPullParserException, IOException { Resources res, Theme theme, XmlPullParser parser) throws XmlPullParserException, IOException, InflateException { BaseInterpolator interpolator = null; BaseInterpolator interpolator = null; Loading Loading @@ -430,7 +409,7 @@ public class AnimationUtils { } else if (name.equals("pathInterpolator")) { } else if (name.equals("pathInterpolator")) { interpolator = new PathInterpolator(res, theme, attrs); interpolator = new PathInterpolator(res, theme, attrs); } else { } else { throw new RuntimeException("Unknown interpolator name: " + parser.getName()); throw new InflateException("Unknown interpolator name: " + parser.getName()); } } } } return interpolator; return interpolator; Loading
core/java/com/android/internal/policy/TransitionAnimation.java +2 −1 Original line number Original line Diff line number Diff line Loading @@ -50,6 +50,7 @@ import android.media.Image; import android.media.ImageReader; import android.media.ImageReader; import android.os.SystemProperties; import android.os.SystemProperties; import android.util.Slog; import android.util.Slog; import android.view.InflateException; import android.view.SurfaceControl; import android.view.SurfaceControl; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.LayoutParams; import android.view.WindowManager.TransitionOldType; import android.view.WindowManager.TransitionOldType; Loading Loading @@ -1264,7 +1265,7 @@ public class TransitionAnimation { public static Animation loadAnimationSafely(Context context, int resId, String tag) { public static Animation loadAnimationSafely(Context context, int resId, String tag) { try { try { return AnimationUtils.loadAnimation(context, resId); return AnimationUtils.loadAnimation(context, resId); } catch (Resources.NotFoundException e) { } catch (Resources.NotFoundException | InflateException e) { Slog.w(tag, "Unable to load animation resource", e); Slog.w(tag, "Unable to load animation resource", e); return null; return null; } } Loading