Wolves Themes v1.0版本的 MD5 值为:cddc92b47f6b7c4a195c9625507eb51c

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


package com.moat.analytics.mobile.cha;

import android.os.Handler;
import android.os.Looper;
import com.tapjoy.TapjoyConstants;
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 final class t {
    private static t f176;
    private static final Queue<e> f177 = new ConcurrentLinkedQueue();
    private Handler f189;
    private long f180 = TapjoyConstants.SESSION_ID_INACTIVITY_TIME;
    private long f178 = 60000;
    volatile int f183 = a.f195;
    volatile boolean f184 = false;
    volatile boolean f181 = false;
    volatile int f179 = 200;
    volatile int f186 = 10;
    private final AtomicBoolean f182 = new AtomicBoolean(false);
    private volatile long f188 = 0;
    private final AtomicInteger f187 = new AtomicInteger(0);
    private final AtomicBoolean f185 = new AtomicBoolean(false);

    interface b {
        void mo55() throws o;
    }

    interface c {
        void mo173(g gVar) throws o;
    }

    public static final class a {
        public static final int f194 = 2;
        public static final int f195 = 1;

        static {
            int[] iArr = {1, 2};
        }
    }

    public static synchronized t m166() {
        t tVar;
        synchronized (t.class) {
            if (f176 == null) {
                f176 = new t();
            }
            tVar = f176;
        }
        return tVar;
    }

    private t() {
        try {
            this.f189 = new Handler(Looper.getMainLooper());
        } catch (Exception e2) {
            o.m132(e2);
        }
    }

    public final void m172() {
        if (System.currentTimeMillis() - this.f188 > this.f180) {
            m167(0L);
        }
    }

    public void m167(final long j) {
        if (this.f185.compareAndSet(false, true)) {
            com.moat.analytics.mobile.cha.a.m16(3, "OnOff", this, "Performing status check.");
            new Thread() {
                @Override
                public final void run() {
                    Looper.prepare();
                    Handler handler = new Handler();
                    handler.postDelayed(new d(BuildConfig.NAMESPACE, handler, new c() {
                        @Override
                        public final void mo173(g gVar) throws o {
                            synchronized (t.f177) {
                                boolean z = ((f) MoatAnalytics.getInstance()).f60;
                                if (t.this.f183 != gVar.m62() || (t.this.f183 == a.f195 && z)) {
                                    t.this.f183 = gVar.m62();
                                    if (t.this.f183 == a.f195 && z) {
                                        t.this.f183 = a.f194;
                                    }
                                    if (t.this.f183 == a.f194) {
                                        com.moat.analytics.mobile.cha.a.m16(3, "OnOff", this, "Moat enabled - Version 2.4.1");
                                    }
                                    for (e eVar : t.f177) {
                                        if (t.this.f183 == a.f194) {
                                            eVar.f204.mo55();
                                        }
                                    }
                                }
                                while (!t.f177.isEmpty()) {
                                    t.f177.remove();
                                }
                            }
                        }
                    }), j);
                    Looper.loop();
                }
            }.start();
        }
    }

    public final void m171(b bVar) throws o {
        if (this.f183 == a.f194) {
            bVar.mo55();
            return;
        }
        m160();
        f177.add(new e(Long.valueOf(System.currentTimeMillis()), bVar));
        if (this.f182.compareAndSet(false, true)) {
            this.f189.postDelayed(new Runnable() {
                @Override
                public final void run() {
                    try {
                        if (t.f177.size() > 0) {
                            t.m160();
                            t.this.f189.postDelayed(this, 60000L);
                            return;
                        }
                        t.this.f182.compareAndSet(true, false);
                        t.this.f189.removeCallbacks(this);
                    } catch (Exception e2) {
                        o.m132(e2);
                    }
                }
            }, 60000L);
        }
    }

    public static void m160() {
        synchronized (f177) {
            long currentTimeMillis = System.currentTimeMillis();
            Iterator<e> it = f177.iterator();
            while (it.hasNext()) {
                if (currentTimeMillis - it.next().f202.longValue() >= 60000) {
                    it.remove();
                }
            }
            if (f177.size() >= 15) {
                for (int i = 0; i < 5; i++) {
                    f177.remove();
                }
            }
        }
    }

    class d implements Runnable {
        private final String f197;
        private final AnonymousClass2.C00822 f198;
        private final Handler f199;

        private d(String str, Handler handler, AnonymousClass2.C00822 c00822) {
            this.f198 = c00822;
            this.f199 = handler;
            this.f197 = "https://z.moatads.com/" + str + "/android/" + BuildConfig.REVISION.substring(0, 7) + "/status.json";
        }

        private String m174() {
            try {
                return m.m110(this.f197 + "?ts=" + System.currentTimeMillis() + "&v=2.4.1").get();
            } catch (Exception unused) {
                return null;
            }
        }

        @Override
        public final void run() {
            try {
                String m174 = m174();
                final g gVar = new g(m174);
                t.this.f184 = gVar.m61();
                t.this.f181 = gVar.m65();
                t.this.f179 = gVar.m64();
                t.this.f186 = gVar.m63();
                new Handler(Looper.getMainLooper()).post(new Runnable() {
                    @Override
                    public final void run() {
                        try {
                            mo173(gVar);
                        } catch (Exception e) {
                            o.m132(e);
                        }
                    }
                });
                t.this.f188 = System.currentTimeMillis();
                t.this.f185.compareAndSet(true, false);
                if (m174 == null) {
                    if (t.this.f187.incrementAndGet() < 10) {
                        t.this.m167(t.this.f178);
                    }
                } else {
                    t.this.f187.set(0);
                }
            } catch (Exception e) {
                o.m132(e);
            }
            this.f199.removeCallbacks(this);
            Looper myLooper = Looper.myLooper();
            if (myLooper != null) {
                myLooper.quit();
            }
        }
    }

    public class e {
        final Long f202;
        final b f204;

        e(Long l, b bVar) {
            this.f202 = l;
            this.f204 = bVar;
        }
    }
}