밤친구 v4.7.3版本的 MD5 值为:a58175795b36d9d722726efa7eb4c52a
以下内容为反编译后的 h.java 源代码,内容仅作参考
package ce;
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> f3591f = Collections.synchronizedMap(new HashMap());
public static String f3592g = null;
public final Context f3593a;
public final String f3594b;
public JSONObject f3595c;
public long f3596d = 0;
public int f3597e = 0;
public class a implements Runnable {
public final Map f3598a;
public a(HashMap hashMap) {
this.f3598a = hashMap;
}
@Override
public final void run() {
h hVar = h.this;
try {
zd.b c10 = zd.a.a().c("https://cgi.connect.qq.com/qqconnectopen/openapi/policy_conf", this.f3598a);
String a10 = c10.a();
be.a.f("openSDK_LOG.OpenConfig", "update: get config statusCode " + c10.f18922c);
h.c(hVar, l.s(a10));
} catch (Exception e10) {
be.a.d("openSDK_LOG.OpenConfig", "get config error ", e10);
}
hVar.f3597e = 0;
}
}
public h(Context context, String str) {
String concat;
InputStream open;
this.f3593a = null;
this.f3594b = null;
this.f3595c = null;
Context applicationContext = context.getApplicationContext();
this.f3593a = applicationContext;
this.f3594b = 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;
} else {
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.f3595c = new JSONObject(str2);
} catch (JSONException unused2) {
this.f3595c = new JSONObject();
}
d();
}
public static h b(Context context, String str) {
h hVar;
Map<String, h> map = f3591f;
synchronized (map) {
be.a.h("openSDK_LOG.OpenConfig", "getInstance begin");
if (str != null) {
f3592g = str;
}
if (str == null && (str = f3592g) == null) {
str = PushConstants.PUSH_TYPE_NOTIFY;
}
hVar = map.get(str);
if (hVar == null) {
hVar = new h(context, str);
map.put(str, hVar);
}
be.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.f3595c = jSONObject;
String jSONObject2 = jSONObject.toString();
String str = hVar.f3594b;
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.f3593a.openFileOutput(concat, 0), Charset.forName(Key.STRING_CHARSET_NAME));
outputStreamWriter.write(jSONObject2);
outputStreamWriter.flush();
outputStreamWriter.close();
hVar.f3596d = SystemClock.elapsedRealtime();
}
public final int a(String str) {
g("get ".concat(str));
f();
return this.f3595c.optInt(str);
}
public final void d() {
if (this.f3597e != 0) {
g("update thread is running, return");
return;
}
this.f3597e = 1;
HashMap hashMap = new HashMap();
hashMap.put("appid", this.f3594b);
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.f3602a.execute(new a(hashMap));
} catch (RejectedExecutionException unused) {
}
}
public final boolean e(String str) {
g("get ".concat(str));
f();
Object opt = this.f3595c.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.f3595c.optInt("Common_frequency");
if (optInt == 0) {
optInt = 1;
}
if (SystemClock.elapsedRealtime() - this.f3596d >= optInt * 3600000) {
d();
}
}
public final void g(String str) {
StringBuilder j10 = androidx.constraintlayout.motion.utils.a.j(str, "; appid: ");
j10.append(this.f3594b);
be.a.h("openSDK_LOG.OpenConfig", j10.toString());
}
}