PicWish v1.6.8版本的 MD5 值为:7e8bab240f03cf6dad8952f8374c4ed1

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


package eb;

import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import com.appsflyer.AppsFlyerProperties;
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 java.util.concurrent.ThreadPoolExecutor;
import org.json.JSONException;
import org.json.JSONObject;
public final class e {
    public static Map<String, e> f7151f = Collections.synchronizedMap(new HashMap());
    public static String f7152g = null;
    public Context f7153a;
    public String f7154b;
    public JSONObject c;
    public long f7155d = 0;
    public int f7156e = 0;

    public class a implements Runnable {
        public final Map f7157l;

        public a(Map map) {
            this.f7157l = map;
        }

        @Override
        public final void run() {
            try {
                bb.b c = bb.a.a().c("https://cgi.connect.qq.com/qqconnectopen/openapi/policy_conf", this.f7157l);
                String a10 = c.a();
                db.a.g("openSDK_LOG.OpenConfig", "update: get config statusCode " + c.c);
                e.c(e.this, i.m(a10));
            } catch (Exception e10) {
                db.a.e("openSDK_LOG.OpenConfig", "get config error ", e10);
            }
            e.this.f7156e = 0;
        }
    }

    public e(Context context, String str) {
        String str2;
        InputStream open;
        this.f7153a = null;
        this.f7154b = null;
        this.c = null;
        this.f7153a = context.getApplicationContext();
        this.f7154b = str;
        String str3 = "";
        if (str != null) {
            try {
                try {
                    str2 = "com.tencent.open.config.json." + this.f7154b;
                } catch (IOException e10) {
                    e10.printStackTrace();
                }
            } catch (FileNotFoundException unused) {
                open = this.f7153a.getAssets().open("com.tencent.open.config.json");
            }
        } else {
            str2 = "com.tencent.open.config.json";
        }
        open = this.f7153a.openFileInput(str2);
        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;
                    }
                    stringBuffer.append(readLine);
                } catch (IOException e11) {
                    e11.printStackTrace();
                }
            } catch (Throwable th2) {
                try {
                    open.close();
                    bufferedReader.close();
                } catch (IOException e12) {
                    e12.printStackTrace();
                }
                throw th2;
            }
        }
        str3 = stringBuffer.toString();
        try {
            open.close();
            bufferedReader.close();
        } catch (IOException e13) {
            e13.printStackTrace();
        }
        try {
            this.c = new JSONObject(str3);
        } catch (JSONException unused2) {
            this.c = new JSONObject();
        }
        d();
    }

    public static e b(Context context, String str) {
        e eVar;
        synchronized (f7151f) {
            db.a.i("openSDK_LOG.OpenConfig", "getInstance begin");
            if (str != null) {
                f7152g = str;
            }
            if (str == null && (str = f7152g) == null) {
                str = "0";
            }
            eVar = f7151f.get(str);
            if (eVar == null) {
                eVar = new e(context, str);
                f7151f.put(str, eVar);
            }
            db.a.i("openSDK_LOG.OpenConfig", "getInstance end");
        }
        return eVar;
    }

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

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

    public final void d() {
        if (this.f7156e != 0) {
            g("update thread is running, return");
            return;
        }
        this.f7156e = 1;
        HashMap hashMap = new HashMap();
        hashMap.put(AppsFlyerProperties.APP_ID, this.f7154b);
        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.4.lite");
        hashMap.put("sdkp", "a");
        a aVar = new a(hashMap);
        ThreadPoolExecutor threadPoolExecutor = h.f7161a;
        try {
            h.f7161a.execute(aVar);
        } catch (RejectedExecutionException unused) {
        }
    }

    public final boolean e(String str) {
        g("get " + 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.f7155d >= optInt * 3600000) {
            d();
        }
    }

    public final void g(String str) {
        StringBuilder b10 = android.support.v4.media.e.b(str, "; appid: ");
        b10.append(this.f7154b);
        db.a.i("openSDK_LOG.OpenConfig", b10.toString());
    }
}