package com.baidu.idl.main.facesdk.statistic; import android.content.Context; import android.text.TextUtils; import android.util.Log; import com.baidu.idl.main.facesdk.BuildConfig; import com.baidu.idl.main.facesdk.callback.Callback; import com.baidu.vis.unified.license.AndroidLicenser; import com.baidu.vis.unified.license.HttpStatus; import com.baidu.vis.unified.license.HttpUtils; import com.bytedance.sdk.openadsdk.api.plugin.PluginConstants; import com.umeng.analytics.pro.am; import org.json.JSONException; import org.json.JSONObject; public class PostDeviceInfo { public static void uploadDeviceInfo(final Context context, final Callback callback) { new Thread(new Runnable() { /* class com.baidu.idl.main.facesdk.statistic.PostDeviceInfo.AnonymousClass1 */ /* JADX WARNING: Removed duplicated region for block: B:29:0x00fe */ /* JADX WARNING: Removed duplicated region for block: B:31:0x0106 */ public final void run() { String str; HttpStatus requestPost; JSONException e; String deviceId = AndroidLicenser.getDeviceId(context.getApplicationContext()); String systemVersion = DeviceInfoUtil.getSystemVersion(); float longValue = (float) ((Long.valueOf(DeviceInfoUtil.getRamInfo(context)).longValue() / 1024) / 1024); float deviceBasicFrequency = (float) (DeviceInfoUtil.getDeviceBasicFrequency() / 1000); int numberOfCPUCores = DeviceInfoUtil.getNumberOfCPUCores(); int intValue = DeviceInfoUtil.getCPUBit().intValue(); Integer networkState = NetWorkUtil.getNetworkState(context); try { JSONObject jSONObject = new JSONObject(); jSONObject.put("analysisType", "offline_Sdk"); jSONObject.put("deviceId", deviceId); jSONObject.put("cpuCore", numberOfCPUCores); jSONObject.put("cpuBit", intValue); jSONObject.put("ghz", Math.round(deviceBasicFrequency)); jSONObject.put("ram", Math.round(longValue)); jSONObject.put("networkType", networkState); jSONObject.put("networkDesc", networkState.intValue() == 1 ? "WIFI网络" : networkState.intValue() == 2 ? "2G网络" : networkState.intValue() == 3 ? "3G网络" : networkState.intValue() == 4 ? "4G网络" : networkState.intValue() == 5 ? "有线网卡" : "其他网络模块"); jSONObject.put(am.x, 1); jSONObject.put("osVersion", systemVersion); jSONObject.put("sdk", 1); jSONObject.put("sdkVersion", BuildConfig.VERSION_NAME); JSONObject jSONObject2 = new JSONObject(); jSONObject2.put("mh", "offlineSdkStatistic"); jSONObject2.put("dt", jSONObject); str = jSONObject2.toString(); try { StringBuilder sb = new StringBuilder(); sb.append("参数是:"); sb.append(str); Log.i("bdface", sb.toString()); } catch (JSONException e2) { e = e2; e.getStackTrace(); requestPost = HttpUtils.requestPost("http://brain.baidu.com/record/api", str, "application/json", "zxq"); if (requestPost == null) { } } } catch (JSONException e3) { e = e3; str = null; e.getStackTrace(); requestPost = HttpUtils.requestPost("http://brain.baidu.com/record/api", str, "application/json", "zxq"); if (requestPost == null) { } } requestPost = HttpUtils.requestPost("http://brain.baidu.com/record/api", str, "application/json", "zxq"); if (requestPost == null) { callback.onResponse(-1, "请求失败"); return; } String str2 = requestPost.responseStr; Log.i("bdface", "response结果:" + str2); try { if (TextUtils.isEmpty(str2)) { callback.onResponse(-1, "request error"); return; } JSONObject jSONObject3 = new JSONObject(str2); callback.onResponse(jSONObject3.optInt(PluginConstants.KEY_ERROR_CODE), jSONObject3.optString("msg")); } catch (JSONException e4) { e4.getStackTrace(); Callback callback = callback; callback.onResponse(-1, "request error = " + e4.getMessage()); } catch (Exception e5) { e5.getStackTrace(); Callback callback2 = callback; callback2.onResponse(-1, "request error = " + e5.getMessage()); } } }).start(); } }