小源钱包 v1.0.0版本的 MD5 值为:2fddb51fa9867693f901004082511bea

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


package com.mobile.auth.gatewayauth.detectnet;

import android.content.Context;
import android.net.Network;
import android.os.Build;
import android.text.TextUtils;
import com.mobile.auth.d.e;
import com.mobile.auth.gatewayauth.ExceptionProcessor;
import com.mobile.auth.gatewayauth.utils.g;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class e {
    private static volatile e f15686a;
    private String f15692g;
    private String f15693h;
    private AtomicBoolean f15688c = new AtomicBoolean(false);
    private int f15690e = 3;
    private int f15691f = 2;
    private ExecutorService f15687b = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, new ArrayBlockingQueue(3), new ThreadPoolExecutor.CallerRunsPolicy());
    private ConcurrentHashMap<String, String> f15689d = new ConcurrentHashMap<>();

    public e() {
        this.f15693h = "eco.taobao.com";
        try {
            this.f15693h = new URL("https://dypnsapi.aliyuncs.com/?").getHost();
        } catch (MalformedURLException unused) {
        }
    }

    static DetectResult a(e eVar, String str, DetectResult detectResult) {
        try {
            return eVar.b(str, detectResult);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private DetectResult a(String str, DetectResult detectResult) {
        try {
            g.a("pingNet: ping检测top默认");
            c a10 = a(str, this.f15693h);
            detectResult.setTopConnected(a10.a());
            if (a10.a()) {
                detectResult.setTopWholeMS(a10.b());
            } else {
                detectResult.setTopWholeMS(0L);
            }
            return detectResult;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public static e a() {
        try {
            if (f15686a == null) {
                synchronized (e.class) {
                    if (f15686a == null) {
                        f15686a = new e();
                    }
                }
            }
            return f15686a;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    static AtomicBoolean a(e eVar) {
        try {
            return eVar.f15688c;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private void a(Context context, final String str, final a aVar) {
        DetectResult cuCellularConnected;
        try {
            g.a("pingNet:检测 默认网络和蜂窝网络");
            final DetectResult detectResult = new DetectResult();
            detectResult.setRequestIds(this.f15689d.keySet()).setSessionIds(this.f15689d.values());
            a(str, detectResult);
            com.mobile.auth.d.e eVar = new com.mobile.auth.d.e();
            if (Build.VERSION.SDK_INT >= 21) {
                eVar.a(context, new e.a() {
                    @Override
                    public void a() {
                        try {
                            g.a("pingNet:切换蜂窝网络超时!");
                            detectResult.setTopCellularConnected(false).setTopCellularWholeMS(0L).setCuCellularConnected(false).setCuCellularWholeMS(0L);
                            e.a(e.this).set(false);
                            a aVar2 = aVar;
                            if (aVar2 != null) {
                                aVar2.a(detectResult);
                            }
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                            }
                        }
                    }

                    @Override
                    public void a(int i10, String str2, long j10) {
                        try {
                            g.a("pingNet:切换蜂窝网络失败!");
                            detectResult.setTopCellularConnected(false).setTopCellularWholeMS(0L).setCuCellularConnected(false).setCuCellularWholeMS(0L);
                            e.a(e.this).set(false);
                            a aVar2 = aVar;
                            if (aVar2 != null) {
                                aVar2.a(detectResult);
                            }
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                            }
                        }
                    }

                    @Override
                    public void a(Network network, long j10) {
                        try {
                            g.a("pingNet:切换蜂窝网络成功!");
                            e.a(e.this, str, detectResult);
                            e.b(e.this, str, detectResult);
                            e.a(e.this).set(false);
                            a aVar2 = aVar;
                            if (aVar2 != null) {
                                aVar2.a(detectResult);
                            }
                        } catch (Throwable th) {
                            try {
                                ExceptionProcessor.processException(th);
                            } catch (Throwable th2) {
                                ExceptionProcessor.processException(th2);
                            }
                        }
                    }
                });
                return;
            }
            boolean a10 = eVar.a(context, this.f15693h);
            g.a("pingNet:系统5.0以下切换蜂窝网络是否成功:".concat(String.valueOf(a10)));
            if (a10) {
                b(str, detectResult);
                c(str, detectResult);
            } else {
                detectResult.setTopCellularConnected(false).setTopCellularWholeMS(0L);
            }
            if (TextUtils.isEmpty(this.f15692g)) {
                cuCellularConnected = detectResult.setCuCellularConnected(false);
            } else if (eVar.a(context, this.f15692g)) {
                c(str, detectResult);
                this.f15688c.set(false);
                if (aVar == null) {
                    aVar.a(detectResult);
                    return;
                }
                return;
            } else {
                cuCellularConnected = detectResult.setCuCellularConnected(false);
            }
            cuCellularConnected.setCuCellularWholeMS(0L);
            this.f15688c.set(false);
            if (aVar == null) {
            }
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    static void a(e eVar, Context context, String str, a aVar) {
        try {
            eVar.a(context, str, aVar);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }

    static DetectResult b(e eVar, String str, DetectResult detectResult) {
        try {
            return eVar.c(str, detectResult);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private DetectResult b(String str, DetectResult detectResult) {
        try {
            g.a("pingNet: ping检测top蜂窝");
            c a10 = a(str, this.f15693h);
            detectResult.setTopCellularConnected(a10.a());
            if (a10.a()) {
                detectResult.setTopCellularWholeMS(a10.b());
            } else {
                detectResult.setTopCellularWholeMS(0L);
            }
            return detectResult;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    static ConcurrentHashMap b(e eVar) {
        try {
            return eVar.f15689d;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    static DetectResult c(e eVar, String str, DetectResult detectResult) {
        try {
            return eVar.a(str, detectResult);
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    private DetectResult c(String str, DetectResult detectResult) {
        try {
            g.a("pingNet: ping检测蜂窝");
            if (TextUtils.isEmpty(this.f15692g)) {
                detectResult.setCuCellularConnected(false).setCuCellularWholeMS(0L);
            } else {
                c a10 = a(str, this.f15692g);
                detectResult.setCuCellularConnected(a10.a());
                if (a10.a()) {
                    detectResult.setCuCellularWholeMS(a10.b());
                } else {
                    detectResult.setCuCellularWholeMS(0L);
                }
            }
            return detectResult;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public c a(String str, String str2) {
        try {
            g.a("pingNet:" + str + " ping start");
            c cVar = new c();
            int i10 = 0;
            while (i10 < this.f15691f) {
                cVar = d.a(str2, this.f15690e);
                g.a("pingNet:第" + i10 + "次 result:" + cVar.toString());
                i10++;
                if (cVar.a()) {
                    break;
                }
            }
            g.a("pingNet:" + str + " ping stop");
            g.a("pingNet:" + str + " 总共 ping了:" + i10 + "次");
            return cVar;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public e a(String str) {
        try {
            this.f15692g = str;
            return this;
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
                return null;
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
                return null;
            }
        }
    }

    public void a(final Context context, final String str, final String str2, final a aVar) {
        try {
            g.a("pingNet:" + str + " startDetect");
            this.f15687b.execute(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (!e.a(e.this).compareAndSet(false, true)) {
                            g.a("pingNet:" + str + " 已经有检测在实施:" + e.b(e.this).toString());
                            e.b(e.this).put(str, str2);
                            return;
                        }
                        e.b(e.this).clear();
                        e.b(e.this).put(str, str2);
                        if (com.mobile.auth.gatewayauth.utils.b.i(context)) {
                            g.a("pingNet:纯蜂窝网络连接");
                            DetectResult detectResult = new DetectResult();
                            detectResult.setRequestIds(e.b(e.this).keySet()).setSessionIds(e.b(e.this).values());
                            DetectResult b10 = e.b(e.this, str, e.a(e.this, str, detectResult));
                            b10.setTopConnected(false).setTopWholeMS(0L);
                            e.a(e.this).set(false);
                            a aVar2 = aVar;
                            if (aVar2 != null) {
                                aVar2.a(b10);
                            }
                        } else if (com.mobile.auth.gatewayauth.utils.b.e(context)) {
                            g.a("pingNet:wifi+蜂窝网络");
                            e.a(e.this, context, str, aVar);
                        } else {
                            g.a("pingNet:纯wifi");
                            DetectResult detectResult2 = new DetectResult();
                            detectResult2.setRequestIds(e.b(e.this).keySet()).setSessionIds(e.b(e.this).values());
                            e.c(e.this, str, detectResult2);
                            detectResult2.setTopCellularConnected(false).setTopCellularWholeMS(0L).setCuCellularConnected(false).setCuCellularWholeMS(0L);
                            e.a(e.this).set(false);
                            a aVar3 = aVar;
                            if (aVar3 != null) {
                                aVar3.a(detectResult2);
                            }
                        }
                    } catch (Throwable th) {
                        try {
                            ExceptionProcessor.processException(th);
                        } catch (Throwable th2) {
                            ExceptionProcessor.processException(th2);
                        }
                    }
                }
            });
        } catch (Throwable th) {
            try {
                ExceptionProcessor.processException(th);
            } catch (Throwable th2) {
                ExceptionProcessor.processException(th2);
            }
        }
    }
}