导航菜单

页面标题

页面副标题

jsgt v4.8.1 - h.java 源代码

正在查看: jsgt v4.8.1 应用的 h.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package ee;

import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.RejectedExecutionException;
import org.json.JSONException;
import org.json.JSONObject;

public final class h {
    public static final Map<String, h> f = Collections.synchronizedMap(new HashMap());
    public static String g = null;
    public final Context a;
    public final String b;
    public JSONObject c;
    public long d = 0;
    public int e = 0;

    public class a implements Runnable {
        public final Map a;

        public a(HashMap hashMap) {
            this.a = hashMap;
        }

        @Override
        public final void run() {
            h hVar = h.this;
            try {
                be.b c = be.a.a().c("https://cgi.connect.qq.com/qqconnectopen/openapi/policy_conf", this.a);
                String a = c.a();
                de.a.f("openSDK_LOG.OpenConfig", "update: get config statusCode " + c.c);
                h.c(hVar, l.s(a));
            } catch (Exception e) {
                de.a.d("openSDK_LOG.OpenConfig", "get config error ", e);
            }
            hVar.e = 0;
        }
    }

    public h(Context context, String str) {
        String concat;
        InputStream open;
        this.a = null;
        this.b = null;
        this.c = null;
        Context applicationContext = context.getApplicationContext();
        this.a = applicationContext;
        this.b = str;
        String str2 = "";
        if (str != null) {
            try {
                try {
                    concat = "com.tencent.open.config.json.".concat(str);
                } catch (IOException e) {
                    e.printStackTrace();
                }
            } catch (FileNotFoundException unused) {
                open = applicationContext.getAssets().open("com.tencent.open.config.json");
            }
        } else {
            concat = "com.tencent.open.config.json";
        }
        open = applicationContext.openFileInput(concat);
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, Charset.forName("UTF-8")));
        StringBuffer stringBuffer = new StringBuffer();
        while (true) {
            try {
                try {
                    String readLine = bufferedReader.readLine();
                    if (readLine == null) {
                        break;
                    } else {
                        stringBuffer.append(readLine);
                    }
                } catch (IOException e2) {
                    e2.printStackTrace();
                }
            } finally {
                try {
                    open.close();
                    bufferedReader.close();
                } catch (IOException e3) {
                    e3.printStackTrace();
                }
            }
        }
        str2 = stringBuffer.toString();
        try {
            this.c = new JSONObject(str2);
        } catch (JSONException unused2) {
            this.c = new JSONObject();
        }
        d();
    }

    public static h b(Context context, String str) {
        h hVar;
        Map<String, h> map = f;
        synchronized (map) {
            de.a.h("openSDK_LOG.OpenConfig", "getInstance begin");
            if (str != null) {
                g = str;
            }
            if (str == null && (str = g) == null) {
                str = "0";
            }
            hVar = map.get(str);
            if (hVar == null) {
                hVar = new h(context, str);
                map.put(str, hVar);
            }
            de.a.h("openSDK_LOG.OpenConfig", "getInstance end");
        }
        return hVar;
    }

    public static void c(h hVar, JSONObject jSONObject) {
        String concat;
        hVar.g("cgi back, do update");
        hVar.c = jSONObject;
        String jSONObject2 = jSONObject.toString();
        String str = hVar.b;
        if (str != null) {
            try {
                concat = "com.tencent.open.config.json.".concat(str);
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            concat = "com.tencent.open.config.json";
        }
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(hVar.a.openFileOutput(concat, 0), Charset.forName("UTF-8"));
        outputStreamWriter.write(jSONObject2);
        outputStreamWriter.flush();
        outputStreamWriter.close();
        hVar.d = SystemClock.elapsedRealtime();
    }

    public final int a(String str) {
        g("get ".concat(str));
        f();
        return this.c.optInt(str);
    }

    public final void d() {
        if (this.e != 0) {
            g("update thread is running, return");
            return;
        }
        this.e = 1;
        HashMap hashMap = new HashMap();
        hashMap.put("appid", this.b);
        hashMap.put("status_os", Build.VERSION.RELEASE);
        hashMap.put("status_machine", Build.MODEL);
        hashMap.put("status_version", Build.VERSION.SDK);
        hashMap.put("sdkv", "3.5.3.lite");
        hashMap.put("sdkp", "a");
        try {
            k.a.execute(new a(hashMap));
        } catch (RejectedExecutionException unused) {
        }
    }

    public final boolean e(String str) {
        g("get ".concat(str));
        f();
        Object opt = this.c.opt(str);
        if (opt == null) {
            return false;
        }
        if (opt instanceof Integer) {
            return !opt.equals(0);
        }
        if (opt instanceof Boolean) {
            return ((Boolean) opt).booleanValue();
        }
        return false;
    }

    public final void f() {
        int optInt = this.c.optInt("Common_frequency");
        if (optInt == 0) {
            optInt = 1;
        }
        if (SystemClock.elapsedRealtime() - this.d >= optInt * 3600000) {
            d();
        }
    }

    public final void g(String str) {
        StringBuilder d = androidx.constraintlayout.motion.utils.a.d(str, "; appid: ");
        d.append(this.b);
        de.a.h("openSDK_LOG.OpenConfig", d.toString());
    }
}