package s1;

import android.net.Uri;
import android.os.Process;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/* JADX INFO: loaded from: classes.dex */
public final class h extends Thread {

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

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

    public h(HashMap map) {
        this.f32645b = map;
    }

    @Override // java.lang.Thread, java.lang.Runnable
    public final void run() {
        int i10 = this.f32644a;
        Object obj = this.f32645b;
        switch (i10) {
            case 0:
                i.access$000((i) obj);
                return;
            case 1:
                Process.setThreadPriority(9);
                super.run();
                return;
            default:
                Map map = (Map) obj;
                Uri.Builder builderBuildUpon = Uri.parse("https://pagead2.googlesyndication.com/pagead/gen_204?id=gmob-apps").buildUpon();
                for (String str : map.keySet()) {
                    builderBuildUpon.appendQueryParameter(str, (String) map.get(str));
                }
                String string = builderBuildUpon.build().toString();
                try {
                    HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(string).openConnection();
                    try {
                        int responseCode = httpURLConnection.getResponseCode();
                        if (responseCode < 200 || responseCode >= 300) {
                            new StringBuilder(String.valueOf(string).length() + 65);
                            break;
                        }
                        httpURLConnection.disconnect();
                        return;
                    } catch (Throwable th) {
                        httpURLConnection.disconnect();
                        throw th;
                    }
                } catch (IOException e10) {
                    e = e10;
                    String message = e.getMessage();
                    new StringBuilder(String.valueOf(message).length() + String.valueOf(string).length() + 27);
                    return;
                } catch (IndexOutOfBoundsException e11) {
                    String message2 = e11.getMessage();
                    new StringBuilder(String.valueOf(message2).length() + String.valueOf(string).length() + 32);
                    return;
                } catch (RuntimeException e12) {
                    e = e12;
                    String message3 = e.getMessage();
                    new StringBuilder(String.valueOf(message3).length() + String.valueOf(string).length() + 27);
                    return;
                } finally {
                }
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h(i iVar) {
        super("ExoPlayer:SimpleDecoder");
        this.f32645b = iVar;
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public h(com.bumptech.glide.load.engine.a aVar, Runnable runnable) {
        super(runnable);
        this.f32645b = aVar;
    }
}
