酷狗概念版 v2.5.5版本的 MD5 值为:782d327088fca4e58310f35a56f41319

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


package com.tencent.gathererga.core.internal.a.b;

import android.text.TextUtils;
import com.sina.weibo.sdk.statistic.LogBuilder;
import com.tencent.gathererga.core.GathererCloudConfigItem;
import com.tencent.gathererga.core.GathererCloudReq;
import com.tencent.gathererga.core.GathererCloudResp;
import com.tencent.gathererga.core.internal.b.d;
import com.tencent.gathererga.core.internal.b.e;
import com.tencent.gathererga.core.j;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class b implements a {

    public static final a f68415a = new b();

    private Map<Integer, Boolean> f68416b = new HashMap();

    private com.tencent.gathererga.core.internal.b f68417c;

    private GathererCloudConfigItem f68418d;

    private Map<String, String> f68419e;
    private boolean f;

    public static a a() {
        return f68415a;
    }

    @Override
    public void a(com.tencent.gathererga.core.internal.b bVar, boolean z) {
        this.f68417c = bVar;
        this.f = z;
        if (this.f) {
            this.f68416b.putAll(this.f68417c.c());
        } else {
            b();
        }
    }

    @Override
    public void a(ConcurrentHashMap<Integer, Boolean> concurrentHashMap) {
        com.tencent.gathererga.core.internal.b bVar = this.f68417c;
        if (bVar != null) {
            bVar.a(concurrentHashMap);
        }
        Map<Integer, Boolean> map = this.f68416b;
        if (map != null) {
            map.putAll(concurrentHashMap);
        }
    }

    public void b() {
        long b2 = ((com.tencent.gathererga.core.internal.a.a.a) com.tencent.gathererga.core.internal.a.a.a(com.tencent.gathererga.core.internal.a.a.a.class)).b();
        if (b2 == 0) {
            d.b("first time to pull conf , last pull time empty");
            a(this.f68417c);
            return;
        }
        if (this.f68418d == null) {
            this.f68418d = c();
        }
        if (this.f68418d == null) {
            d.b("first time to pull conf mGathererCloudResp null");
            a(this.f68417c);
        } else if (Math.abs(System.currentTimeMillis() - b2) >= this.f68418d.getLifeTime() * 3600) {
            d.b("time to re-pull conf");
            a(this.f68417c);
        } else {
            d.b("not need to pull cloud conf at init");
            a(this.f68418d.getFeatureIdOps());
        }
    }

    private void a(final com.tencent.gathererga.core.internal.b bVar) {
        e.a().a(new Runnable() {
            @Override
            public void run() {
                String a2 = bVar.g().a("https://gatherer.m.qq.com/gatherer_conf/GetConf", "application/json", b.this.b(bVar).toJson().toString());
                if (TextUtils.isEmpty(a2)) {
                    d.d("cloud conf error !!!");
                    return;
                }
                d.b("http resp : " + a2);
                GathererCloudResp gathererCloudResp = new GathererCloudResp(a2);
                if (gathererCloudResp.getRet() != 0 || gathererCloudResp.getConfig_item() == null) {
                    d.d("cloud conf GathererCloudResp ret " + gathererCloudResp.getRet());
                    return;
                }
                if (gathererCloudResp.getConfig_item().isEffective()) {
                    String jSONObject = gathererCloudResp.getConfig_item().toJson().toString();
                    d.b("gathererCloudConfigItem : " + jSONObject);
                    b.this.f68418d = gathererCloudResp.getConfig_item();
                    com.tencent.gathererga.core.internal.a.a.a aVar = (com.tencent.gathererga.core.internal.a.a.a) com.tencent.gathererga.core.internal.a.a.a(com.tencent.gathererga.core.internal.a.a.a.class);
                    aVar.a(jSONObject);
                    aVar.a(System.currentTimeMillis());
                    b.this.a(gathererCloudResp.getConfig_item().getFeatureIdOps());
                    d.a("resp : " + gathererCloudResp.toString());
                }
            }
        });
    }

    public synchronized void a(Map<Integer, Integer> map) {
        for (Integer num : map.keySet()) {
            this.f68416b.put(num, Boolean.valueOf(map.get(num).intValue() > 0));
        }
        this.f68416b.putAll(this.f68417c.c());
    }

    public GathererCloudReq b(com.tencent.gathererga.core.internal.b bVar) {
        return new GathererCloudReq(c(bVar), c(), (String) ((j) com.tencent.gathererga.core.d.a(j.class)).a(com.tencent.gathererga.core.internal.provider.b.g().b().g()).b());
    }

    private GathererCloudConfigItem c() {
        String a2 = ((com.tencent.gathererga.core.internal.a.a.a) com.tencent.gathererga.core.internal.a.a.a(com.tencent.gathererga.core.internal.a.a.a.class)).a();
        if (TextUtils.isEmpty(a2)) {
            return null;
        }
        try {
            d.b("readFromLocal : " + a2);
            return new GathererCloudConfigItem(a2);
        } catch (Throwable th) {
            d.a(th);
            return null;
        }
    }

    private Map<String, String> c(com.tencent.gathererga.core.internal.b bVar) {
        if (this.f68419e == null) {
            this.f68419e = new HashMap();
            this.f68419e.put("platform", "2");
            this.f68419e.put("gathererSDKVersion", "1");
            this.f68419e.put("apiLevel", "" + com.tencent.gathererga.core.internal.b.b.a());
            this.f68419e.put(LogBuilder.KEY_CHANNEL, "" + bVar.d());
            this.f68419e.put("adapterVersion", "" + bVar.e());
            this.f68419e.put("appid", "" + bVar.b());
            com.tencent.gathererga.core.internal.provider.b g = com.tencent.gathererga.core.internal.provider.b.g().b().g();
            com.tencent.gathererga.core.e eVar = (com.tencent.gathererga.core.e) com.tencent.gathererga.core.d.a(com.tencent.gathererga.core.e.class);
            this.f68419e.put("brand", "" + eVar.c(g).b());
            this.f68419e.put("model", "" + eVar.b(g).b());
            com.tencent.gathererga.core.b bVar2 = (com.tencent.gathererga.core.b) com.tencent.gathererga.core.d.a(com.tencent.gathererga.core.b.class);
            this.f68419e.put("pkg", "" + bVar2.a(g).b());
            this.f68419e.put("appVersionName", "" + bVar2.b(g).b());
        }
        return this.f68419e;
    }

    @Override
    public boolean a(int i) {
        Map<Integer, Boolean> map = this.f68416b;
        if (map == null) {
            return true;
        }
        Boolean bool = map.get(Integer.valueOf(i));
        if (bool != null) {
            return bool.booleanValue();
        }
        return !this.f;
    }
}