APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Նվագարկիչ
版本号:9.9.9
包名称:com.iptv.player

MD5 校验值:d7f913ab91d7343430e85d5ce2e5aff0

反编译源代码说明

PersonalInfoManager.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package com.mopub.common.privacy;

import android.content.ActivityNotFoundException;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import com.mopub.common.ClientMetadata;
import com.mopub.common.Constants;
import com.mopub.common.MoPub;
import com.mopub.common.Preconditions;
import com.mopub.common.SdkInitializationListener;
import com.mopub.common.VisibleForTesting;
import com.mopub.common.logging.MoPubLog;
import com.mopub.common.privacy.MoPubIdentifier;
import com.mopub.common.privacy.SyncRequest;
import com.mopub.common.util.Intents;
import com.mopub.common.util.ManifestUtils;
import com.mopub.exceptions.IntentNotResolvableException;
import com.mopub.mobileads.MoPubConversionTracker;
import com.mopub.mobileads.MoPubErrorCode;
import com.mopub.network.MoPubNetworkError;
import com.mopub.network.MultiAdResponse;
import com.mopub.network.Networking;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Objects;
import java.util.Set;

public class PersonalInfoManager {

    public final Context f18785a;

    public final Set<ConsentStatusChangeListener> f18786b;

    public final oe.d f18787c;

    public final ConsentDialogController f18788d;

    public final MoPubConversionTracker f18789e;

    public final SyncRequest.Listener f18790f;

    public MultiAdResponse.ServerOverrideListener f18791g;

    public SdkInitializationListener f18792h;

    public long f18793i = 300000;

    public Long f18794j;

    public ConsentStatus f18795k;

    public boolean f18796l;

    public boolean f18797m;

    public boolean f18798n;

    public boolean f18799o;

    public class a implements MoPubIdentifier.AdvertisingIdChangeListener {
        public a() {
        }

        @Override
        public void onIdChanged(AdvertisingId advertisingId, AdvertisingId advertisingId2) {
            Preconditions.checkNotNull(advertisingId);
            Preconditions.checkNotNull(advertisingId2);
            if (advertisingId.isDoNotTrack() && advertisingId2.isDoNotTrack()) {
                return;
            }
            if (!advertisingId.isDoNotTrack() && advertisingId2.isDoNotTrack()) {
                PersonalInfoManager.this.a(ConsentStatus.DNT, ConsentChangeReason.DENIED_BY_DNT_ON);
                PersonalInfoManager.this.requestSync(true);
                return;
            }
            if (advertisingId.isDoNotTrack() && !advertisingId2.isDoNotTrack()) {
                ConsentStatus consentStatus = ConsentStatus.EXPLICIT_NO;
                if (consentStatus.equals(PersonalInfoManager.this.f18787c.f37441j)) {
                    PersonalInfoManager.this.a(consentStatus, ConsentChangeReason.DNT_OFF);
                    return;
                } else {
                    PersonalInfoManager.this.a(ConsentStatus.UNKNOWN, ConsentChangeReason.DNT_OFF);
                    return;
                }
            }
            if (TextUtils.isEmpty(advertisingId2.f18750a) || advertisingId2.f18750a.equals(PersonalInfoManager.this.f18787c.f37439h) || !ConsentStatus.EXPLICIT_YES.equals(PersonalInfoManager.this.f18787c.f37435d)) {
                return;
            }
            PersonalInfoManager personalInfoManager = PersonalInfoManager.this;
            oe.d dVar = personalInfoManager.f18787c;
            dVar.f37436e = null;
            dVar.f37440i = null;
            personalInfoManager.a(ConsentStatus.UNKNOWN, ConsentChangeReason.IFA_CHANGED);
        }
    }

    public class b implements Runnable {

        public final ConsentDialogListener f18801a;

        public b(PersonalInfoManager personalInfoManager, ConsentDialogListener consentDialogListener) {
            this.f18801a = consentDialogListener;
        }

        @Override
        public void run() {
            MoPubLog.ConsentLogEvent consentLogEvent = MoPubLog.ConsentLogEvent.LOAD_FAILED;
            MoPubErrorCode moPubErrorCode = MoPubErrorCode.DO_NOT_TRACK;
            MoPubLog.log(consentLogEvent, Integer.valueOf(moPubErrorCode.getIntCode()), moPubErrorCode);
            this.f18801a.onConsentDialogLoadFailed(moPubErrorCode);
        }
    }

    public class c implements Runnable {

        public final ConsentDialogListener f18802a;

        public c(PersonalInfoManager personalInfoManager, ConsentDialogListener consentDialogListener) {
            this.f18802a = consentDialogListener;
        }

        @Override
        public void run() {
            MoPubLog.ConsentLogEvent consentLogEvent = MoPubLog.ConsentLogEvent.LOAD_FAILED;
            MoPubErrorCode moPubErrorCode = MoPubErrorCode.GDPR_DOES_NOT_APPLY;
            MoPubLog.log(consentLogEvent, Integer.valueOf(moPubErrorCode.getIntCode()), moPubErrorCode);
            this.f18802a.onConsentDialogLoadFailed(moPubErrorCode);
        }
    }

    public class d implements Runnable {

        public final ConsentStatusChangeListener f18803a;

        public final ConsentStatus f18804b;

        public final ConsentStatus f18805c;

        public final boolean f18806d;

        public d(PersonalInfoManager personalInfoManager, ConsentStatusChangeListener consentStatusChangeListener, ConsentStatus consentStatus, ConsentStatus consentStatus2, boolean z10) {
            this.f18803a = consentStatusChangeListener;
            this.f18804b = consentStatus;
            this.f18805c = consentStatus2;
            this.f18806d = z10;
        }

        @Override
        public void run() {
            this.f18803a.onConsentStateChange(this.f18804b, this.f18805c, this.f18806d);
        }
    }

    public static class e {

        public static final int[] f18807a;

        static {
            int[] iArr = new int[ConsentStatus.values().length];
            f18807a = iArr;
            try {
                iArr[ConsentStatus.EXPLICIT_YES.ordinal()] = 1;
            } catch (NoSuchFieldError unused) {
            }
            try {
                f18807a[ConsentStatus.EXPLICIT_NO.ordinal()] = 2;
            } catch (NoSuchFieldError unused2) {
            }
        }
    }

    public class f implements MultiAdResponse.ServerOverrideListener {
        public f(a aVar) {
        }

        @Override
        public void onForceExplicitNo(String str) {
            if (TextUtils.isEmpty(str)) {
                PersonalInfoManager.this.a(ConsentStatus.EXPLICIT_NO, ConsentChangeReason.REVOKED_BY_SERVER);
            } else {
                PersonalInfoManager.this.b(ConsentStatus.EXPLICIT_NO, str);
            }
        }

        @Override
        public void onForceGdprApplies() {
            PersonalInfoManager.this.forceGdprApplies();
        }

        @Override
        public void onInvalidateConsent(String str) {
            if (TextUtils.isEmpty(str)) {
                PersonalInfoManager.this.a(ConsentStatus.UNKNOWN, ConsentChangeReason.REACQUIRE_BY_SERVER);
            } else {
                PersonalInfoManager.this.b(ConsentStatus.UNKNOWN, str);
            }
        }

        @Override
        public void onReacquireConsent(String str) {
            if (!TextUtils.isEmpty(str)) {
                PersonalInfoManager.this.f18787c.f37437f = str;
            }
            oe.d dVar = PersonalInfoManager.this.f18787c;
            dVar.f37453v = true;
            dVar.b();
        }

        @Override
        public void onRequestSuccess(String str) {
            if (!TextUtils.isEmpty(PersonalInfoManager.this.f18787c.f37433b) || TextUtils.isEmpty(str)) {
                return;
            }
            oe.d dVar = PersonalInfoManager.this.f18787c;
            dVar.f37433b = str;
            dVar.b();
        }
    }

    public class g implements SyncRequest.Listener {
        public g(a aVar) {
        }

        @Override
        public void onErrorResponse(MoPubNetworkError moPubNetworkError) {
            MoPubLog.log(MoPubLog.ConsentLogEvent.SYNC_FAILED, Integer.valueOf(moPubNetworkError.getReason() != null ? moPubNetworkError.getReason().getCode() : MoPubErrorCode.UNSPECIFIED.getIntCode()), moPubNetworkError.getMessage() != null ? moPubNetworkError.getMessage() : MoPubErrorCode.UNSPECIFIED.toString());
            PersonalInfoManager personalInfoManager = PersonalInfoManager.this;
            personalInfoManager.f18796l = false;
            if (personalInfoManager.f18792h != null) {
                MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "Personal Info Manager initialization finished but ran into errors.");
                PersonalInfoManager.this.f18792h.onInitializationFinished();
                PersonalInfoManager.this.f18792h = null;
            }
        }

        @Override
        public void onResponse(SyncResponse syncResponse) {
            MoPubLog.log(MoPubLog.ConsentLogEvent.SYNC_COMPLETED, new Object[0]);
            boolean canCollectPersonalInformation = PersonalInfoManager.this.canCollectPersonalInformation();
            oe.d dVar = PersonalInfoManager.this.f18787c;
            if (dVar.f37454w == null) {
                dVar.f37454w = Boolean.valueOf(syncResponse.isGdprRegion());
            }
            if (syncResponse.isForceGdprApplies()) {
                PersonalInfoManager personalInfoManager = PersonalInfoManager.this;
                personalInfoManager.f18797m = true;
                personalInfoManager.f18787c.f37438g = true;
                boolean canCollectPersonalInformation2 = personalInfoManager.canCollectPersonalInformation();
                if (canCollectPersonalInformation != canCollectPersonalInformation2) {
                    PersonalInfoManager personalInfoManager2 = PersonalInfoManager.this;
                    ConsentStatus consentStatus = personalInfoManager2.f18787c.f37435d;
                    personalInfoManager2.c(consentStatus, consentStatus, canCollectPersonalInformation2);
                }
            }
            String str = PersonalInfoManager.this.f18787c.f37434c;
            if (!TextUtils.isEmpty(str) && PersonalInfoManager.this.f18787c.f37433b.isEmpty()) {
                PersonalInfoManager.this.f18787c.f37433b = str;
            }
            PersonalInfoManager personalInfoManager3 = PersonalInfoManager.this;
            oe.d dVar2 = personalInfoManager3.f18787c;
            dVar2.f37436e = personalInfoManager3.f18795k;
            dVar2.f37442k = syncResponse.isWhitelisted();
            PersonalInfoManager.this.f18787c.f37443l = syncResponse.getCurrentVendorListVersion();
            PersonalInfoManager.this.f18787c.f37444m = syncResponse.getCurrentVendorListLink();
            PersonalInfoManager.this.f18787c.f37445n = syncResponse.getCurrentPrivacyPolicyVersion();
            PersonalInfoManager.this.f18787c.f37446o = syncResponse.getCurrentPrivacyPolicyLink();
            String currentVendorListIabHash = syncResponse.getCurrentVendorListIabHash();
            String currentVendorListIabFormat = syncResponse.getCurrentVendorListIabFormat();
            if (!TextUtils.isEmpty(currentVendorListIabHash) && !currentVendorListIabHash.equals(PersonalInfoManager.this.f18787c.f37448q) && !TextUtils.isEmpty(currentVendorListIabFormat)) {
                oe.d dVar3 = PersonalInfoManager.this.f18787c;
                dVar3.f37447p = currentVendorListIabFormat;
                dVar3.f37448q = currentVendorListIabHash;
            }
            String str2 = syncResponse.f18826n;
            if (!TextUtils.isEmpty(str2)) {
                PersonalInfoManager.this.f18787c.setExtras(str2);
            }
            String consentChangeReason = syncResponse.getConsentChangeReason();
            if (syncResponse.isForceExplicitNo()) {
                PersonalInfoManager.this.f18791g.onForceExplicitNo(consentChangeReason);
            } else if (syncResponse.isInvalidateConsent()) {
                PersonalInfoManager.this.f18791g.onInvalidateConsent(consentChangeReason);
            } else if (syncResponse.isReacquireConsent()) {
                PersonalInfoManager.this.f18791g.onReacquireConsent(consentChangeReason);
            }
            String callAgainAfterSecs = syncResponse.getCallAgainAfterSecs();
            if (!TextUtils.isEmpty(callAgainAfterSecs)) {
                try {
                    long parseLong = Long.parseLong(callAgainAfterSecs);
                    if (parseLong > 0) {
                        PersonalInfoManager.this.f18793i = parseLong * 1000;
                    } else {
                        MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "callAgainAfterSecs is not positive: " + callAgainAfterSecs);
                    }
                } catch (NumberFormatException unused) {
                    MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "Unable to parse callAgainAfterSecs. Ignoring value");
                }
            }
            ConsentStatus consentStatus2 = ConsentStatus.EXPLICIT_YES;
            if (!consentStatus2.equals(PersonalInfoManager.this.f18795k)) {
                PersonalInfoManager.this.f18787c.f37439h = null;
            }
            PersonalInfoManager personalInfoManager4 = PersonalInfoManager.this;
            if (personalInfoManager4.f18798n) {
                personalInfoManager4.f18797m = false;
                personalInfoManager4.f18798n = false;
            }
            personalInfoManager4.f18787c.b();
            PersonalInfoManager personalInfoManager5 = PersonalInfoManager.this;
            personalInfoManager5.f18796l = false;
            if (ConsentStatus.POTENTIAL_WHITELIST.equals(personalInfoManager5.f18795k)) {
                PersonalInfoManager personalInfoManager6 = PersonalInfoManager.this;
                if (personalInfoManager6.f18787c.f37442k) {
                    personalInfoManager6.a(consentStatus2, ConsentChangeReason.GRANTED_BY_WHITELISTED_PUB);
                    PersonalInfoManager.this.requestSync(true);
                }
            }
            SdkInitializationListener sdkInitializationListener = PersonalInfoManager.this.f18792h;
            if (sdkInitializationListener != null) {
                sdkInitializationListener.onInitializationFinished();
                PersonalInfoManager.this.f18792h = null;
            }
        }
    }

    public PersonalInfoManager(Context context, String str, SdkInitializationListener sdkInitializationListener) {
        Preconditions.checkNotNull(context);
        Preconditions.checkNotNull(str);
        Context applicationContext = context.getApplicationContext();
        this.f18785a = applicationContext;
        this.f18786b = Collections.synchronizedSet(new HashSet());
        this.f18790f = new g(null);
        f fVar = new f(null);
        this.f18791g = fVar;
        MultiAdResponse.setServerOverrideListener(fVar);
        this.f18788d = new ConsentDialogController(applicationContext);
        oe.d dVar = new oe.d(applicationContext);
        this.f18787c = dVar;
        if (!TextUtils.isEmpty(str) && !str.equals(dVar.f37434c)) {
            dVar.f37433b = "";
            dVar.f37434c = str;
            dVar.b();
        }
        this.f18789e = new MoPubConversionTracker(applicationContext);
        a aVar = new a();
        this.f18792h = sdkInitializationListener;
        MoPubIdentifier moPubIdentifier = ClientMetadata.getInstance(applicationContext).getMoPubIdentifier();
        moPubIdentifier.setIdChangeListener(aVar);
        moPubIdentifier.f18783f = new oe.e(this);
        if (moPubIdentifier.f18782e) {
            moPubIdentifier.b();
        }
    }

    @VisibleForTesting
    public static boolean e(boolean z10, Boolean bool, boolean z11, Long l10, long j10, String str, boolean z12) {
        if (z10) {
            return false;
        }
        if (bool == null) {
            return true;
        }
        if (!bool.booleanValue()) {
            return false;
        }
        if (z11) {
            return true;
        }
        if (z12 && TextUtils.isEmpty(str)) {
            return false;
        }
        return l10 == null || SystemClock.uptimeMillis() - l10.longValue() > j10;
    }

    public final void a(ConsentStatus consentStatus, ConsentChangeReason consentChangeReason) {
        b(consentStatus, consentChangeReason.getReason());
    }

    @VisibleForTesting
    public void b(ConsentStatus consentStatus, String str) {
        boolean z10;
        ConsentStatus consentStatus2;
        boolean canCollectPersonalInformation;
        Preconditions.checkNotNull(consentStatus);
        Preconditions.checkNotNull(str);
        oe.d dVar = this.f18787c;
        ConsentStatus consentStatus3 = dVar.f37435d;
        if (!dVar.f37453v && consentStatus3.equals(consentStatus)) {
            MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "Consent status is already " + consentStatus3 + ". Not doing a state transition.");
            return;
        }
        oe.d dVar2 = this.f18787c;
        StringBuilder a10 = android.support.v4.media.b.a("");
        a10.append(Calendar.getInstance().getTimeInMillis());
        dVar2.f37440i = a10.toString();
        oe.d dVar3 = this.f18787c;
        dVar3.f37437f = str;
        dVar3.f37435d = consentStatus;
        if (!ConsentStatus.EXPLICIT_NO.equals(consentStatus)) {
            ConsentStatus consentStatus4 = ConsentStatus.POTENTIAL_WHITELIST;
            if (!consentStatus4.equals(consentStatus) && (consentStatus4.equals(consentStatus3) || !ConsentStatus.EXPLICIT_YES.equals(consentStatus))) {
                z10 = false;
                if (z10) {
                    oe.d dVar4 = this.f18787c;
                    dVar4.f37450s = dVar4.getCurrentPrivacyPolicyVersion();
                    oe.d dVar5 = this.f18787c;
                    dVar5.f37449r = dVar5.getCurrentVendorListVersion();
                    oe.d dVar6 = this.f18787c;
                    dVar6.f37451t = dVar6.getCurrentVendorListIabFormat();
                }
                consentStatus2 = ConsentStatus.DNT;
                if (!consentStatus2.equals(consentStatus) || ConsentStatus.UNKNOWN.equals(consentStatus)) {
                    oe.d dVar7 = this.f18787c;
                    dVar7.f37450s = null;
                    dVar7.f37449r = null;
                    dVar7.f37451t = null;
                }
                if (ConsentStatus.EXPLICIT_YES.equals(consentStatus)) {
                    this.f18787c.f37439h = ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().f18750a;
                }
                if (consentStatus2.equals(consentStatus)) {
                    this.f18787c.f37441j = consentStatus3;
                }
                oe.d dVar8 = this.f18787c;
                dVar8.f37453v = false;
                dVar8.b();
                canCollectPersonalInformation = canCollectPersonalInformation();
                if (canCollectPersonalInformation) {
                    ClientMetadata.getInstance(this.f18785a).repopulateCountryData();
                    if (this.f18789e.shouldTrack()) {
                        this.f18789e.reportAppOpen(false);
                    }
                }
                MoPubLog.log(MoPubLog.ConsentLogEvent.UPDATED, consentStatus3, consentStatus, Boolean.valueOf(canCollectPersonalInformation()), str);
                c(consentStatus3, consentStatus, canCollectPersonalInformation);
            }
        }
        z10 = true;
        if (z10) {
        }
        consentStatus2 = ConsentStatus.DNT;
        if (!consentStatus2.equals(consentStatus)) {
        }
        oe.d dVar72 = this.f18787c;
        dVar72.f37450s = null;
        dVar72.f37449r = null;
        dVar72.f37451t = null;
        if (ConsentStatus.EXPLICIT_YES.equals(consentStatus)) {
        }
        if (consentStatus2.equals(consentStatus)) {
        }
        oe.d dVar82 = this.f18787c;
        dVar82.f37453v = false;
        dVar82.b();
        canCollectPersonalInformation = canCollectPersonalInformation();
        if (canCollectPersonalInformation) {
        }
        MoPubLog.log(MoPubLog.ConsentLogEvent.UPDATED, consentStatus3, consentStatus, Boolean.valueOf(canCollectPersonalInformation()), str);
        c(consentStatus3, consentStatus, canCollectPersonalInformation);
    }

    public final void c(ConsentStatus consentStatus, ConsentStatus consentStatus2, boolean z10) {
        synchronized (this.f18786b) {
            Iterator<ConsentStatusChangeListener> it = this.f18786b.iterator();
            while (it.hasNext()) {
                new Handler(Looper.getMainLooper()).post(new d(this, it.next(), consentStatus, consentStatus2, z10));
            }
        }
    }

    public boolean canCollectPersonalInformation() {
        Boolean gdprApplies = gdprApplies();
        if (gdprApplies == null) {
            return false;
        }
        if (gdprApplies.booleanValue()) {
            return getPersonalInfoConsentStatus().equals(ConsentStatus.EXPLICIT_YES) && !ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().isDoNotTrack();
        }
        return true;
    }

    @VisibleForTesting
    public void d() {
        MoPubLog.log(MoPubLog.ConsentLogEvent.SYNC_ATTEMPTED, new Object[0]);
        this.f18795k = this.f18787c.f37435d;
        this.f18796l = true;
        this.f18794j = Long.valueOf(SystemClock.uptimeMillis());
        SyncUrlGenerator syncUrlGenerator = new SyncUrlGenerator(this.f18785a, this.f18795k.getValue());
        syncUrlGenerator.withAdUnitId(this.f18787c.chooseAdUnit()).withConsentedIfa(this.f18787c.f37439h).withLastChangedMs(this.f18787c.f37440i).withLastConsentStatus(this.f18787c.f37436e).withConsentChangeReason(this.f18787c.f37437f).withConsentedVendorListVersion(this.f18787c.getConsentedVendorListVersion()).withConsentedPrivacyPolicyVersion(this.f18787c.getConsentedPrivacyPolicyVersion()).withCachedVendorListIabHash(this.f18787c.f37448q).withExtras(this.f18787c.getExtras()).withGdprApplies(gdprApplies()).withForceGdprApplies(this.f18787c.isForceGdprApplies());
        if (this.f18797m) {
            this.f18798n = true;
            syncUrlGenerator.withForceGdprAppliesChanged(Boolean.TRUE);
        }
        Networking.getRequestQueue(this.f18785a).add(new SyncRequest(this.f18785a, syncUrlGenerator.generateUrlString(Constants.HOST), this.f18790f));
    }

    public void forceGdprApplies() {
        if (this.f18787c.isForceGdprApplies()) {
            return;
        }
        boolean canCollectPersonalInformation = canCollectPersonalInformation();
        oe.d dVar = this.f18787c;
        dVar.f37438g = true;
        this.f18797m = true;
        dVar.b();
        boolean canCollectPersonalInformation2 = canCollectPersonalInformation();
        if (canCollectPersonalInformation != canCollectPersonalInformation2) {
            ConsentStatus consentStatus = this.f18787c.f37435d;
            c(consentStatus, consentStatus, canCollectPersonalInformation2);
        }
        requestSync(true);
    }

    public Boolean gdprApplies() {
        return this.f18787c.isForceGdprApplies() ? Boolean.TRUE : this.f18787c.f37454w;
    }

    public ConsentData getConsentData() {
        return new oe.d(this.f18785a);
    }

    public ConsentStatus getPersonalInfoConsentStatus() {
        return this.f18787c.f37435d;
    }

    public void grantConsent() {
        if (ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().isDoNotTrack()) {
            MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "Cannot grant consent because Do Not Track is on.");
            return;
        }
        if (this.f18787c.f37442k) {
            a(ConsentStatus.EXPLICIT_YES, ConsentChangeReason.GRANTED_BY_WHITELISTED_PUB);
        } else {
            MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "You do not have approval to use the grantConsent API. Please reach out to your account teams or support@mopub.com for more information.");
            a(ConsentStatus.POTENTIAL_WHITELIST, ConsentChangeReason.GRANTED_BY_NOT_WHITELISTED_PUB);
        }
        requestSync(true);
    }

    public boolean isConsentDialogReady() {
        return this.f18788d.f18765d;
    }

    public void loadConsentDialog(ConsentDialogListener consentDialogListener) {
        MoPubLog.log(MoPubLog.ConsentLogEvent.LOAD_ATTEMPTED, new Object[0]);
        ManifestUtils.checkGdprActivitiesDeclared(this.f18785a);
        if (ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().isDoNotTrack()) {
            if (consentDialogListener != null) {
                new Handler().post(new b(this, consentDialogListener));
                return;
            }
            return;
        }
        Boolean gdprApplies = gdprApplies();
        if (gdprApplies != null && !gdprApplies.booleanValue()) {
            if (consentDialogListener != null) {
                new Handler().post(new c(this, consentDialogListener));
                return;
            }
            return;
        }
        ConsentDialogController consentDialogController = this.f18788d;
        oe.d dVar = this.f18787c;
        synchronized (consentDialogController) {
            Preconditions.checkNotNull(dVar);
            if (consentDialogController.f18765d) {
                if (consentDialogListener != null) {
                    consentDialogController.f18767f.post(new oe.a(consentDialogController, consentDialogListener));
                }
                return;
            }
            if (consentDialogController.f18766e) {
                MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, "Already making a consent dialog load request.");
                return;
            }
            consentDialogController.f18764c = consentDialogListener;
            consentDialogController.f18766e = true;
            Context context = consentDialogController.f18762a;
            ConsentDialogUrlGenerator consentDialogUrlGenerator = new ConsentDialogUrlGenerator(context, dVar.f37433b, dVar.f37435d.getValue());
            consentDialogUrlGenerator.f18772h = gdprApplies;
            consentDialogUrlGenerator.f18775k = dVar.getConsentedPrivacyPolicyVersion();
            consentDialogUrlGenerator.f18774j = dVar.getConsentedVendorListVersion();
            consentDialogUrlGenerator.f18773i = dVar.isForceGdprApplies();
            Networking.getRequestQueue(consentDialogController.f18762a).add(new ConsentDialogRequest(context, consentDialogUrlGenerator.generateUrlString(Constants.HOST), consentDialogController));
        }
    }

    public void requestSync(boolean z10) {
        if (MoPub.isSdkInitialized()) {
            if (e(this.f18796l, gdprApplies(), z10, this.f18794j, this.f18793i, this.f18787c.f37439h, ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().isDoNotTrack())) {
                d();
            }
        }
    }

    public void revokeConsent() {
        if (ClientMetadata.getInstance(this.f18785a).getMoPubIdentifier().getAdvertisingInfo().isDoNotTrack()) {
            MoPubLog.log(MoPubLog.ConsentLogEvent.CUSTOM, "Cannot revoke consent because Do Not Track is on.");
        } else {
            a(ConsentStatus.EXPLICIT_NO, ConsentChangeReason.DENIED_BY_PUB);
            requestSync(true);
        }
    }

    public void setAllowLegitimateInterest(boolean z10) {
        this.f18799o = z10;
    }

    public boolean shouldAllowLegitimateInterest() {
        return this.f18799o;
    }

    public boolean shouldShowConsentDialog() {
        Boolean gdprApplies = gdprApplies();
        if (gdprApplies == null || !gdprApplies.booleanValue()) {
            return false;
        }
        oe.d dVar = this.f18787c;
        if (dVar.f37453v) {
            return true;
        }
        return dVar.f37435d.equals(ConsentStatus.UNKNOWN);
    }

    public boolean showConsentDialog() {
        ConsentDialogController consentDialogController = this.f18788d;
        Objects.requireNonNull(consentDialogController);
        MoPubLog.log(MoPubLog.ConsentLogEvent.SHOW_ATTEMPTED, new Object[0]);
        if (!consentDialogController.f18765d || TextUtils.isEmpty(consentDialogController.f18763b)) {
            MoPubLog.ConsentLogEvent consentLogEvent = MoPubLog.ConsentLogEvent.SHOW_FAILED;
            MoPubErrorCode moPubErrorCode = MoPubErrorCode.INTERNAL_ERROR;
            MoPubLog.log(consentLogEvent, Integer.valueOf(moPubErrorCode.getIntCode()), moPubErrorCode);
            return false;
        }
        consentDialogController.f18765d = false;
        Context context = consentDialogController.f18762a;
        String str = consentDialogController.f18763b;
        int i10 = ConsentDialogActivity.f18755e;
        Preconditions.checkNotNull(context);
        if (TextUtils.isEmpty(str)) {
            MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, "ConsentDialogActivity htmlData can't be empty string.");
            MoPubLog.ConsentLogEvent consentLogEvent2 = MoPubLog.ConsentLogEvent.SHOW_FAILED;
            MoPubErrorCode moPubErrorCode2 = MoPubErrorCode.INTERNAL_ERROR;
            MoPubLog.log(consentLogEvent2, Integer.valueOf(moPubErrorCode2.getIntCode()), moPubErrorCode2);
        } else {
            Preconditions.checkNotNull(context);
            Preconditions.checkNotNull(str);
            Bundle bundle = new Bundle();
            bundle.putString("html-page-content", str);
            try {
                Intents.startActivity(context, Intents.getStartActivityIntent(context, ConsentDialogActivity.class, bundle));
            } catch (ActivityNotFoundException | IntentNotResolvableException unused) {
                MoPubLog.log(MoPubLog.SdkLogEvent.CUSTOM, "ConsentDialogActivity not found - did you declare it in AndroidManifest.xml?");
                MoPubLog.ConsentLogEvent consentLogEvent3 = MoPubLog.ConsentLogEvent.SHOW_FAILED;
                MoPubErrorCode moPubErrorCode3 = MoPubErrorCode.INTERNAL_ERROR;
                MoPubLog.log(consentLogEvent3, Integer.valueOf(moPubErrorCode3.getIntCode()), moPubErrorCode3);
            }
        }
        consentDialogController.f18766e = false;
        consentDialogController.f18765d = false;
        consentDialogController.f18764c = null;
        consentDialogController.f18763b = null;
        return true;
    }

    public void subscribeConsentStatusChangeListener(ConsentStatusChangeListener consentStatusChangeListener) {
        if (consentStatusChangeListener == null) {
            return;
        }
        this.f18786b.add(consentStatusChangeListener);
    }

    public void unsubscribeConsentStatusChangeListener(ConsentStatusChangeListener consentStatusChangeListener) {
        this.f18786b.remove(consentStatusChangeListener);
    }
}