package com.google.android.gms.internal.pal;

import android.app.Activity;
import android.content.Context;
import android.util.DisplayMetrics;
import android.view.MotionEvent;
import android.view.View;
import androidx.media3.exoplayer.analytics.AnalyticsListener;
import java.util.LinkedList;

/* JADX INFO: loaded from: classes2.dex */
public abstract class i3 implements h3 {

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public static volatile y3 f20961t;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public MotionEvent f20962a;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public double f20971j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public double f20972k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    public double f20973l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public float f20974m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public float f20975n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public float f20976o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public float f20977p;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final DisplayMetrics f20980s;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final LinkedList f20963b = new LinkedList();

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public long f20964c = 0;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public long f20965d = 0;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public long f20966e = 0;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public long f20967f = 0;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public long f20968g = 0;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public long f20969h = 0;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public long f20970i = 0;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public boolean f20978q = false;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public boolean f20979r = false;

    public i3(Context context) {
        try {
            if (((Boolean) f5.f20904d.f20907c.b(l5.f21051p)).booleanValue()) {
                c3.b();
            } else {
                q9.r(f20961t);
            }
            this.f20980s = context.getResources().getDisplayMetrics();
        } catch (Throwable unused) {
        }
    }

    public abstract long a(StackTraceElement[] stackTraceElementArr);

    public abstract ea b(Context context, View view, Activity activity);

    public abstract ea c(Context context, f6 f6Var);

    public abstract ea d(Context context, View view, Activity activity);

    public abstract z3 e(MotionEvent motionEvent);

    /* JADX WARN: Removed duplicated region for block: B:48:0x00a4  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x00a8  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final String f(Context context, String str, int i10, View view, Activity activity, byte[] bArr) {
        f6 f6VarO;
        String str2;
        g3 g3Var;
        int i11;
        Exception exc;
        int i12;
        int i13;
        String strA;
        ea eaVarC;
        int i14;
        int i15 = i10;
        ea eaVarB = null;
        if (bArr == null || bArr.length <= 0) {
            f6VarO = null;
        } else {
            try {
                f6VarO = f6.o(bArr, w.a());
            } catch (zzadi unused) {
                f6VarO = null;
            } catch (NullPointerException unused2) {
                return Integer.toString(3);
            }
        }
        long jCurrentTimeMillis = System.currentTimeMillis();
        g5 g5Var = l5.f21041f;
        f5 f5Var = f5.f20904d;
        boolean zBooleanValue = ((Boolean) f5Var.f20907c.b(g5Var)).booleanValue();
        if (zBooleanValue) {
            g3Var = f20961t != null ? f20961t.f21359l : null;
            str2 = true != ((Boolean) f5Var.f20907c.b(l5.f21051p)).booleanValue() ? "te" : "be";
        } else {
            str2 = null;
            g3Var = null;
        }
        try {
            if (i15 == 3) {
                eaVarB = b(context, view, activity);
                try {
                    this.f20978q = true;
                    i14 = 1002;
                } catch (Exception e10) {
                    exc = e10;
                    i11 = 2;
                    if (zBooleanValue && g3Var != null) {
                        if (i15 != 3) {
                            i13 = 1003;
                        } else if (i15 == i11) {
                            i13 = AnalyticsListener.EVENT_AUDIO_INPUT_FORMAT_CHANGED;
                        } else {
                            i12 = 1001;
                            i15 = 1;
                            g3Var.a(i12, -1, System.currentTimeMillis() - jCurrentTimeMillis, str2, exc);
                        }
                        i12 = i13;
                        g3Var.a(i12, -1, System.currentTimeMillis() - jCurrentTimeMillis, str2, exc);
                    }
                }
            } else {
                if (i15 == 2) {
                    eaVarC = d(context, view, activity);
                    i14 = AnalyticsListener.EVENT_AUDIO_DECODER_INITIALIZED;
                } else {
                    eaVarC = c(context, f6VarO);
                    i14 = 1000;
                }
                eaVarB = eaVarC;
            }
            if (!zBooleanValue || g3Var == null) {
                i11 = 2;
            } else {
                i11 = 2;
                try {
                    g3Var.a(i14, -1, System.currentTimeMillis() - jCurrentTimeMillis, str2, null);
                } catch (Exception e11) {
                    e = e11;
                    exc = e;
                    if (zBooleanValue) {
                        if (i15 != 3) {
                        }
                        i12 = i13;
                        g3Var.a(i12, -1, System.currentTimeMillis() - jCurrentTimeMillis, str2, exc);
                    }
                }
            }
        } catch (Exception e12) {
            e = e12;
            i11 = 2;
        }
        long jCurrentTimeMillis2 = System.currentTimeMillis();
        if (eaVarB != null) {
            try {
                if (((l1) eaVarB.g()).h() == 0) {
                    strA = Integer.toString(5);
                } else {
                    strA = c3.a((l1) eaVarB.g(), str);
                    if (zBooleanValue && g3Var != null) {
                        g3Var.a(i15 == 3 ? AnalyticsListener.EVENT_BANDWIDTH_ESTIMATE : i15 == i11 ? 1010 : 1004, -1, System.currentTimeMillis() - jCurrentTimeMillis2, str2, null);
                    }
                }
            } catch (Exception e13) {
                strA = Integer.toString(7);
                if (zBooleanValue && g3Var != null) {
                    g3Var.a(i15 == 3 ? AnalyticsListener.EVENT_AUDIO_ENABLED : i15 == i11 ? 1011 : 1005, -1, System.currentTimeMillis() - jCurrentTimeMillis2, str2, e13);
                }
            }
        } else {
            strA = Integer.toString(5);
        }
        return strA;
    }
}
