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

import android.provider.Settings;
import androidx.media3.exoplayer.ExoPlayer;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

/* JADX INFO: loaded from: classes2.dex */
public final class h4 extends w4 {

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final /* synthetic */ int f20945h;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h4(y3 y3Var, ea eaVar, int i10, int i11) {
        super(y3Var, "w1mRpvC09hSNbQ10UvFXagm2P4TWR/T2KztJ+buPFQZnRnjxpdFVScAm9trUP6jM", "1tXSieficgPhud4YihA+CzunTIb+yA05iyb1BkAzMoc=", eaVar, i10, 89);
        this.f20945h = i11;
        switch (i11) {
            case 1:
                super(y3Var, "6vt+8E5GP5AwoxquDM0Y7lVJzS23/VCjNo5D8xB8rgAaaF6IhToGZhlIAUkgigHl", "jx9F7EAIAhvEI8G+/hWsHBitt0z+K8moFRn7/w45eYc=", eaVar, i10, 49);
                break;
            case 2:
                super(y3Var, "C6OPKdOx6rUdfDdOmaUimt8yM1FrOv7bKCITdJ0Uo74WwXDfvXouJ4oz4kHBjTSk", "dTWRHHPyYq/fNXOTAS/wjayGzv2SlrSwyDcB+vX+h5Q=", eaVar, i10, 5);
                break;
            case 3:
                super(y3Var, "ysEnh8zkgcN8WwINs5FP7vGybZW2TtVSX36HO6emvdUrcCkVbC9hrF5Pe5ZSZx3i", "3LpdW89cIASEFv5WvS5ZDEWsiVGQitP33SL3WZgJ6zE=", eaVar, i10, 24);
                break;
            case 4:
                super(y3Var, "AZwRbSS9Tjg/vY6NNyDfd3mU35mZBbQduzRpliDRt3qUNjlKylmreq0JkiCiO6dF", "lsjUo68NMWNsPUz4dBIEYtWAZHRXaEljQLBgt48XQs4=", eaVar, i10, 76);
                break;
            case 5:
                super(y3Var, "Ls+ZUCEdSGy+47NpfWc5WNy2WCTB2lhysvWY8PCvkdyqiw8HkO3XVSxwPIsY4tvv", "1yJaDnXEM3em29nHb3kYjIOvpW6Mkce5Fji3syGd7T0=", eaVar, i10, 12);
                break;
            case 6:
                super(y3Var, "vkfQoQl1Rxr7/uvSSRcOrQI31A6S/KAPW33nf5P0hYbuVy6BLjHzjUB4OEnneXoS", "SfaCE2ReDSQ3+KDKcvA6SSrX7nuWYsM/FN3ZFmlH0dA=", eaVar, i10, 3);
                break;
            case 7:
                super(y3Var, "WepZYnT/MXyJE28LKN26NT6D3mAA2J2spDFApE1ixrQxTNXRg7wshW7BC/EU90LT", "sjYkfzJTuYKxh1jvZaP9n5dx9JGmzJotOUC/vdvgi4M=", eaVar, i10, 73);
                break;
            case 8:
                super(y3Var, "sdX902x/AS9226TxUXaqji9wP1uHqRQA8nkg2YMN1TcruTTaw008l9z5V3jZGjLO", "z3i9M2k4RJ/f7GArNBcGbUcpUFpuRmLev6S20UO7Vqs=", eaVar, i10, 51);
                break;
            case 9:
                super(y3Var, "6CWPidOWJZFxRWI8V7yi3OiMbOhIWZX/jTayTGRwqCM0W8dtKHQOPe60TuQicfhG", "gYPijpNio6OwLgbzbH6IuWSNtvp7bCV5UMbKZJCVNdg=", eaVar, i10, 48);
                break;
            default:
                break;
        }
    }

    private final void c() {
        String str = (String) this.f21307e.invoke(null, new Object[0]);
        synchronized (this.f21306d) {
            ea eaVar = this.f21306d;
            if (eaVar.f20700c) {
                eaVar.i();
                eaVar.f20700c = false;
            }
            l1.S((l1) eaVar.f20699b, str);
        }
    }

    private final void d() {
        ea eaVar = this.f21306d;
        if (eaVar.f20700c) {
            eaVar.i();
            eaVar.f20700c = false;
        }
        l1.k0((l1) eaVar.f20699b, -1L);
        ea eaVar2 = this.f21306d;
        if (eaVar2.f20700c) {
            eaVar2.i();
            eaVar2.f20700c = false;
        }
        l1.l0((l1) eaVar2.f20699b, -1L);
        int[] iArr = (int[]) this.f21307e.invoke(null, this.f21303a.f21348a);
        synchronized (this.f21306d) {
            try {
                ea eaVar3 = this.f21306d;
                long j10 = iArr[0];
                if (eaVar3.f20700c) {
                    eaVar3.i();
                    eaVar3.f20700c = false;
                }
                l1.k0((l1) eaVar3.f20699b, j10);
                ea eaVar4 = this.f21306d;
                long j11 = iArr[1];
                if (eaVar4.f20700c) {
                    eaVar4.i();
                    eaVar4.f20700c = false;
                }
                l1.l0((l1) eaVar4.f20699b, j11);
                int i10 = iArr[2];
                if (i10 != Integer.MIN_VALUE) {
                    ea eaVar5 = this.f21306d;
                    long j12 = i10;
                    if (eaVar5.f20700c) {
                        eaVar5.i();
                        eaVar5.f20700c = false;
                    }
                    l1.G((l1) eaVar5.f20699b, j12);
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // com.google.android.gms.internal.pal.w4
    public final void a() throws InvocationTargetException {
        switch (this.f20945h) {
            case 0:
                c();
                return;
            case 1:
                ea eaVar = this.f21306d;
                if (eaVar.f20700c) {
                    eaVar.i();
                    eaVar.f20700c = false;
                }
                l1.Z((l1) eaVar.f20699b, 3);
                try {
                    if (true == ((Boolean) this.f21307e.invoke(null, this.f21303a.f21348a)).booleanValue()) {
                        i = 2;
                    }
                    if (eaVar.f20700c) {
                        eaVar.i();
                        eaVar.f20700c = false;
                    }
                    l1.Z((l1) eaVar.f20699b, i);
                    return;
                } catch (InvocationTargetException e10) {
                    if (!(e10.getTargetException() instanceof Settings.SettingNotFoundException)) {
                        throw e10;
                    }
                    return;
                }
            case 2:
                d();
                return;
            case 3:
                if (this.f21303a.f21360m) {
                    e();
                    return;
                }
                synchronized (this.f21306d) {
                    this.f21306d.m((String) this.f21307e.invoke(null, this.f21303a.f21348a));
                    break;
                }
                return;
            case 4:
                i = true == ((Boolean) this.f21307e.invoke(null, this.f21303a.f21348a)).booleanValue() ? 2 : 1;
                ea eaVar2 = this.f21306d;
                if (eaVar2.f20700c) {
                    eaVar2.i();
                    eaVar2.f20700c = false;
                }
                l1.c0((l1) eaVar2.f20699b, i);
                return;
            case 5:
                ea eaVar3 = this.f21306d;
                if (eaVar3.f20700c) {
                    eaVar3.i();
                    eaVar3.f20700c = false;
                }
                l1.n0((l1) eaVar3.f20699b, -1L);
                long jLongValue = ((Long) this.f21307e.invoke(null, this.f21303a.f21348a)).longValue();
                if (eaVar3.f20700c) {
                    eaVar3.i();
                    eaVar3.f20700c = false;
                }
                l1.n0((l1) eaVar3.f20699b, jLongValue);
                return;
            case 6:
                String str = (String) this.f21307e.invoke(null, this.f21303a.f21348a, Boolean.valueOf(((Boolean) f5.f20904d.f20907c.b(l5.f21048m)).booleanValue()));
                r3 r3Var = new r3();
                r3Var.f21177a = -1L;
                r3Var.f21178b = -1L;
                HashMap mapA = z2.a(str);
                if (mapA != null) {
                    r3Var.f21177a = ((Long) mapA.get(0)).longValue();
                    r3Var.f21178b = ((Long) mapA.get(1)).longValue();
                }
                synchronized (this.f21306d) {
                    ea eaVar4 = this.f21306d;
                    long j10 = r3Var.f21177a;
                    if (eaVar4.f20700c) {
                        eaVar4.i();
                        eaVar4.f20700c = false;
                    }
                    l1.j0((l1) eaVar4.f20699b, j10);
                    ea eaVar5 = this.f21306d;
                    long j11 = r3Var.f21178b;
                    if (eaVar5.f20700c) {
                        eaVar5.i();
                        eaVar5.f20700c = false;
                    }
                    l1.H((l1) eaVar5.f20699b, j11);
                    break;
                }
                return;
            case 7:
                ea eaVar6 = this.f21306d;
                try {
                    if (true == ((Boolean) this.f21307e.invoke(null, this.f21303a.f21348a)).booleanValue()) {
                        i = 2;
                    }
                    if (eaVar6.f20700c) {
                        eaVar6.i();
                        eaVar6.f20700c = false;
                    }
                    l1.b0((l1) eaVar6.f20699b, i);
                    return;
                } catch (InvocationTargetException unused) {
                    if (eaVar6.f20700c) {
                        eaVar6.i();
                        eaVar6.f20700c = false;
                    }
                    l1.b0((l1) eaVar6.f20699b, 3);
                    return;
                }
            case 8:
                synchronized (this.f21306d) {
                    String str2 = (String) this.f21307e.invoke(null, new Object[0]);
                    v3 v3Var = new v3();
                    HashMap mapA2 = z2.a(str2);
                    if (mapA2 != null) {
                        v3Var.f21267a = (Long) mapA2.get(0);
                        v3Var.f21268b = (Long) mapA2.get(1);
                    }
                    ea eaVar7 = this.f21306d;
                    long jLongValue2 = v3Var.f21267a.longValue();
                    if (eaVar7.f20700c) {
                        eaVar7.i();
                        eaVar7.f20700c = false;
                    }
                    l1.y((l1) eaVar7.f20699b, jLongValue2);
                    ea eaVar8 = this.f21306d;
                    long jLongValue3 = v3Var.f21268b.longValue();
                    if (eaVar8.f20700c) {
                        eaVar8.i();
                        eaVar8.f20700c = false;
                    }
                    l1.z((l1) eaVar8.f20699b, jLongValue3);
                    break;
                }
                return;
            default:
                this.f21306d.k(3);
                boolean zBooleanValue = ((Boolean) this.f21307e.invoke(null, this.f21303a.f21348a)).booleanValue();
                synchronized (this.f21306d) {
                    try {
                        if (zBooleanValue) {
                            this.f21306d.k(2);
                        } else {
                            this.f21306d.k(1);
                        }
                    } finally {
                    }
                    break;
                }
                return;
        }
    }

    @Override // com.google.android.gms.internal.pal.w4
    public final void b() {
        switch (this.f20945h) {
            case 3:
                y3 y3Var = this.f21303a;
                if (y3Var.f21363p) {
                    super.b();
                } else if (y3Var.f21360m) {
                    e();
                }
                break;
            default:
                super.b();
                break;
        }
    }

    @Override // com.google.android.gms.internal.pal.w4, java.util.concurrent.Callable
    public final /* bridge */ /* synthetic */ Object call() {
        switch (this.f20945h) {
            case 3:
                b();
                break;
            default:
                b();
                break;
        }
        return null;
    }

    public final void e() {
        Future future;
        y3 y3Var = this.f21303a;
        com.google.android.gms.ads.identifier.b bVar = null;
        if (y3Var.f21354g) {
            if (y3Var.f21353f == null && (future = y3Var.f21355h) != null) {
                try {
                    future.get(ExoPlayer.DEFAULT_DETACH_SURFACE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
                    y3Var.f21355h = null;
                } catch (InterruptedException | ExecutionException unused) {
                } catch (TimeoutException unused2) {
                    y3Var.f21355h.cancel(true);
                }
            }
            bVar = y3Var.f21353f;
        }
        if (bVar == null) {
            return;
        }
        try {
            com.google.android.gms.ads.identifier.a aVarE = bVar.e();
            String strB = a4.b(aVarE.getId());
            if (strB != null) {
                synchronized (this.f21306d) {
                    this.f21306d.m(strB);
                    ea eaVar = this.f21306d;
                    boolean z10 = aVarE.f7871a;
                    if (eaVar.f20700c) {
                        eaVar.i();
                        eaVar.f20700c = false;
                    }
                    l1.U((l1) eaVar.f20699b, z10);
                    ea eaVar2 = this.f21306d;
                    if (eaVar2.f20700c) {
                        eaVar2.i();
                        eaVar2.f20700c = false;
                    }
                    l1.d0((l1) eaVar2.f20699b);
                }
            }
        } catch (IOException unused3) {
        }
    }
}
