From bb8c33e73e0389ac23e1c24b08f4e82d54532fdc Mon Sep 17 00:00:00 2001 From: Vadim Caen Date: Wed, 29 Sep 2021 12:05:46 +0000 Subject: [PATCH] Catch exception when parsing faulty AVD If an application uses an animated vector drawable for its splashsreen but the files generates an error (like a target not found for the animation), we catch it and log it instead of crashing sysui Test: manual, created an AVD with a tag referencing a non exising group in the dawable Fixes: 201274348 Change-Id: Ia195b8a626ed4bcad41ffad0e05871b5a632c8df --- .../SplashscreenIconDrawableFactory.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java index f0685a81d25f5..38122ffc032b5 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/SplashscreenIconDrawableFactory.java @@ -38,6 +38,7 @@ import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Trace; +import android.util.Log; import android.util.PathParser; import android.window.SplashScreenView; @@ -50,6 +51,8 @@ import com.android.internal.R; */ public class SplashscreenIconDrawableFactory { + private static final String TAG = "SplashscreenIconDrawableFactory"; + /** * @return An array containing the foreground drawable at index 0 and if needed a background * drawable at index 1. @@ -282,7 +285,12 @@ public class SplashscreenIconDrawableFactory { if (startListener != null) { startListener.run(); } - mAnimatableIcon.start(); + try { + mAnimatableIcon.start(); + } catch (Exception ex) { + Log.e(TAG, "Error while running the splash screen animated icon", ex); + animation.cancel(); + } } @Override