Snaptube v4.40.0.4401610版本的 MD5 值为:ca2b95dcff63007195db02a6c93091b9

以下内容为反编译后的 azh.java 源代码,内容仅作参考


package o;

import android.content.Context;
import android.net.Uri;
import android.os.Handler;
import android.os.Looper;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.util.Log;
import com.mobvista.msdk.base.common.constant.ShowAndLoadErrorConstant;
import com.snaptube.extractor.pluginlib.common.HttpException;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
public class azh {
    private static volatile azh f16084;
    private volatile Boolean f16085;
    private Context f16093;
    private Runnable f16086 = new Runnable() {
        @Override
        public void run() {
            if (!azh.this.f16088 && azh.this.f16085 == null) {
                azh.this.f16088 = true;
                new Thread(azh.this.f16091).start();
            }
        }
    };
    private Runnable f16091 = new Runnable() {
        @Override
        public void run() {
            int statusCode;
            String str;
            cfe m16325;
            try {
                if (azh.this.f16093 != null) {
                    str = ((TelephonyManager) azh.this.f16093.getSystemService("phone")).getNetworkCountryIso();
                } else {
                    Log.w("AvailabilityChecker", ShowAndLoadErrorConstant.CONTEXT_IS_NULL);
                    str = "";
                }
                Log.i("AvailabilityChecker", "networkCountryIso is " + str);
                Uri parse = Uri.parse("http://www.snappea.com/api/availability");
                if (!TextUtils.isEmpty(str)) {
                    parse = parse.buildUpon().appendQueryParameter("networkCountryIso", str.toUpperCase()).build();
                }
                m16325 = bal.m16325(parse.toString(), null, null);
            } catch (HttpException e) {
                statusCode = e.getStatusCode();
            } catch (Throwable th) {
                Log.w("AvailabilityChecker", "request availability api failed", th);
            }
            if (m16325 != null) {
                statusCode = m16325.m20558();
                if (statusCode != 418 || statusCode == 200 || statusCode == 204) {
                    azh.this.f16085 = Boolean.valueOf(statusCode != 418);
                    ban.m16328(azh.this.f16093, azh.this.f16085.booleanValue());
                    Log.d("AvailabilityChecker", "Availability: " + azh.this.f16085);
                } else {
                    azh.this.f16085 = Boolean.valueOf(ban.m16329(azh.this.f16093));
                }
                azh.this.f16087.post(azh.this.f16092);
            }
            statusCode = 0;
            if (statusCode != 418) {
            }
            azh.this.f16085 = Boolean.valueOf(statusCode != 418);
            ban.m16328(azh.this.f16093, azh.this.f16085.booleanValue());
            Log.d("AvailabilityChecker", "Availability: " + azh.this.f16085);
            azh.this.f16087.post(azh.this.f16092);
        }
    };
    private Runnable f16092 = new Runnable() {
        @Override
        public void run() {
            azh.this.f16088 = false;
            if (azh.this.f16085 == null) {
                azh.this.m16102();
            } else {
                azh.this.f16090.countDown();
            }
        }
    };
    private final Handler f16087 = new Handler(Looper.getMainLooper());
    private int f16089 = 1;
    private boolean f16088 = false;
    private CountDownLatch f16090 = new CountDownLatch(1);

    private azh(Context context) {
        m16108();
        if (context != null) {
            this.f16093 = context.getApplicationContext();
        }
    }

    public static azh m16097(Context context) {
        if (f16084 == null) {
            synchronized (azh.class) {
                if (f16084 == null) {
                    f16084 = new azh(context);
                }
            }
        }
        return f16084;
    }

    public boolean m16105() {
        if (this.f16085 == null) {
            throw new IllegalStateException();
        }
        return this.f16085.booleanValue();
    }

    public boolean m16107(boolean z) {
        return this.f16085 == null ? z : this.f16085.booleanValue();
    }

    public void m16108() {
        if (this.f16085 == null) {
            this.f16087.post(this.f16086);
        }
    }

    public void m16102() {
        this.f16089 = Math.min(this.f16089 * 2, 512);
        this.f16087.postDelayed(this.f16086, this.f16089 * 1000);
    }

    public boolean m16106(long j) {
        if (this.f16085 != null) {
            return true;
        }
        m16108();
        try {
            return this.f16090.await(j, TimeUnit.MILLISECONDS);
        } catch (InterruptedException e) {
            return false;
        }
    }
}