正在查看: Top浏览器 v4.6.16 应用的 g.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: Top浏览器 v4.6.16 应用的 g.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package c.x.c.g;
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
import com.umeng.analytics.pro.ak;
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 org.adblockplus.libadblockplus.android.webview.AdblockWebView;
import org.json.JSONException;
import org.json.JSONObject;
public class g {
public static Map<String, g> a = Collections.synchronizedMap(new HashMap());
public static String b = null;
public Context f682c;
public String f683d;
public JSONObject f684e = null;
public long f685f = 0;
public int f686g = 0;
public boolean f687h = true;
public class a implements Runnable {
public final Map a;
public a(Map map) {
this.a = map;
}
@Override
public void run() {
try {
c.x.c.b.b c2 = c.x.c.b.a.a().c("https://cgi.connect.qq.com/qqconnectopen/openapi/policy_conf", this.a);
String a = c2.a();
c.x.c.f.a.k("openSDK_LOG.OpenConfig", "update: get config statusCode " + c2.d());
g.this.g(k.s(a));
} catch (Exception e2) {
c.x.c.f.a.i("openSDK_LOG.OpenConfig", "get config error ", e2);
}
g.this.f686g = 0;
}
}
public g(Context context, String str) {
this.f682c = null;
this.f683d = null;
this.f682c = context.getApplicationContext();
this.f683d = str;
d();
h();
}
public static g c(Context context, String str) {
g gVar;
synchronized (a) {
c.x.c.f.a.n("openSDK_LOG.OpenConfig", "getInstance begin");
if (str != null) {
b = str;
}
if (str == null && (str = b) == null) {
str = "0";
}
gVar = a.get(str);
if (gVar == null) {
gVar = new g(context, str);
a.put(str, gVar);
}
c.x.c.f.a.n("openSDK_LOG.OpenConfig", "getInstance end");
}
return gVar;
}
public int b(String str) {
l("get " + str);
k();
return this.f684e.optInt(str);
}
public final void d() {
try {
this.f684e = new JSONObject(j("com.tencent.open.config.json"));
} catch (JSONException unused) {
this.f684e = new JSONObject();
}
}
public final void f(String str, String str2) {
try {
if (this.f683d != null) {
str = str + "." + this.f683d;
}
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(this.f682c.openFileOutput(str, 0), Charset.forName(AdblockWebView.WebResponseResult.RESPONSE_CHARSET_NAME));
outputStreamWriter.write(str2);
outputStreamWriter.flush();
outputStreamWriter.close();
} catch (IOException e2) {
e2.printStackTrace();
}
}
public final void g(JSONObject jSONObject) {
l("cgi back, do update");
this.f684e = jSONObject;
f("com.tencent.open.config.json", jSONObject.toString());
this.f685f = SystemClock.elapsedRealtime();
}
public final void h() {
if (this.f686g != 0) {
l("update thread is running, return");
return;
}
this.f686g = 1;
HashMap hashMap = new HashMap();
hashMap.put("appid", this.f683d);
hashMap.put("status_os", Build.VERSION.RELEASE);
hashMap.put("status_machine", e.a().c(f.a()));
hashMap.put("status_version", Build.VERSION.SDK);
hashMap.put("sdkv", "3.5.8.lite");
hashMap.put("sdkp", ak.av);
j.b(new a(hashMap));
}
public boolean i(String str) {
l("get " + str);
k();
Object opt = this.f684e.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 String j(String str) {
InputStream open;
String str2;
String str3 = "";
try {
try {
if (this.f683d != null) {
str2 = str + "." + this.f683d;
} else {
str2 = str;
}
open = this.f682c.openFileInput(str2);
} catch (IOException e2) {
e2.printStackTrace();
return "";
}
} catch (FileNotFoundException unused) {
open = this.f682c.getAssets().open(str);
}
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(open, Charset.forName(AdblockWebView.WebResponseResult.RESPONSE_CHARSET_NAME)));
StringBuffer stringBuffer = new StringBuffer();
while (true) {
try {
try {
try {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
stringBuffer.append(readLine);
} catch (IOException e3) {
e3.printStackTrace();
}
} catch (IOException e4) {
e4.printStackTrace();
open.close();
bufferedReader.close();
}
} catch (Throwable th) {
try {
open.close();
bufferedReader.close();
} catch (IOException e5) {
e5.printStackTrace();
}
throw th;
}
}
str3 = stringBuffer.toString();
open.close();
bufferedReader.close();
return str3;
}
public final void k() {
int optInt = this.f684e.optInt("Common_frequency");
if (optInt == 0) {
optInt = 1;
}
if (SystemClock.elapsedRealtime() - this.f685f >= optInt * 3600000) {
h();
}
}
public final void l(String str) {
if (this.f687h) {
c.x.c.f.a.n("openSDK_LOG.OpenConfig", str + "; appid: " + this.f683d);
}
}
}