package com.ironsource; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Build; import android.os.Environment; import android.os.StatFs; import android.support.v4.media.session.PlaybackStateCompat; import android.telephony.TelephonyManager; import android.text.TextUtils; import com.applovin.sdk.AppLovinEventTypes; import com.glu.plugins.gluanalytics.AnalyticsData; import com.ironsource.mediationsdk.config.ConfigFile; import com.ironsource.mediationsdk.logger.IronLog; import com.ironsource.mediationsdk.logger.IronSourceLogger; import com.ironsource.mediationsdk.logger.IronSourceLoggerManager; import com.ironsource.mediationsdk.utils.IronSourceConstants; import com.ironsource.mediationsdk.utils.IronSourceUtils; import com.ironsource.v8; import java.util.Calendar; import java.util.HashMap; import java.util.Locale; import java.util.Map; import java.util.TimeZone; /* loaded from: classes2.dex */ public class yc implements Runnable { public static final String M = "sdkVersion"; public static final String N = "AdvIdOptOutReason"; private static final int O = 15; private static final int P = 840; private static final int Q = -720; private Context K; private final String a = getClass().getSimpleName(); private final String b = "bundleId"; private final String c = "advertisingId"; private final String d = v8.i.M; private final String e = "appKey"; private final String f = "deviceOS"; private final String g = AnalyticsData.S_OS_VERSION; private final String h = v8.i.t; private final String i = v8.i.u; private final String j = "language"; private final String k = v8.i.k; private final String l = "deviceModel"; private final String m = v8.i.r; private final String n = "externalFreeMemory"; private final String o = "internalFreeMemory"; private final String p = "battery"; private final String q = "gmtMinutesOffset"; private final String r = v8.i.W; private final String s = "sessionId"; private final String t = "pluginType"; private final String u = "pluginVersion"; private final String v = "plugin_fw_v"; private final String w = "jb"; private final String x = "advertisingIdType"; private final String y = ad.I0; private final String z = "firstSession"; private final String A = "mcc"; private final String B = "mnc"; private final String C = "icc"; private final String D = "tz"; private final String E = "auid"; private final String F = "userLat"; private final String G = "publisherAPI"; private final String H = "missingDependencies"; private final String I = "missingManifest"; private final String J = "other"; private final ce L = el.N().f(); private yc() { } public yc(Context context) { this.K = context.getApplicationContext(); } private String a(String str) { return TextUtils.isEmpty(str) ? "missingDependencies" : !ja.a.b() ? "publisherAPI" : !this.L.u(this.K) ? "missingManifest" : Boolean.parseBoolean(str) ? "userLat" : "other"; } private Map a() { boolean z; String str; HashMap hashMap = new HashMap(); hashMap.put("sessionId", IronSourceUtils.getSessionId()); String e = e(); if (!TextUtils.isEmpty(e)) { hashMap.put("bundleId", e); String b = v3.b(this.K, e); if (!TextUtils.isEmpty(b)) { hashMap.put(v8.i.W, b); } } hashMap.put("appKey", c()); String p = this.L.p(this.K); String a = this.L.a(this.K); boolean z2 = false; if (TextUtils.isEmpty(p)) { p = this.L.J(this.K); z = true; str = !TextUtils.isEmpty(p) ? IronSourceConstants.TYPE_UUID : ""; } else { str = IronSourceConstants.TYPE_GAID; z = false; } if (!TextUtils.isEmpty(p)) { hashMap.put("advertisingId", p); hashMap.put("advertisingIdType", str); } if (!TextUtils.isEmpty(a)) { z2 = Boolean.parseBoolean(a); hashMap.put(v8.i.M, Boolean.valueOf(z2)); } if (z || z2) { hashMap.put(N, a(a)); } hashMap.put("deviceOS", h()); if (!TextUtils.isEmpty(b())) { hashMap.put(AnalyticsData.S_OS_VERSION, b()); } String connectionType = IronSourceUtils.getConnectionType(this.K); if (!TextUtils.isEmpty(connectionType)) { hashMap.put(v8.i.t, connectionType); } String d = s8.d(this.K); if (!TextUtils.isEmpty(d)) { hashMap.put(v8.i.u, d); } hashMap.put("sdkVersion", r()); String l = l(); if (!TextUtils.isEmpty(l)) { hashMap.put("language", l); } String g = g(); if (!TextUtils.isEmpty(g)) { hashMap.put(v8.i.k, g); } String f = f(); if (!TextUtils.isEmpty(f)) { hashMap.put("deviceModel", f); } String n = n(); if (!TextUtils.isEmpty(n)) { hashMap.put(v8.i.r, n); } hashMap.put("internalFreeMemory", Long.valueOf(k())); hashMap.put("externalFreeMemory", Long.valueOf(i())); hashMap.put("battery", Integer.valueOf(d())); int j = j(); if (a(j)) { hashMap.put("gmtMinutesOffset", Integer.valueOf(j)); } String p2 = p(); if (!TextUtils.isEmpty(p2)) { hashMap.put("pluginType", p2); } String q = q(); if (!TextUtils.isEmpty(q)) { hashMap.put("pluginVersion", q); } String o = o(); if (!TextUtils.isEmpty(o)) { hashMap.put("plugin_fw_v", o); } String valueOf = String.valueOf(this.L.f()); if (!TextUtils.isEmpty(valueOf)) { hashMap.put("jb", valueOf); } String m = m(); if (!TextUtils.isEmpty(m)) { hashMap.put(ad.I0, m); } String valueOf2 = String.valueOf(IronSourceUtils.getFirstSession(this.K)); if (!TextUtils.isEmpty(valueOf2)) { hashMap.put("firstSession", valueOf2); } String s = this.L.s(this.K); if (!TextUtils.isEmpty(s)) { hashMap.put("auid", s); } hashMap.put("mcc", Integer.valueOf(r8.b(this.K))); hashMap.put("mnc", Integer.valueOf(r8.c(this.K))); String n2 = this.L.n(this.K); if (!TextUtils.isEmpty(n2)) { hashMap.put("icc", n2); } String b2 = this.L.b(); if (!TextUtils.isEmpty(b2)) { hashMap.put("tz", b2); } IronLog.INTERNAL.verbose("collecting data for events: " + hashMap); return hashMap; } private boolean a(int i) { return i <= P && i >= Q && i % 15 == 0; } private String b() { try { String str = Build.VERSION.RELEASE; return "" + Build.VERSION.SDK_INT + "(" + str + ")"; } catch (Exception e) { i9.d().a(e); return ""; } } private String c() { return com.ironsource.mediationsdk.p.m().n(); } private int d() { try { Intent registerReceiver = this.K.registerReceiver(null, new IntentFilter("android.intent.action.BATTERY_CHANGED")); int intExtra = registerReceiver != null ? registerReceiver.getIntExtra(AppLovinEventTypes.USER_COMPLETED_LEVEL, -1) : 0; int intExtra2 = registerReceiver != null ? registerReceiver.getIntExtra("scale", -1) : 0; if (intExtra == -1 || intExtra2 == -1) { return -1; } return (int) ((intExtra / intExtra2) * 100.0f); } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, this.a + ":getBatteryLevel()", e); return -1; } } private String e() { try { return this.K.getPackageName(); } catch (Exception e) { i9.d().a(e); return ""; } } private String f() { try { return Build.MODEL; } catch (Exception e) { i9.d().a(e); return ""; } } private String g() { try { return Build.MANUFACTURER; } catch (Exception e) { i9.d().a(e); return ""; } } private String h() { return v8.d; } private long i() { if (!s()) { return -1L; } StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath()); return (statFs.getAvailableBlocks() * statFs.getBlockSize()) / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED; } private int j() { try { TimeZone timeZone = TimeZone.getDefault(); return Math.round(((timeZone.getOffset(Calendar.getInstance(timeZone).getTimeInMillis()) / 1000) / 60) / 15) * 15; } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, this.a + ":getGmtMinutesOffset()", e); return 0; } } private long k() { try { StatFs statFs = new StatFs(Environment.getDataDirectory().getPath()); return (statFs.getAvailableBlocks() * statFs.getBlockSize()) / PlaybackStateCompat.ACTION_SET_CAPTIONING_ENABLED; } catch (Exception e) { i9.d().a(e); return -1L; } } private String l() { try { return Locale.getDefault().getLanguage(); } catch (Exception e) { i9.d().a(e); return ""; } } private String m() { return com.ironsource.mediationsdk.p.m().q(); } private String n() { try { TelephonyManager telephonyManager = (TelephonyManager) this.K.getSystemService("phone"); if (telephonyManager == null) { return ""; } String networkOperatorName = telephonyManager.getNetworkOperatorName(); return !networkOperatorName.equals("") ? networkOperatorName : ""; } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, this.a + ":getMobileCarrier()", e); return ""; } } private String o() { try { return ConfigFile.getConfigFile().getPluginFrameworkVersion(); } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, "getPluginFrameworkVersion()", e); return ""; } } private String p() { try { return ConfigFile.getConfigFile().getPluginType(); } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, "getPluginType()", e); return ""; } } private String q() { try { return ConfigFile.getConfigFile().getPluginVersion(); } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, "getPluginVersion()", e); return ""; } } private String r() { return IronSourceUtils.getSDKVersion(); } private boolean s() { try { return Environment.getExternalStorageState().equals("mounted"); } catch (Exception e) { i9.d().a(e); return false; } } @Override // java.lang.Runnable public void run() { try { xc.a().a(a()); } catch (Exception e) { i9.d().a(e); IronSourceLoggerManager.getLogger().logException(IronSourceLogger.IronSourceTag.NATIVE, "Thread name = " + getClass().getSimpleName(), e); } } }