package com.airbnb.lottie; import android.content.Context; import com.airbnb.lottie.network.DefaultLottieNetworkFetcher; import com.airbnb.lottie.network.LottieNetworkCacheProvider; import com.airbnb.lottie.network.LottieNetworkFetcher; import com.airbnb.lottie.network.NetworkCache; import com.airbnb.lottie.network.NetworkFetcher; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.io.File; import o.Lfp; /* loaded from: classes.dex */ public class L { public static boolean DBG = false; private static final int MAX_DEPTH = 20; public static final String TAG = "LOTTIE"; private static LottieNetworkCacheProvider cacheProvider = null; private static int depthPastMaxDepth = 0; private static LottieNetworkFetcher fetcher = null; private static volatile NetworkCache networkCache = null; private static volatile NetworkFetcher networkFetcher = null; private static String[] sections = null; private static long[] startTimeNs = null; private static int traceDepth = 0; private static boolean traceEnabled = false; private L() { } public static void beginSection(String str) { if (traceEnabled) { int i = traceDepth; if (i == 20) { depthPastMaxDepth++; return; } sections[i] = str; startTimeNs[i] = System.nanoTime(); Lfp.b(str); traceDepth++; } } public static float endSection(String str) { int i = depthPastMaxDepth; if (i > 0) { depthPastMaxDepth = i - 1; return BitmapDescriptorFactory.HUE_RED; } if (!traceEnabled) { return BitmapDescriptorFactory.HUE_RED; } int i2 = traceDepth - 1; traceDepth = i2; if (i2 == -1) { throw new IllegalStateException("Can't end trace section. There are none."); } if (!str.equals(sections[i2])) { StringBuilder sb = new StringBuilder("Unbalanced trace call "); sb.append(str); sb.append(". Expected "); sb.append(sections[traceDepth]); sb.append("."); throw new IllegalStateException(sb.toString()); } Lfp.c(); return ((float) (System.nanoTime() - startTimeNs[traceDepth])) / 1000000.0f; } public static NetworkFetcher networkFetcher(Context context) { NetworkFetcher networkFetcher2; NetworkFetcher networkFetcher3 = networkFetcher; if (networkFetcher3 != null) { return networkFetcher3; } synchronized (NetworkFetcher.class) { networkFetcher2 = networkFetcher; if (networkFetcher2 == null) { NetworkCache networkCache2 = networkCache(context); LottieNetworkFetcher lottieNetworkFetcher = fetcher; if (lottieNetworkFetcher == null) { lottieNetworkFetcher = new DefaultLottieNetworkFetcher(); } networkFetcher2 = new NetworkFetcher(networkCache2, lottieNetworkFetcher); networkFetcher = networkFetcher2; } } return networkFetcher2; } public static NetworkCache networkCache(Context context) { NetworkCache networkCache2; Context applicationContext = context.getApplicationContext(); NetworkCache networkCache3 = networkCache; if (networkCache3 != null) { return networkCache3; } synchronized (NetworkCache.class) { networkCache2 = networkCache; if (networkCache2 == null) { LottieNetworkCacheProvider lottieNetworkCacheProvider = cacheProvider; if (lottieNetworkCacheProvider == null) { lottieNetworkCacheProvider = new LottieNetworkCacheProvider(applicationContext) { // from class: com.airbnb.lottie.L.1 final Context val$appContext; { this.val$appContext = applicationContext; } @Override // com.airbnb.lottie.network.LottieNetworkCacheProvider public File getCacheDir() { return new File(this.val$appContext.getCacheDir(), "lottie_network_cache"); } }; } networkCache2 = new NetworkCache(lottieNetworkCacheProvider); networkCache = networkCache2; } } return networkCache2; } public static void setTraceEnabled(boolean z) { if (traceEnabled == z) { return; } traceEnabled = z; if (z) { sections = new String[20]; startTimeNs = new long[20]; } } public static void setFetcher(LottieNetworkFetcher lottieNetworkFetcher) { fetcher = lottieNetworkFetcher; } public static void setCacheProvider(LottieNetworkCacheProvider lottieNetworkCacheProvider) { cacheProvider = lottieNetworkCacheProvider; } }