diff options
author | d34d <clark@cyngn.com> | 2014-11-19 21:10:00 -0800 |
---|---|---|
committer | d34d <clark@cyngn.com> | 2014-11-19 21:24:53 -0800 |
commit | 6c1f0f1a4c8fbc8a947c7536cdefa39a98f0229f (patch) | |
tree | 5a5f8c816cf017aac0db3a0316345bdecfd62d98 /src/com | |
parent | 77bb31f5c1954e4f895ca36ccd0483e844193e01 (diff) | |
download | packages_apps_ThemeChooser-6c1f0f1a4c8fbc8a947c7536cdefa39a98f0229f.tar.gz packages_apps_ThemeChooser-6c1f0f1a4c8fbc8a947c7536cdefa39a98f0229f.tar.bz2 packages_apps_ThemeChooser-6c1f0f1a4c8fbc8a947c7536cdefa39a98f0229f.zip |
Bootanimations: Skip over bad parts
It is possible there are still some good parts to play so we
continue on to the next line. If we end up with no parts that
were good it will be caught in parseAnimation()
Change-Id: Ib6a9c132c3cda7cedd5670fd2f00582642f09e1e
REF: THEMESTORE-406
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/cyngn/theme/util/BootAnimationHelper.java | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/com/cyngn/theme/util/BootAnimationHelper.java b/src/com/cyngn/theme/util/BootAnimationHelper.java index 24b8bc2..589b037 100644 --- a/src/com/cyngn/theme/util/BootAnimationHelper.java +++ b/src/com/cyngn/theme/util/BootAnimationHelper.java @@ -9,6 +9,7 @@ import android.content.res.ThemeConfig; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.AsyncTask; +import android.text.TextUtils; import android.util.Log; import android.view.View; import android.widget.ImageView; @@ -168,15 +169,25 @@ public class BootAnimationHelper { List<AnimationPart> animationParts = new ArrayList<AnimationPart>(); while ((line = reader.readLine()) != null) { - String[] info = line.split(" "); + // trim off any leading and trailing spaces + line = line.trim(); + // if the line is empty continue on to the next + if (TextUtils.isEmpty(line)) continue; + + String[] info = line. split(" "); if (info.length != NUM_PART_LINE_PARAMETERS) { - throw new BootAnimationException(String.format( + Log.w(TAG, String.format( "Invalid # of part parameters; exptected %d, read %d (\"%s\")", NUM_PART_LINE_PARAMETERS, info.length, line)); + // let's continue in case there are parts that are valid + continue; } if (!info[0].equals("p") && !info[0].equals("c")) { - throw new BootAnimationException(String.format( + Log.w(TAG, String.format( "Unknown part type; expected 'p' or 'c', read %s (\"%s\")", info[0], line)); + + // let's continue in case there are parts that are valid + continue; } int playCount = Integer.parseInt(info[1]); int pause = Integer.parseInt(info[2]); |