package e;

import android.app.Activity;
import android.app.job.JobParameters;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.SurfaceTexture;
import android.graphics.Typeface;
import android.graphics.YuvImage;
import android.media.metrics.NetworkEvent;
import android.media.metrics.PlaybackErrorEvent;
import android.media.metrics.PlaybackMetrics;
import android.media.metrics.PlaybackStateEvent;
import android.media.metrics.TrackChangeEvent;
import android.os.Process;
import android.os.StrictMode;
import android.view.View;
import androidx.fragment.app.strictmode.Violation;
import androidx.media3.common.SimpleBasePlayer;
import androidx.media3.common.audio.AudioManagerCompat;
import androidx.media3.common.util.ConditionVariable;
import androidx.media3.exoplayer.analytics.MediaMetricsListener;
import androidx.media3.exoplayer.audio.AudioRendererEventListener;
import androidx.media3.exoplayer.video.spherical.SphericalGLSurfaceView;
import androidx.media3.ui.PlayerView;
import com.google.android.datatransport.runtime.scheduling.jobscheduling.JobInfoSchedulerService;
import com.google.android.gms.internal.ads.cv1;
import com.google.android.gms.internal.ads.dg;
import com.google.android.gms.internal.measurement.i1;
import com.google.common.collect.ImmutableCollection;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.zxing.ResultMetadataType;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Iterator;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.Callable;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class t implements Runnable {

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

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ Object f25327b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ Object f25328c;

    public /* synthetic */ t(u uVar, Runnable runnable) {
        this.f25326a = 16;
        this.f25328c = runnable;
        this.f25327b = uVar;
    }

    @Override // java.lang.Runnable
    public final void run() {
        u uVar;
        oa.a aVar;
        int i10 = 0;
        String absolutePath = null;
        switch (this.f25326a) {
            case 0:
                uVar = (u) this.f25327b;
                Runnable runnable = (Runnable) this.f25328c;
                uVar.getClass();
                try {
                    runnable.run();
                    return;
                } finally {
                }
            case 1:
                a0.d0 d0Var = (a0.d0) this.f25327b;
                View[] viewArr = (View[]) this.f25328c;
                if (d0Var.f59p != -1) {
                    for (View view : viewArr) {
                        view.setTag(d0Var.f59p, Long.valueOf(System.nanoTime()));
                    }
                }
                if (d0Var.f60q != -1) {
                    int length = viewArr.length;
                    while (i10 < length) {
                        viewArr[i10].setTag(d0Var.f60q, null);
                        i10++;
                    }
                    return;
                }
                return;
            case 2:
                ((i0.p) this.f25327b).b((Typeface) this.f25328c);
                return;
            case 3:
            case 22:
            default:
                mc.j jVar = (mc.j) this.f25327b;
                mc.b bVar = (mc.b) this.f25328c;
                mc.k kVar = jVar.f30607a;
                boolean z10 = kVar.f30612d;
                Activity activity = kVar.f30609a;
                if (z10) {
                    mc.w wVar = bVar.f30596b;
                    dg dgVar = wVar.f30647a;
                    Rect rect = new Rect(0, 0, dgVar.f10392c, dgVar.f10393d);
                    YuvImage yuvImage = new YuvImage(dgVar.f10391b, wVar.f30648b, dgVar.f10392c, dgVar.f10393d, null);
                    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
                    yuvImage.compressToJpeg(rect, 90, byteArrayOutputStream);
                    byte[] byteArray = byteArrayOutputStream.toByteArray();
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.inSampleSize = 2;
                    Bitmap bitmapDecodeByteArray = BitmapFactory.decodeByteArray(byteArray, 0, byteArray.length, options);
                    int i11 = wVar.f30649c;
                    if (i11 != 0) {
                        Matrix matrix = new Matrix();
                        matrix.postRotate(i11);
                        bitmapDecodeByteArray = Bitmap.createBitmap(bitmapDecodeByteArray, 0, 0, bitmapDecodeByteArray.getWidth(), bitmapDecodeByteArray.getHeight(), matrix, false);
                    }
                    try {
                        File fileCreateTempFile = File.createTempFile("barcodeimage", ".jpg", activity.getCacheDir());
                        FileOutputStream fileOutputStream = new FileOutputStream(fileCreateTempFile);
                        bitmapDecodeByteArray.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
                        fileOutputStream.close();
                        absolutePath = fileCreateTempFile.getAbsolutePath();
                    } catch (IOException e10) {
                        e10.toString();
                    }
                    break;
                }
                Intent intent = new Intent("com.google.zxing.client.android.SCAN");
                intent.addFlags(524288);
                intent.putExtra("SCAN_RESULT", bVar.f30595a.f31467a);
                ob.f fVar = bVar.f30595a;
                intent.putExtra("SCAN_RESULT_FORMAT", fVar.f31470d.toString());
                byte[] bArr = fVar.f31468b;
                if (bArr != null && bArr.length > 0) {
                    intent.putExtra("SCAN_RESULT_BYTES", bArr);
                }
                Map map = fVar.f31471e;
                if (map != null) {
                    ResultMetadataType resultMetadataType = ResultMetadataType.f24340i;
                    if (map.containsKey(resultMetadataType)) {
                        intent.putExtra("SCAN_RESULT_UPC_EAN_EXTENSION", map.get(resultMetadataType).toString());
                    }
                    Number number = (Number) map.get(ResultMetadataType.f24332a);
                    if (number != null) {
                        intent.putExtra("SCAN_RESULT_ORIENTATION", number.intValue());
                    }
                    String str = (String) map.get(ResultMetadataType.f24334c);
                    if (str != null) {
                        intent.putExtra("SCAN_RESULT_ERROR_CORRECTION_LEVEL", str);
                    }
                    Iterable iterable = (Iterable) map.get(ResultMetadataType.f24333b);
                    if (iterable != null) {
                        Iterator it = iterable.iterator();
                        while (it.hasNext()) {
                            intent.putExtra("SCAN_RESULT_BYTE_SEGMENTS_" + i10, (byte[]) it.next());
                            i10++;
                        }
                    }
                }
                if (absolutePath != null) {
                    intent.putExtra("SCAN_RESULT_IMAGE_PATH", absolutePath);
                }
                activity.setResult(-1, intent);
                kVar.a();
                return;
            case 4:
                Violation violation = (Violation) this.f25328c;
                j1.a aVar2 = j1.b.f28545a;
                nb.g.i(violation, "$violation");
                throw violation;
            case 5:
                androidx.lifecycle.e eVar = (androidx.lifecycle.e) this.f25327b;
                Runnable runnable2 = (Runnable) this.f25328c;
                nb.g.i(eVar, "this$0");
                nb.g.i(runnable2, "$runnable");
                if (!((Queue) eVar.f2649d).offer(runnable2)) {
                    throw new IllegalStateException("cannot enqueue any more runnables".toString());
                }
                eVar.a();
                return;
            case 6:
                ((SimpleBasePlayer) this.f25327b).lambda$updateStateForPendingOperation$62((com.google.common.util.concurrent.w) this.f25328c);
                return;
            case 7:
                AudioManagerCompat.lambda$getAudioManager$0((Context) this.f25327b, (ConditionVariable) this.f25328c);
                return;
            case 8:
                ((MediaMetricsListener) this.f25327b).lambda$maybeReportPlaybackError$0((PlaybackErrorEvent) this.f25328c);
                return;
            case 9:
                ((MediaMetricsListener) this.f25327b).lambda$reportTrackChangeEvent$3((TrackChangeEvent) this.f25328c);
                return;
            case 10:
                ((MediaMetricsListener) this.f25327b).lambda$finishCurrentSession$4((PlaybackMetrics) this.f25328c);
                return;
            case 11:
                ((MediaMetricsListener) this.f25327b).lambda$maybeReportPlaybackStateChange$2((PlaybackStateEvent) this.f25328c);
                return;
            case 12:
                ((MediaMetricsListener) this.f25327b).lambda$maybeReportNetworkChange$1((NetworkEvent) this.f25328c);
                return;
            case 13:
                ((AudioRendererEventListener.EventDispatcher) this.f25327b).lambda$decoderReleased$5((String) this.f25328c);
                return;
            case 14:
                ((SphericalGLSurfaceView) this.f25327b).lambda$onSurfaceTextureAvailable$1((SurfaceTexture) this.f25328c);
                return;
            case 15:
                ((PlayerView) this.f25327b).lambda$onImageAvailable$1((Bitmap) this.f25328c);
                return;
            case 16:
                Runnable runnable3 = (Runnable) this.f25328c;
                uVar = (u) this.f25327b;
                try {
                    runnable3.run();
                    return;
                } finally {
                }
            case 17:
                e4.i iVar = (e4.i) this.f25327b;
                androidx.window.layout.n nVar = (androidx.window.layout.n) this.f25328c;
                nb.g.i(iVar, "this$0");
                nb.g.i(nVar, "$newLayoutInfo");
                iVar.f25464c.accept(nVar);
                return;
            case 18:
                ((JobInfoSchedulerService) this.f25327b).lambda$onStartJob$0((JobParameters) this.f25328c);
                return;
            case 19:
                com.google.common.util.concurrent.m mVar = (com.google.common.util.concurrent.m) this.f25327b;
                ImmutableCollection immutableCollection = (ImmutableCollection) this.f25328c;
                cv1 cv1Var = com.google.common.util.concurrent.m.Q;
                mVar.q(immutableCollection);
                return;
            case 20:
                com.google.firebase.components.o oVar = (com.google.firebase.components.o) this.f25327b;
                gb.a aVar3 = (gb.a) this.f25328c;
                if (oVar.f24039b != com.google.firebase.components.o.f24037d) {
                    throw new IllegalStateException("provide() can be called only once.");
                }
                synchronized (oVar) {
                    aVar = oVar.f24038a;
                    oVar.f24038a = null;
                    oVar.f24039b = aVar3;
                    break;
                }
                aVar.getClass();
                return;
            case 21:
                com.google.firebase.components.n nVar2 = (com.google.firebase.components.n) this.f25327b;
                gb.a aVar4 = (gb.a) this.f25328c;
                synchronized (nVar2) {
                    try {
                        if (nVar2.f24035b == null) {
                            nVar2.f24034a.add(aVar4);
                        } else {
                            nVar2.f24035b.add(aVar4.get());
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
                return;
            case 23:
                ya.a aVar5 = (ya.a) this.f25327b;
                Runnable runnable4 = (Runnable) this.f25328c;
                Process.setThreadPriority(aVar5.f36904c);
                StrictMode.ThreadPolicy threadPolicy = aVar5.f36905d;
                if (threadPolicy != null) {
                    StrictMode.setThreadPolicy(threadPolicy);
                }
                runnable4.run();
                return;
            case 24:
                Callable callable = (Callable) this.f25327b;
                nb.c cVar = (nb.c) this.f25328c;
                try {
                    Object objCall = callable.call();
                    ya.h hVar = (ya.h) cVar.f31183b;
                    int i12 = ya.h.f36925f;
                    hVar.set(objCall);
                    return;
                } catch (Exception e11) {
                    ya.h hVar2 = (ya.h) cVar.f31183b;
                    int i13 = ya.h.f36925f;
                    hVar2.h(e11);
                    return;
                }
            case 25:
                ((i1) this.f25327b).a((Intent) this.f25328c);
                return;
            case 26:
                FirebaseMessaging firebaseMessaging = (FirebaseMessaging) this.f25327b;
                w8.i iVar2 = (w8.i) this.f25328c;
                com.google.firebase.messaging.d0 d0Var2 = FirebaseMessaging.f24118l;
                firebaseMessaging.getClass();
                try {
                    iVar2.setResult(firebaseMessaging.a());
                    return;
                } catch (Exception e12) {
                    iVar2.a(e12);
                    return;
                }
            case 27:
                com.google.firebase.messaging.q qVar = (com.google.firebase.messaging.q) this.f25327b;
                w8.i iVar3 = (w8.i) this.f25328c;
                qVar.getClass();
                try {
                    iVar3.setResult(qVar.e());
                    return;
                } catch (Exception e13) {
                    iVar3.a(e13);
                    return;
                }
            case 28:
                ((lc.a) this.f25327b).f30206b.success(this.f25328c);
                return;
        }
    }

    public /* synthetic */ t(Object obj, Object obj2, int i10) {
        this.f25326a = i10;
        this.f25327b = obj;
        this.f25328c = obj2;
    }
}
