同程有借 v1.0.0版本的 MD5 值为:e33397cdbab33543d0c134ec96d77fb8
以下内容为反编译后的 b.java 源代码,内容仅作参考
package z3;
import android.content.Context;
import android.content.pm.PackageManager;
import android.util.Log;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
import java.security.InvalidParameterException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import javax.net.ssl.HttpsURLConnection;
public class b {
private String f20986a;
private Context f20988c;
private boolean f20987b = true;
private List<a> f20989d = new ArrayList();
public b(Context context, boolean z8) {
if (context != null) {
this.f20988c = context.getApplicationContext();
if (z8) {
this.f20986a = "https://api-ipv6.megvii.com/faceid/v1/sdk/authm";
return;
} else {
this.f20986a = "https://api.faceid.com/faceid/v1/sdk/authm";
return;
}
}
throw new InvalidParameterException("context can not be null");
}
private String a(String str) {
try {
if (this.f20987b) {
c.a();
}
HttpsURLConnection httpsURLConnection = (HttpsURLConnection) new URL(this.f20986a).openConnection();
httpsURLConnection.setConnectTimeout(5000);
httpsURLConnection.setReadTimeout(5000);
httpsURLConnection.setRequestMethod("POST");
httpsURLConnection.setRequestProperty("Content-type", "text/plain");
httpsURLConnection.setRequestProperty("User-Agent", d());
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(httpsURLConnection.getOutputStream());
bufferedOutputStream.write(str.getBytes());
bufferedOutputStream.close();
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(httpsURLConnection.getInputStream()));
StringBuilder sb = new StringBuilder();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine != null) {
sb.append(readLine);
} else {
bufferedReader.close();
httpsURLConnection.disconnect();
return sb.toString();
}
}
} catch (IOException e9) {
e9.printStackTrace();
return null;
} catch (Exception e10) {
e10.printStackTrace();
return null;
}
}
private String c() {
try {
return this.f20988c.getPackageManager().getPackageInfo(this.f20988c.getPackageName(), 0).packageName;
} catch (PackageManager.NameNotFoundException e9) {
e9.printStackTrace();
return "";
}
}
private String d() {
String str;
Iterator<a> it;
try {
if (this.f20989d.size() > 0) {
String str2 = "";
while (this.f20989d.iterator().hasNext()) {
str2 = str2 + it.next().c() + "$";
}
str = str2.substring(0, str2.length() - 1);
} else {
str = "";
}
return "MegVii-SDK/" + str + "/" + c() + "/" + e() + "/" + Locale.getDefault().getLanguage();
} catch (Exception e9) {
e9.printStackTrace();
return "";
}
}
private String e() {
try {
return this.f20988c.getPackageManager().getPackageInfo(this.f20988c.getPackageName(), 0).versionName;
} catch (PackageManager.NameNotFoundException e9) {
e9.printStackTrace();
return "";
}
}
public String b(String str) {
Log.w("LicenseManager", "managers size " + this.f20989d.size());
if (this.f20988c == null || this.f20989d.size() == 0) {
return null;
}
this.f20988c = this.f20988c.getApplicationContext();
StringBuilder sb = new StringBuilder();
for (a aVar : this.f20989d) {
String a9 = aVar.a(str);
Log.w("LicenseManager", "Thread id :" + Thread.currentThread().getName() + "contextStr is " + a9);
sb.append(a9);
sb.append('$');
}
String sb2 = sb.toString();
return sb2.substring(0, sb2.length() - 1);
}
public synchronized boolean f(a aVar) {
boolean z8;
z8 = false;
for (a aVar2 : this.f20989d) {
if (aVar2.c().equals(aVar.c())) {
z8 = true;
}
}
if (!z8) {
this.f20989d.add(aVar);
}
return !z8;
}
public Map<String, Long> g(String str) {
HashMap hashMap = null;
if (str != null && this.f20988c != null) {
String[] split = str.split("\\$");
if (split.length != this.f20989d.size()) {
return null;
}
this.f20988c = this.f20988c.getApplicationContext();
hashMap = new HashMap(split.length);
for (int i9 = 0; i9 < this.f20989d.size(); i9++) {
hashMap.put(this.f20989d.get(i9).c(), Long.valueOf(this.f20989d.get(i9).b(split[i9])));
}
}
return hashMap;
}
public synchronized Map<String, Long> h(String str) {
return g(a(b(str)));
}
}