Allow animations in zip files to include base64 encoded inline images (#2110)

Fixes #2111 

Co-authored-by: 子贺 <hepenghui.hph@alibabapictures.com>
diff --git a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
index 7f8b3bd..a5d9da3 100644
--- a/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
+++ b/lottie/src/main/java/com/airbnb/lottie/LottieCompositionFactory.java
@@ -10,6 +10,7 @@
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Typeface;
+import android.util.Base64;
 
 import androidx.annotation.Nullable;
 import androidx.annotation.RawRes;
@@ -504,6 +505,31 @@
       }
     }
 
+    if (images.isEmpty()) {
+      for (Map.Entry<String, LottieImageAsset> entry : composition.getImages().entrySet()) {
+        LottieImageAsset asset = entry.getValue();
+        if (asset == null) {
+          return null;
+        }
+        String filename = asset.getFileName();
+        BitmapFactory.Options opts = new BitmapFactory.Options();
+        opts.inScaled = true;
+        opts.inDensity = 160;
+
+        if (filename.startsWith("data:") && filename.indexOf("base64,") > 0) {
+          // Contents look like a base64 data URI, with the format data:image/png;base64,<data>.
+          byte[] data;
+          try {
+            data = Base64.decode(filename.substring(filename.indexOf(',') + 1), Base64.DEFAULT);
+          } catch (IllegalArgumentException e) {
+            Logger.warning("data URL did not have correct base64 format.", e);
+            return null;
+          }
+          asset.setBitmap(BitmapFactory.decodeByteArray(data, 0, data.length, opts));
+        }
+      }
+    }
+
     // Ensure that all bitmaps have been set.
     for (Map.Entry<String, LottieImageAsset> entry : composition.getImages().entrySet()) {
       if (entry.getValue().getBitmap() == null) {
diff --git a/snapshot-tests/src/main/assets/Tests/ZipInlineImage.zip b/snapshot-tests/src/main/assets/Tests/ZipInlineImage.zip
new file mode 100644
index 0000000..145e91f
--- /dev/null
+++ b/snapshot-tests/src/main/assets/Tests/ZipInlineImage.zip
Binary files differ