GoooBet v1.0版本的 MD5 值为:ff9748f16167bfd7735b669c0a9931c5

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


package com.moat.analytics.mobile.mpub;

import android.os.Handler;
import android.os.Looper;
import com.google.android.exoplayer2.upstream.DefaultLoadErrorHandlingPolicy;
import java.util.Iterator;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

public class w {
    private static w h;
    private static final Queue<c> i = new ConcurrentLinkedQueue();
    private Handler j;
    private long f = 1800000;
    private long g = DefaultLoadErrorHandlingPolicy.DEFAULT_TRACK_BLACKLIST_MS;

    volatile d f3115a = d.OFF;
    volatile boolean b = false;
    volatile boolean c = false;
    volatile int d = 200;
    volatile int e = 10;
    private final AtomicBoolean k = new AtomicBoolean(false);
    private volatile long l = 0;
    private final AtomicInteger m = new AtomicInteger(0);
    private final AtomicBoolean n = new AtomicBoolean(false);

    private class a implements Runnable {
        private final Handler b;
        private final String c;
        private final e d;

        private a(String str, Handler handler, e eVar) {
            this.d = eVar;
            this.b = handler;
            this.c = "https://sejs.moatads.com/" + str + "/android/422d7e6/status.json";
        }

        private void a() {
            String b = b();
            final m mVar = new m(b);
            w.this.b = mVar.a();
            w.this.c = mVar.b();
            w.this.d = mVar.c();
            w.this.e = mVar.d();
            new Handler(Looper.getMainLooper()).post(new Runnable() {
                @Override
                public void run() {
                    try {
                        a.this.d.a(mVar);
                    } catch (Exception e) {
                        n.a(e);
                    }
                }
            });
            w.this.l = System.currentTimeMillis();
            w.this.n.compareAndSet(true, false);
            if (b != null) {
                w.this.m.set(0);
            } else if (w.this.m.incrementAndGet() < 10) {
                w wVar = w.this;
                wVar.a(wVar.g);
            }
        }

        private String b() {
            try {
                return q.a(this.c + "?ts=" + System.currentTimeMillis() + "&v=2.6.6").b();
            } catch (Exception unused) {
                return null;
            }
        }

        @Override
        public void run() {
            try {
                a();
            } catch (Exception e) {
                n.a(e);
            }
            this.b.removeCallbacks(this);
            Looper myLooper = Looper.myLooper();
            if (myLooper != null) {
                myLooper.quit();
            }
        }
    }

    interface b {
        void b();

        void c();
    }

    public class c {

        final Long f3121a;
        final b b;

        c(Long l, b bVar) {
            this.f3121a = l;
            this.b = bVar;
        }
    }

    public enum d {
        OFF,
        ON
    }

    public interface e {
        void a(m mVar);
    }

    private w() {
        try {
            this.j = new Handler(Looper.getMainLooper());
        } catch (Exception e2) {
            n.a(e2);
        }
    }

    public static synchronized w a() {
        w wVar;
        synchronized (w.class) {
            if (h == null) {
                h = new w();
            }
            wVar = h;
        }
        return wVar;
    }

    public void a(final long j) {
        if (this.n.compareAndSet(false, true)) {
            p.a(3, "OnOff", this, "Performing status check.");
            new Thread() {
                @Override
                public void run() {
                    Looper.prepare();
                    Handler handler = new Handler();
                    handler.postDelayed(new a("MPUB", handler, new e() {
                        @Override
                        public void a(m mVar) {
                            synchronized (w.i) {
                                boolean z = ((k) MoatAnalytics.getInstance()).f3102a;
                                if (w.this.f3115a != mVar.e() || (w.this.f3115a == d.OFF && z)) {
                                    w.this.f3115a = mVar.e();
                                    if (w.this.f3115a == d.OFF && z) {
                                        w.this.f3115a = d.ON;
                                    }
                                    if (w.this.f3115a == d.ON && !i.a().b()) {
                                        w.this.f3115a = d.OFF;
                                    }
                                    if (w.this.f3115a == d.ON) {
                                        p.a(3, "OnOff", this, "Moat enabled - Version 2.6.6");
                                    }
                                    for (c cVar : w.i) {
                                        if (w.this.f3115a == d.ON) {
                                            cVar.b.b();
                                        } else {
                                            cVar.b.c();
                                        }
                                    }
                                }
                                while (!w.i.isEmpty()) {
                                    w.i.remove();
                                }
                            }
                        }
                    }), j);
                    Looper.loop();
                }
            }.start();
        }
    }

    public void d() {
        synchronized (i) {
            long currentTimeMillis = System.currentTimeMillis();
            Iterator<c> it = i.iterator();
            while (it.hasNext()) {
                if (currentTimeMillis - it.next().f3121a.longValue() >= DefaultLoadErrorHandlingPolicy.DEFAULT_TRACK_BLACKLIST_MS) {
                    it.remove();
                }
            }
            if (i.size() >= 15) {
                for (int i2 = 0; i2 < 5; i2++) {
                    i.remove();
                }
            }
        }
    }

    private void e() {
        if (this.k.compareAndSet(false, true)) {
            this.j.postDelayed(new Runnable() {
                @Override
                public void run() {
                    try {
                        if (w.i.size() > 0) {
                            w.this.d();
                            w.this.j.postDelayed(this, DefaultLoadErrorHandlingPolicy.DEFAULT_TRACK_BLACKLIST_MS);
                        } else {
                            w.this.k.compareAndSet(true, false);
                            w.this.j.removeCallbacks(this);
                        }
                    } catch (Exception e2) {
                        n.a(e2);
                    }
                }
            }, DefaultLoadErrorHandlingPolicy.DEFAULT_TRACK_BLACKLIST_MS);
        }
    }

    public void a(b bVar) {
        if (this.f3115a == d.ON) {
            bVar.b();
            return;
        }
        d();
        i.add(new c(Long.valueOf(System.currentTimeMillis()), bVar));
        e();
    }

    public void b() {
        if (System.currentTimeMillis() - this.l > this.f) {
            a(0L);
        }
    }
}