Picsart v24.6版本的 MD5 值为:21a61631d94e54da68d2ad9268b8b9d9

以下内容为反编译后的 DtbDeviceRegistration.java 源代码,内容仅作参考


package com.amazon.device.ads;

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import com.amazon.aps.shared.analytics.APSEventSeverity;
import com.amazon.aps.shared.analytics.APSEventType;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.inmobi.sdk.InMobiSdk;
import java.security.SecureRandom;
import java.util.HashMap;
import java.util.Map;
import kotlin.jvm.internal.Intrinsics;
import myobfuscated.i7.f;
import myobfuscated.i7.g;
import myobfuscated.l7.c;
import myobfuscated.o7.b;
import myobfuscated.s7.n;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
public class DtbDeviceRegistration {
    private static final String AAX_VIDEO_HOST_NAME_KEY = "aaxVideoHostname";
    private static final String CONFIG_OS_KEY = "os";
    private static final String CONFIG_OS_VERSION_KEY = "osVersion";
    private static final String CONFIG_PRIVACY_APPLICABLE = "privacyApplicable";
    private static final String CONFIG_PRIVACY_KEY = "privacy";
    private static final String CONFIG_SEGMENT_ID_KEY = "segmentId";
    private static final String LOG_TAG = "com.amazon.device.ads.DtbDeviceRegistration";
    private static String appId;
    private static int configSeq;
    private static DtbDeviceRegistration dtbDeviceRegistrationInstance;
    private final DtbMetrics metrics = new DtbMetrics();

    private DtbDeviceRegistration() {
    }

    private HashMap<String, Object> buildConfigInfoParams(String str) {
        HashMap<String, Object> hashMap = new HashMap<>();
        hashMap.put("appId", str);
        hashMap.put("sdkVer", DtbCommonUtils.getSDKVersion());
        hashMap.put("fp", "false");
        hashMap.put("testMode", Boolean.toString(AdRegistration.isTestMode()));
        JSONObject paramsJsonGetSafe = DtbDeviceData.getDeviceDataInstance().getParamsJsonGetSafe();
        if (paramsJsonGetSafe != null) {
            hashMap.put("dinfo", paramsJsonGetSafe);
        }
        JSONObject paramsJson = DtbPackageNativeData.getPackageNativeDataInstance(AdRegistration.getContext()).getParamsJson();
        if (paramsJson != null) {
            hashMap.put("pkg", paramsJson);
        }
        if (AdRegistration.getCustomDictionary() != null && AdRegistration.getCustomDictionary().containsKey(DtbConstants.MEDIATION_NAME)) {
            String str2 = AdRegistration.getCustomDictionary().get(DtbConstants.MEDIATION_NAME);
            if (!DtbCommonUtils.isNullOrEmpty(str2)) {
                hashMap.put(DtbConstants.MEDIATION_NAME, str2);
            }
        }
        if (Math.random() <= DTBMetricsConfiguration.getClientConfigVal("distribution_pixel", DTBMetricsConfiguration.DISTRIBUTION_PIXEL_DEFAULT_VALUE.intValue(), "sample_rates").intValue() / 100.0f) {
            String sDKDistributionPlace = AdRegistration.getSDKDistributionPlace();
            if (!DtbCommonUtils.isNullOrEmpty(sDKDistributionPlace)) {
                hashMap.put("distribution", sDKDistributionPlace);
            }
        }
        hashMap.put(CONFIG_SEGMENT_ID_KEY, Integer.valueOf(new SecureRandom().nextInt(1000) + 1));
        hashMap.put(CONFIG_OS_KEY, DtbConstants.NATIVE_OS_NAME);
        hashMap.put("osVersion", Build.VERSION.RELEASE);
        return hashMap;
    }

    private HashMap<String, Object> buildSISParams(String str) {
        HashMap<String, Object> hashMap = new HashMap<>(DtbDeviceData.getDeviceDataInstance().getDeviceParams());
        String adId = DtbSharedPreferences.getInstance().getAdId();
        if (adId != null) {
            hashMap.put("adId", adId);
        }
        String idfa = DtbSharedPreferences.getInstance().getIdfa();
        Boolean optOut = DtbSharedPreferences.getInstance().getOptOut();
        if (!DtbCommonUtils.isNullOrEmpty(idfa)) {
            hashMap.put("idfa", idfa);
        }
        hashMap.put("oo", convertBooleanToFlag(optOut));
        if (str != null) {
            hashMap.put("appId", str);
        }
        JSONObject paramsJson = DtbPackageNativeData.getPackageNativeDataInstance(AdRegistration.getContext()).getParamsJson();
        if (paramsJson != null) {
            hashMap.put("pkg", paramsJson);
        }
        Context context = AdRegistration.getContext();
        if (context != null) {
            SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
            Object obj = defaultSharedPreferences.contains(DtbConstants.IABTCF_GDPR_APPLIES) ? defaultSharedPreferences.getAll().get(DtbConstants.IABTCF_GDPR_APPLIES) : null;
            String string = defaultSharedPreferences.getString(DtbConstants.IABTCF_TC_STRING, null);
            if (obj != null) {
                try {
                    if ((obj instanceof Integer) && (((Integer) obj).intValue() == 1 || ((Integer) obj).intValue() == 0)) {
                        hashMap.put(InMobiSdk.IM_GDPR_CONSENT_GDPR_APPLIES, obj);
                    } else if (((obj instanceof String) && ((String) obj).equals("1")) || ((String) obj).equals("0")) {
                        hashMap.put(InMobiSdk.IM_GDPR_CONSENT_GDPR_APPLIES, obj);
                    } else {
                        DtbLog.info("IABTCF_gdprApplies should be a 1 or 0 as per IAB guideline");
                    }
                } catch (ClassCastException unused) {
                    DtbLog.info("IABTCF_gdprApplies should be a number as per IAB guideline");
                }
            }
            if (string != null) {
                hashMap.put(InMobiSdk.IM_GDPR_CONSENT_IAB, string);
            }
            if (DTBMetricsConfiguration.getInstance().isFeatureEnabled(DTBMetricsConfiguration.FEATURE_FLAG_GPP_PARAMS_TO_AIP_CALL)) {
                HashMap<String, Object> addGPPParametersFromPreferences = DtbCommonUtils.addGPPParametersFromPreferences(defaultSharedPreferences);
                if (!DtbCommonUtils.isNullOrEmpty(addGPPParametersFromPreferences)) {
                    hashMap.putAll(addGPPParametersFromPreferences);
                }
            }
        }
        String encodedNonIABString = AdRegistration.getEncodedNonIABString();
        if (!DtbCommonUtils.isNullOrEmpty(encodedNonIABString)) {
            hashMap.put("gdpr_custom", encodedNonIABString);
        }
        return hashMap;
    }

    private static String convertBooleanToFlag(Boolean bool) {
        return (bool != null && bool.booleanValue()) ? "1" : "0";
    }

    private synchronized void initializeAds() {
        if (DtbCommonUtils.isOnMainThread()) {
            DtbLog.error(LOG_TAG, "Unable to fetch advertising identifier information on main thread.");
            return;
        }
        String appKey = AdRegistration.getAppKey();
        appId = appKey;
        if (DtbCommonUtils.isNullOrEmpty(appKey)) {
            DtbLog.error(LOG_TAG, "App id not available");
        } else if (!DtbCommonUtils.isNetworkConnected()) {
            DtbLog.debug("Network is not available");
        } else {
            DtbDebugProperties.getInstance();
            registerConfig(appId);
            long currentTimeMillis = System.currentTimeMillis();
            long longValue = DtbSharedPreferences.getInstance().getSisLastCheckIn().longValue();
            if (DtbSharedPreferences.getInstance().getIsSisRegisterationSuccessful()) {
                long j = currentTimeMillis - longValue;
                if (j <= 86400000) {
                    DtbLog.debug("SIS call not required, last registration duration:" + j + ", expiration:86400000");
                    return;
                }
            }
            new DtbAdvertisingInfo();
            boolean z = false;
            if (!c.f.b() && !DTBMetricsConfiguration.getInstance().isFeatureEnabled(DTBMetricsConfiguration.FEATURE_AIP_CALL_IF_NO_GDPR_CONSENT, false)) {
                f.a(LOG_TAG, "No AIP calls as the feature flag is off");
                return;
            }
            String sisEndpoint = DtbSharedPreferences.getInstance().getSisEndpoint();
            if (sisEndpoint.startsWith("null")) {
                DtbLog.debug("SIS is not ready");
                return;
            }
            StringBuilder sb = new StringBuilder(DtbDebugProperties.getSISUrl(sisEndpoint));
            if (longValue == 0) {
                DtbLog.info(LOG_TAG, "Trying to register ad id..");
                sb.append("/generate_did");
            } else {
                DtbLog.info(LOG_TAG, "Trying to update ad id..");
                sb.append("/update_dev_info");
                z = true;
            }
            HashMap<String, Object> buildSISParams = buildSISParams(appId);
            try {
                try {
                    DtbHttpClient dtbHttpClient = new DtbHttpClient(sb.toString());
                    dtbHttpClient.setUseSecure(DtbDebugProperties.getIsSecure(true));
                    dtbHttpClient.setParams(buildSISParams);
                    dtbHttpClient.enableQueryParams();
                    DtbMetric dtbMetric = z ? DtbMetric.SIS_LATENCY_UPDATE_DEVICE_INFO : DtbMetric.SIS_LATENCY_REGISTER_EVENT;
                    this.metrics.startTimer(dtbMetric);
                    dtbHttpClient.executePOST(60000);
                    this.metrics.stopTimer(dtbMetric);
                    if (DtbCommonUtils.isNullOrEmpty(dtbHttpClient.getResponse())) {
                        DtbLog.debug("No response from sis call.");
                        throw new Exception("SIS Response is null");
                    }
                    JSONObject jSONObject = (JSONObject) new JSONTokener(dtbHttpClient.getResponse()).nextValue();
                    DtbSharedPreferences.getInstance().setIsSisRegisterationSuccessful(isRegistrationRequestSuccessful(jSONObject));
                    if (DtbSharedPreferences.getInstance().getIsSisRegisterationSuccessful()) {
                        if (dtbMetric != null) {
                            this.metrics.resetMetric(dtbMetric);
                        }
                        pingSis(sisEndpoint, appId);
                        return;
                    }
                    DtbLog.info(LOG_TAG, "ad id failed registration: " + jSONObject);
                    throw new Exception("ad id failed registration: ");
                } catch (JSONException e) {
                    DtbLog.error("JSON error parsing return from SIS: " + e.getMessage());
                    if (0 != 0) {
                        this.metrics.resetMetric(null);
                    }
                }
            } catch (Exception e2) {
                DtbLog.error("Error registering device for ads:" + e2);
                if (0 != 0) {
                    this.metrics.resetMetric(null);
                }
            }
        }
    }

    private boolean isPingRequestSuccessful(JSONObject jSONObject) throws JSONException {
        if (jSONObject.has("rcode")) {
            if (jSONObject.getInt("rcode") == 1) {
                DtbSharedPreferences.getInstance().saveSisLastPing(System.currentTimeMillis());
                DtbLog.info(LOG_TAG, "ad id is registered or updated successfully.");
                return true;
            } else if (jSONObject.getInt("rcode") == 103 || (jSONObject.getInt("rcode") == 101 && jSONObject.has("msg") && jSONObject.getInt("msg") == 103)) {
                DtbSharedPreferences.getInstance().saveSisLastPing(System.currentTimeMillis());
                DtbLog.info("gdpr consent not granted");
                return true;
            } else {
                return false;
            }
        }
        return false;
    }

    private boolean isRegistrationRequestSuccessful(JSONObject jSONObject) throws JSONException {
        if (jSONObject.has("rcode")) {
            DtbSharedPreferences.getInstance().saveSisLastCheckIn(System.currentTimeMillis());
            if (jSONObject.getInt("rcode") == 1 && jSONObject.has("adId")) {
                String string = jSONObject.getString("adId");
                if (jSONObject.has("idChanged") && jSONObject.getBoolean("idChanged")) {
                    DtbLog.info(LOG_TAG, "ad id has changed, updating..");
                    this.metrics.incrementMetric(DtbMetric.SIS_COUNTER_IDENTIFIED_DEVICE_CHANGED);
                }
                DtbSharedPreferences.getInstance().saveAdId(string);
                DtbLog.info(LOG_TAG, "ad id is registered or updated successfully.");
                return true;
            }
            if (jSONObject.getInt("rcode") != 103) {
                if (jSONObject.getInt("rcode") != 101 || !jSONObject.has("msg")) {
                    return false;
                }
                if (jSONObject.optInt("msg") != 103 && !"need at least one native id in parameter".equals(jSONObject.get("msg"))) {
                    return false;
                }
            }
            DtbSharedPreferences.getInstance().removeAdid();
            DtbLog.debug(LOG_TAG, "No ad-id returned");
            return true;
        }
        return false;
    }

    public static void lambda$verifyRegistration$0() {
        dtbDeviceRegistrationInstance.initializeAds();
        g.b(false);
    }

    private void loadApsMetricsConfig() {
        String clientConfigVal = DTBMetricsConfiguration.getClientConfigVal(DTBMetricsConfiguration.APSMETRICS_LEVEL1_KEY, DTBMetricsConfiguration.APSMETRICS_LEVEL2_KEY, "url", "https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecord");
        if (!myobfuscated.fk.a.e(clientConfigVal)) {
            myobfuscated.o7.b.d = clientConfigVal;
        }
        double doubleValue = DTBMetricsConfiguration.getClientConfigVal(DTBMetricsConfiguration.APSMETRICS_LEVEL1_KEY, DTBMetricsConfiguration.APSMETRICS_LEVEL2_KEY, DTBMetricsConfiguration.APSMETRICS_SAMPLING_RATE, 0.01d).doubleValue();
        if (0.0d <= doubleValue && doubleValue <= 100.0d) {
            myobfuscated.o7.b.c = doubleValue;
            b.a.b();
        }
        String clientConfigVal2 = DTBMetricsConfiguration.getClientConfigVal(DTBMetricsConfiguration.APSMETRICS_LEVEL1_KEY, DTBMetricsConfiguration.APSMETRICS_LEVEL2_KEY, DTBMetricsConfiguration.APSMETRICS_APIKEY, "a5c71f6aff54eb34c826d952c285eaf0650b4259c83ae598962681a6429b63f6");
        if (myobfuscated.fk.a.e(clientConfigVal2)) {
            return;
        }
        myobfuscated.o7.b.e = clientConfigVal2;
    }

    private boolean parseRegisterConfigResponse(String str, long j, boolean z) throws Exception {
        JSONObject jSONObject = (JSONObject) new JSONTokener(str).nextValue();
        if (jSONObject.has(CONFIG_PRIVACY_APPLICABLE)) {
            Object obj = jSONObject.get(CONFIG_PRIVACY_APPLICABLE);
            if (obj instanceof JSONArray) {
                c cVar = c.f;
                JSONArray jSONArray = (JSONArray) obj;
                if (jSONArray != null) {
                    cVar.getClass();
                    int length = jSONArray.length();
                    int i = 0;
                    while (true) {
                        if (i >= length) {
                            break;
                        }
                        int i2 = i + 1;
                        if (Intrinsics.c("gdprtcfv2", jSONArray.get(i))) {
                            cVar.d = Boolean.TRUE;
                            break;
                        }
                        i = i2;
                    }
                } else {
                    cVar.d = Boolean.FALSE;
                }
            }
        }
        if (jSONObject.has("pj")) {
            DtbSharedPreferences.getInstance().savePJTemplate(jSONObject.getJSONObject("pj"));
        } else {
            DtbSharedPreferences.getInstance().removePJTemplate();
        }
        if (jSONObject.has(CONFIG_PRIVACY_KEY)) {
            setPrivacyConfigToSharedPreferences(jSONObject.getJSONArray(CONFIG_PRIVACY_KEY));
        } else {
            DtbSharedPreferences.getInstance().removePrivacyLocationConfig();
        }
        if (!jSONObject.has(DtbDebugProperties.AAX_HOSTNAME) && !jSONObject.has("sisURL") && !jSONObject.has(AAX_VIDEO_HOST_NAME_KEY)) {
            String str2 = LOG_TAG;
            DtbLog.info(str2, "ad configuration failed load: " + jSONObject);
            throw new Exception("ad configuration failed load");
        }
        if (jSONObject.has(DtbDebugProperties.AAX_HOSTNAME)) {
            DtbSharedPreferences.getInstance().saveAaxHostname(jSONObject.getString(DtbDebugProperties.AAX_HOSTNAME));
        }
        if (jSONObject.has("sisURL")) {
            z = DtbSharedPreferences.getInstance().saveSisEndpoint(jSONObject.getString("sisURL"));
        }
        if (jSONObject.has("ttl")) {
            DtbSharedPreferences.getInstance().saveConfigTtlInMilliSeconds(Long.parseLong(jSONObject.getString("ttl")));
        }
        if (jSONObject.has(AAX_VIDEO_HOST_NAME_KEY)) {
            DtbSharedPreferences.getInstance().saveAaxVideoHostname(jSONObject.getString(AAX_VIDEO_HOST_NAME_KEY));
        }
        if (jSONObject.has("bidTimeout")) {
            DtbSharedPreferences.getInstance().saveBidTimeout(Integer.valueOf(jSONObject.getInt("bidTimeout")));
        } else {
            DtbSharedPreferences.getInstance().removeBidTimeout();
        }
        DtbSharedPreferences.getInstance().saveConfigLastCheckIn(j);
        DtbLog.info(LOG_TAG, "ad configuration loaded successfully.");
        return z;
    }

    private void pingSis(String str, String str2) {
        if (System.currentTimeMillis() - DtbSharedPreferences.getInstance().getSisLastPing() < 2592000000L) {
            return;
        }
        String adId = DtbSharedPreferences.getInstance().getAdId();
        if (adId == null || adId.isEmpty()) {
            DtbLog.info("error retrieving ad id, cancelling sis ping");
            return;
        }
        try {
            if (!DtbCommonUtils.isNetworkConnected()) {
                DtbLog.debug("Network is not available");
                return;
            }
            DtbHttpClient dtbHttpClient = new DtbHttpClient(str + "/ping");
            dtbHttpClient.setUseSecure(DtbDebugProperties.getIsSecure(true));
            HashMap<String, Object> hashMap = new HashMap<>();
            hashMap.put("appId", str2);
            hashMap.put("adId", adId);
            Context context = AdRegistration.getContext();
            if (context != null) {
                SharedPreferences defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
                Object obj = defaultSharedPreferences.contains(DtbConstants.IABTCF_GDPR_APPLIES) ? defaultSharedPreferences.getAll().get(DtbConstants.IABTCF_GDPR_APPLIES) : null;
                String string = defaultSharedPreferences.getString(DtbConstants.IABTCF_TC_STRING, null);
                if (obj != null) {
                    try {
                        if ((obj instanceof Integer) && (((Integer) obj).intValue() == 1 || ((Integer) obj).intValue() == 0)) {
                            hashMap.put(InMobiSdk.IM_GDPR_CONSENT_GDPR_APPLIES, obj);
                        } else if (((obj instanceof String) && ((String) obj).equals("1")) || ((String) obj).equals("0")) {
                            hashMap.put(InMobiSdk.IM_GDPR_CONSENT_GDPR_APPLIES, obj);
                        } else {
                            DtbLog.info("IABTCF_gdprApplies should be a 1 or 0 as per IAB guideline");
                        }
                    } catch (ClassCastException unused) {
                        DtbLog.info("IABTCF_gdprApplies should be a number as per IAB guideline");
                    }
                }
                if (string != null) {
                    hashMap.put(InMobiSdk.IM_GDPR_CONSENT_IAB, string);
                }
                if (DTBMetricsConfiguration.getInstance().isFeatureEnabled(DTBMetricsConfiguration.FEATURE_FLAG_GPP_PARAMS_TO_AIP_CALL)) {
                    HashMap<String, Object> addGPPParametersFromPreferences = DtbCommonUtils.addGPPParametersFromPreferences(defaultSharedPreferences);
                    if (!DtbCommonUtils.isNullOrEmpty(addGPPParametersFromPreferences)) {
                        hashMap.putAll(addGPPParametersFromPreferences);
                    }
                }
            }
            String encodedNonIABString = AdRegistration.getEncodedNonIABString();
            if (!DtbCommonUtils.isNullOrEmpty(encodedNonIABString)) {
                hashMap.put("gdpr_custom", encodedNonIABString);
            }
            dtbHttpClient.setParams(hashMap);
            dtbHttpClient.executeGET(60000);
            if (DtbCommonUtils.isNullOrEmpty(dtbHttpClient.getResponse())) {
                DtbLog.debug("No response from sis ping.");
                throw new Exception("Ping SIS Response is null");
            }
            JSONObject jSONObject = (JSONObject) new JSONTokener(dtbHttpClient.getResponse()).nextValue();
            if (isPingRequestSuccessful(jSONObject)) {
                return;
            }
            String str3 = LOG_TAG;
            DtbLog.info(str3, "sis ping failed failed registration: " + jSONObject);
            throw new Exception("sis ping failed registration: ");
        } catch (Exception e) {
            DtbLog.error("Error pinging sis: " + e);
        }
    }

    private boolean registerConfig(String str) {
        DtbMetrics dtbMetrics;
        DtbMetric dtbMetric;
        configSeq++;
        long currentTimeMillis = System.currentTimeMillis();
        long longValue = currentTimeMillis - DtbSharedPreferences.getInstance().getConfigLastCheckIn().longValue();
        long configTtlInMilliSeconds = DtbSharedPreferences.getInstance().getConfigTtlInMilliSeconds();
        StringBuilder j = myobfuscated.a0.a.j("Config last check in duration: ", longValue, ", Expiration: ");
        j.append(configTtlInMilliSeconds);
        DtbLog.debug(j.toString());
        if (!DTBMetricsConfiguration.getInstance().isFeatureEnabled("config_check_in_ttl_feature_v2")) {
            configTtlInMilliSeconds = 172800000;
        }
        int i = (longValue > configTtlInMilliSeconds ? 1 : (longValue == configTtlInMilliSeconds ? 0 : -1));
        boolean z = false;
        if (i <= 0) {
            DtbLog.debug("No config refresh required");
            return false;
        } else if (!DtbCommonUtils.isNetworkConnected()) {
            DtbLog.debug("Network is not available");
            return false;
        } else {
            DtbHttpClient dtbHttpClient = new DtbHttpClient(e.m(new StringBuilder(), DtbDebugProperties.getConfigHostName("mads.amazon-adsystem.com"), "/msdk/getConfig"));
            dtbHttpClient.addHeader("Accept", "application/json");
            for (Map.Entry<String, String> entry : DtbDebugProperties.getConfigRequestHeaders(JsonUtils.EMPTY_JSON).entrySet()) {
                dtbHttpClient.addHeader(entry.getKey(), entry.getValue());
            }
            dtbHttpClient.setUseSecure(DtbDebugProperties.getIsSecure(true));
            dtbHttpClient.setParams(buildConfigInfoParams(str));
            try {
                try {
                    DtbMetrics dtbMetrics2 = this.metrics;
                    dtbMetric = DtbMetric.CONFIG_DOWNLOAD_LATENCY;
                    dtbMetrics2.startTimer(dtbMetric);
                    dtbHttpClient.executeGET(60000);
                    this.metrics.stopTimer(dtbMetric);
                    if (DtbCommonUtils.isNullOrEmpty(dtbHttpClient.getResponse())) {
                        throw new Exception("Config Response is null");
                    }
                    z = parseRegisterConfigResponse(dtbHttpClient.getResponse(), currentTimeMillis, false);
                    b.a.c("remoteConfigFetchSuccess", String.valueOf(configSeq));
                    dtbMetrics = this.metrics;
                } catch (Exception e) {
                    DtbLog.error("Error fetching DTB config: " + e);
                    myobfuscated.o7.a.b(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Error fetching DTB config:", e);
                    b.a.c("remoteConfigFetchFailure", String.valueOf(configSeq));
                    dtbMetrics = this.metrics;
                    if (dtbMetrics != null) {
                        dtbMetric = DtbMetric.CONFIG_DOWNLOAD_LATENCY;
                        dtbMetrics.resetMetric(dtbMetric);
                    }
                    try {
                        DTBMetricsConfiguration.getInstance().loadMobileClientConfig();
                        double intValue = DTBMetricsConfiguration.getClientConfigVal("sampling_rate", DTBMetricsConfiguration.ANALYTIC_PIXEL_DEFAULT_VALUE.intValue(), "analytics").intValue() / 100.0f;
                        String clientConfigVal = DTBMetricsConfiguration.getClientConfigVal("url", "", "analytics");
                        String clientConfigVal2 = DTBMetricsConfiguration.getClientConfigVal("api_key", "", "analytics");
                        if (myobfuscated.o7.a.b == null || !myobfuscated.o7.a.c) {
                            myobfuscated.o7.a.a(AdRegistration.getContext());
                            String version = AdRegistration.getVersion();
                            if (version != null && !version.trim().isEmpty()) {
                                myobfuscated.o7.a.a = version.trim();
                            }
                        }
                        myobfuscated.o7.a.c((int) intValue);
                        myobfuscated.o7.a.e = (clientConfigVal == null || clientConfigVal.trim().isEmpty()) ? "https://prod.cm.publishers.advertising.a2z.com/logrecord/putlog" : "https://prod.cm.publishers.advertising.a2z.com/logrecord/putlog";
                        myobfuscated.o7.a.d = (clientConfigVal2 == null || clientConfigVal2.trim().isEmpty()) ? "e9026ffd475a1a3691e6b2ce637a9b92aab1073ebf53a67c5f2583be8a804ecb" : "e9026ffd475a1a3691e6b2ce637a9b92aab1073ebf53a67c5f2583be8a804ecb";
                        loadApsMetricsConfig();
                    } catch (RuntimeException e2) {
                        DtbLog.warn("Error when reading client config file for APSAndroidShared library" + e2);
                    }
                    return z;
                }
            } catch (Throwable th) {
                DtbMetrics dtbMetrics3 = this.metrics;
                if (dtbMetrics3 != null) {
                    dtbMetrics3.resetMetric(DtbMetric.CONFIG_DOWNLOAD_LATENCY);
                }
                throw th;
            }
        }
    }

    private void setPrivacyConfigToSharedPreferences(JSONArray jSONArray) {
        for (int i = 0; i < jSONArray.length(); i++) {
            try {
                JSONObject jSONObject = jSONArray.getJSONObject(i);
                if (jSONObject.has("location")) {
                    DtbSharedPreferences.getInstance().savePrivacyLocationConfig(jSONObject.getJSONObject("location"));
                    return;
                }
            } catch (RuntimeException e) {
                e = e;
                DtbLog.error(LOG_TAG, "Failed to parse privacy configuration");
                myobfuscated.o7.a.b(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Failed to parse privacy configuration", e);
                return;
            } catch (JSONException e2) {
                e = e2;
                DtbLog.error(LOG_TAG, "Failed to parse privacy configuration");
                myobfuscated.o7.a.b(APSEventSeverity.FATAL, APSEventType.EXCEPTION, "Failed to parse privacy configuration", e);
                return;
            }
        }
        DtbSharedPreferences.getInstance().removePrivacyLocationConfig();
    }

    public static synchronized void verifyRegistration() {
        synchronized (DtbDeviceRegistration.class) {
            try {
                if (dtbDeviceRegistrationInstance == null) {
                    dtbDeviceRegistrationInstance = new DtbDeviceRegistration();
                    g.b(false);
                }
                if (!g.a()) {
                    g.b(true);
                    DtbThreadService.getInstance().execute(new n(0));
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}