Import updated Android Setupdesign Library 381429150

Copied from google3/third_party/java_src/android_libs/setupdesign

Test: mm
BUG: b/191230767

Included changes:
  - 381429150 [GlifLoadingLayout] Fix ErrorPron Since API Settings.getF...
  - 380143326 [GlifLoadingLayout] Fix GlifloadingLayout will not finish...
  - 379668624 Add system background surface for 1p

PiperOrigin-RevId: 381429150
Change-Id: I0a94bae9820a12cbbc692fcbf1dc4e7aabbbaa29
diff --git a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
index c6b2b2a..d239e3d 100644
--- a/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
+++ b/lottie_loading_layout/src/com/google/android/setupdesign/GlifLoadingLayout.java
@@ -32,6 +32,8 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
+import android.provider.Settings.Global;
+import android.provider.Settings.SettingNotFoundException;
 import android.util.AttributeSet;
 import android.util.Log;
 import android.view.LayoutInflater;
@@ -785,7 +787,8 @@
           }
         };
 
-    private LottieAnimationFinishListener(
+    @VisibleForTesting
+    LottieAnimationFinishListener(
         GlifLoadingLayout glifLoadingLayout, Runnable runnable, long finishWithMinimumDuration) {
       if (runnable == null) {
         throw new NullPointerException("Runnable can not be null");
@@ -795,7 +798,7 @@
       this.handler = new Handler(Looper.getMainLooper());
       this.lottieAnimationView = glifLoadingLayout.findLottieAnimationView();
 
-      if (glifLoadingLayout.isLottieLayoutVisible()) {
+      if (glifLoadingLayout.isLottieLayoutVisible() && !isZeroAnimatorDurationScale()) {
         lottieAnimationView.setRepeatCount(0);
         lottieAnimationView.addAnimatorListener(animatorListener);
         if (finishWithMinimumDuration > 0) {
@@ -807,6 +810,22 @@
     }
 
     @VisibleForTesting
+    boolean isZeroAnimatorDurationScale() {
+      try {
+        if (Build.VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN_MR1) {
+          return Global.getFloat(
+              glifLoadingLayout.getContext().getContentResolver(), Global.ANIMATOR_DURATION_SCALE)
+              == 0f;
+        } else {
+          return false;
+        }
+
+      } catch (SettingNotFoundException e) {
+        return false;
+      }
+    }
+
+    @VisibleForTesting
     public void onAnimationFinished() {
       handler.removeCallbacks(runnable);
       runnable.run();
diff --git a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
index 2541c66..2db8c75 100644
--- a/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
+++ b/main/src/com/google/android/setupdesign/util/DynamicColorPalette.java
@@ -41,6 +41,7 @@
     ColorType.ERROR_WARNING,
     ColorType.SUCCESS_DONE,
     ColorType.FALLBACK_ACCENT,
+    ColorType.BACKGROUND_SURFACE,
   })
   public @interface ColorType {
     int ACCENT = 0;
@@ -50,6 +51,7 @@
     int ERROR_WARNING = 4;
     int SUCCESS_DONE = 5;
     int FALLBACK_ACCENT = 6;
+    int BACKGROUND_SURFACE = 7;
   }
 
   @ColorInt
@@ -76,6 +78,9 @@
       case ColorType.FALLBACK_ACCENT:
         colorRes = R.color.sud_system_fallback_accent;
         break;
+      case ColorType.BACKGROUND_SURFACE:
+        colorRes = R.color.sud_system_background_surface;
+        break;
         // fall out
     }