package androidx.privacysandbox.ads.adservices.adselection; import android.adservices.adselection.AdSelectionConfig; import android.adservices.common.AdSelectionSignals; import android.adservices.common.AdTechIdentifier; import android.annotation.SuppressLint; import android.content.Context; import android.net.Uri; import androidx.annotation.DoNotInline; import androidx.annotation.RequiresExtension; import androidx.annotation.RequiresPermission; import androidx.core.os.OutcomeReceiverKt; import androidx.credentials.CredentialManager$$ExternalSyntheticLambda0; import androidx.privacysandbox.ads.adservices.internal.AdServicesInfo; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt; import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt; import kotlin.coroutines.jvm.internal.DebugProbesKt; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.jvm.internal.Intrinsics; import kotlin.jvm.internal.SourceDebugExtension; import kotlinx.coroutines.CancellableContinuationImpl; /* loaded from: classes.dex */ public abstract class AdSelectionManager { public static final Companion Companion = new Companion(null); @SuppressLint({"NewApi", "ClassVerificationFailure"}) public static final AdSelectionManager obtain(Context context) { return Companion.obtain(context); } @RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") public abstract Object reportImpression(ReportImpressionRequest reportImpressionRequest, Continuation continuation); @RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") public abstract Object selectAds(AdSelectionConfig adSelectionConfig, Continuation continuation); @SuppressLint({"NewApi", "ClassVerificationFailure"}) @RequiresExtension(extension = 1000000, version = 4) @SourceDebugExtension({"SMAP\nAdSelectionManager.kt\nKotlin\n*S Kotlin\n*F\n+ 1 AdSelectionManager.kt\nandroidx/privacysandbox/ads/adservices/adselection/AdSelectionManager$Api33Ext4Impl\n+ 2 CancellableContinuation.kt\nkotlinx/coroutines/CancellableContinuationKt\n*L\n1#1,199:1\n314#2,11:200\n314#2,11:211\n*S KotlinDebug\n*F\n+ 1 AdSelectionManager.kt\nandroidx/privacysandbox/ads/adservices/adselection/AdSelectionManager$Api33Ext4Impl\n*L\n98#1:200,11\n162#1:211,11\n*E\n"}) public static final class Api33Ext4Impl extends AdSelectionManager { private final android.adservices.adselection.AdSelectionManager mAdSelectionManager; public Api33Ext4Impl(android.adservices.adselection.AdSelectionManager mAdSelectionManager) { Intrinsics.checkNotNullParameter(mAdSelectionManager, "mAdSelectionManager"); this.mAdSelectionManager = mAdSelectionManager; } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public Api33Ext4Impl(android.content.Context r2) { /* r1 = this; java.lang.String r0 = "context" kotlin.jvm.internal.Intrinsics.checkNotNullParameter(r2, r0) java.lang.Class r0 = androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline15.m() java.lang.Object r2 = r2.getSystemService(r0) java.lang.String r0 = "context.getSystemService…:class.java\n )" kotlin.jvm.internal.Intrinsics.checkNotNullExpressionValue(r2, r0) android.adservices.adselection.AdSelectionManager r2 = androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline16.m(r2) r1.(r2) return */ throw new UnsupportedOperationException("Method not decompiled: androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager.Api33Ext4Impl.(android.content.Context):void"); } /* JADX WARN: Removed duplicated region for block: B:15:0x0035 */ /* JADX WARN: Removed duplicated region for block: B:8:0x0023 */ @Override // androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager @androidx.annotation.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") @androidx.annotation.DoNotInline /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public java.lang.Object selectAds(androidx.privacysandbox.ads.adservices.adselection.AdSelectionConfig r5, kotlin.coroutines.Continuation r6) { /* r4 = this; boolean r0 = r6 instanceof androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$selectAds$1 if (r0 == 0) goto L13 r0 = r6 androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$selectAds$1 r0 = (androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$selectAds$1) r0 int r1 = r0.label r2 = -2147483648(0xffffffff80000000, float:-0.0) r3 = r1 & r2 if (r3 == 0) goto L13 int r1 = r1 - r2 r0.label = r1 goto L18 L13: androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$selectAds$1 r0 = new androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$selectAds$1 r0.(r4, r6) L18: java.lang.Object r6 = r0.result java.lang.Object r1 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED() int r2 = r0.label r3 = 1 if (r2 == 0) goto L35 if (r2 != r3) goto L2d java.lang.Object r5 = r0.L$0 androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl r5 = (androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager.Api33Ext4Impl) r5 kotlin.ResultKt.throwOnFailure(r6) goto L48 L2d: java.lang.IllegalStateException r5 = new java.lang.IllegalStateException java.lang.String r6 = "call to 'resume' before 'invoke' with coroutine" r5.(r6) throw r5 L35: kotlin.ResultKt.throwOnFailure(r6) android.adservices.adselection.AdSelectionConfig r5 = r4.convertAdSelectionConfig(r5) r0.L$0 = r4 r0.label = r3 java.lang.Object r6 = r4.selectAdsInternal(r5, r0) if (r6 != r1) goto L47 return r1 L47: r5 = r4 L48: android.adservices.adselection.AdSelectionOutcome r6 = androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline0.m(r6) androidx.privacysandbox.ads.adservices.adselection.AdSelectionOutcome r5 = r5.convertResponse(r6) return r5 */ throw new UnsupportedOperationException("Method not decompiled: androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager.Api33Ext4Impl.selectAds(androidx.privacysandbox.ads.adservices.adselection.AdSelectionConfig, kotlin.coroutines.Continuation):java.lang.Object"); } private final android.adservices.adselection.AdSelectionConfig convertAdSelectionConfig(AdSelectionConfig adSelectionConfig) { AdSelectionConfig.Builder adSelectionSignals; AdSelectionConfig.Builder customAudienceBuyers; AdSelectionConfig.Builder decisionLogicUri; AdTechIdentifier fromString; AdSelectionConfig.Builder seller; AdSelectionConfig.Builder perBuyerSignals; AdSelectionConfig.Builder sellerSignals; AdSelectionConfig.Builder trustedScoringSignalsUri; android.adservices.adselection.AdSelectionConfig build; adSelectionSignals = AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline19.m().setAdSelectionSignals(convertAdSelectionSignals(adSelectionConfig.getAdSelectionSignals())); customAudienceBuyers = adSelectionSignals.setCustomAudienceBuyers(convertBuyers(adSelectionConfig.getCustomAudienceBuyers())); decisionLogicUri = customAudienceBuyers.setDecisionLogicUri(adSelectionConfig.getDecisionLogicUri()); fromString = AdTechIdentifier.fromString(adSelectionConfig.getSeller().getIdentifier()); seller = decisionLogicUri.setSeller(fromString); perBuyerSignals = seller.setPerBuyerSignals(convertPerBuyerSignals(adSelectionConfig.getPerBuyerSignals())); sellerSignals = perBuyerSignals.setSellerSignals(convertAdSelectionSignals(adSelectionConfig.getSellerSignals())); trustedScoringSignalsUri = sellerSignals.setTrustedScoringSignalsUri(adSelectionConfig.getTrustedScoringSignalsUri()); build = trustedScoringSignalsUri.build(); Intrinsics.checkNotNullExpressionValue(build, "Builder()\n …\n .build()"); return build; } private final AdSelectionSignals convertAdSelectionSignals(androidx.privacysandbox.ads.adservices.common.AdSelectionSignals adSelectionSignals) { AdSelectionSignals fromString; fromString = AdSelectionSignals.fromString(adSelectionSignals.getSignals()); Intrinsics.checkNotNullExpressionValue(fromString, "fromString(request.signals)"); return fromString; } private final List convertBuyers(List list) { AdTechIdentifier fromString; ArrayList arrayList = new ArrayList(); Iterator it = list.iterator(); while (it.hasNext()) { fromString = AdTechIdentifier.fromString(it.next().getIdentifier()); Intrinsics.checkNotNullExpressionValue(fromString, "fromString(buyer.identifier)"); arrayList.add(fromString); } return arrayList; } private final Map convertPerBuyerSignals(Map map) { AdTechIdentifier fromString; AdSelectionSignals adSelectionSignals; HashMap hashMap = new HashMap(); for (androidx.privacysandbox.ads.adservices.common.AdTechIdentifier adTechIdentifier : map.keySet()) { fromString = AdTechIdentifier.fromString(adTechIdentifier.getIdentifier()); Intrinsics.checkNotNullExpressionValue(fromString, "fromString(key.identifier)"); if (map.get(adTechIdentifier) != null) { androidx.privacysandbox.ads.adservices.common.AdSelectionSignals adSelectionSignals2 = map.get(adTechIdentifier); Intrinsics.checkNotNull(adSelectionSignals2); adSelectionSignals = convertAdSelectionSignals(adSelectionSignals2); } else { adSelectionSignals = null; } hashMap.put(fromString, adSelectionSignals); } return hashMap; } private final AdSelectionOutcome convertResponse(android.adservices.adselection.AdSelectionOutcome adSelectionOutcome) { long adSelectionId; Uri renderUri; adSelectionId = adSelectionOutcome.getAdSelectionId(); renderUri = adSelectionOutcome.getRenderUri(); Intrinsics.checkNotNullExpressionValue(renderUri, "response.renderUri"); return new AdSelectionOutcome(adSelectionId, renderUri); } /* JADX INFO: Access modifiers changed from: private */ public final android.adservices.adselection.ReportImpressionRequest convertReportImpressionRequest(ReportImpressionRequest reportImpressionRequest) { AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline18.m(); return AdSelectionManager$Api33Ext4Impl$$ExternalSyntheticApiModelOutline17.m(reportImpressionRequest.getAdSelectionId(), convertAdSelectionConfig(reportImpressionRequest.getAdSelectionConfig())); } /* JADX INFO: Access modifiers changed from: private */ @RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") public final Object selectAdsInternal(android.adservices.adselection.AdSelectionConfig adSelectionConfig, Continuation continuation) { Continuation intercepted; Object coroutine_suspended; intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation); CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(intercepted, 1); cancellableContinuationImpl.initCancellability(); this.mAdSelectionManager.selectAds(adSelectionConfig, new CredentialManager$$ExternalSyntheticLambda0(), OutcomeReceiverKt.asOutcomeReceiver(cancellableContinuationImpl)); Object result = cancellableContinuationImpl.getResult(); coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); if (result == coroutine_suspended) { DebugProbesKt.probeCoroutineSuspended(continuation); } return result; } @Override // androidx.privacysandbox.ads.adservices.adselection.AdSelectionManager @RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE") @DoNotInline public Object reportImpression(ReportImpressionRequest reportImpressionRequest, Continuation continuation) { Continuation intercepted; Object coroutine_suspended; Object coroutine_suspended2; intercepted = IntrinsicsKt__IntrinsicsJvmKt.intercepted(continuation); CancellableContinuationImpl cancellableContinuationImpl = new CancellableContinuationImpl(intercepted, 1); cancellableContinuationImpl.initCancellability(); this.mAdSelectionManager.reportImpression(convertReportImpressionRequest(reportImpressionRequest), new CredentialManager$$ExternalSyntheticLambda0(), OutcomeReceiverKt.asOutcomeReceiver(cancellableContinuationImpl)); Object result = cancellableContinuationImpl.getResult(); coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); if (result == coroutine_suspended) { DebugProbesKt.probeCoroutineSuspended(continuation); } coroutine_suspended2 = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); return result == coroutine_suspended2 ? result : Unit.INSTANCE; } } public static final class Companion { public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) { this(); } private Companion() { } @SuppressLint({"NewApi", "ClassVerificationFailure"}) public final AdSelectionManager obtain(Context context) { Intrinsics.checkNotNullParameter(context, "context"); if (AdServicesInfo.INSTANCE.version() >= 4) { return new Api33Ext4Impl(context); } return null; } } }