Booty Calls v1.2.156版本的 MD5 值为:919c7e4dc831ea1adbaf506a3cc1a198
以下内容为反编译后的 b.java 源代码,内容仅作参考
package com.lovense.sdklibrary;
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.text.TextUtils;
import android.util.Log;
import androidx.core.view.InputDeviceCompat;
import com.broadcom.bt.util.io.IOUtils;
import com.broadcom.bt.util.mime4j.field.Field;
import com.helpshift.HelpshiftEvent;
import com.nutaku.game.sdk.NutakuSdk;
import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
public class b {
private static String a;
private static String b;
class a extends Thread {
final String a;
final Context b;
final com.lovense.sdklibrary.callBack.a c;
a(String str, Context context, com.lovense.sdklibrary.callBack.a aVar) {
this.a = str;
this.b = context;
this.c = aVar;
}
@Override
public void run() {
try {
HashMap hashMap = new HashMap();
hashMap.put("token", this.a);
hashMap.put("uuid", b.b);
hashMap.put("appType", b.a(this.b));
hashMap.put("bundleID", b.b(this.b));
hashMap.put("platform", "Android");
JSONObject jSONObject = new JSONObject(URLDecoder.decode(b.a("/api/sdk/checkToken", hashMap), "UTF-8"));
String optString = jSONObject.optString(HelpshiftEvent.DATA_MESSAGE, "");
this.c.a(jSONObject.optBoolean("result"), optString);
} catch (Exception unused) {
this.c.a(false, "");
}
}
}
class C0007b extends Thread {
final Context a;
final String b;
final String c;
final String d;
C0007b(Context context, String str, String str2, String str3) {
this.a = context;
this.b = str;
this.c = str2;
this.d = str3;
}
@Override
public void run() {
try {
HashMap hashMap = new HashMap();
hashMap.put("token", b.a);
hashMap.put("uuid", b.b);
hashMap.put("appType", b.a(this.a));
hashMap.put("bundleId", b.b(this.a));
hashMap.put("platform", "Android");
hashMap.put("toyMac", this.b);
hashMap.put("toyVersion", this.c);
hashMap.put("toyType", this.d);
b.b("/toyConnect/record", hashMap);
} catch (Exception unused) {
}
}
}
private static class c {
private static final Method a = a();
private static Method a() {
try {
return SharedPreferences.Editor.class.getMethod("apply", new Class[0]);
} catch (NoSuchMethodException unused) {
return null;
}
}
public static void a(SharedPreferences.Editor editor) {
try {
if (a != null) {
a.invoke(editor, new Object[0]);
return;
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException unused) {
}
editor.commit();
}
}
public static int a(String str) {
int round = (int) Math.round(Math.abs(Math.sqrt((Math.pow(c(str.substring(1, 3)) * 0.0625f, 2.0d) + Math.pow(c(str.substring(5, 7)) * 0.0625f, 2.0d)) + Math.pow(c(str.substring(9, 11)) * 0.0625f, 2.0d)) - 4.0d));
if (round < 0) {
round = 0;
}
if (round > 4) {
return 4;
}
return round;
}
public static String a(Context context) {
try {
return context.getResources().getString(context.getPackageManager().getPackageInfo(context.getPackageName(), 0).applicationInfo.labelRes);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
return null;
}
}
public static String a(String str, Map<String, String> map) {
String sb;
?? r10;
?? r102;
PrintWriter printWriter;
String readLine;
String str2 = "";
PrintWriter printWriter2 = null;
if (map != null) {
try {
StringBuilder sb2 = new StringBuilder();
boolean z = true;
for (Map.Entry<String, String> entry : map.entrySet()) {
if (z) {
z = false;
} else {
sb2.append("&");
}
sb2.append(URLEncoder.encode(entry.getKey(), "UTF-8"));
sb2.append("=");
sb2.append(URLEncoder.encode(entry.getValue(), "UTF-8"));
}
sb = sb2.toString();
} catch (Exception e) {
e.printStackTrace();
}
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://apps.lovense.com" + str).openConnection();
httpURLConnection.setRequestProperty("accept", "*/*");
httpURLConnection.setRequestProperty("connection", "Keep-Alive");
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty(Field.CONTENT_TYPE, "application/x-www-form-urlencoded;charset=utf-8");
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setReadTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
httpURLConnection.setConnectTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
if (sb != null || sb.trim().equals("")) {
printWriter = null;
} else {
printWriter = new PrintWriter(httpURLConnection.getOutputStream());
try {
printWriter.print(sb);
printWriter.flush();
} catch (Exception e2) {
e = e2;
r102 = 0;
printWriter2 = printWriter;
r102 = r102;
try {
e.printStackTrace();
if (printWriter2 != null) {
printWriter2.close();
}
if (r102 != 0) {
r102.close();
}
return str2;
} catch (Throwable th) {
th = th;
printWriter = printWriter2;
printWriter2 = r102;
r10 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
try {
printWriter2.close();
} catch (IOException e3) {
e3.printStackTrace();
throw th;
}
}
if (r10 != 0) {
r10.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
r10 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
}
if (r10 != 0) {
}
throw th;
}
}
r102 = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
while (true) {
try {
readLine = r102.readLine();
if (readLine != null) {
break;
}
str2 = str2 + readLine;
} catch (Exception e4) {
e = e4;
printWriter2 = printWriter;
r102 = r102;
e.printStackTrace();
if (printWriter2 != null) {
}
if (r102 != 0) {
}
return str2;
} catch (Throwable th3) {
th = th3;
printWriter2 = r102;
r10 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
}
if (r10 != 0) {
}
throw th;
}
}
if (printWriter != null) {
printWriter.close();
}
r102.close();
return str2;
}
sb = null;
HttpURLConnection httpURLConnection2 = (HttpURLConnection) new URL("https://apps.lovense.com" + str).openConnection();
httpURLConnection2.setRequestProperty("accept", "*/*");
httpURLConnection2.setRequestProperty("connection", "Keep-Alive");
httpURLConnection2.setRequestMethod("POST");
httpURLConnection2.setRequestProperty(Field.CONTENT_TYPE, "application/x-www-form-urlencoded;charset=utf-8");
httpURLConnection2.setUseCaches(false);
httpURLConnection2.setDoOutput(true);
httpURLConnection2.setDoInput(true);
httpURLConnection2.setReadTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
httpURLConnection2.setConnectTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
if (sb != null) {
}
printWriter = null;
r102 = new BufferedReader(new InputStreamReader(httpURLConnection2.getInputStream()));
while (true) {
readLine = r102.readLine();
if (readLine != null) {
}
str2 = str2 + readLine;
}
if (printWriter != null) {
}
r102.close();
return str2;
}
public static List<LovenseToy> a(Application application) {
ArrayList arrayList = new ArrayList();
try {
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(application.openFileInput("lv_tys.db")));
bufferedReader.readLine();
while (true) {
String readLine = bufferedReader.readLine();
if (readLine == null) {
break;
}
if (!TextUtils.isEmpty(readLine)) {
String[] split = readLine.split("::");
arrayList.add(new LovenseToy(split[0], Integer.valueOf(!split[1].equals("null") ? Integer.valueOf(split[1]).intValue() : 0), split[2], !split[3].equals("null") ? split[3] : ""));
}
}
} catch (Exception e) {
Log.d("ContentValues", e.getMessage());
}
return arrayList;
}
public static void a(Application application, List<LovenseToy> list) {
try {
StringBuffer stringBuffer = new StringBuffer(com.lovense.sdklibrary.a.b + IOUtils.LINE_SEPARATOR_UNIX);
for (LovenseToy lovenseToy : list) {
stringBuffer.append(lovenseToy.getToyId() + "::" + lovenseToy.getVersion() + "::" + lovenseToy.getType() + "::" + lovenseToy.getMacAddress() + IOUtils.LINE_SEPARATOR_UNIX);
}
FileOutputStream openFileOutput = application.openFileOutput("lv_tys.db", 0);
openFileOutput.write(stringBuffer.toString().getBytes());
openFileOutput.close();
} catch (Exception e) {
Log.d("ContentValues", e.getMessage());
}
}
public static void a(Context context, String str, com.lovense.sdklibrary.callBack.a aVar) {
a = str;
if (c(context)) {
new a(str, context, aVar).start();
} else {
aVar.a(false, "");
}
}
public static void a(Context context, String str, String str2, String str3) {
new C0007b(context, str, str2, str3).start();
}
public static int b(String str) {
String[] split = str.replace(";", "").split(",");
int i = 0;
if (split != null && split.length > 0) {
i = Integer.valueOf(split[0].substring(split[0].indexOf("S") + 1)).intValue();
}
System.out.println("rsi:" + str + " speed:" + i);
return i;
}
public static String b(Context context) {
return context.getPackageName();
}
public static String b(String str, Map<String, String> map) {
?? r6;
?? r62;
PrintWriter printWriter;
String str2 = "";
PrintWriter printWriter2 = null;
try {
try {
String jSONObject = new JSONObject(map).toString();
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL("https://apps.lovense.com" + str).openConnection();
httpURLConnection.setRequestProperty("accept", "*/*");
httpURLConnection.setRequestProperty("connection", "Keep-Alive");
httpURLConnection.setRequestMethod("POST");
httpURLConnection.setRequestProperty(Field.CONTENT_TYPE, "application/json;charset=utf-8");
httpURLConnection.setUseCaches(false);
httpURLConnection.setDoOutput(true);
httpURLConnection.setDoInput(true);
httpURLConnection.setReadTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
httpURLConnection.setConnectTimeout(NutakuSdk.CONNECTION_TIMEOUT_MS);
if (jSONObject == null || jSONObject.trim().equals("")) {
printWriter = null;
} else {
printWriter = new PrintWriter(httpURLConnection.getOutputStream());
try {
printWriter.print(jSONObject);
printWriter.flush();
} catch (Exception e) {
e = e;
r62 = 0;
printWriter2 = printWriter;
r62 = r62;
try {
e.printStackTrace();
if (printWriter2 != null) {
}
if (r62 != 0) {
}
return str2;
} catch (Throwable th) {
th = th;
printWriter = printWriter2;
printWriter2 = r62;
r6 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
try {
printWriter2.close();
} catch (IOException e2) {
e2.printStackTrace();
throw th;
}
}
if (r6 != 0) {
r6.close();
}
throw th;
}
} catch (Throwable th2) {
th = th2;
r6 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
}
if (r6 != 0) {
}
throw th;
}
}
r62 = new BufferedReader(new InputStreamReader(httpURLConnection.getInputStream()));
while (true) {
try {
String readLine = r62.readLine();
if (readLine == null) {
break;
}
str2 = str2 + readLine;
} catch (Exception e3) {
e = e3;
printWriter2 = printWriter;
r62 = r62;
e.printStackTrace();
if (printWriter2 != null) {
printWriter2.close();
}
if (r62 != 0) {
r62.close();
}
return str2;
} catch (Throwable th3) {
th = th3;
printWriter2 = r62;
r6 = printWriter2;
printWriter2 = printWriter;
if (printWriter2 != null) {
}
if (r6 != 0) {
}
throw th;
}
}
if (printWriter != null) {
printWriter.close();
}
r62.close();
} catch (IOException e4) {
e4.printStackTrace();
}
} catch (Exception e5) {
e = e5;
r62 = 0;
} catch (Throwable th4) {
th = th4;
r6 = 0;
if (printWriter2 != null) {
}
if (r6 != 0) {
}
throw th;
}
return str2;
}
public static void b(Application application) {
SharedPreferences sharedPreferences = application.getSharedPreferences("lv_tys.db", 0);
String string = sharedPreferences.getString("uuid", null);
if (string != null) {
b = string;
return;
}
int random = (int) (((Math.random() * 9.0d) + 1.0d) * 100000.0d);
b = "LVS" + System.currentTimeMillis() + "-" + random;
SharedPreferences.Editor edit = sharedPreferences.edit();
edit.putString("uuid", b);
c.a(edit);
}
private static int c(String str) {
int intValue = Integer.valueOf(str, 16).intValue();
return intValue > 127 ? intValue + InputDeviceCompat.SOURCE_ANY : intValue;
}
private static boolean c(Context context) {
NetworkInfo[] allNetworkInfo;
ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService("connectivity");
if (connectivityManager != null && (allNetworkInfo = connectivityManager.getAllNetworkInfo()) != null && allNetworkInfo.length > 0) {
for (NetworkInfo networkInfo : allNetworkInfo) {
if (networkInfo.getState() == NetworkInfo.State.CONNECTED) {
return true;
}
}
}
return false;
}
}