package com.sjm.sjmdsp.net.task; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.net.wifi.WifiManager; import android.os.Build; import android.provider.Settings; import android.telephony.TelephonyManager; import android.view.WindowManager; import com.efs.sdk.base.core.util.NetworkUtil; import com.sjm.sjmdsp.core.config.SdkConfig; import com.sjm.sjmdsp.core.utils.AppInfoUtil; import com.sjm.sjmdsp.core.utils.DeviceIdUtil; import com.sjm.sjmdsp.core.utils.DeviceUtil; import com.sjm.sjmdsp.core.utils.NetworkTypeUtil; import java.net.Inet4Address; import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.URLEncoder; import java.util.Enumeration; import java.util.HashMap; import java.util.Map; public enum NetRequestBaseParams { INSTANCE; private Map<String, String> deviceInfo; private String gps; private String imei; private String ipAddress; private String model; private String oaid; private String packageName; private String systemVer; public Map<String, String> getParams() { if (this.deviceInfo == null) { this.deviceInfo = new HashMap(); if (Build.VERSION.SDK_INT >= 29) { String str = null; try { str = SdkConfig.context.getSharedPreferences("HZ_sjm_Config", 0).getString("oaId", null); } catch (Exception e) { e.printStackTrace(); } Map<String, String> map = this.deviceInfo; if (str == null) { str = "null"; } map.put("oaid", str); } else { this.deviceInfo.put("imei", DeviceIdUtil.getIMEI(SdkConfig.context)); } this.deviceInfo.put("uuid", DeviceIdUtil.getDeviceUUID(SdkConfig.context)); this.deviceInfo.put("brand", Build.BRAND); this.deviceInfo.put("model", Build.MODEL); this.deviceInfo.put("systemVer", Build.VERSION.RELEASE); this.deviceInfo.put("packageName", SdkConfig.context.getApplicationContext().getPackageName()); this.deviceInfo.put("osv", Build.VERSION.RELEASE); Map<String, String> map2 = this.deviceInfo; map2.put("osl", Build.VERSION.SDK_INT + ""); try { this.deviceInfo.put("androidid", Settings.System.getString(SdkConfig.context.getContentResolver(), "android_id")); } catch (Exception unused) { } String str2 = "2"; this.deviceInfo.put("devicetype", isPad(SdkConfig.context) ? str2 : "1"); Map<String, String> map3 = this.deviceInfo; if (!isScreenChange(SdkConfig.context)) { str2 = "1"; } map3.put("orientation", str2); Map<String, String> map4 = this.deviceInfo; map4.put("width", getScreenWidth(SdkConfig.context) + ""); Map<String, String> map5 = this.deviceInfo; map5.put("height", getScreenHeight(SdkConfig.context) + ""); try { Map<String, String> map6 = this.deviceInfo; map6.put("networktype", NetworkTypeUtil.getNetworkState(SdkConfig.context) + ""); } catch (Exception unused2) { } Map<String, String> map7 = this.deviceInfo; map7.put("operator", getSimOperator(SdkConfig.context) + ""); this.deviceInfo.put("image_width", "1"); this.deviceInfo.put("image_height", "1"); try { this.deviceInfo.put("appname", URLEncoder.encode(AppInfoUtil.getAppName(SdkConfig.context), "utf-8")); } catch (Exception unused3) { } } this.deviceInfo.put("ipAddress", getIpAddress(SdkConfig.context)); this.deviceInfo.put("location", DeviceUtil.getLocation(SdkConfig.context)); return this.deviceInfo; } /* JADX WARNING: Removed duplicated region for block: B:25:0x0055 A[ADDED_TO_REGION] */ private int getSimOperator(Context context) { char c = 0; try { String simOperator = ((TelephonyManager) context.getSystemService("phone")).getSimOperator(); if (simOperator == null) { return 0; } int hashCode = simOperator.hashCode(); if (hashCode != 49679477) { switch (hashCode) { case 49679470: if (simOperator.equals("46000")) { break; } break; case 49679471: if (simOperator.equals("46001")) { c = 3; break; } break; case 49679472: if (simOperator.equals("46002")) { c = 1; break; } break; case 49679473: if (simOperator.equals("46003")) { c = 4; break; } break; } if (c != 0 || c == 1 || c == 2) { return 1; } if (c != 3) { return c != 4 ? 4 : 2; } return 3; } else if (simOperator.equals("46007")) { c = 2; if (c != 0) { } return 1; } c = 65535; if (c != 0) { } return 1; } catch (Exception unused) { return 0; } } public static int getScreenWidth(Context context) { if (context == null) { return 0; } return ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getWidth(); } public static int getScreenHeight(Context context) { if (context == null) { return 0; } return ((WindowManager) context.getSystemService("window")).getDefaultDisplay().getHeight(); } public boolean isScreenChange(Context context) { if (context != null && context.getResources().getConfiguration().orientation == 2) { return true; } return false; } public static boolean isPad(Context context) { return context != null && (context.getResources().getConfiguration().screenLayout & 15) >= 3; } private String getIpAddress(Context context) { NetworkInfo activeNetworkInfo = ((ConnectivityManager) context.getSystemService("connectivity")).getActiveNetworkInfo(); if (activeNetworkInfo == null || !activeNetworkInfo.isConnected()) { return "null"; } if (activeNetworkInfo.getType() != 0) { return activeNetworkInfo.getType() == 1 ? intIP2StringIP(((WifiManager) context.getApplicationContext().getSystemService(NetworkUtil.NETWORK_TYPE_WIFI)).getConnectionInfo().getIpAddress()) : "null"; } try { Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces(); while (networkInterfaces.hasMoreElements()) { Enumeration<InetAddress> inetAddresses = networkInterfaces.nextElement().getInetAddresses(); while (true) { if (inetAddresses.hasMoreElements()) { InetAddress nextElement = inetAddresses.nextElement(); if (!nextElement.isLoopbackAddress() && (nextElement instanceof Inet4Address)) { return nextElement.getHostAddress(); } } } } return "null"; } catch (SocketException e) { e.printStackTrace(); return "null"; } } public String intIP2StringIP(int i) { return (i & 255) + "." + ((i >> 8) & 255) + "." + ((i >> 16) & 255) + "." + ((i >> 24) & 255); } }