package com.google.firebase.crashlytics.internal.stacktrace; /* loaded from: classes2.dex */ public class MiddleOutFallbackStrategy implements StackTraceTrimmingStrategy { private final int maximumStackSize; private final MiddleOutStrategy middleOutStrategy; private final StackTraceTrimmingStrategy[] trimmingStrategies; public MiddleOutFallbackStrategy(int i, StackTraceTrimmingStrategy... stackTraceTrimmingStrategyArr) { this.maximumStackSize = i; this.trimmingStrategies = stackTraceTrimmingStrategyArr; this.middleOutStrategy = new MiddleOutStrategy(i); } @Override // com.google.firebase.crashlytics.internal.stacktrace.StackTraceTrimmingStrategy public StackTraceElement[] getTrimmedStackTrace(StackTraceElement[] stackTraceElementArr) { if (stackTraceElementArr.length <= this.maximumStackSize) { return stackTraceElementArr; } StackTraceElement[] stackTraceElementArr2 = stackTraceElementArr; for (StackTraceTrimmingStrategy stackTraceTrimmingStrategy : this.trimmingStrategies) { if (stackTraceElementArr2.length <= this.maximumStackSize) { break; } stackTraceElementArr2 = stackTraceTrimmingStrategy.getTrimmedStackTrace(stackTraceElementArr); } return stackTraceElementArr2.length > this.maximumStackSize ? this.middleOutStrategy.getTrimmedStackTrace(stackTraceElementArr2) : stackTraceElementArr2; } }