그늘 v4.6.9版本的 MD5 值为:45bd3dac9e441bb87fea09c92b437adc
以下内容为反编译后的 h.java 源代码,内容仅作参考
package be;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import com.bumptech.glide.load.Key;
import com.meizu.cloud.pushsdk.constants.PushConstants;
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> f865f = Collections.synchronizedMap(new HashMap());
public static String f866g = null;
public final Context f867a;
public final String f868b;
public JSONObject f869c;
public long f870d = 0;
public int f871e = 0;
public class a implements Runnable {
public final Map f872a;
public a(HashMap hashMap) {
this.f872a = hashMap;
}
@Override
public final void run() {
h hVar = h.this;
try {
yd.b c4 = yd.a.a().c("https://cgi.connect.qq.com/qqconnectopen/openapi/policy_conf", this.f872a);
String a10 = c4.a();
ae.a.f("openSDK_LOG.OpenConfig", "update: get config statusCode " + c4.f15902c);
h.c(hVar, l.s(a10));
} catch (Exception e10) {
ae.a.d("openSDK_LOG.OpenConfig", "get config error ", e10);
}
hVar.f871e = 0;
}
}
public h(Context context, String str) {
String concat;
InputStream open;
this.f867a = null;
this.f868b = null;
this.f869c = null;
Context applicationContext = context.getApplicationContext();
this.f867a = applicationContext;
this.f868b = str;
String str2 = "";
if (str == null) {
concat = "com.tencent.open.config.json";
} else {
try {
try {
concat = "com.tencent.open.config.json.".concat(str);
} catch (IOException e10) {
e10.printStackTrace();
}
} catch (FileNotFoundException unused) {
open = applicationContext.getAssets().open("com.tencent.open.config.json");
}
}
open = applicationContext.openFileInput(concat);
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, Charset.forName(Key.STRING_CHARSET_NAME)));
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;
}
}
str2 = stringBuffer.toString();
try {
open.close();
bufferedReader.close();
} catch (IOException e13) {
e13.printStackTrace();
}
try {
this.f869c = new JSONObject(str2);
} catch (JSONException unused2) {
this.f869c = new JSONObject();
}
d();
}
public static h b(Context context, String str) {
h hVar;
Map<String, h> map = f865f;
synchronized (map) {
ae.a.h("openSDK_LOG.OpenConfig", "getInstance begin");
if (str != null) {
f866g = str;
}
if (str == null && (str = f866g) == null) {
str = PushConstants.PUSH_TYPE_NOTIFY;
}
hVar = map.get(str);
if (hVar == null) {
hVar = new h(context, str);
map.put(str, hVar);
}
ae.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.f869c = jSONObject;
String jSONObject2 = jSONObject.toString();
String str = hVar.f868b;
if (str != null) {
try {
concat = "com.tencent.open.config.json.".concat(str);
} catch (IOException e10) {
e10.printStackTrace();
}
} else {
concat = "com.tencent.open.config.json";
}
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(hVar.f867a.openFileOutput(concat, 0), Charset.forName(Key.STRING_CHARSET_NAME));
outputStreamWriter.write(jSONObject2);
outputStreamWriter.flush();
outputStreamWriter.close();
hVar.f870d = SystemClock.elapsedRealtime();
}
public final int a(String str) {
g("get ".concat(str));
f();
return this.f869c.optInt(str);
}
public final void d() {
if (this.f871e != 0) {
g("update thread is running, return");
return;
}
this.f871e = 1;
HashMap hashMap = new HashMap();
hashMap.put("appid", this.f868b);
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.f876a.execute(new a(hashMap));
} catch (RejectedExecutionException unused) {
}
}
public final boolean e(String str) {
g("get ".concat(str));
f();
Object opt = this.f869c.opt(str);
if (opt == null) {
return false;
}
if (opt instanceof Integer) {
return !opt.equals(0);
}
if (!(opt instanceof Boolean)) {
return false;
}
return ((Boolean) opt).booleanValue();
}
public final void f() {
int optInt = this.f869c.optInt("Common_frequency");
if (optInt == 0) {
optInt = 1;
}
if (SystemClock.elapsedRealtime() - this.f870d >= optInt * 3600000) {
d();
}
}
public final void g(String str) {
StringBuilder p6 = androidx.constraintlayout.motion.utils.a.p(str, "; appid: ");
p6.append(this.f868b);
ae.a.h("openSDK_LOG.OpenConfig", p6.toString());
}
}