package com.mobile.auth.gatewayauth.utils; import android.content.Context; import android.os.Build; import android.util.DisplayMetrics; import android.view.WindowManager; import com.mobile.auth.BuildConfig; import com.mobile.auth.gatewayauth.ExceptionProcessor; import com.mobile.auth.gatewayauth.model.TerminalInfo; import com.mobile.auth.gatewayauth.utils.security.PackageUtils; import com.mobile.auth.k.a; import com.mobile.auth.o.e; import com.nirvana.tools.jsoner.JSONUtils; public class d { public static String a() { try { return Build.BRAND; } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } public static String a(Context context) { try { return e.a(context); } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } public static String a(Context context, String str, String str2) { try { TerminalInfo terminalInfo = new TerminalInfo(); terminalInfo.setOsVersion(b()); terminalInfo.setDeviceName(c()); terminalInfo.setDeviceBrand(a()); terminalInfo.setPackageName(PackageUtils.getPackageName(context)); terminalInfo.setAppVersion(PackageUtils.getVersionName(context)); terminalInfo.setSign(PackageUtils.getSign(context)); terminalInfo.setVendorKey(str2); terminalInfo.setSdkVersion(BuildConfig.VERSION_NAME); terminalInfo.setOperatorCode(b.c(str2)); terminalInfo.setNetworkType(b.a(context, true)); terminalInfo.setSceneCode(str); terminalInfo.setUniqueId(com.mobile.auth.gatewayauth.manager.d.a); return JSONUtils.toJson(terminalInfo, null).toString(); } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } public static String a(Context context, String str, String str2, String str3, String str4, String str5, String str6, boolean z) { try { TerminalInfo terminalInfo = new TerminalInfo(); terminalInfo.setAccessCode(str4); terminalInfo.setOsVersion(b()); terminalInfo.setDeviceName(c()); terminalInfo.setDeviceBrand(a()); terminalInfo.setPackageName(PackageUtils.getPackageName(context)); terminalInfo.setAppVersion(PackageUtils.getVersionName(context)); terminalInfo.setSign(PackageUtils.getSign(context)); terminalInfo.setVendorKey(str5); terminalInfo.setSdkVersion(BuildConfig.VERSION_NAME); terminalInfo.setOperatorCode(b.c(str5)); terminalInfo.setNetworkType(b.a(context, true)); if (z) { terminalInfo.setInnerIP(b.a()); } terminalInfo.setCsrf(str6); terminalInfo.setSceneCode(str3); terminalInfo.setCertifyId(str); terminalInfo.setCustomId(str2); terminalInfo.setMark(a.a); return JSONUtils.toJson(terminalInfo, null).toString(); } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } public static int b(Context context) { try { WindowManager windowManager = (WindowManager) context.getSystemService("window"); DisplayMetrics displayMetrics = new DisplayMetrics(); if (windowManager != null) { windowManager.getDefaultDisplay().getMetrics(displayMetrics); } return displayMetrics.widthPixels; } catch (Throwable th) { ExceptionProcessor.processException(th); return -1; } } public static String b() { try { return Build.VERSION.RELEASE; } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } public static int c(Context context) { try { WindowManager windowManager = (WindowManager) context.getSystemService("window"); DisplayMetrics displayMetrics = new DisplayMetrics(); if (windowManager != null) { windowManager.getDefaultDisplay().getMetrics(displayMetrics); } return displayMetrics.heightPixels; } catch (Throwable th) { ExceptionProcessor.processException(th); return -1; } } public static String c() { try { return Build.MODEL.length() > 20 ? Build.MODEL.substring(0, 20) : Build.MODEL; } catch (Throwable th) { ExceptionProcessor.processException(th); return null; } } }